http://matplotlib.org/api/pyplot_summary.html
作圖指令
方法 | 描述 | 類型 |
---|---|---|
angle_spectrum | Plot the angle spectrum. | plot |
arrow | Add an arrow to the axes. | plot |
bar | Make a bar plot. | plot |
barbs | Plot a 2-D field of barbs. | plot |
barh | Make a horizontal bar plot. | plot |
boxplot | Make a box and whisker plot. | plot |
broken_barh | Plot horizontal bars. | Plot |
cohere | Plot the coherence between?x?and?y. | plot |
contour | Plot contours. | plot |
contourf | Plot contours. | plot |
csd | Plot the cross-spectral density. | plot |
errorbar | Plot an errorbar graph. | plot |
eventplot | Plot identical parallel lines at specific positions. | plot |
fill | Plot filled polygons. 做面積圖 | plot |
fill_between | Make filled polygons between two curves. | |
fill_betweenx | Make filled polygons between two horizontal curves. | |
hexbin | Make a hexagonal binning plot. | plot |
hist | Plot a histogram. | plot |
hist2d | Make a 2D histogram plot. | plot |
loglog | Make a plot with log scaling on both the?x?and?y?axis. | plot |
magnitude_spectrum | Plot the magnitude spectrum. | Plot |
pcolormesh | Plot a quadrilateral mesh. | Plot |
phase_spectrum | Plot the phase spectrum. | Plot |
pie | Plot a pie chart. | Plot |
plot | Plot lines and/or markers to the?Axes. | Plot |
plot_date | A plot with data that contains dates. | Plot |
plotfile | Plot the data in in a file. | Plot |
polar | Make a polar plot. | plot |
thetagrids | Get or set the theta locations of the gridlines in a polar plot. | |
psd | Plot the power spectral density. | Plot |
quiver | Plot a 2-D field of arrows. | Plot |
scatter | Make a scatter plot of?x?vs?y?Marker size is scaled by?s?and marker color is mapped to?cParameters ———- x, y : array_like, shape (n, ) Input data s : scalar or array_like, shape (n, ), optional size in points^2. | plot |
semilogx | Make a plot with log scaling on the?x?axis. | plot |
semilogy | Make a plot with log scaling on the?y?axis. | plot |
specgram | Plot a spectrogram. | Plot |
spy | Plot the sparsity pattern on a 2-D array. | Plot |
stem | Create a stem plot. | plot |
step | Make a step plot. | plot |
streamplot | Draws streamlines of a vector flow. | plot |
violinplot | Make a violin plot. | Plot |
xcorr | Plot the cross correlation between?x?and?y. | Plot |
acorr | Plot the autocorrelation of?x. |
坐标軸指令
方法 | 描述 | 類型 |
---|---|---|
axis | Convenience method to get or set axis properties. | axis |
yticks | Get or set the?y-limits of the current tick locations and labels. | yticks |
yscale | Set the scaling of the?y-axis. | yscale |
ylim | Get or set the?y-limits of the current axes. | ylim |
ylabel | Set the?y?axis label of the current axis. | ylabel |
xticks | Get or set the?x-limits of the current tick locations and labels. | xticks |
xscale | Set the scaling of the?x-axis. | xscale |
xlim | Get or set the?x?limits of the current axes. | xlim |
xlabel | Set the?x?axis label of the current axis. | xlabel |
minorticks_off | Remove minor ticks from the current plot. | ticks |
minorticks_on | Display minor ticks on the current plot. | ticks |
autoscale | Autoscale the axis view to the data (toggle). | scale |
圖文說明指令
方法 | 描述 | 類型 |
---|---|---|
suptitle | Add a centered title to the figure. | title |
title | Set a title of the current axes. | title |
figtext | Add text to figure. | text |
text | Add text to the axes. | text |
grid | 控制背景網格線 | axes |
table | Add a table to the current axes. | table |
figlegend | Place a legend in the figure. | legend |
legend | Places a legend on the axes. | legend |
annotate | Annotate the point?xy?with text?s. | Annotate |
colorbar | Add a colorbar to a plot. | colorbar |
set_cmap | Set the default colormap. |
輔助線
方法 | 描述 | 類型 |
---|---|---|
vlines | Plot vertical lines. | vlines |
hlines | Plot horizontal lines at each?y?from?xmin?to?xmax. | hlines |
axvspan | Add a vertical span (rectangle) across the axes. | axvspan |
axvline | Add a vertical line across the axes. | axvline |
axhspan | Add a horizontal span (rectangle) across the axis. | axhspan |
axhline | Add a horizontal line across the axis. | axhline |
twinx | Make a second axes that shares the?x-axis. | axes |
twiny | Make a second axes that shares the?y-axis. | axes |
圖檔
方法 | 描述 | 類型 |
---|---|---|
imread | Read an image from a file into an array. | image |
imsave | Save an array as in image file. | image |
imshow | Display an image on the axes. | image |
clim | Set the color limits of the current image. | image |
sci | Set the current image. | image |
figure
方法 | 描述 | 類型 |
---|---|---|
figure | Creates a new figure. | figure |
figimage | Adds a non-resampled image to the figure. | figimage |
clf | Clear the current figure. | figure |
close | Close a figure window. | figure |
draw | Redraw the current figure. | figure |
gcf | Get a reference to the current figure. | figure |
savefig | Save the current figure. | |
show | Display a figure. | |
get_figlabels | Return a list of existing figure labels. | figure |
get_fignums | Return a list of existing figure numbers. | figure |
axes
方法 | 描述 | 類型 |
---|---|---|
axes | Add an axes to the figure. | axes |
box | Turn the axes box on or off. | axes |
cla | Clear the current axes. | axes |
delaxes | Remove an axes from the current figure. | axes |
gca | Get the current?Axes?instance on the current figure matching the given keyword args, or create one. | axes |
sca | Set the current Axes instance to?ax. | axes |
subplot | Return a subplot axes positioned by the given grid definition. | axes |
subplot2grid | Create a subplot in a grid. | axes |
subplot_tool | Launch a subplot tool window for a figure. | axes |
subplots | Create a figure and a set of subplots This utility wrapper makes it convenient to create common layouts of subplots, including the enclosing figure object, in a single call. | axes |
subplots_adjust | Tune the subplot layout. | axes |
其他
方法 | 描述 | 類型 |
---|---|---|
stackplot | Draws a stacked area plot. | Draws |
clabel | Label a contour plot. | |
fignum_exists | ||
findobj | Find artist objects. | |
gci | Get the current colorable artist. | |
hold | ||
install_repl_displayhook | Install a repl display hook so that any stale figure are automatically redrawn when control is returned to the repl. | |
ioff | Turn interactive mode off. | |
ion | Turn interactive mode on. | |
ishold | ||
isinteractive | Return status of interactive mode. | |
locator_params | Control behavior of tick locators. | |
margins | Set or retrieve autoscaling margins. | |
matshow | Display an array as a matrix in a new figure window. | |
over | ||
pause | Pause for?interval?seconds. | |
pcolor | Create a pseudocolor plot of a 2-D array. | |
quiverkey | Add a key to a quiver plot. | |
rc | Set the current rc params. | |
rc_context | Return a context manager for managing rc settings. | |
rcdefaults | Restore the rc params from Matplotlib’s internal defaults. | |
rgrids | Get or set the radial gridlines on a polar plot. | |
setp | Set a property on an artist object. | |
switch_backend | Switch the default backend. | |
tick_params | Change the appearance of ticks and tick labels. | |
ticklabel_format | Change the?ScalarFormatter?used by default for linear axes. | |
tight_layout | Automatically adjust subplot parameters to give specified padding. | |
tricontour | Draw contours on an unstructured triangular grid. | |
tricontourf | Draw contours on an unstructured triangular grid. | |
tripcolor | Create a pseudocolor plot of an unstructured triangular grid. | |
triplot | Draw a unstructured triangular grid as lines and/or markers. | |
uninstall_repl_displayhook | Uninstalls the matplotlib display hook. | |
xkcd | Turns on?xkcd?sketch-style drawing mode. |