pyspecdata.plot_funcs package¶
Submodules¶
pyspecdata.plot_funcs.image module¶
-
pyspecdata.plot_funcs.image.fl_image(self, A, **kwargs)¶ Called as fl.image() where fl is the figlist_var object
Note that this code just wraps the figlist properties, and the heavy lifting is done by the image( function. Together, the effect is as follows:
check_units converts to human-readable units, and makes sure they match the units already used in the plot.
if A has more than two dimensions, the final dimension in A.dimlabels is used as the column dimension, and a direct-product of all non-column dimensions (a Kronecker product, such that the innermost index comes the latest in the list A.dimlabels) is used as the row dimension. A white/black line is drawn after the innermost index used to create the direct product is finished iterating.
If A consists of complex data, then an HSV plot (misnomer, actually an HV plot) is used: - convert to polar form: \(z=\rho \exp(i \phi)\) - \(\phi\) determines the color (Hue)
- Color wheel is cyclical, like \(\exp(i \phi)\)
- red is taken as \(\phi=0\), purely real and positive
- green-blue is \(pi\) radians out of phase with red and therefore negative real
\(\rho\) determines the intensity (value) - Depending on whether or not black is set (either as a
keyword argument, or fl.black, the background will be black with high \(\rho\) values “lit up” (intended for screen plotting) or the background will be white with the high \(\rho\) values “colored in” (intended for printing)
If the data type (dtype) of the data in A is real (typically achieved by calling abs(A) or A.runcopy(real)), then A is plotted with a colormap and corresponding colorbar.
If no title has been given, it’s set to the name of the current plot in the figurelist
-
pyspecdata.plot_funcs.image.x¶ If A is a numpy array, then this gives the values along the x axis (columns). Defaults to the size of the array. Not used if A is nddata.
Type: Optional[double] or Optional[scalar]
-
pyspecdata.plot_funcs.image.y¶ If A is a numpy array, then this gives the values along the y axis (columns). Defaults to the size of the array. Not used if A is nddata.
Type: Optional[double] or Optional[scalar]
-
pyspecdata.plot_funcs.image.x_first¶ Since it’s designed to represent matrices, an image plot by defaults is “transposed” relative to all other plots. If you want the first dimension on the x-axis (e.g., if you are plotting a contour plot on top of an image), then set x_first to True.
Type: boolean
-
pyspecdata.plot_funcs.image.spacing¶ Determines the size of the white/black line drawn Defaults to 1
Type: integer
-
pyspecdata.plot_funcs.image.ax¶ the Axis object where the plot should go.
Type: matplotlib Axes
-
all remaning are passed through to matplotlib imshow
-
pyspecdata.plot_funcs.image.origin¶ upper and lower are passed to matplotlib. Flip is for 2D nmr, and flips the data manually.
Type: {‘upper’, ‘lower’, ‘flip’}
-
.. code-block:: python from pyspecdata import * fl = figlist_var()
t = r_[-1:1:300j] x = nddata(t,[-1],[‘x’]).labels(‘x’,t) y = nddata(t,[-1],[‘y’]).labels(‘y’,t)
z = x**2 + 2*y**2 print “dimlabels of z:”,z.dimlabels
fl.next(‘image with contours’) fl.image(z,x_first = True) # x_first is needed to align # with the contour plot z.contour(colors = ‘w’,alpha = 0.75)
fl.next(‘simple plot’) # just to show that x is the same # here as well fl.plot(z[‘y’:(0,0.01)])
fl.show(‘compare_image_contour_150911.pdf’)
-
pyspecdata.plot_funcs.image.image(A, x=[], y=[], **kwargs)¶ Please don’t call image directly anymore – use the image method of figurelist
-
pyspecdata.plot_funcs.image.imagehsv(A, logscale=False, black=False)¶ This provides the HSV mapping used to plot complex number
Module contents¶
This subpackage contains plotting functions that take advantage of nddata. Eventually, all plotting functions should be moved to separate modules in this subpackage.