Hi, what are you looking for?

# Data Visualization Like a Professional Data Visualization Like a Professional

This tutorial will not include the basic topics where we will learn advanced functions concepts and structures for data visualization, so read the previous articles in the subsection. These concepts are used in almost every project. After this article, you will level up your data visualization skills.

You Should Know Before Start Article

##### Customize Graphic

While we have seen how we can manipulate the line graph in previous articles, we have to learn more features. Let’s work with the dimension function first.

```import numpy as np
from matplotlib import pyplot as plt

figure = plt.figure()
figure_axes = figure.add_axes([0.7 , 0.7 , 0.2 , 0.2])
x = np.array([10 , 20 , 30 , 40 , 50])
y = np.array([100 , 200 , 100 , 200 , 100])

figure_axe.plot(x , y)```

Add_axes can be used to give dimension and coordinate to the created figure. The first 2 values are coordinates and the other 2 values are width and height. We can create nested graphics by playing with the dimensions of the figures, now let’s look at creating nested graphics.

##### Creating Nested Graphic

We need 4 separate axes to create nested graphics. To avoid having to create these data, let’s use the linspace function which is a function of numpy. The linspace function generates random values for the amount given to us.

As you can see, we can create a graph with different indexes on the same figure. The add_axes function adjusts the location and size of the second graph. You can add labels and titles to these graphics as we saw in the previous lesson.

##### Visual Improvements

We have seen how to use legends in the past lessons, let’s continue with the visual enhancements section to learn a few new arguments and to repeat. Let’s start with labels first.

```x = np.linspace(0 , 10 , 30)
y = x ** 3

plt.plot(x , y , label = "Random Value")
plt.legend()```

Next, there is a loc argument. With the help of this argument, you can change the location of the label. It is registered to 1 by default. We use the legend function’s loc argument to change this value.

```plt.legend(loc = 1) #Set right
plt.legend(loc = 2) #Set left```

Let’s examine the dpi argument of the figure function to adjust the resolution. With this argument, you can enlarge and shrink the graphics and increase their resolution.

It is very useful for adjusting sizes and controlling resolution, but if you can increase the size and resolution of your graphic by increasing the dpi value, the resolution is important when increasing the graphic out.

`fig.savefig("Figure.png" , dpi = 150)`

If you can change the dpi value before saving the graphic, it is useful to increase the size for more comfortable reading, but the dpi increases the file size.

1. Ira Merwin

April 1, 2021 at 07:02

Can’t wait to see how you arrange them

2. Antonia Terris

April 2, 2021 at 07:55

Yayeeee welcome to the club of insane book hoarders!