<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>graphs in python Archives -</title>
	<atom:link href="https://mitindia.in/tag/graphs-in-python/feed/" rel="self" type="application/rss+xml" />
	<link>https://mitindia.in/tag/graphs-in-python/</link>
	<description></description>
	<lastBuildDate>Wed, 03 Feb 2021 06:30:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://mitindia.in/wp-content/uploads/2023/03/cropped-android-chrome-512x512-1-32x32.png</url>
	<title>graphs in python Archives -</title>
	<link>https://mitindia.in/tag/graphs-in-python/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Graphs in Python</title>
		<link>https://mitindia.in/graphs-in-python/</link>
		
		<dc:creator><![CDATA[SKB]]></dc:creator>
		<pubDate>Wed, 03 Feb 2021 06:30:16 +0000</pubDate>
				<category><![CDATA[Artificial Intelligence]]></category>
		<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[bar]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[data science]]></category>
		<category><![CDATA[graphs in python]]></category>
		<category><![CDATA[pie]]></category>
		<category><![CDATA[scatter]]></category>
		<guid isPermaLink="false">http://www.mitindia.in/?p=1128</guid>

					<description><![CDATA[<p>Graphs [for Data Science] Graphs in Python : Graph represents graphical / pictorial representation of set of data. Due to continuous development of various packages / library files in python it is easy  and sophisticated way to show data in various graph format. [pie / bar / scatter / column charts] Before you run these [&#8230;]</p>
<p>The post <a href="https://mitindia.in/graphs-in-python/">Graphs in Python</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1><span style="color: #003366;">Graphs</span> [<span style="color: #993300;">for <a href="https://www.mitindia.in/tag/data-science/" target="_blank" rel="noopener">Data Science</a></span>]</h1>
<p>Graphs in Python : Graph represents graphical / pictorial representation of set of data.</p>
<p>Due to continuous development of various packages / library files in python it is easy  and sophisticated way to show data in various graph format. [pie / bar / scatter / column charts]</p>
<p>Before you run these examples, install following packages.</p>
<p><span style="color: #333300;">a) pip install matplotlib [basic graphs]</span><br />
<span style="color: #333300;">b) pip install numpy [numeric python]</span><br />
<span style="color: #333300;">c) pip install pandas [panel data]</span><br />
<span style="color: #333300;">d) pip install plotly [for advanced and most sophisticated graphs]</span></p>
<p>Here are some examples.</p>
<ol>
<li><strong>The following example shows a particular company stock performance in given period. [here we took hdfc bank ltd example]</strong></li>
</ol>
<pre class="EnlighterJSRAW" data-enlighter-language="null">#Analyzing particular share price in particular period 
import pandas as pd
#pip install plotly
import plotly.express as px
df = pd.read_csv('HBD.csv')
fig = px.line(df, x = 'HBD_x', y = 'HBD_y', title='HDFC Shares prices 2019-20')
fig.show()
</pre>
<p>To download HBD.csv file, click <a href="https://in.finance.yahoo.com/" target="_blank" rel="noopener">here</a> or you can google it.</p>
<p>Output of above example is :</p>
<p><img decoding="async" class="alignnone size-medium wp-image-1129" src="http://www.mitindia.in/wp-content/uploads/2021/02/map2-300x153.png" alt="MAP2" width="300" height="153" srcset="https://mitindia.in/wp-content/uploads/2021/02/map2-300x153.png 300w, https://mitindia.in/wp-content/uploads/2021/02/map2-768x391.png 768w, https://mitindia.in/wp-content/uploads/2021/02/map2-1024x522.png 1024w, https://mitindia.in/wp-content/uploads/2021/02/map2.png 1280w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p><strong>2.  Student performance  </strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">import matplotlib.pyplot as plt
import csv
x=[]
y=[]
with open('student_data.csv', 'r') as csvfile:
    plots= csv.reader(csvfile, delimiter=',')
    for row in plots:
        x.append(str(row[0]))
        y.append(str(row[1]))
