<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Matplotlib on shocksolution.com</title><link>https://shocksolution.com/tags/matplotlib/</link><description>Recent content in Matplotlib on shocksolution.com</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 17 Aug 2011 22:40:14 +0000</lastBuildDate><atom:link href="https://shocksolution.com/tags/matplotlib/index.xml" rel="self" type="application/rss+xml"/><item><title>Removing an axis or both axes from a matplotlib plot</title><link>https://shocksolution.com/posts/removing-an-axis-or-both-axes-from-a-matplotlib-plot/</link><pubDate>Wed, 17 Aug 2011 22:40:14 +0000</pubDate><guid>https://shocksolution.com/posts/removing-an-axis-or-both-axes-from-a-matplotlib-plot/</guid><description>&lt;p&gt;Sometimes, the frame around a &lt;a href="http://matplotlib.sourceforge.net/" title="matplotlib"&gt;matplotlib&lt;/a&gt; plot can detract from the information you are trying to convey.  How do you remove the frame, ticks, or axes from a matplotlib plot? &lt;figure class="ma0 w-75"&gt;&lt;img src="https://shocksolution.com/images/plot_without_y_axis.png"&#10;&#9;&#9;&#9;alt="matplotlib plot without a y axis"&gt;&lt;figcaption&gt;&#10;&#9;&#9;&#9;&lt;p&gt;matplotlib plot without a y axis&lt;/p&gt;&#10;&#9;&#9;&lt;/figcaption&gt;&#10;&lt;/figure&gt;&#10;&lt;/p&gt;&#10;&lt;p&gt;Some books you may find useful when working with matplotlib: &lt;a href="https://%3C%3Cwww.amazon.com/gp/product/0132269937/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0132269937&amp;amp;linkCode=as2&amp;amp;tag=rootwork0f-20&amp;amp;linkId=44971fe03f445ae25fecb2cc2702d3aa&amp;amp;gt%3E;"&gt;&lt;img src="//ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;amp;MarketPlace=US&amp;amp;ASIN=0132269937&amp;amp;ServiceVersion=20070822&amp;amp;ID=AsinImage&amp;amp;WS=1&amp;amp;Format=_SL160_&amp;amp;tag=rootwork0f-20" alt="image"&gt;&lt;/a&gt;&lt;img src="//ir-na.amazon-adsystem.com/e/ir?t=rootwork0f-20&amp;amp;l=am2&amp;amp;o=1&amp;amp;a=0132269937" alt="image"&gt;&lt;a href="https://%3C%3Cwww.amazon.com/Python-Data-Analysis-Wrangling-IPython/dp/1491957662/ref=as_li_ss_il?keywords=matplotlib&amp;amp;qid=1537646489&amp;amp;sr=8-12&amp;amp;ref=sr_1_12&amp;amp;linkCode=li2&amp;amp;tag=rootwork0f-20&amp;amp;linkId=545b965f9a5ae1055ae778fca7628568&amp;amp;language=en_US&amp;amp;gt%3E;"&gt;&lt;img src="//ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;amp;ASIN=1491957662&amp;amp;Format=_SL160_&amp;amp;ID=AsinImage&amp;amp;MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;WS=1&amp;amp;tag=rootwork0f-20&amp;amp;language=en_US" alt="image"&gt;&lt;/a&gt;&lt;img src="https://ir-na.amazon-adsystem.com/e/ir?t=rootwork0f-20&amp;amp;language=en_US&amp;amp;l=li2&amp;amp;o=1&amp;amp;a=1491957662" alt="image"&gt;&lt;a href="https://%3C%3Cwww.amazon.com/Mastering-matplotlib-Duncan-M-McGreggor/dp/1783987545/ref=as_li_ss_il?keywords=matplotlib&amp;amp;qid=1537646489&amp;amp;sr=8-1&amp;amp;ref=sr_1_1&amp;amp;linkCode=li2&amp;amp;tag=rootwork0f-20&amp;amp;linkId=ec917748d4c441f93e36024379f32b58&amp;amp;language=en_US&amp;amp;gt%3E;"&gt;&lt;img src="//ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;amp;ASIN=1783987545&amp;amp;Format=_SL160_&amp;amp;ID=AsinImage&amp;amp;MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;WS=1&amp;amp;tag=rootwork0f-20&amp;amp;language=en_US" alt="image"&gt;&lt;/a&gt;&lt;img src="https://ir-na.amazon-adsystem.com/e/ir?t=rootwork0f-20&amp;amp;language=en_US&amp;amp;l=li2&amp;amp;o=1&amp;amp;a=1783987545" alt="image"&gt;&lt;a href="https://%3C%3Cwww.amazon.com/Matplotlib-Plotting-Cookbook-Alexandre-Devert/dp/1849513260/ref=as_li_ss_il?keywords=matplotlib&amp;amp;qid=1537646489&amp;amp;sr=8-2&amp;amp;ref=sr_1_2&amp;amp;linkCode=li2&amp;amp;tag=rootwork0f-20&amp;amp;linkId=6b7d2e5dacde0fa357c7d0316befb29b&amp;amp;language=en_US&amp;amp;gt%3E;"&gt;&lt;img src="//ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;amp;ASIN=1849513260&amp;amp;Format=_SL160_&amp;amp;ID=AsinImage&amp;amp;MarketPlace=US&amp;amp;ServiceVersion=20070822&amp;amp;WS=1&amp;amp;tag=rootwork0f-20&amp;amp;language=en_US" alt="image"&gt;&lt;/a&gt;&lt;img src="https://ir-na.amazon-adsystem.com/e/ir?t=rootwork0f-20&amp;amp;language=en_US&amp;amp;l=li2&amp;amp;o=1&amp;amp;a=1849513260" alt="image"&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://github.com/cfinch/Shocksolution_Examples/tree/master/Plotting/matplotlib" title="Removing%20an%20axis%20from%20a%20Matplotlib%20plot"&gt;The full example is available on github&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;First, we construct a figure and an axes object:&lt;/p&gt;&#10;&lt;div class="code-block"&gt;&#10; &lt;button class="code-copy" type="button" hidden aria-label="Copy code to clipboard"&gt;&#10; &lt;span class="code-copy-label" aria-hidden="true"&gt;Copy&lt;/span&gt;&#10; &lt;/button&gt;&#10; &lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;fig1 = plt.figure(facecolor=&amp;#39;white&amp;#39;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ax1 = plt.axes(frameon=False)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10; &lt;/div&gt;&lt;p&gt;The Axes object is a container that holds the axes, the ticks, the labels, the plot, the legend, etc.  You will always have an Axes object, even if the axes are not visible! The keyword argument &lt;strong&gt;frameon=False&lt;/strong&gt; turns the frame off. An alternative method is:&lt;/p&gt;</description></item></channel></rss>