<?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 Alok Regmi</title>
		<link>https://alokregmi.com/tags/matplotlib/</link>
		<description>Recent content in Matplotlib on Alok Regmi</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<lastBuildDate>Sun, 18 Oct 2020 07:12:40 +0545</lastBuildDate>
		
			<atom:link href="https://alokregmi.com/tags/matplotlib/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Matplotlib</title>
				<link>https://alokregmi.com/braindump/2020/04/matplotlib/</link>
				<pubDate>Sun, 19 Apr 2020 15:59:45 +0545</pubDate>
				<guid>https://alokregmi.com/braindump/2020/04/matplotlib/</guid>
				<description>&lt;p&gt;triangles&lt;/p&gt;&#xA;&lt;p&gt;plot(t, t, &amp;lsquo;r&amp;ndash;&amp;rsquo;, t, t**2, &amp;lsquo;bs&amp;rsquo;, t, t**3, &amp;lsquo;g^&amp;rsquo;)&lt;/p&gt;&#xA;&lt;p&gt;plt.plot(x,y,&amp;lsquo;r&amp;ndash;&amp;rsquo;, linewidth=1.0)&lt;/p&gt;&#xA;&lt;p&gt;when lines= plt.plot(x1,y1,x2,y2)&lt;/p&gt;&#xA;&lt;p&gt;and the use of subplot() command&lt;/p&gt;&#xA;&lt;p&gt;plt.figure(1)                # the first figure&#xA;plt.subplot(211)             # the first subplot in the first figure&#xA;plt.plot([1, 2, 3])&#xA;plt.subplot(212)             # the second subplot in the first figure&#xA;plt.plot([4, 5, 6])&lt;/p&gt;&#xA;&lt;p&gt;plt.figure(2)                # a second figure&#xA;plt.plot([4, 5, 6])          # creates a subplot(111) by default&lt;/p&gt;&#xA;&lt;p&gt;plt.figure(1)                # figure 1 current; subplot(212) still current&#xA;plt.subplot(211)             # make subplot(211) in figure1 current&#xA;plt.title(&amp;lsquo;Easy as 1, 2, 3&amp;rsquo;)&lt;/p&gt;</description>
			</item>
			<item>
				<title>Matplotlib</title>
				<link>https://alokregmi.com/ai/matplotlib/</link>
				<pubDate>Fri, 27 Dec 2019 00:00:00 +0000</pubDate>
				<guid>https://alokregmi.com/ai/matplotlib/</guid>
				<description>&lt;h2 id=&#34;matplotlib&#34;&gt;Matplotlib&lt;/h2&gt;&#xA;&lt;h3 id=&#34;creating-objects-for-interaction&#34;&gt;Creating objects for interaction&lt;/h3&gt;&#xA;&lt;!--list-separator--&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Create empty plot to be filled in with data&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-jupyter-python&#34; data-lang=&#34;jupyter-python&#34;&gt;import matplotlib.pyplot as plt&#xA;fig, ax = plt.subplots()&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;!--list-separator--&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Create some plot&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-jupyter-python&#34; data-lang=&#34;jupyter-python&#34;&gt;from sklearn import datasets&#xA;import pandas as pd&#xA;import numpy as np&#xA;iris = datasets.load_iris()&#xA;df = pd.DataFrame(data= np.c_[iris[&amp;#39;data&amp;#39;], iris[&amp;#39;target&amp;#39;]],&#xA;                     columns= iris[&amp;#39;feature_names&amp;#39;] + [&amp;#39;target&amp;#39;])&#xA;print(df.head())&#xA;&#xA;import matplotlib.pyplot as plt&#xA;fig, ax = plt.subplots()&#xA;ax.plot(df.iloc[:,0], df.iloc[:,1])&#xA;plt.show()&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   sepal length (cm)  sepal width (cm)  petal length (cm)  petal width (cm)  \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0                5.1               3.5                1.4               0.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1                4.9               3.0                1.4               0.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2                4.7               3.2                1.3               0.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;3                4.6               3.1                1.5               0.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;4                5.0               3.6                1.4               0.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   target&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;0     0.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1     0.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2     0.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;3     0.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;4     0.0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;figure&gt;&lt;img src=&#34;../../ox-hugo/d4f1d991e8d2e5142059b8cc6dcfd1f5b827e08c.png&#34;&gt;&#xA;    &lt;/figure&gt;&#xA;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;other-functionalities&#34;&gt;Other functionalities&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;plt.axis([x-axis_start, xend, ystart, yend])&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;plt.plot(x,y,&amp;lsquo;color or dots or any fucking thing to represent the numbers&amp;rsquo;)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;r&amp;ndash; means red dashes and bs means blue squares and g^ means green&#xA;triangles&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;make a numpy array using arange(start, end, step_size)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;multiple plot in plot()&#xA;plot(t, t, &amp;lsquo;r&amp;ndash;&amp;rsquo;, t, t**2, &amp;lsquo;bs&amp;rsquo;, t, t**3, &amp;lsquo;g^&amp;rsquo;)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;tuple unpacking with obj_name, comma  is the essence&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;setting linewidth with:&#xA;plt.plot(x,y,&amp;lsquo;r&amp;ndash;&amp;rsquo;, linewidth=1.0)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;plt.setp(lines, color=&amp;lsquo;r&amp;rsquo;, linewidth=2.0)&#xA;when lines= plt.plot(x1,y1,x2,y2)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;plt.plot(t1, f(t1), &amp;lsquo;bo&amp;rsquo;, t2, f(t2), &amp;lsquo;k&amp;rsquo;)&#xA;and the use of subplot() command&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;plt.figure(fig_no)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;using figures and subplot()&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
			</item>
	</channel>
</rss>
