Showing posts with label Line chart. Show all posts
Showing posts with label Line chart. Show all posts

Sunday, August 14, 2022

Let us Learn Matplotlib

 

(Photo Source: pexels.com)

 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

Now let us plot very simply in Google Colab. Open Google colab by signing in with your Gmail. You can do it in Jupyter or any kind of IDE such as PyCharm etc. 

The Code is given below 

 

import matplotlib.pyplot as plt

% matplotlib inline

x=[1,2,3,4,5,6,7,8,9,10]

y=[51504847494648504544]

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=[51504847494648504544]

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=[51504847494648504544]

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=[51504847494648504544]

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=[51504847494648504544]

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=[51504847494648504544]

plt.xlabel('Days')

plt.ylabel('Temp')

plt.title('Weather Report for Upcoming 10 Days')

plt.plot(x,y, color='green', marker='D', linewidth=4)

 

 
 
 
03 Multi line plot
If you need a multi line plot with markers and labels of the lines. The code is given below. 
 
 



 
If you like the post buy the B.Tech Guidebook & Campus Placement Guidebook to support the blog. You can read the books freely in Kindle format also. You will greatly benefited by these two books as they cover how to increase your productivity & placement chances during B.Tech life.

   


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)

21. Avoiding Herd Mentality During College Life

(https://authenticmedia2020.blogspot.com/2021/11/avoiding-herd-mentality-sunday-binge.html)

22. Considering Oneself as a Business of One (Sunday Binge Reading:03) (https://authenticmedia2020.blogspot.com/2021/12/considering-oneself-as-business-of-one.html)

23. Do you put your future in others' hands?

(https://authenticmedia2020.blogspot.com/2021/12/do-you-put-your-future-in-others-hands.html)

24. Are You Employable by Private or Govt Sector Companies?

https://authenticmedia2020.blogspot.com/2021/12/are-you-employable-by-private-or-govt.html)

25. Common Mistakes in a Cover Letter & Resume

 (https://authenticmedia2020.blogspot.com/2022/01/common-mistakes-in-cover-letter-resume.html)

26. Everything boils down to communication at the end

(https://authenticmedia2020.blogspot.com/2022/01/everything-boils-down-to-communication.html)

27. What Chetan Bhagat Has to say about Networking?

(https://authenticmedia2020.blogspot.com/2022/01/what-chetan-bhagat-has-to-say-about.html)

28. Remember what you read!!!! Digest what you read!!!

(https://authenticmedia2020.blogspot.com/2022/02/remember-what-you-read-digest-what-you.html)

29. Kaizen: Continuous improvement for students

(https://authenticmedia2020.blogspot.com/2022/02/kaizen-continuous-improvement-for.html)

30. Shark Tank: A must watch for Entrepreneurs

(https://authenticmedia2020.blogspot.com/2022/02/shark-tank-must-watch-for-entrepreneurs.html)

31. How to write an excellent answer?

 (https://authenticmedia2020.blogspot.com/2022/02/how-to-write-excellent-answer-sunday.html)

32. Four Tips for Linked In

 (https://authenticmedia2020.blogspot.com/2022/02/four-tips-for-linked-in-t-p-series-on.html)

33. How to write an excellent answer?

(https://authenticmedia2020.blogspot.com/2022/02/how-to-write-excellent-answer-sunday.html)

34. The Trick Question in the Interviews

(https://authenticmedia2020.blogspot.com/2022/03/the-trick-question-in-interviews.html)

35. What did Sunfox teach me? (https://authenticmedia2020.blogspot.com/2022/04/what-did-sunfox-teach-me.html)

36. Networking through Alumni

(https://authenticmedia2020.blogspot.com/2022/05/networking-through-alumni.html)

37. What does a recruiter want?

(https://authenticmedia2020.blogspot.com/2022/06/what-does-recruiter-want-sunday-binge.html)

38. Machine Learning: 101 (Assamese)

(https://authenticmedia2020.blogspot.com/2022/06/machine-learning-101-assamese.html)

39. How to choose a field for higher education?

(https://authenticmedia2020.blogspot.com/2022/06/how-to-choose-field-for-higher-education.html)

40. Employment risks associated with 'StartUps'

(https://authenticmedia2020.blogspot.com/2022/07/employment-risks-associated-with.html)

41. How to Study

(https://authenticmedia2020.blogspot.com/2022/07/how-to-study.html)

 


Health is wealth for students

   (Photo source:pexels.com)   Nowadays, when I look around, most of the students are either obese or have some kind of health issues. ...