plt.plot(x,y, marker='o')
#plt.bar(x,y)
plt.title('Student Marks Information')
plt.xlabel('Names')
plt.ylabel('Marks')
plt.show()
</pre>
<p>Prepare .csv file as following for above example</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-medium wp-image-1130" src="http://www.mitindia.in/wp-content/uploads/2021/02/prepare3-300x268.png" alt="" width="300" height="268" srcset="https://mitindia.in/wp-content/uploads/2021/02/prepare3-300x268.png 300w, https://mitindia.in/wp-content/uploads/2021/02/prepare3.png 316w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>Output of above example is :</p>
<p><img decoding="async" class="alignnone size-medium wp-image-1132" src="http://www.mitindia.in/wp-content/uploads/2021/02/map3-300x188.png" alt="" width="300" height="188" srcset="https://mitindia.in/wp-content/uploads/2021/02/map3-300x188.png 300w, https://mitindia.in/wp-content/uploads/2021/02/map3-768x482.png 768w, https://mitindia.in/wp-content/uploads/2021/02/map3.png 882w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>&nbsp;</p>
<p><strong>3. Course enrollment details</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">#Data Visualizing using Python 
import numpy as np 
import matplotlib.pyplot as plt  
# creating the dataset 
data = {'C':20, 'C++':15, 'Java':30, 'Python':35} 
courses = list(data.keys()) 
values = list(data.values()) 
fig = plt.figure(figsize = (5, 2)) 
# creating the bar plot 
plt.bar(courses, values, color ='green', width = 0.5)
plt.xlabel("Courses offered") 
plt.ylabel("No. of students enrolled") 
plt.title("Students enrolled in different courses") 
plt.show() 
</pre>
<p>Output of above example is :</p>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1133" src="http://www.mitindia.in/wp-content/uploads/2021/02/map4-300x150.png" alt="" width="300" height="150" srcset="https://mitindia.in/wp-content/uploads/2021/02/map4-300x150.png 300w, https://mitindia.in/wp-content/uploads/2021/02/map4.png 597w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p><strong>4. Following example shows BSE [Bombay Stock Exchange] Market performance during &#8211; 2019-2020</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="null"># BSE market data analysis - 2019-20
import pandas as pd
#pip install plotly
import plotly.express as px
df = pd.read_csv('BSESN.csv')
fig = px.line(df, x = 'Date', y='Value', title='BSE Market Price Analysis 2019-20') #use px.bar, px.scatter 
fig.show()
</pre>
<p>To download BSESN.csv file, click <a href="https://in.finance.yahoo.com/quote/%5EBSESN?p=%5EBSESN" target="_blank" rel="noopener">here</a> or you can google it.</p>
<p>Output of above example is :</p>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1134" src="http://www.mitindia.in/wp-content/uploads/2021/02/map5-300x153.png" alt="" width="300" height="153" srcset="https://mitindia.in/wp-content/uploads/2021/02/map5-300x153.png 300w, https://mitindia.in/wp-content/uploads/2021/02/map5-768x391.png 768w, https://mitindia.in/wp-content/uploads/2021/02/map5-1024x522.png 1024w, https://mitindia.in/wp-content/uploads/2021/02/map5.png 1272w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p><strong>5.  The following example[pie chart] shows population records from few Asian countries.</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">#Data Analysis and Visualization using  pie chart 
import plotly.express as px 
import numpy 
  
# Random Data 
random_x = [1300000000, 1450000000, 120000000, 12000000, 180000000] 
countries= ['India', 'China', 'Japan', 'Bangladesh', 'Pakistan'] 
  
fig = px.pie(values=random_x, names=countries, title='Asian countries population') 
fig.show()
</pre>
<p>Output of above example is :</p>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1135" src="http://www.mitindia.in/wp-content/uploads/2021/02/map6-300x154.png" alt="" width="300" height="154" srcset="https://mitindia.in/wp-content/uploads/2021/02/map6-300x154.png 300w, https://mitindia.in/wp-content/uploads/2021/02/map6-768x394.png 768w, https://mitindia.in/wp-content/uploads/2021/02/map6-1024x526.png 1024w, https://mitindia.in/wp-content/uploads/2021/02/map6.png 1282w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p><strong>6. Now, following example shows India&#8217;s  increase in population, life expectancy , GDP / Per capita income etc from 1952 to 2007.</strong></p>
<pre class="EnlighterJSRAW" data-enlighter-language="null">#population chart : lifexp, gdppercapita etc.
import plotly.express as px
data = px.data.gapminder()

data_india = data[data.country == 'India']
fig = px.bar(data_india, x='year', y='pop',
             hover_data=['lifeExp', 'gdpPercap'], color='lifeExp',
             labels={'pop':'population of India'}, height=400)
fig.show()
</pre>
<p>Output of above example is :</p>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-1136" src="http://www.mitindia.in/wp-content/uploads/2021/02/map8-300x120.png" alt="" width="300" height="120" srcset="https://mitindia.in/wp-content/uploads/2021/02/map8-300x120.png 300w, https://mitindia.in/wp-content/uploads/2021/02/map8-768x307.png 768w, https://mitindia.in/wp-content/uploads/2021/02/map8-1024x409.png 1024w, https://mitindia.in/wp-content/uploads/2021/02/map8.png 1282w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>Thanks for scrolling !!!</p>
<p><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fmitindia.in%2Fgraphs-in-python%2F&amp;linkname=Graphs%20in%20Python" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fmitindia.in%2Fgraphs-in-python%2F&amp;linkname=Graphs%20in%20Python" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fmitindia.in%2Fgraphs-in-python%2F&#038;title=Graphs%20in%20Python" data-a2a-url="https://mitindia.in/graphs-in-python/" data-a2a-title="Graphs in Python"><img src="https://static.addtoany.com/buttons/favicon.png" alt="Share"></a></p><p>The post <a href="https://mitindia.in/graphs-in-python/">Graphs in Python</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
