User Tools

Site Tools


other:python:jyp_steps

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
other:python:jyp_steps [2019/05/27 09:28]
jypeter [Matplotlib] Improved
other:python:jyp_steps [2019/05/29 08:55]
jypeter [Matplotlib] details for subplots_adjust
Line 181: Line 181:
  
 The documentation is good, but not always easy to use. <wrap hi>A good way to start with matplotlib</​wrap>​ is to: The documentation is good, but not always easy to use. <wrap hi>A good way to start with matplotlib</​wrap>​ is to:
-  - Look at the [[http://​matplotlib.org/​gallery.html|matplotlib gallery]] to get an idea of all you can do with matplotlib. Later, when you need to plot something, go back to the gallery to find some examples that are close to what you need and click on them to view their source code+  - Look at the [[https://​matplotlib.org/​gallery/index.html|matplotlib gallery]] to get an idea of all you can do with matplotlib. Later, when you need to plot something, go back to the gallery to find some examples that are close to what you need and click on them to view their source code
   - Use the free hints provided by JY!   - Use the free hints provided by JY!
     - You need to know some matplotlib specific vocabulary:     - You need to know some matplotlib specific vocabulary:
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]]
     - some examples are more //​pythonic//​ (ie object oriented) than others, some example mix different styles of coding, all this can be confusing. Try to [[http://​matplotlib.org/​faq/​usage_faq.html#​coding-styles|use an object oriented way of doing things]]!     - some examples are more //​pythonic//​ (ie object oriented) than others, some example mix different styles of coding, all this can be confusing. Try to [[http://​matplotlib.org/​faq/​usage_faq.html#​coding-styles|use an object oriented way of doing things]]!
-    - it may be hard to (remember how to) work with colors. Some examples from the [[http://​matplotlib.org/​gallery.html|Gallery]] can help you!+    - it may be hard to (remember how to) work with colors. Some examples from the [[https://​matplotlib.org/​gallery/index.html]] can help you!
       * [[https://​matplotlib.org/​examples/​pylab_examples/​leftventricle_bulleye.html|leftventricle_bulleye.py]]:​ associating different types of colormaps to a plot and colorbar       * [[https://​matplotlib.org/​examples/​pylab_examples/​leftventricle_bulleye.html|leftventricle_bulleye.py]]:​ associating different types of colormaps to a plot and colorbar
       * [[https://​matplotlib.org/​examples/​api/​colorbar_only.html|colorbar_only.py]]:​ the different types of colorbars (or plotting only a colorbar)       * [[https://​matplotlib.org/​examples/​api/​colorbar_only.html|colorbar_only.py]]:​ the different types of colorbars (or plotting only a colorbar)
Line 230: Line 230:
     * [[https://​matplotlib.org/​gallery/​color/​color_demo.html|color demo]]     * [[https://​matplotlib.org/​gallery/​color/​color_demo.html|color demo]]
     * [[https://​matplotlib.org/​examples/​color/​named_colors.html|named colors]]     * [[https://​matplotlib.org/​examples/​color/​named_colors.html|named colors]]
-  * [[https://​matplotlib.org/​api/​pyplot_api.html#​matplotlib.pyplot.legend|legend(...)]] ([[https://​matplotlib.org/​examples/​pylab_examples/​legend_demo3.html|legend demo]])+  ​* [[https://​matplotlib.org/​api/​_as_gen/​matplotlib.pyplot.text.html|text(...)]] and [[https://​matplotlib.org/​tutorials/​text/​annotations.html|annotations]] 
 +    * ''​fontsize'':​ size in points, or (better!) string specifying a relative size (''​xx-small'',​ ''​x-small'',​ ''​small'',​ ''​medium'',​ ''​large'',​ ''​x-large'',​ ''​xx-large''​) 
 +    * [[https://​matplotlib.org/​api/​text_api.html#​matplotlib.text.Text|all the text properties]] 
 +  ​* [[https://​matplotlib.org/​api/​pyplot_api.html#​matplotlib.pyplot.legend|legend(...)]] ([[https://​matplotlib.org/​examples/​pylab_examples/​legend_demo3.html|legend demo]], [[https://​matplotlib.org/​users/​legend_guide.html|advanced legend guide]])
     * The legend will //show// the lines (or other objects) that were associated with a //label// with the ''​label=''​ keyword when creating/​updating a plot     * The legend will //show// the lines (or other objects) that were associated with a //label// with the ''​label=''​ keyword when creating/​updating a plot
       * If there are some elements of a plot that you do not want to associate with a legend (e.g. there are several lines with the same color and markers, but you want to plot the legend only once), do not specify a ''​label=''​ keyword for these elements, or add a ''​_''​ at the front of the label strings       * If there are some elements of a plot that you do not want to associate with a legend (e.g. there are several lines with the same color and markers, but you want to plot the legend only once), do not specify a ''​label=''​ keyword for these elements, or add a ''​_''​ at the front of the label strings
other/python/jyp_steps.txt · Last modified: 2024/03/07 10:15 by jypeter