01. Matplotlib Line chart
Let us take a ten day report of weather of a place.
Weather Report |
|
Day |
Temperature |
1 |
51 |
2 |
50 |
3 |
48 |
4 |
47 |
5 |
49 |
6 |
46 |
7 |
48 |
8 |
50 |
9 |
45 |
10 |
44 |
The Code is given below
import matplotlib.pyplot as plt % matplotlib inline x=[1,2,3,4,5,6,7,8,9,10] y=[51, 50, 48, 47, 49, 46, 48, 50, 45, 44] plt.xlabel('Days') plt.ylabel('Temp') plt.title('Weather Report for Upcoming 10 Days') plt.plot(x,y, color='green', linewidth=4, linestyle='dotted')
|
Note: You can change linewidth & linestyle as per your wish
02 Matplotlib: Markers of line Chart
Taking the same problem of weather report for 10 days,
Let us take a ten day report of weather of a place.
Weather Report |
|
Day |
Temperature |
1 |
51 |
2 |
50 |
3 |
48 |
4 |
47 |
5 |
49 |
6 |
46 |
7 |
48 |
8 |
50 |
9 |
45 |
10 |
44 |
We are to develop a line chart with labels in X & Y axis and also chart title. Besides that we need to change the marker styles.
Now, let us see the coding for it for ‘+’ marker.
import matplotlib.pyplot as plt % matplotlib inline x=[1,2,3,4,5,6,7,8,9,10] y=[51, 50, 48, 47, 49, 46, 48, 50, 45, 44] plt.xlabel('Days') plt.ylabel('Temp') plt.title('Weather Report for Upcoming 10 Days') plt.plot(x,y, 'g+')
|
If you need a dashed line chart then the coding would be
import matplotlib.pyplot as plt % matplotlib inline x=[1,2,3,4,5,6,7,8,9,10] y=[51, 50, 48, 47, 49, 46, 48, 50, 45, 44] plt.xlabel('Days') plt.ylabel('Temp') plt.title('Weather Report for Upcoming 10 Days') plt.plot(x,y, 'g+')
|
If you need a ‘diamond’ marker, the coding is below
import matplotlib.pyplot as plt % matplotlib inline x=[1,2,3,4,5,6,7,8,9,10] y=[51, 50, 48, 47, 49, 46, 48, 50, 45, 44] plt.xlabel('Days') plt.ylabel('Temp') plt.title('Weather Report for Upcoming 10 Days') plt.plot(x,y, 'D--')
|
If you need a continuous line with ‘+’ marker, the coding is given below.
import matplotlib.pyplot as plt % matplotlib inline x=[1,2,3,4,5,6,7,8,9,10] y=[51, 50, 48, 47, 49, 46, 48, 50, 45, 44] plt.xlabel('Days') plt.ylabel('Temp') plt.title('Weather Report for Upcoming 10 Days') plt.plot(x,y, color='green',marker='+')
|
If you need a thicker line compared to the previous one with ‘+’ marker, the coding is given below.
import matplotlib.pyplot as plt % matplotlib inline x=[1,2,3,4,5,6,7,8,9,10] y=[51, 50, 48, 47, 49, 46, 48, 50, 45, 44] plt.xlabel('Days') plt.ylabel('Temp') plt.title('Weather Report for Upcoming 10 Days') plt.plot(x,y, color='green', marker='D', linewidth=4)
|
Our Popular Posts
1. Behavioral questions
(https://authenticmedia2020.blogspot.com/2021/03/understanding-behavioral-questions-in.html)
2. Tellin your story
(https://authenticmedia2020.blogspot.com/2021/02/telling-your-story-in-linkedin-for-job.html)
3. Personal branding
(https://authenticmedia2020.blogspot.com/2021/02/personal-branding-for-job-interviews.html)
4. Soft skill hard skill
(https://authenticmedia2020.blogspot.com/2021/01/soft-skill-for-job-interviews-for.html)
5. Transferable skill
(https://authenticmedia2020.blogspot.com/2021/01/transferable-skills-concept-definition.html)
6. Enhancing employability (https://authenticmedia2020.blogspot.com/2020/12/enhancing-your-employability-during.html)
7. Cover letter
(https://authenticmedia2020.blogspot.com/2020/12/cover-letters-and-resumes-t-p-on.html)
8. Professional networking
(https://authenticmedia2020.blogspot.com/2020/12/professional-networking-benefits-for.html)
9. Communication tips
(https://authenticmedia2020.blogspot.com/2020/11/communication-tips-for-interviews.html)
10. Being articulate
(https://authenticmedia2020.blogspot.com/2020/11/being-articulate-for-interviews.html)
11. Mirroring Techniques
(https://authenticmedia2020.blogspot.com/2020/10/mirroring-technique-to-master-for.html)
12. Personal job interview
(https://authenticmedia2020.blogspot.com/2020/10/personal-interview-t-p-on-wednesdaysl-06.html)
13. Group discussion
(https://authenticmedia2020.blogspot.com/2020/09/group-discussion-in-placement-drive-dos.html)
14. How to sell yourself
(https://authenticmedia2020.blogspot.com/2020/09/how-to-sell-yourself-sunday-series-with.html)
15. Your Attire Carry You
(https://authenticmedia2020.blogspot.com/2020/09/your-attire-carry-you-t-p-series-on.html)
16. Leadership
(https://authenticmedia2020.blogspot.com/2020/07/leadership-quality.html)
17. What are your strengths?
(https://authenticmedia2020.blogspot.com/2021/07/what-areyour-strengths-t-p-series-on.html)
18. What are your weaknesses?
(https://authenticmedia2020.blogspot.com/2021/08/what-are-your-weaknesses.html)
19. Tell me about yourself.
(https://authenticmedia2020.blogspot.com/2021/08/tell-me-about-yourself-introduce.html)
20. Online Interviews, Telephonic Interviews, etc.
(https://authenticmedia2020.blogspot.com/2021/09/online-interviews-telephonic-interviews.html)