In this example we change the width and height of the figure(width > height):–. ![]() Then we used the plot method to plot the graph between X and Y, and show method to show the figure. Here, the first thing we have to do is to import two python module “ matplotlib” and “ numpy” by these line of codes:-Īnd then we created a numpy array and then established the relation between X and Y i.e. Now, you can see that the width and height of the figure are equal. Square size figure in Matplotlib with Python import matplotlib.pyplot as plt If we don’t use the property to change or set the size of figure, then it takes width and height both same and the result will be a square type figure. In this example we see the default drawn figure(width = height) :. ![]() There is a method of changing the size of a figure in matplotlib by using “ figsize=(a,b)” attribute, where “a = width of the figure in unit inches” and “b = height of the figure in unit inches”. In this article, we have to only focus on changing the size of the figure. Setting or Changing the Size of a Figure in Matplotlib Python The matplotlib module is used to create a figure, and we can do different types of experiment with that figure such as “changing the axis of the graph”, “changing the geometric shape”, “changing the background colour of the figure” and many more. The main motto of this article is how to change or set the size of a figure in Matplotlib using Python. ![]() In this article, we need some basic concept of two python module named as “Matplotlib” and “Numpy”.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |