Class o2graph_plotter¶
- class o2sclpy.o2graph_plotter¶
A plotting class for the o2graph script. This class is a child of the
o2sclpy.plot_base
class.This class is not necessarily intended to be instantiated by the end user.
The function parameter o2scl must always be a ctypes DLL object which points to the libo2scl shared library (.so on linux and .dylib on OSX). The function parameter amp must always be a pointer to the o2scl_acol::acol_manager object.
- append_images(args)¶
Documentation for o2graph command
append-images
:Combine two images side by side
Command-line arguments:
<img1> <img2> <img out>
- bl_import(gltf_path: str = '', blender_cmd: str = '', o2sclpy_dir: str = '', cam_dist: float = 5.0, light_energy: float = 800, light_dist: float = 5.8, bg_color: str = '(0,0,0,0)', cam_type: str = 'ORTHO', ortho_scale: float = 2.0, res_x: int = 1600, res_y: int = 900, blend_file: str = '', output_png: str = '')¶
Documentation for o2graph command
bl-import
:Load a GLTF file into Blender
Command-line arguments:
<gltf file> [kwargs]
This command opens up the Blender GUI, removes the default Blender objects (for example the default cube), and loads the specified GLTF file. It also loads a camera and eight light sources, one at each corner of a large cube with a edge length of twice the value of
light_dist
.This command requires Blender.
The allowed keyword arguments are:
blender_cmd='', the path to the Blender executable \ o2sclpy_dir='', the directory to the O2sclpy package \ cam_dist=5.0, the camera's distance from the volume center \ light_energy=800.0, the light source energy \ light_dist=5.8, the relative coordinate of the light sources \ bg_color='(0,0,0,0)', the background color \ cam_type='ORTHO', the camera type, PERSP, ORTHO, or PANO \ ortho_scale=2.0, the scale of orthographic cameras \ res_x=1600, the x resolution of the rendered image \ res_y=900, the y resolution of the rendered image \ blend_file='', the optional blend file for the output \ output_png='', an optional output rendered image \
If
blender_cmd
ando2sclpy_dir
are not specified, then o2sclpy attempts to automatically determine them. Becausebg_color
is a string, it can contain python code. The value ofortho_scale
is only used for the orthographic camera.
- bl_six_mp4(n_frames: int, mp4_file: str, n_sit: int = 0, blender_cmd: str = '', o2sclpy_dir: str = '', vf: str = '', cam_dist: float = 5.0, light_energy: float = 800, light_dist: float = 5.8, bg_color: str = '(0,0,0,0)', cam_type: str = 'ORTHO', res_x: int = 1600, res_y: int = 900, blend_file: str = '')¶
Documentation for o2graph command
bl-six-mp4
:View each axis of a set of 3D objects in a movie
Command-line arguments:
<n_frames> <mp4 file> [kwargs]
This command requires Blender, the associated python package,
bpy
, and the installation offfmpeg
.The allowed keyword arguments are:
n_sit=0, the number of frames to sit at the six faces \ blender_cmd='', the path to the Blender executable \ o2sclpy_dir='', the directory to the O2sclpy package \ vf='', the video filter to send to ffmpeg \ cam_dist=5.0, the camera's distance from the volume center \ light_energy=800.0, the light source energy \ light_dist=5.8, the light's distance from the volume center \ bg_color='(0,0,0,0)', the background color \ cam_type='ORTHO', the camera type, PERSP, ORTHO, or PANO \ res_x=1600, the x resolution of the rendered image \ res_y=900, the y resolution of the rendered image \ blend_file='', the optional blend file for the output \
The vf kwarg is forwarded to the
mp4
command to generate the final video.
- bl_yaw_mp4(n_frames: int, mp4_file: str, blender_cmd: str = '', o2sclpy_dir: str = '', vf: str = '', cam_dist: float = 5.0, light_energy: float = 800, light_dist: float = 5.8, bg_color: str = '', cam_type: str = 'ORTHO', ortho_scale: float = 2.0, res_x: int = 1600, res_y: int = 900, blend_file: str = '')¶
Documentation for o2graph command
bl-yaw-mp4
:View 3D objects in a movie by rotating the camera
Command-line arguments:
<n_frames> <mp4 file> <kwargs>
This command saves the current 3D objects into a GLTF file and then uses Blender to render them into a series of images which are then combined to a mp4 file using ffmpeg. The camera is rotated around the vector which starts at the center of the volume and points upwards along the z-axis. Five light sources are used, arranged in a quincunx lying above the x-y plane.
This command requires Blender, the associated python package,
bpy
, and the installation offfmpeg
.The allowed keyword arguments are:
blender_cmd='', the path to the Blender executable \ o2sclpy_dir='', the directory to the O2sclpy package \ vf='', the video filter to send to ffmpeg \ cam_dist=5.0, the camera's distance from the volume center \ light_energy=800.0, the light source energy \ light_dist=5.8, the light's distance from the volume center \ bg_color='(0,0,0,0)', the background color \ cam_type='ORTHO', the camera type, PERSP, ORTHO, or PANO \ ortho_scale=2.0, the scale of orthographic cameras \ res_x=1600, the x resolution of the rendered image \ res_y=900, the y resolution of the rendered image \ blend_file='', the optional blend file for the output \
The vf kwarg is forwarded to the
mp4
command to generate the final video.
- cbar = 0¶
Colorbar object
- commands(amp, args)¶
Output the currently available commands.
- create_camera_vecs()¶
Create vectors (pos,foc,nor,wid) from the user settings in yt_position, yt_focus, yt_north and yt_width. This function is used in yt_render to keep track of the camera properties. The output vectors are always created in the internal coordinate system.
- den_plot_anim(amp, args)¶
Documentation for o2graph command
den-plot-anim
:Create an animated density plot from a rank 3 tensor_grid object
Command-line arguments:
<x index> <y index> <z index [+'r']> <mp4 filename> [kwargs for imshow()]
Create an mp4 animation of a density plot from a
tensor_grid
object with rank 3. The first argument specifies which tensor index is along the x axis (either0
,1
or2
), the second argument is the tensor index is along the y axis (either0
,1
or2
), and the third argument is the tensor index which will be animated. If the third argument has an additionalr
suffix, then the animation will be reversed, so that the first frame corresponds to the largest value of the grid for the associated index.Experimental.
This command requires the installation of
ffmpeg
.
- den_plot_o2graph(amp, args)¶
Documentation for o2graph command
den-plot
:For objects of type
table3d
:Create a density plot from a slice of a table3d
Command-line arguments:
<slice> [kwargs]
Creates a density plot from the specified slice. A z-axis density legend is displayed on the RHS if
colbar
is set to True before plotting. If z-axis limits are specified, then values larger than the upper limit are set equal to the upper limit and values smaller than the lower limit are set equal to the lower limit before plotting.The python function imshow() is used, unless ‘pcm=True’ is specified, in which case the pcolormesh() function is used instead. When ‘pcm=False’, logarithmic scales are handled by taking the base 10 log of the x- or y-grids specified in the table3d object before plotting. When ‘pcm=True’, logarithmic axes can be handled automatically. The imshow() function presumes a uniform linear or logarithmic x- and y-axis grid, and the den-plot function will output a warning if this is not the case. The pcolormesh() function can handle arbitrary x and y-axis grids. If
logz
is set to true, then the base 10 logarithm is taken of the data before the density plot is constructed.Some useful kwargs are cmap, interpolation (for imshow), alpha, vmin, and vmax.
See https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.imshow.html and https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.pcolormesh.html for more information and keyword arguments.
For objects of type
hist_2d
:Create a density plot from a hist_2d object
Command-line arguments:
[kwargs]
Creates a density plot from the current two-dimensional histogram. A z-axis density legend is displayed on the RHS if
colbar
is set to True before plotting. If z-axis limits are specified, then values larger than the upper limit are set equal to the upper limit and values smaller than the lower limit are set equal to the lower limit before plotting.The python function imshow() is used, unless ‘pcm=True’ is specified, in which case the pcolormesh() function is used instead. When ‘pcm=False’, logarithmic scales are handled by taking the base 10 log of the x- or y-grids specified in the table3d object before plotting. When ‘pcm=True’, logarithmic axes can be handled automatically. The imshow() function presumes a uniform linear or logarithmic x- and y-axis grid, and the den-plot function will output a warning if this is not the case. The pcolormesh() function can handle arbitrary x and y-axis grids. If
logz
is set to true, then the base 10 logarithm is taken of the data before the density plot is constructed.Some useful kwargs are cmap, interpolation (for imshow), alpha, vmin, and vmax.
See https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.imshow.html and https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.pcolormesh.html for more information and keyword arguments.
For objects of type
tensor
:Create a density plot from a tensor object.
Command-line arguments:
[index_1 index_2] [kwargs]
If the tensor has rank 2 and the indices are not specified, then plot the first index along the x-axis and the second index along the y-axis. A z-axis density legend is print on the RHS if
colbar
is set to 1 before plotting. If z-axis limits are specified, then values larger than the upper limit are set equal to the upper limit and values smaller than the lower limit are set equal to the lower limit before plotting.For objects of type
tensor<int>
:Create a density plot from a tensor<int> object.
Command-line arguments:
[index_1 index_2] [kwargs]
If the tensor has rank 2 and the indices are not specified, then plot the first index along the x-axis and the second index along the y-axis. A z-axis density legend is print on the RHS if
colbar
is set to 1 before plotting. If z-axis limits are specified, then values larger than the upper limit are set equal to the upper limit and values smaller than the lower limit are set equal to the lower limit before plotting.For objects of type
tensor<size_t>
:Create a density plot from a tensor<size_t> object.
Command-line arguments:
[index_1 index_2] [kwargs]
If the tensor has rank 2 and the indices are not specified, then plot the first index along the x-axis and the second index along the y-axis. A z-axis density legend is print on the RHS if
colbar
is set to 1 before plotting. If z-axis limits are specified, then values larger than the upper limit are set equal to the upper limit and values smaller than the lower limit are set equal to the lower limit before plotting.For objects of type
tensor_grid
:Create a density plot from a tensor_grid object.
Command-line arguments:
[index_1 index_2] [kwargs]
If the tensor has rank 2 and the indices are not specified, then plot the first index along the x-axis and the second index along the y-axis. A z-axis density legend is print on the RHS if
colbar
is set to 1 before plotting. If z-axis limits are specified, then values larger than the upper limit are set equal to the upper limit and values smaller than the lower limit are set equal to the lower limit before plotting.
- den_plot_rgb_o2graph(amp, args)¶
Documentation for o2graph command
den-plot-rgb
:For objects of type
table3d
:Create a density plot from a specified slice
Command-line arguments:
<slice r> <slice g> <slice b> [kwargs]
Create a density plot from the three specified slices. This command uses imshow(). To directly create a .png file with no axes, specify the output png filename with the kwarg make_png. Making png files requires the Pillow python package.
For example:
o2graph -create table3d x "grid:0,1,0.01" y "grid:0,1,0.01" \ r "x" -function "y" g -function 0 b -den-plot-rgb r g b -show
- ell_max(amp, args)¶
Desc
- errorbar(amp, args)¶
Documentation for o2graph command
errorbar
:For objects of type
table
:Plot the specified columns with errorbars.
Command-line arguments:
<x> <y> <xerr> <yerr> [kwargs]
Plot column <y> versus column <x> with symmetric error bars given in column <xerr> and <yerr>. For no uncertainty in either the x or y direction, just use 0 for <xerr> or <yerr>, respectively.
Some useful kwargs for the errorbar command are:
keyword description default value \ ---------- --------------------------------- ------------- \ ecolor error bar color None \ elinewidth error bar line width None \ capsize cap size in points None \ barsabove plot error bars on top of points False \ lolims y value is lower limit False \ uplims y value is upper limit False \ xlolims x value is lower limit False \ xuplims x value is upper limit False \ errorevery draw error bars on subset of data 1 \ capthick thickness of error bar cap None \
For error points with no lines use, e.g. lw=0,elinewidth=1. See also
error-point
for plotting a single point with errorbars.See also https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.errorbar.html
- filter_image(fname)¶
If a filter has been defined, apply that filter to the image stored in file
fname
. This function is used in yt_save_annotate() to filter the images after saving them to a file.
- font_summary(mode='', prefix='fonts', check_str='AabSZz09', print_str='AbCdEfGhIjKlMnOpQrStUvWxYz', info_family='', info_weight='normal', info_style='normal')¶
Provide a summary of the available fonts.
If the argument
mode
is not either ‘pdf’ or ‘list’, then a help message is output to the screen. Theprefix
argument is the filename prefix for the pdf files whenmode
is ‘pdf’ and ignored otherwise.
- gen_acol(amp, cmd_name, args)¶
Run a general
acol
command namedcmd_name
with arguments stored inargs
. This function uses the O2scl functiono2scl_acol_parse()
.
- get_wrapper(amp, args)¶
Wrapper around
o2sclpy.plot_base.get()
which gets plot-related parameters and gets other parameters fromacol_manager
.
- gltf_o2graph(amp, args)¶
Documentation for o2graph command
gltf
:Write a GLTF file from 3D objects (experimental)
Command-line arguments:
<prefix>
Write a GLTF file from 3D objects to the file called
prefix.gltf
. The user should consider modifying the working directory for 3D objects first, using-set td_wdir <dir>
. This command only constructs the GLTF file and thus does not require Blender.
- help_func(amp, args)¶
Function to process the help command.
- hist2d_plot(amp, args)¶
Documentation for o2graph command
hist2d-plot
:For objects of type
table
:Create a 2D histogram plot from two columns in a table
Command-line arguments:
<col x> <col y> [kwargs]
Create a 2D histogram plot from the specified columns. This command uses matplotlib to construct the histogram rather than using O2scl to create a hist object.
- hist_plot(amp, args)¶
Documentation for o2graph command
hist-plot
:For objects of type
table
:Create a histogram plot from a column in a table
Command-line arguments:
<col> [kwargs]
For a table, create a histogram plot from the specified column. This command uses matplotlib to construct the histogram rather than using O2scl to create a histogram object. Some useful kwargs are bins, color, edgecolor(ec), facecolor (fc), fill, hatch, and zorder. This command uses the matplotlib hist() function, see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.hist.html for information and keyword arguments. For example:
o2graph -create table x grid:0,10,0.01 \ -function "abs(sin(x))" y -hist-plot y \ "bins=40,fc=red,ec=blue,hatch=---" -show
For objects of type
hist
:Create a histogram plot from the current histogram.
Command-line arguments:
[kwargs]
Create a histogram plot from the current histogram. Some useful kwargs are color, edgecolor(ec), facecolor (fc), fill, hatch, and zorder. This command uses the matplotlib hist() function, see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.hist.html for information and keyword arguments. For example:
o2graph -create table x grid:0,10,0.01 \ -function "abs(sin(x))" y -to-hist y 40 \ -hist-plot "fc=red,ec=blue,hatch=---" -show
- kde_2d_plot(amp, args)¶
Documentation for o2graph command
kde-2d-plot
:For objects of type
table
:Plot a KDE of two columns
Command-line arguments:
<column x> <column y> [plot kwargs] [kde kwargs]
This command converts the two columns to a matrix and two vectors which define the x and y grids. Useful plot kwargs are all the usual plotting kwargs, plus x_min=0, x_max=0, y_min=0, y_max=0, z_mult=1, and n_points=201. Similar to the command
kde-plot
, if x_max is less than x_min then the limits on the x grid are either taken from the parametersxlo
andxhi
if they are set, or otherwise computed from the minimum and maximum of the specified x column. Otherwise, if x_max is smaller than x_min, then those values are used as the limits for the KDE (which need not correspond toxlo
andxhi
). The same holds for y_min, y_max, and the y grid. The number of points between x_min and x_max and between y_min and y_max is determined by the n_points parameter. The z vector is multiplied by y_mult before plotting.Useful KDE kwargs are kernel=’gaussian’, metric=’euclidean’, transform=’unit’, and bandwidth=’none’.
- kde_plot(amp, args)¶
Documentation for o2graph command
kde-plot
:For objects of type
table
:Plot a KDE of one column
Command-line arguments:
<column> [plot kwargs] [kde kwargs]
This command takes the column of the table, computes a one-dimensional KDE, and then uses that KDE to fill two vectors, an x and y vector to plot the data. Useful plot kwargs are all the usual plotting kwargs, plus x_min=0, x_max=0, y_mult=1, and n_points=201. If x_max is less than x_min then the limits on the x vector are either taken from the parameters
xlo
andxhi
if they are set, or otherwise computed from the minimum and maximum of the data. Otherwise, if x_max is smaller than x_min, then those values are used as the limits for the KDE (which need not correspond toxlo
andxhi
). The number of points between x_min and x_max is determined by the n_points parameter. The y vector is multiplied by y_mult before plotting.The
kde_sklearn
object is used for the KDE. Useful KDE kwargs are kernel=’gaussian’, metric=’euclidean’, transform=’unit’, and bandwidth=’none’. The bandwidth can be either ‘scott’, ‘silverman’ or a floating point number.
- mp4(args, loop=False, vf='', fps=10)¶
Documentation for o2graph command
mp4
:Create an mp4 file from a series of images.
Command-line arguments:
<pattern> <output> [kwargs]
Typical patterns are “prefix%02dsuffix” and outputs are “out.mp4”. If the “mp4” suffix is omitted, it is automatically added.
The allowed kwargs are loop=False, fps=10, and vf=’’. The former controls whether or not the
-stream_loop -1
is passed to ffmpeg and the latter is the video filter to be applied with ffmpeg’s-vf
flag. A typical video filter kwarg is e.g. vf=’eq=brightness=0.5:contrast=10’.This command requires the installation of
ffmpeg
.
- parse_argv(argv)¶
Parse command-line arguments.
This is the main function used by the O₂graph script . Once it has created a list of strings from argv, it calls parse_string_list() to call the proper functions. It creates the pointer to the o2scl acol_manager object called amp.
- parse_string_list(strlist, amp)¶
Parse a list of strings.
This function is called by parse_argv().
- plot1(amp, args)¶
Documentation for o2graph command
plot1
:For objects of type
table
:Plot the specified column
Command-line arguments:
<y> [kwargs]
Plot column <y> versus row number. Some useful kwargs are color (c), dashes, linestyle (ls), linewidth (lw), marker, markeredgecolor (mec), markeredgewidth (mew), markerfacecolor (mfc), markerfacecoloralt (mfcalt), markersize (ms). For example: “o2graph -create x 0 10 0.2 -function sin(x) y -plot1 y ls=’–‘,marker=’o’ -show”. This command uses the matplotlib plot() function, see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html for information and keyword arguments. This command does not yet support the matplotlib format parameter.
For objects of type
double[]
:Plot the array.
Command-line arguments:
[kwargs]
Plot the array. Some useful kwargs are color (c), dashes, linestyle (ls), linewidth (lw), marker, markeredgecolor (mec), markeredgewidth (mew), markerfacecolor (mfc), markerfacecoloralt (mfcalt), markersize (ms). https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html for information and keyword arguments. This command does not yet support the matplotlib format parameter.
For objects of type
int[]
:Plot the array.
Command-line arguments:
[kwargs]
Plot the array. Some useful kwargs are color (c), dashes, linestyle (ls), linewidth (lw), marker, markeredgecolor (mec), markeredgewidth (mew), markerfacecolor (mfc), markerfacecoloralt (mfcalt), markersize (ms). https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html for information and keyword arguments. This command does not yet support the matplotlib format parameter.
For objects of type
size_t[]
:Plot the array.
Command-line arguments:
[kwargs]
Plot the array. Some useful kwargs are color (c), dashes, linestyle (ls), linewidth (lw), marker, markeredgecolor (mec), markeredgewidth (mew), markerfacecolor (mfc), markerfacecoloralt (mfcalt), markersize (ms). https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html for information and keyword arguments. This command does not yet support the matplotlib format parameter.
- plot_color(amp, args)¶
Documentation for o2graph command
plot-color
:For objects of type
table
:Plot three columns, using the third for the color
Command-line arguments:
<x> <y> <c> <cmap> [kwargs]
Plot column <y> versus column <x> using column <c> to specify the line color. Some useful kwargs are color (c), dashes, linestyle (ls), linewidth (lw), marker, markeredgecolor (mec), markeredgewidth (mew), markerfacecolor (mfc), markerfacecoloralt (mfcalt), markersize (ms). For example:
o2graph -create x 0 10 0.2 -function sin(x) y -plot x y \ lw=0,marker='+' -show
This command uses the matplotlib plot() function, see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html for information and keyword arguments. This command does not yet support the matplotlib format parameter.
If a cmyt colormap is used, then the
cmyt
Python package is required.
- plot_o2graph(amp, args)¶
Documentation for o2graph command
plot
:For objects of type
table
:Plot two columns.
Command-line arguments:
<x> <y> [kwargs]
Plot column <y> versus column <x>. Some useful kwargs are color (c), dashes, linestyle (ls), linewidth (lw), marker, markeredgecolor (mec), markeredgewidth (mew), markerfacecolor (mfc), markerfacecoloralt (mfcalt), markersize (ms), and zorder. For example:
o2graph -create table x grid:0,10,0.2 -function "sin(x)" y \ -plot x y "lw=0,marker=+" -show
This command uses the matplotlib plot() function, see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html for information and keyword arguments. This command does not yet support the matplotlib format parameter.
For objects of type
vec_vec_double
:Plot one or two columns.
Command-line arguments:
<x index> [y index or 'none'] [kwargs]
Plot vector with index [index y] versus vector with index <index x>. Alternatively, if the second argument is the string ‘none’, plot the vector with index <index x>. Some useful kwargs are color (c), dashes, linestyle (ls), linewidth (lw), marker, markeredgecolor (mec), markeredgewidth (mew), markerfacecolor (mfc), markerfacecoloralt (mfcalt), markersize (ms). For example:
o2graph -create vec_vec_double grid:0,10,0.2 "func:51:sin(i)" \ -plot 0 1 "lw=0,marker=+" -show
This command uses the matplotlib plot() function, see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html for information and keyword arguments. This command does not yet support the matplotlib format parameter.
For objects of type
hist
:Plot the histogram
Command-line arguments:
[kwargs]
Plot the histogram weights as a function of the bin representative values. Some useful kwargs (which apply for all three object types) are color (c), dashes, linestyle (ls), linewidth (lw), marker, markeredgecolor (mec), markeredgewidth (mew), markerfacecolor (mfc), markerfacecoloralt (mfcalt), markersize (ms). For example:
o2graph -create table x grid:0,10,0.01 \ -function "abs(sin(x))" y -to-hist y 20 \ -plot "lw=0,marker=+" -show
This command uses the matplotlib plot() function, see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html for information and keyword arguments. This command does not yet support the matplotlib format parameter.
For objects of type
vector<contour_line>
:Plot the contour lines.
Command-line arguments:
[kwargs]
Plot the set of contour lines. Some useful kwargs (which apply for all three object types) are color (c), dashes, linestyle (ls), linewidth (lw), marker, markeredgecolor (mec), markeredgewidth (mew), markerfacecolor (mfc), markerfacecoloralt (mfcalt), markersize (ms). For example:
o2graph -create table3d x grid:0,1,0.02 y grid:0,1,0.02 z \ "(exp(-(x-0.2)^2/0.1)+exp(-(x-0.9)^2/0.1))*exp(-(y-0.4)^2/0.1)" \ -contours 0.5 z -plot "lw=2" -show
This command uses the matplotlib plot() function, see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html for information and keyword arguments. This command does not yet support the matplotlib format parameter.
For objects of type
prob_dens_mdim_amr
:Plot the probability distribution.
Command-line arguments:
[kwargs]
Plot the set of contour lines. Some useful kwargs (which apply for all three object types) are color (c), dashes, linestyle (ls), linewidth (lw), marker, markeredgecolor (mec), markeredgewidth (mew), markerfacecolor (mfc), markerfacecoloralt (mfcalt), markersize (ms). This command uses the matplotlib plot() function, see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html for information and keyword arguments. This command does not yet support the matplotlib format parameter.
- plotv(amp, args)¶
Documentation for o2graph command
plotv
:Plot several vector-like data sets.
Command-line arguments:
[multiple vector spec. for x] <multiple vector spec. for y>
The plotv command plots one or several pairs of vectors for x and y. The total number of curves plotted will be the number of vector data sets from the first argument times the number of vector data sets from the second argument. If the x and y vector lengths are not equal, then the longer vector is truncated. Any kwargs are applied to all curves plotted. For details on multiple vector specifications, use o2graph -help mult-vector-spec.
There is an additional keyword argument
filter
. The filter is parsed through the python eval() function and all pairs of points for which the function evaluates to False are omitted from the plot. Local variables of interest arex
andy
, corresponding to the x and y value at each point, andk
, the current array index.
- print_param_docs(amt)¶
Print parameter documentation.
Called by help_func().
- restore_focus(foc)¶
Restore the value of self.yt_focus from the array ‘foc’.
- restore_north(nor)¶
Restore the value of self.yt_north from the array ‘nor’.
- restore_position(pos)¶
Restore the value of self.yt_position from the array ‘pos’ which is …
- restore_width(wid)¶
Restore the value of self.yt_width from the array ‘wid’.
- rplot(amp, args)¶
Documentation for o2graph command
rplot
:For objects of type
table
:Plot a region inside a column or in between two columns.
Command-line arguments:
<x1> <y1> [x2 y2] [kwargs]
If either 2 or 3 arguments are specified, this command plots the region inside the curve defined by the specified set of x and y values. The first point is copied at the end to ensure a closed region. If 4 or 5 arguments are specified, then this command plots the region in between two sets of x and y values, again adding the first point from (x1,y1) to the end to ensure a closed region.
- scatter_o2graph(amp, args)¶
Documentation for o2graph command
scatter
:For objects of type
table
:Create a scatter plot from 2-4 columns.
Command-line arguments:
<x> <y> [s] [c] [kwargs]
This command creates a scatter plot form columns <x> and <y>, optionally using column [s] to choose the marker size and optionally using column [c] to choose the marker color. To vary the marker colors while choosing the default marker size just specify ‘None’ as the argument for [s]. Or, to specify keyword arguments while using the default size and color, specify ‘None’ as the argument for both [s] and [c].
- set_wrapper(amp, args)¶
Wrapper around
o2sclpy.plot_base.set()
which sets plot-related parameters and sends other parameters toacol_manager
.
- to_kde(amp, args)¶
Documentation for o2graph command
to-kde
:For objects of type
table
:Convert columns in a table to a KDE (unfinished)
Command-line arguments:
<options or 'none'> <column 1> [column 2] ...
Desc.
- wdocs_wrapper(amp, args)¶
- yt_add_vol(amp, args, keyname='o2graph_vol')¶
Documentation for o2graph command
yt-add-vol
:For objects of type
tensor_grid
:Add a tensor_grid object as a yt volume source
Command-line arguments:
[kwargs]
This command adds the volumetric data specified in the
tensor_grid
object as a yt volume source. The transfer function previously specified byyt-tf
is used, or if unspecified, then yt’s transfer_function_helper is used to create a 3 layer default transfer function.
- yt_ann_func(amp, args)¶
Documentation for o2graph command
yt-ann
:Annotate a yt rendering (experimental).
Command-line arguments:
[args]
The
yt-ann
command adds a list of o2graph commands that can be used to annotate a yt rendering. Annotations are normal o2graph 2D plotting commands built upon a coordinate system with (0,0) as the lower-left corner of the image and (1,1) as the upper-right corner. Arguments foryt-ann
may include dashes but must end with the word ‘end’.For example:
-yt-ann -text 0.1 0.95 "Ann. example" color=w,ha=left end
The list or arguments in args must end with ‘end’. If args contains only one entry (‘end’), then the list of annotations is cleared.
- yt_mesh(amp, args)¶
Plot a mesh from vertices specified by a slice of O2scl table3d object.
- yt_path_func(amp, args)¶
Documentation for o2graph command
yt-path
:Add a path to the yt animation.
Command-line arguments:
<type> <number of frames> <other parameters>
The
yt-path
adds a path to a yt animation. To rotate the camera around the z-axis, use ‘yaw’ <n_frames> <angle>, where angle is a fraction of a full rotation to perform by the end of the animation. To zoom the camera, use ‘zoom’ <n_frames> <factor> ,where factor is the total zoom factor to apply over all n_frames. To move the camera along a line, use ‘move’ <n_frames> <[dest_x,dest_y,dest_z]> <’internal’ or ‘user’>, where the third argument is the destination in either the internal or user-specified coordinate system. To turn the camera without moving it, use ‘turn’ <n_frames> <[foc_x,foc_y,foc_z]> <’internal’ or ‘user’>. Executing ‘yt-path reset’ resets the yt animation path to an empty list (for no animation).
- yt_render(amp, fname, mov_fname='', loop=False)¶
Documentation for o2graph command
yt-render
:Render the yt volume visualization.
Command-line arguments:
<filename or pattern> [kwargs]
Perform the volume rendering. If yt_path is empty, then the first argument is the filename. If yt_path is not empty then the first argument is a filename pattern containing * where each frame will be stored. If yt_path is not empty and a movie filename is given, then ffmpeg will be used to combine the frames into an mp4 file.
The keyword argument
mov_fname
specifies the output movie file (if an animation is specified withyt-path
). If empty, the filenameo2graph.mp4
is used.This command requires the installation of
ffmpeg
.
- yt_save_annotate(amp, fname)¶
Create a .png image, then add 2D annotations, save to file named ‘fname’, and then apply any filters
- yt_scatter(amp, args)¶
Documentation for o2graph command
yt-scatter
:For objects of type
table
:Add scattered points to a yt scene
Command-line arguments:
<x column> <y column> <z column> [size column] [red column] [green column] [blue column] [alpha column]
Add a series of points to a yt scene. If a volume has not yet been added, then a default volume is added. If the x, y-, or z-axis limits have not yet been set, then they are set by the limits of the data. If the size column is unspecified, ‘none’, or ‘None’, then the default value of 3 is used. If the color columns are unspecified, ‘none’ or ‘None’, then [1,1,1] is used, and finally the default for the alpha column is 0.5. If any of the values for the color columns are less than zero or greater than 1, then that color column is rescaled to [0,1].
- yt_tf_func(args)¶
Documentation for o2graph command
yt-tf
:Edit the yt transfer function.
Command-line arguments:
<mode> <args>
To create a new transfer function, use ‘new’ for <mode> and the remaining <args> are <min> <max> [nbins] .To add a Gaussian, use ‘gauss’ for <mode> and <args> are <loc> <width> <red> <green> <blue>, and <alpha>. To add a step function, use ‘step’ <low> <high> <red> <green> <blue>, and <alpha>. To plot the transfer function, use ‘plot’ <filename>.
- yt_vertex_list(amp, args)¶
Documentation for o2graph command
yt-vertex-list
:For objects of type
table
:Draw a line from a series of vertices in a table.
Command-line arguments:
<x column> <y column> <z column> [kwargs]
Create a series of yt LineSource objects in a visualization using the three specified columns as vertices. One line segment will be drawn from the values in the first row to the values in the second row, one line segment from the second row to the third row, and so on.