plot
Note
Functions for plotting.
Module author: Adam Gagorik <adam.gagorik@gmail.com>
-
plot.convert(ifile, ofile, density=300)[source]
Convert a file.
-
plot.crop(name, border=10)[source]
Crop a file.
-
plot.save(name, border=10, **kwargs)[source]
Save a file and crop it.
-
plot.subplots(nrows=1, ncols=1, w=6, h=6, l=1.0, r=1.0, t=1.0, b=1.0, ws=1.0, hs=1.0, units='in', **kwargs)[source]
Wrapper around matplotlib.pyplot.subplots() that uses absolute (instead of relative) lengths.
Parameters: |
- nrows – number of rows
- ncols – number of cols
- w – width of each subplot
- h – height of each subplot
- l – left margin
- r – right margin
- t – top margin
- b – bottom margin
- ws – horizontal space between subplots
- hs – vertical space between subplots
- units – units of length (default=in, cm)
|
-
plot.multiple_locator(axis=None, x=None, y=None, s=None, which='major')[source]
Easier way to set mpl.ticker.MultipleLocator.
-
plot.maxn_locator(axis=None, x=None, y=None, s=None, which='major')[source]
Easier way to set mpl.ticker.MaxNLocator.
-
plot.scilimits(*args, **kwargs)[source]
Easier way to set scilimits.
-
plot.zoom(axis=None, factor=0.05, l=None, r=None, t=None, b=None)[source]
Zoom out.
-
plot.shift_subplots(fig=None, horizontal=0.0, vertical=0.0)[source]
Shift center of subplots.
-
plot.create_colorbar_axes(axis=None, shift=0.01, width=0.05)[source]
Create colorbar axis next to subplot.
-
plot.fix_colorbar_labels(cax)[source]
Align colorbar labels.
-
plot.fake_alpha(rgb, alpha)[source]
Compute color.
-
plot.rectangle(x0, y0, x1, y1, axis=None, **kwargs)[source]
Draw a rectangle.
-
plot.contourf(x, y, v, n, index=(slice(None, None, None), slice(None, None, None), 0), **kwargs)[source]
wrapper around contourf
-
plot.contour(x, y, v, n, index=(slice(None, None, None), slice(None, None, None), 0), **kwargs)[source]
wrapper around contour
-
plot.errorbar(x, y, color='r', **kwargs)[source]
wrapper around errorbar
-
plot.transformA(x, y, a=None)[source]
transform angle from data to screen coordinates
-
plot.transformX(x, transform_from=None, transform_to=None)[source]
transform x from axes to data coords
-
plot.transformY(y, transform_from=None, transform_to=None)[source]
transform y from axes to data coords
-
plot.scale_bars(patches)[source]
scales bars of bar plot
-
class plot.BarPlot(groups, members, rwidth=0.5, gshift=1.0)[source]
Helper for calculating x-values of bar plots.
>>> bar = BarPlot(groups=3, members=2)
>>> bar.ydata[0,:] = [1,1] #group 0
>>> bar.ydata[1,:] = [2,2] #group 1
>>> bar.ydata[2,:] = [3,3] #group 2
>>> bar.plot()
-
class plot.PeakFinder(figure=None, mode='fit', handle=None, callback=None, savename='plot.pdf')[source]
Interactive way to find peaks on a xy plot.
>>> fig, ax1 = plt.subplots(1, 1)
>>> x = np.linspace(-2*np.pi, 2*np.pi)
>>> plt.plot(x, np.sin(x), 'r-')
>>> finder = PeakFinder(figure=fig)
>>> plt.show()