plot2d

Utilities to plot in 2D.

cornerHistogram

vtkplotter.plot2d.cornerHistogram(values, bins=20, vrange=None, minbin=0, logscale=False, title='', c='g', bg='k', pos=1, s=0.2, lines=True)[source]

Build a histogram from a list of values in n bins. The resulting object is a 2D actor.

Use vrange to restrict the range of the histogram.

Use pos to assign its position:
  • 1, topleft,
  • 2, topright,
  • 3, bottomleft,
  • 4, bottomright,
  • (x, y), as fraction of the rendering window

cornerPlot

vtkplotter.plot2d.cornerPlot(points, pos=1, s=0.2, title='', c='b', bg='k', lines=True)[source]

Return a vtkXYPlotActor that is a plot of x versus y, where points is a list of (x,y) points.

Parameters:pos (int) –

assign position:

  • 1, topleft,
  • 2, topright,
  • 3, bottomleft,
  • 4, bottomright.

donutPlot

vtkplotter.plot2d.donutPlot(fractions, title='', r1=1.7, r2=1, phigap=0, lpos=0.8, lsize=0.15, c=None, bc='k', alpha=1, labels=(), showDisc=False)[source]

Donut plot or pie chart.

Parameters:
  • title (str) – plot title
  • r1 (float) – inner radius
  • r2 (float) – outer radius, starting from r1
  • phigap (float) – gap angle btw 2 radial bars, in degrees
  • lpos (float) – label gap factor along radius
  • lsize (float) – label size
  • c – color of the plot slices
  • bc – color of the disc frame
  • alpha – alpha of the disc frame
  • labels (list) – list of labels
  • showDisc (bool) – show the outer ring axis

donutPlot.py donutPlot.py

fxy

vtkplotter.plot2d.fxy(z='sin(3*x)*log(x-y)/3', x=(0, 3), y=(0, 3), zlimits=(None, None), showNan=True, zlevels=10, c='b', bc='aqua', alpha=1, texture='paper', res=(100, 100))[source]

Build a surface representing the function \(f(x,y)\) specified as a string or as a reference to an external function.

Parameters:
  • x (float) – x range of values.
  • y (float) – y range of values.
  • zlimits (float) – limit the z range of the independent variable.
  • zlevels (int) – will draw the specified number of z-levels contour lines.
  • showNan (bool) – show where the function does not exist as red points.
  • res (list) – resolution in x and y.

fxy.py fxy.py

Function is: \(f(x,y)=\sin(3x) \cdot \log(x-y)/3\) in range \(x=[0,3], y=[0,3]\).

hexHistogram

vtkplotter.plot2d.hexHistogram(xvalues, yvalues, xtitle='', ytitle='', ztitle='', bins=12, norm=1, fill=True, c=None, cmap='terrain_r', alpha=1)[source]

Build a hexagonal histogram from a list of x and y values.

Parameters:
  • bins (bool) – nr of bins for the smaller range in x or y.
  • norm (float) – sets a scaling factor for the z axis (freq. axis).
  • fill (bool) – draw solid hexagons.
  • cmap (str) – color map name for elevation.

histoHexagonal.py histoHexagonal.py

histogram

vtkplotter.plot2d.histogram(values, xtitle='', ytitle='', bins=25, vrange=None, logscale=False, yscale=None, fill=True, gap=0.02, c='olivedrab', alpha=1, outline=True, lw=2, lc='black', errors=False)[source]

Build a histogram from a list of values in n bins. The resulting object is a 2D actor.

Parameters:
  • bins (int) – number of bins.
  • vrange (list) – restrict the range of the histogram.
  • logscale (bool) – use logscale on y-axis.
  • fill (bool) – fill bars woth solid color c.
  • gap (float) – leave a small space btw bars.
  • outline (bool) – show outline of the bins.
  • errors (bool) – show error bars.

histogram.py histogram.py

plotxy

vtkplotter.plot2d.plotxy(data, xerrors=None, yerrors=None, xlimits=None, ylimits=None, xscale=1, yscale=None, xlogscale=False, ylogscale=False, c='k', alpha=1, xtitle='x', ytitle='y', title='', titleSize=None, ec=None, lc='k', lw=2, line=True, dashed=False, splined=False, marker=None, ms=None, mc=None, ma=None)[source]

