{:.no_toc}
* TOC {:toc}There a lot of functions in matplotlib.pyplot. Here I list the more important ones.
Questions to David Rotermund
pylab is a historic interface and its use is strongly discouraged. The equivalent replacement is matplotlib.pyplot
axes | Add an Axes to the current figure and make it the current Axes. |
cla | Clear the current axes. |
clf | Clear the current figure. |
close | Close a figure window. |
delaxes | Remove an Axes (defaulting to the current axes) from its figure. |
fignum_exists | Return whether the figure with the given id exists. |
figure | Create a new figure, or activate an existing figure. |
gca | Get the current Axes. |
gcf | Get the current figure. |
get_figlabels | Return a list of existing figure labels. |
get_fignums | Return a list of existing figure numbers. |
sca | Set the current Axes to ax and the current Figure to the parent of ax. |
subplot | Add an Axes to the current figure or retrieve an existing Axes. |
subplot2grid | Create a subplot at a specific location inside a regular grid. |
subplot_mosaic | Build a layout of Axes based on ASCII art or nested lists. |
subplots | Create a figure and a set of subplots. |
twinx | Make and return a second axes that shares the x-axis. |
twiny | Make and return a second axes that shares the y-axis. |
more Basic
plot | Plot y versus x as lines and/or markers. |
errorbar | Plot y versus x as lines and/or markers with attached errorbars. |
scatter | A scatter plot of y vs. |
step | Make a step plot. |
loglog | Make a plot with log scaling on both the x- and y-axis. |
semilogx | Make a plot with log scaling on the x-axis. |
semilogy | Make a plot with log scaling on the y-axis. |
bar | Make a bar plot. |
barh | Make a horizontal bar plot. |
bar_label | Label a bar plot. |
pie | Plot a pie chart. |
vlines | Plot vertical lines at each x from ymin to ymax. |
hlines | Plot horizontal lines at each y from xmin to xmax. |
fill | Plot filled polygons. |
polar | Make a polar plot. |
more Binned
hist | Compute and plot a histogram. |
hist2d | Make a 2D histogram plot. |
clabel | Label a contour plot. |
contour | Plot contour lines. |
contourf | Plot filled contours. |
more 2D arrays
imshow | Display data as an image, i.e., on a 2D regular raster. |
annotate | Annotate the point xy with text text. |
text | Add text to the Axes. |
figtext | Add text to figure. |
table | Add a table to an Axes. |
arrow | Add an arrow to the Axes. |
figlegend | Place a legend on the figure. |
legend | Place a legend on the Axes. |
autoscale | Autoscale the axis view to the data (toggle). |
axis | Convenience method to get or set some axis properties. |
box | Turn the axes box on or off on the current axes. |
grid | Configure the grid lines. |
locator_params | Control behavior of major tick locators. |
minorticks_off | Remove minor ticks from the Axes. |
minorticks_on | Display minor ticks on the Axes. |
rgrids | Get or set the radial gridlines on the current polar plot. |
thetagrids | Get or set the theta gridlines on the current polar plot. |
tick_params | Change the appearance of ticks, tick labels, and gridlines. |
ticklabel_format | Configure the ScalarFormatter used by default for linear Axes. |
xlabel | Set the label for the x-axis. |
xlim | Get or set the x limits of the current axes. |
xscale | Set the xaxis' scale. |
xticks | Get or set the current tick locations and labels of the x-axis. |
ylabel | Set the label for the y-axis. |
ylim | Get or set the y-limits of the current axes. |
yscale | Set the yaxis' scale. |
yticks | Get or set the current tick locations and labels of the y-axis. |
title | Set a title for the Axes. |
more Layout
margins | Set or retrieve autoscaling margins. |
subplots_adjust | Adjust the subplot layout parameters. |
tight_layout | Adjust the padding between and around subplots. |
more Colormapping
clim | Set the color limits of the current image. |
colorbar | Add a colorbar to a plot. |
sci | Set the current image. |
get_cmap | Get a colormap instance, defaulting to rc values if name is None. |
set_cmap | Set the default colormap, and applies it to the current image if any. |
imread | Read an image from a file into an array. |
imsave | Colormap and save an array as an image file. |
more Configuration
rc | Set the current rcParams. group is the grouping for the rc, e.g., for lines.linewidth the group is lines, for axes.facecolor, the group is axes, and so on. Group may also be a list or tuple of group names, e.g., (xtick, ytick). kwargs is a dictionary attribute name/value pairs, e.g.,::. |
rcdefaults | Restore the rcParams from Matplotlib's internal default style. |
more Output
draw | Redraw the current figure. |
ioff | Disable interactive mode. |
ion | Enable interactive mode. |
pause | Run the GUI event loop for interval seconds. |
savefig | Save the current figure. |
show | Display all open figures. |
more Other
waitforbuttonpress | Blocking call to interact with the figure. |