User Tools

Site Tools


other:python:matplotlib_by_jyp

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
other:python:matplotlib_by_jyp [2020/02/11 13:55] – [Starting (and more) with matplotlib] jypeterother:python:matplotlib_by_jyp [2020/03/31 12:49] – [Misc Matplotlib tricks] Improved jypeter
Line 187: Line 187:
 ===== Misc Matplotlib tricks ===== ===== Misc Matplotlib tricks =====
  
-  * Specifying the background color of a plot (e.g. when plotting a masked variable and you don't want the masked areas to be white) +==== Specifying the background color of a plot ==== 
-    * ''# make the background dark gray (call this before the contourf)''\\ ''plt.gca().patch.set_color('.25')''\\ ''plt.contourf(d)''\\ ''plt.show()'' + 
-    [[https://stackoverflow.com/questions/9797520/masking-part-of-a-contourf-plot-in-matplotlib|trick source]]+e.g. You need to plot a masked variable, but you don't want the masked areas to be white 
 + 
 +<code># make the background dark gray (call this before the contourf) 
 +plt.gca().patch.set_color('.25') 
 +plt.contourf(d) 
 +plt.show()</code> 
 + 
 +[[https://stackoverflow.com/questions/9797520/masking-part-of-a-contourf-plot-in-matplotlib|trick source]]
  
  
other/python/matplotlib_by_jyp.txt · Last modified: 2023/10/26 10:39 by jypeter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki