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/23 14:41] jypeter [Useful reference pages] Added help for the 'legend' |
other:python:jyp_steps [2019/05/24 15:23] jypeter [Matplotlib] |
||
---|---|---|---|
Line 187: | Line 187: | ||
- some resources for having multiple plots on the same figure | - some resources for having multiple plots on the same figure | ||
* [[https://matplotlib.org/gallery/recipes/create_subplots.html#sphx-glr-gallery-recipes-create-subplots-py|Easily creating subplots]] | * [[https://matplotlib.org/gallery/recipes/create_subplots.html#sphx-glr-gallery-recipes-create-subplots-py|Easily creating subplots]] | ||
+ | * [[https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.add_subplot|fig.add_subplot(...)]] | ||
+ | * [[https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.add_axes|fig.add_axes(...)]] | ||
+ | * [[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_adjust.html|subplots_adjust]] can be used to change the boundaries | ||
* [[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 202: | Line 207: | ||
- the documentation may mention [[http://matplotlib.org/faq/usage_faq.html#what-is-a-backend|backends]]. What?? Basically, you use python commands to create a plot, and the backend is the //thing// that will render your plot on the screen or in a file (png, pdf, etc...) | - the documentation may mention [[http://matplotlib.org/faq/usage_faq.html#what-is-a-backend|backends]]. What?? Basically, you use python commands to create a plot, and the backend is the //thing// that will render your plot on the screen or in a file (png, pdf, etc...) | ||
- if you don't see a part of what you have plotted, maybe it's hidden behind other elements! Use the [[https://matplotlib.org/examples/pylab_examples/zorder_demo.html|zorder parameter]] to explicitly specify the plotting order/layers | - if you don't see a part of what you have plotted, maybe it's hidden behind other elements! Use the [[https://matplotlib.org/examples/pylab_examples/zorder_demo.html|zorder parameter]] to explicitly specify the plotting order/layers | ||
+ | * things should work //as expected// if //zorder// is not explicitly specified | ||
+ | * Use the ''zorder=NN'' parameter when creating objects. ''NN'' is an integer where 0 is the lowest value (the farthest from the eye), and objects are plotted above objects with a lower //zorder// value | ||
+ | * Use ''matplotlib_object.set_order(NN)'' to change the order after an object has been created | ||
- Read the [[http://www.labri.fr/perso/nrougier/teaching/matplotlib/|Matplotlib tutorial by Nicolas Rougier]] | - Read the [[http://www.labri.fr/perso/nrougier/teaching/matplotlib/|Matplotlib tutorial by Nicolas Rougier]] | ||
- 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. |