Draw a 2D plot of variable x vs y.

Parameters:
  • data (list) – input format can be [allx, ally] or [(x1,y1), (x2,y2), …]
  • xerrors (list) – set uncertainties for the x variable, shown as error bars.
  • yerrors (list) – set uncertainties for the y variable, shown as error bars.
  • xlimits (list) – set limits to the range for the x variable
  • ylimits (list) – set limits to the range for the y variable
  • xscale (float) – set scaling factor in x. Default is 1.
  • yscale (float) – set scaling factor in y. Automatically calculated to get a reasonable aspect ratio. Scaling factor is saved in info[‘yscale’].
  • xlogscale (bool) – set x logarithmic scale.
  • ylogscale (bool) – set y logarithmic scale.
  • c (str) – color of frame and text.
  • alpha (float) – opacity of frame and text.
  • xtitle (str) – title label along x-axis.
  • ytitle (str) – title label along y-axis.
  • title (str) – histogram title on top.
  • titleSize (float) – size of title
  • ec (str) – color of error bar, by default the same as marker color
  • lc (str) – color of line
  • lw (float) – width of line
  • line (bool) – join points with line
  • dashed (bool) – use a dashed line style
  • splined (bool) – spline the line joining the point as a countinous curve
  • marker (str,int) – use a marker shape for the data points
  • ms (float) – marker size.
  • mc (str) – color of marker
  • ma (float) – opacity of marker

plotxy.py plotxy.py

polarHistogram

vtkplotter.plot2d.polarHistogram(values, title='', bins=10, r1=0.25, r2=1, phigap=3, rgap=0.05, lpos=1, lsize=0.05, c=None, bc='k', alpha=1, cmap=None, deg=False, vmin=None, vmax=None, labels=(), showDisc=True, showLines=True, showAngles=True, showErrors=False)[source]

Polar histogram with errorbars.

Parameters:
  • title (str) – histogram title
  • bins (int) – number of bins in phi
  • r1 (float) – inner radius
  • r2 (float) – outer radius
  • phigap (float) – gap angle btw 2 radial bars, in degrees
  • rgap (float) – gap factor along radius of numeric angle labels
  • lpos (float) – label gap factor along radius
  • lsize (float) – label size
  • c – color of the histogram bars, can be a list of length bins.
  • bc – color of the frame and labels
  • alpha – alpha of the frame
  • cmap (str) – color map name
  • deg (bool) – input array is in degrees
  • vmin (float) – minimum value of the radial axis
  • vmax (float) – maximum value of the radial axis
  • labels (list) – list of labels, must be of length bins
  • showDisc (bool) – show the outer ring axis
  • showLines (bool) – show lines to the origin
  • showAngles (bool) – show angular values
  • showErrors (bool) – show error bars

polarHisto.py polarHisto.py

polarPlot

vtkplotter.plot2d.polarPlot(rphi, title='', r1=0, r2=1, lpos=1, lsize=0.03, c='blue', bc='k', alpha=1, lw=3, deg=False, vmax=None, fill=True, spline=True, smooth=0, showPoints=True, showDisc=True, showLines=True, showAngles=True)[source]

Polar/radar plot by splining a set of points in polar coordinates. Input is a list of polar angles and radii.

Parameters:
  • title (str) – histogram title
  • bins (int) – number of bins in phi
  • r1 (float) – inner radius
  • r2 (float) – outer radius
  • lsize (float) – label size
  • c – color of the line
  • bc – color of the frame and labels
  • alpha – alpha of the frame
  • lw (int) – line width in pixels
  • deg (bool) – input array is in degrees
  • fill (bool) – fill convex area with solid color
  • spline (bool) – interpolate the set of input points
  • showPoints (bool) – show data points
  • showDisc (bool) – show the outer ring axis
  • showLines (bool) – show lines to the origin
  • showAngles (bool) – show angular values

polarPlot.py polarPlot.py