If you don’t read Data Visualization With Matplotlib For Beginner first you should read this write. This write, we gonna make a style graphic with Matplotlib. We going to learn new graphic types.
Change Style Of Plot
Now, we change the style of the graphics. We going to use the ggplot style for graphics.
Did you see, anymore, we have a graphic with the square background. This style supports readable graphics so you can use style.
Change Line Color
Anymore, we have a graphic with a new style. Let’s change the line color for a readable graphic. To change the color of the line you can simply add a new argument to the “plt.plot” part for example if I add ‘R’ in plt.plot my line color be red.
You can get that color by entering the initial letter of the color you want, for example, Red = ‘R’, Blue = ‘B’, Green = ‘G’.
Change Line Width
Now, we know how to change line color but sometimes we need to the bold line. For example, we have a 3 line but 1 line is so important so, we can change this line to a bold line for a readable graphic.
Anymore, we have a bold line. Try to keep it at width 3 for more readable graphics, from slow now we know basic design for graphics. Now, we going to learn the most popular graphic types and tips.
Change Line Style
this parts, we going to learn basic line types after this we always use these line styles. Let’s look at popular line style.
You can choose line styles with the line style parameter you will give to plt.plot. There are many line shapes, I will only show 2 of them. if you want to look all you can go to this site.
Now, we know line style. Anymore, we going to learn graphic types. We going to create some graphics and we going to compare these types.
1- Histogram Type
We, now going to learn a new argument for histogram types, edge color argument makes colorize your edge. To use it, simply type edgecolor = ‘R’ in plt.plot. but anymore, we don’t use plt.plot, now we going to use plt.hist() so histogram function. Let’s create a new histogram and examine this code.
We created a histogram graphic with black edges. Now let’s create new graphics with different bins and examine this graphic for practice.
Bin is a range of values. If you increase bins values graphic value ranges are decreases. The logic of the bin may be complicated at first, so you can practice by making new graphics.
2- Scatter Plots
Anymore, we know histogram graphics how to make them now, we going to learn to scatter plots. Let’s create the first scatter graphics.
3- Bar Graphic Style
Bar graphic style so much like a histogram but not the same. Firstly, we going to use this graphic style, after that, we examine this style and we going to compare it with a histogram.
Bar Graphic Vs Histogram
Mainly difference is, for a bar graph, each column represents a group defined by a categorical variable; with a histogram, each column represents a group defined by a continuous quantitative variable.
We saw new argument s and markers let’s examine these arguments. s is a size argument if you increase s value your x grows. marker is limited just you can use the main ones. we saw edge colors and color so I don’t tell again.
All Code: HERE
CONGRATULATIONS YOU PASSED DATA VISUALIZATION WITH MATPLOTLIB FOR INTERMEDIATE!