Class td_plot_base¶
- class o2sclpy.td_plot_base¶
A class for managing 3D visualizations
- latex_png_counter = 0¶
Counter for PNGs from LaTeX used in td_mat()
- td_arrow(x1, y1, z1, x2, y2, z2, name='arrow', mat='white', r=0, tail_ratio=0.9, n_theta=20, head_width=3, coords='internal')¶
Documentation for o2graph command
td-arrow
:Plot an arrow in a 3d visualization (experimental)
Command-line arguments:
<x1> <y1> <z1> <x2> <y2> <z2> [kwargs]
This command plots and arrow (a combination of a cylinder for the body of the arrow and a cone for the head) from point (x1,y1,z1) to point (x2,y2,z2). By default, the arrow coordinates are specified in the internal coordinate system. If the keyword argument
coords
isuser
, then the coordinates are in the user coordinate system.The fraction of the length of the cylinder to the distance between the user-specified points is given in
tail_ratio
and defaults to 0.9. The valuer
is the radius of the cylinder, and the base of the code has a radius of twicer
. If the user-specified value ofr
is zero or negative, then the default value is used (the length of the arrow divided by 80). The argumentn_theta
specifies the number of vertices in the azimuthal direction. The total number of faces is always three timesn_theta
.
- td_axis_label(ldir: str, tex_label: str, tex_mat_name: str = '', end_mat_name: str = 'white', png_file: str = '', group_name: str = '', offset: float = 0.1, height: float = 0.1, flatten: str = 'white')¶
Documentation for o2graph command
td-axis-label
:Create an axis label in a 3d visualization (experimental).
Command-line arguments:
<ldir> <tex_label> [kwargs]
Create an axis label in the direction
ldir
with labeltex_label
.Direction,
ldir
, must be eitherx
,y
, orz
. The LaTeX image fromtex_label
will be stored in file namedpng_file
. A new material will be created from the LaTeX image, namedtex_mat_name
and added to the material list before the corresponding mesh is added. Iftex_mat_name
is empty, thenmat_xtitle
,mat_ytitle
, ormat_ztitle
will be used, depending on the direction. Ifgroup_name
is empty, thenx_title
,y_title
, orz_title
will be used, depending on the direction.The material named
end_mat_name
will be used for the two faces which do not have labels. Ifend_mat_name
is the default,white
, then a default white material will be created for that purpose. Otherwise, it is presumed the user has already added the material.The number
offset
is the offset of the label from the x-axis, in the internal coordinate system. The numberheight
is used for the height dimension of the faces with the LaTeX image, and the width is computed automatically from the aspect ratio of the LaTeX output.
- td_den_plot(o2scl, amp, args, cmap='', mat_name='white', normals=False)¶
Documentation for o2graph command
td-den-plot
:Create a 3D density plot (experimental).
Command-line arguments:
<x label> <y label> <z label> [kwargs]
Note that normals are typically not specified, because the density plot presumes flat shading. Blender, for example, uses smooth shading for GLTF files when normals are specified, and this can complicate the density plot.
- td_grid(n, name='grid', mat='white', auto_labels=False)¶
Documentation for o2graph command
td-grid
:Plot an axis in a 3d visualization (experimental)
Command-line arguments:
[kwargs]
Plot a grid of lines
- td_icos(args, n_subdiv=0, r=0.04, phi_cut='', mat='')¶
Documentation for o2graph command
td-icos
:Create a 3D icosphere (experimental).
Command-line arguments:
<x> <y> <z> [kwargs]
Note that normals are typically not specified, because the density plot presumes flat shading. Blender, for example, uses smooth shading for GLTF files when normals are specified, and this can complicate the density plot.
- td_line(x1, y1, z1, x2, y2, z2, name='line', mat='white', coords='user')¶
Documentation for o2graph command
td-line
:Plot a line in a 3d visualization (experimental)
Command-line arguments:
<x1> <y1> <z1> <x2> <y2> <z2> [kwargs]
By default, the line coordinates are specified in the internal coordinate system. If the keyword argument
coords
isuser
, then the coordinates are in the user coordinate system.
- td_mat(name: str, r: float, g: float, b: float, alpha: float = 1, metal: float = 0, rough: float = 1, ds: bool = True, txt: str = '', alpha_mode: str = 'opaque', alpha_cutoff: float = 0.5, efr: float = 0.0, efg: float = 0.0, efb: float = 0.0, packages: str = '', prefix: str = '', resize: bool = True)¶
Documentation for o2graph command
td-mat
:Create a 3d material (experimental)
Command-line arguments:
<name> <r> <g> <b> [kwargs]
Create a new material with the specified properties.
LaTeX textures are created in the working directory with the name
[prefix]latex%d.png
and then resized, if necessary, to files named[prefix]latexr%d.png
.
- td_pgram(x1, y1, z1, x2, y2, z2, x3, y3, z3, name='pgram', mat='', force_rect=False, match_txt=False, coords='user')¶
Documentation for o2graph command
td-pgram
:Plot a parallelogram in a 3D visualization (experimental)
Command-line arguments:
<x1> <y1> <z1> <x2> <y2> <z2> <x3> <y3> <z3> [kwargs]
- td_scatter(o2scl, amp, args, n_subdiv: int = 0, r: float = 0.04, metal: str = '', rough: str = '')¶
Documentation for o2graph command
td-scatter
:Create a 3D scatter plot (experimental).
Command-line arguments:
<x column> <y column> <z column> [r column] [g column] [b column] [kwargs]
Full desc.