Download Data Visualization in Python: A Beginner's Guide to Matplotlib - Prof. Gu and more Lecture notes Computer Science in PDF only on Docsity!
Meaning ➔It is the representationData visualization of data and information in a ➔^ graphical^ maps and imagesThe data inor python^ pictorial is visualized^ form^ such using^ as^ chartsthe ‘ matplotlib^ ,graphs^ ,‘ Advantages^ library^ bar , scatter etc^ which^ is^ used^ to^ form^ the^ charts^ like^ line^ ,
- Improved understandingBetter decision makingIncreased efficiency Steps^ 4.^ 5.^ Improved communicationEnhanced collaboration
- Generating the dataImporting the used libraryCreating the visualization
- Customizing visualizationSaving or displaying visualizations
Type of visualization in matplotlib 1. 2. Line chartBar chart
- HistogramScatter plotsPie charts Steps to plot a simple line graph^ 6.^ 7.^ Box plots3d plots
- Import mathplotlib library called as as pltPrepare arrays , 1 as x axis and other as y axis the data to be plotted , it is done by creating 2
- Call pass it to x and y dataAdd the title to the plot using the title function the plot function from the matplotlib library and
- Add functionShow the plot using the show function labels to the x and y axis using x label and y label
- The save the plot using the save fig fun plot will be displayed in a new window we can Eg - Import matplotlib.pyplot as plt X = [ 1 , 2 ,3 , 4 , 5 ] Y = [ 1,4,9,16,25 ] Plt.plot ( x , y ) Plt.title ( “ simple line graph “ ) Plt. xlable ( “ numbers “) Plt.ylabel ( “ square “ ) plt.show() Plt.savefig ( “ graph. Png “ ) Important methods of mathplotlib Method 1. 2. PlotScatter
- HistBarPie
- TitleXlabel
Description ➔To graph plot data on the ➔ ➔It a scatter plotTo is usedcreate to create a ➔^ histogramTo create a bar
Example Plt.plot ( x ,y ) Plt.scatter ( x , y ) Plt.hist ) ( data Plt.bar( ,height) x
- YlabelXlim Ylim
- 12.Xsticks ks Ystic ➔^ graphTo chart create a pie ➔ ➔To the graphUsed give to labelthe title the tox ➔^ axisUsed axis to label the y ➔ ➔Used the x axisUsed toto setset limitlimit forfor ➔^ the y axisUsed on x axis to et tick mark ➔Used mark on y axis to set tick
Plt.pie ) Plt. title ( (sizes “ ng “ ) Plt.xlabel (“abc “ ) Plt.ylabel qwr “ ) Plt.xlim ( 0, 10) ( “ Plt.ylim 100 ) Plt.xticks ( (^0) (, range ) Playsticks , 0 , 11 ,1( range ) , 0 , 10 , 2
Plot method parameters for customizing a line graph 1. 2. X - the x coordinate of the plotY - the y coordinate of the plot
- Line style a.it plotted points is used to control the style of line connecting the
- linewidth^ b.^ It^ ,dashost ,none etc^ accepts^ the^ value^ solid^ ,^ dotted^ ,^ dashed
- Line Colour^ a.^ b.^ It is used to control the width of the lineThe default value is 0 a. b. It the plotted pointEg - color = “ red “ is used to control the color of the line connecting
- Marker 7. Markersize a.It is used to control the shape of the marker a.It is used to control the size of the marker
- Markeredgecolorb. a.^ Eg - markersize = 10It is used to control the edge of a marker
- Markeredgewidth^ b. a.^ Eg - markeredgecolor = “ red “Used to control the width of the edge of the marker
- Markerfacecolor^ b. a.^ Eg - markeredgewidth = 2It is used to control the color of the face of the
- Label a.^ markerIt is used to specify a label for the plotted data Random walk ➔It sequence is a ofmathematical steps or movements concept thatthat aredescribes randomly a ➔^ determinedIt that can not be predicted with certainty can be thought as a series of events or decisions ➔Types are 1. Discrete
- Continuous - eg : traffic flow in a cityAnimal migrationRandom surfing on the internet Plotly ➔It^ 5. Spread of diseasesis a data visualization library for creating ➔^ interactive and visually appealing data visualizationIt that can be easily understood by people is usually used to turn data into charts and graph ➔In browser formats such as html or pdf plotly saved visualizations as a image can file be ordisplayed exported in to a otherweb Api [ application programming interface ] ➔Set software and applications of protocols , routines and tools for building ➔It systems access the data of another system allows or (^) platformsfor communications where it allowsbetween 1 systemdifferent to