

We then modify the y-coordinates from 0 to 25. Similarly, we have to create a plot of x-coordinates of 0 to 10 and y-coordinates be the cube of each of these x-coordinates. Then we show the figure with the show() function. The first value is the lower limit and the second value is the upper limit. Again, this function takes in a list composed of 2 values. Now set the limit of the x coordinates from 0 to 6 using the “ set_xlim()” function. We then have our x-coordinates that ranges from 0 to 10. This creates a figure object, which is initially empty, because we haven’t inserted anything in it. Then we create a variable named “a” and set its value to plt.figure(). Here, the first thing we have to do is to import two python module “ matplotlib” and “ numpy” by these line of codes :. We then modify the x-coordinates from 0 to 6. Let say we have to create a plot of x-coordinates of 0 to 10 and y-coordinates be the cube of each of these x-coordinates. This limit the coordinates between these two values. These limit functions always accept a list containing two values, first value for lower bound and second value for upper bound.

set_ylim() :- For modifying y-axis range.set_xlim() :- For modifying x-axis range.We can limit the value of modified x-axis and y-axis by using two different functions:. Setting axis range in matplotlib using Python But we want to modify the range of x and y coordinates, let say x-axis now extends from 0 to 6 and y-axis now extends to 0 to 25 after modifying. Let say we have to plot some graph in matplotlib which have x-axis and y-axis coordinate, let say x-axis extends from 0 to 10 and y-axis extends according to the relation between x and y.
#SIGMAPLOT 11 CHANGE AXIS HOW TO#
In this article we are going to understand how to set the axis range of any graph in matplotlib using python. In this article we need basic concept of some module of python such as “Matplotlib” and “Numpy”.
