Python | Data Analysis | Matplotlib.Pyplot
#python #dataanalysis #matplotlib #dataset #pyplot #plot #show #visualization #analysistools #mathematicalplottinglibrary #linegraph #list #settitle #setxlabel #setylabel #functions #loops #forloops #keyvalue #kvpairs #programming #pythonloop #data #keys #import #values #set #variables #itemsmethod #dictionarylooping #pythondictionary #storeinformation #pythondata #pythonkeys #pythonvalues #pythonpairs #pythonprogramming #argumenterrors #traceback #typeerror * Hello everyone, welcome back, in this video, I am explaining to plot a simple line graph for square number sequence (via import matplotlib.pyplot) ! * import matplotlib.pyplot as plt # import pyplot module using alias plt * input_values = [1, 2, 3, 4, 5] # list with five input values, first data of x-coordinate is 0.0 in graph, which should be 1.0 * squares = [1, 4, 9, 16, 25] # create a list called squares to hold data * plt.style.use (‘seaborn-v0_8’) # the built-in seaborn style, Matplotlib has a number of predefined styles available, they are good starting settings for background colors, gridlines, line widths, fonts, font sizes, and more, this make visualizations appealing without requiring much customization, style available as plt.style.available, add one line code before generating the plot * fig, ax = plt.subplots ( ) # calling subplots ( ) function to generate one/more plots in same figure, variable “fig” represents entire figure/plots collection that are generated, variable “ax” represents a single point in figure & is most used all the time * ax.plot (squares, linewidth=3) # use plot ( ) method to plot the data given, linewidth is the optional parameter controls thickness of the line that plot ( ) generates * ax.plot (input_values, squares, linewidth=3) # plot ( ) method is now provided with input values along with squares and linewidth, override default behavior by giving plot ( ) the input values (as another list named input_values) * ax.set_title ("Square Numbers") # the set_title ( ) method sets the chart title * ax.set_title ("Square Numbers", fontsize=24) # the parameter fontsize control the text size on the chart * ax.set_xlabel (“Value”) # the set_xlabel ( ) method allows us to set a title for x-axis * ax.set_ylabel ("Square of Value") # the set_ylabel ( ) method allows us to set a title for y-axis * plt.show ( ) # function plt.show ( ) opens Matplotlib's viewer & displays the plot * YouTube channel link: https://www.youtube.com/@NareshKSHETRI * Python playlist in my Channel: https://www.youtube.com/playlist?list=PL7-xjgCdZq84QfIKf3RAixGkGDQlHqWM- * Video recorded on: Zoom, Video edited on: iMovie version 10.3.5 (at iMac) * Link to download (and install) Python for your specific OS: https://www.python.org/ * Link to Google Colab: https://colab.research.google.com/ * LinkedIn (let us connect): https://www.linkedin.com/in/NareshKshetri/ * Website (Google Sites): https://sites.google.com/view/NareshKshetri * Please like, share, & subscribe if the video was helpful !
Download
0 formatsNo download links available.