Embellishing a plot
Title
Question
Maximum and minimum limit of set and get axes?
Python Embellishing-a-plot 14-15 min 10-20 sec
Answers:
get or set the x limits of the current axes.
xmin, xmax = xlim() # return the current xlim
xlim( (xmin, xmax) ) # set the xlim to xmin, xmax
xlim( xmin, xmax ) # set the xlim to xmin, xmax<paste>
change x-axis limits
import matplotlib.pyplot as plt
w = 4
h = 3
d = 70
plt.figure(figsize=(w, h), dpi=d)
x = [1, 2, 4, 3, 0]
plt.xlim(0, 10)
plt.plot(x)
plt.savefig("out.png")
Login to add comment