The plotting module contains classes and funtions to aid in making plots useful for astrophysics.
The 2D plots in this module all use the matplotlib package, while 3d plots are a mix of matplotlib and mayavi .
Note
In this module and all other places astropysics uses matplotlib,
Bases: object
takes the last set of xys and matches them to an NX2 array of x,y values, returning indecies into the 1st dimension
mapfunc should accept a 1D numpy array as the first argument, and the args tuple will be passed as the rest of the arguments. It should return an array of the same length as the first argument.
majorticks is the number of major ticks in the interval, while minorticks is the number of ticks between each majortick
invfunc, if present, is used to make a linearly-spaced axis
fmt and minfmt are either format specifiers for the value along the axis, or ‘sci%?’ or ‘pow%?’ to use scientific notation
if fmt is ‘log#’ or ‘ln’, a logarithmic axis will be assumed with the base given by #, and minfmt is ignored. (the function then just provides the edges)
Animates a figure made in matplotlib using the mplot3d 3D plotting tools.
Parameters: |
|
---|---|
Raises: |
|
Plots a 1d sequence of data points as a cumulative count less than (or greater than) a given value - i.e. the integrated histogram.
Parameters: |
|
---|
kwargs are passed into matplotlib.pyplot.plot()
Returns: | (val,N) i.e. the x and y values of the resulting plot. |
---|
plots dual-valued functions kwargs go to errorbar function
fixes log plots to be upper bounds in the event of zero-data or errorbars that go below zero
logaxes can be ‘x’,’y’,or,’xy’
Given a base file name where movie frame files have been saved, generates a movie using ffmpeg. This is intended to be used with the *_animate() functions in this module, but can be used for any set of filenames that follow the correct pattern and define movie frames.
ffmpeg must be installed for this function to work.
Parameters: |
|
---|---|
Returns: | A string with the command line call to ffmpeg |
Raises ValueError: | |
If the ffmpeg call does not complete sucessfully or there are no matching files. |
Switch enthought.mayavi.mlab to use “checkerboard” style stereo
Parameters: | |
---|---|
Returns: | the VTK render window object |
This generates an animation using the mlab.animate() mechanism that rotates the scene and possibly zooms in and out with a fixed focal point.
Parameters: |
|
---|---|
Returns: | (anim,fnlist) anim is an animator of the sort that mlab.animate() returns – call this animator to start the animation. fnlist is a list of filenames that have been saved - it will initially be empty, but once the animation is run, it will be populated. |
Adjust enthought.mayavi.mlab camera based on a position and focal point rather than angles as used by enthought.mayavi.mlab.() .
Parameters: |
|
---|---|
Returns: | The VTK Camera object |
Switch enthought.mayavi.mlab to use “checkerboard” style stereo
Parameters: | dostereo – Turns on stereo if True, off if False, or if None, toggles stereo mode. |
---|---|
Returns: | the VTK render window object |
Used for with statements containing matplotlib plots. Usage:
with _mpl_context() as plt:
plt.plot(x,y,...)
plt.scatter(xs,ys,...)
Parameters: |
|
---|
Generates a texture and applies it to a mayavi surface.
Parameters: |
|
---|---|
Returns: | The enthought.mayavi.modules.surface.Surface object |
Uses the ‘steps’ line style to make histograms from bin data like that output from numpy.histogram(). While similar in functionality to matplotlib.pyplot.hist(), it allows the histogram data to be modfied instead of being computed in the function and accepts keywords like matplotlib.pyplot.plot().
Parameters: |
|
---|
Additional keywords are passed into matplotlib.pyplot.plot().
cb can be used to specify the label of the colorbar
returns collection,maskinds
plots x vs. y, scatter plotting where the number is below the threshold, contouring if above
bins is the number of bins or [xbins,ybins]
ncontours defaults to bins/3
threshold defaults to whatever fills half the histogram
lims can be None or (xmin,xmax,ymin,ymax)
skwargs goes into scatter(), ckwargs goes into contour() or contourf()
Warning
This function will likely be adapted to use matplotlib.pyplot.hexbin() in the near future instead of contour or contourf, so don’t expect it to stay consistent until that happens
pcfg is a 2-tuple of the form (rows,cols)
kwargs go into pyplot.scatter
fitline can be False/True or a dictionary that has line props and an optional ‘annotate’ key word for annotation (also ‘asize’ sets font size)
quick scatter plot to lasso objects and return an object that will be updated with the selections
args and kwargs go into matplotlib scatter except for ‘close’ which is used to close the current figure on function call(default True)
returns a dictionary that will be populated with ‘i’,’xis’, and’yi’ , and possibly ‘ci’ or ‘si’ if c or s are in the scatter plot
Generates histograms in the first parameter that are split over ranges based on a second parameter.
Parameters: |
|
---|
kwargs are passed into the calls to matplotlib.pyplot.hist()
returns (nrows,ncolumns) to optimize the space for n panels
Performs the same operation as matplotlib.pyplot.subplots_adjust() but uses point size uinits instead of fractions of the total figure size.