This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
other:python:jyp_steps [2019/05/28 16:24] jypeter [Matplotlib] Changed the URL of the Gallery |
other:python:jyp_steps [2019/05/29 09:54] jypeter [Useful reference pages] |
||
---|---|---|---|
Line 196: | Line 196: | ||
* [[https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplot.html|plt.subplot(...)]] | * [[https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplot.html|plt.subplot(...)]] | ||
* [[https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplots.html|plt.subplots(...)]] with an **s** at the end ([[https://matplotlib.org/gallery/subplots_axes_and_figures/subplots_demo.html|demo]]) | * [[https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplots.html|plt.subplots(...)]] with an **s** at the end ([[https://matplotlib.org/gallery/subplots_axes_and_figures/subplots_demo.html|demo]]) | ||
- | * [[https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplots_adjust.html|subplots_adjust]] can be used to change the boundaries | + | * [[https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplots_adjust.html|subplots_adjust]] can be used to change the overall boundaries of the subplots on the figure, and the spacing between the subplots\\ ''plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)''\\ or ''my_page.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)'' |
* [[https://matplotlib.org/gallery/index.html#subplots-axes-and-figures|Subplots, axes and figures]] gallery | * [[https://matplotlib.org/gallery/index.html#subplots-axes-and-figures|Subplots, axes and figures]] gallery | ||
* [[https://matplotlib.org/tutorials/intermediate/gridspec.html#sphx-glr-tutorials-intermediate-gridspec-py|Customizing Figure Layouts Using GridSpec and Other Functions]], [[https://matplotlib.org/tutorials/intermediate/constrainedlayout_guide.html|constrained layout]] and [[https://matplotlib.org/tutorials/intermediate/tight_layout_guide.html|tight layout]] | * [[https://matplotlib.org/tutorials/intermediate/gridspec.html#sphx-glr-tutorials-intermediate-gridspec-py|Customizing Figure Layouts Using GridSpec and Other Functions]], [[https://matplotlib.org/tutorials/intermediate/constrainedlayout_guide.html|constrained layout]] and [[https://matplotlib.org/tutorials/intermediate/tight_layout_guide.html|tight layout]] | ||
Line 217: | Line 217: | ||
- Download the [[http://matplotlib.org/contents.html|pdf version of the manual]]. **Do not print** the 2800+ pages of the manual! Read the beginner's guide (Chapter //FIVE// of //Part II//) and have a super quick look at the table of contents of the whole document. | - Download the [[http://matplotlib.org/contents.html|pdf version of the manual]]. **Do not print** the 2800+ pages of the manual! Read the beginner's guide (Chapter //FIVE// of //Part II//) and have a super quick look at the table of contents of the whole document. | ||
- | ==== Useful reference pages ==== | + | ==== Useful matplotlib reference pages ==== |
* [[https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plot.html|plot(...)]]: Plot y versus x as lines and/or markers | * [[https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plot.html|plot(...)]]: Plot y versus x as lines and/or markers | ||
Line 242: | Line 242: | ||
* if the legend is outside of the plot, you have to **explicitly provide enough space for the legend on the page** | * if the legend is outside of the plot, you have to **explicitly provide enough space for the legend on the page** | ||
* e.g. with [[https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplots_adjust.html|subplots_adjust]], ''plt.subplots_adjust(right=0.75)'' will make all the plots use 75% on the left of the page, and leave 25% on the right for the legend | * e.g. with [[https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplots_adjust.html|subplots_adjust]], ''plt.subplots_adjust(right=0.75)'' will make all the plots use 75% on the left of the page, and leave 25% on the right for the legend | ||
+ | * The [[https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html|figure(...)]] and the associated methods | ||
+ | * The [[https://matplotlib.org/api/axes_api.html|axes]] and the associated methods | ||
+ | * [[https://matplotlib.org/tutorials/introductory/customizing.html#matplotlib-rcparams|matplotlib default settings]] can be queried and updated | ||
+ | * example: the default figure size (inches) is ''mpl.rcParams['figure.figsize']'' (''[6.4, 4.8]'') | ||
+ | * current settings' file: ''mpl.matplotlib_fname()'' | ||
==== Misc Matplotlib tricks ==== | ==== Misc Matplotlib tricks ==== |