Connect with us

Hi, what are you looking for?

Data Science

Data Visualization With Matplotlib For Intermediate

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.Graphic

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.

1- Dashed

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.

2- Dotted

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.

Graphic 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

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


Click to comment

Leave a Reply

Your email address will not be published.

You May Also Like


According to a study from Dartmouth College, Dartmouth’s Tuck School of Business, and Indiana University, artificial intelligence systems can be trained to produce human-like...

Cyber Security

In this article, we are going to learn essential Bash commands. This article contains all of the essential topics about Bash scripting. We are...

Machine Learning

In this article, we are going to learn how to build regression models with PyCaret in Python. If you don’t have any experience with...

Cyber Security

In this article, we are going to examine real-world logic bombs. Also, we are going to create one with Python for seeing how to...