Plotting a trend graph in Python
A trend Graph is a graph that is used to show the trends data over a period of time. It describes a functional representation of two variables (x , y). In which the x is the time-dependent variable whereas y is the collected data. The graph can be in shown any form that can be via line chart, Histograms, scatter plot, bar chart, and pie-chart. In python, we can plot these trend graphs by using matplotlib.pyplot library. It is used for plotting a figure for the given data.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
The task is simple and straightforward, for plotting any graph we must suffice the basic data requirement after this determine the values of x over the period of time and data collected for y. Plot the graphs for the above-given data.
Given below are various implementations to depict the same:
medals Time_Period 0 100 2010 1 98 2011 2 102 2012 3 56 2013 4 78 2014 5 56 2015 6 78 2016 7 96 2017
Example 2: Using the above data we would plot the scatter and bar graph.
Example 3: student getting marks in 2010.