## matplotlib-users

 [Matplotlib-users] How to set constant y-axis scale value From: melloncx - 2010-04-28 12:34:04 ```Hello, I am quite new in matplotlib, I am now facing a quite simple problem but have no idea to solve. I just want set the y axis scale to value 100, which means in the image, the y axis is always of scale 100, because the points in my image indicates the percentage value(for example, 20%, 87%) which will never exceed 100. So, How to set the y axis scale to constant value 100 ?? It's really hard to find a answer from internet. -- View this message in context: http://old.nabble.com/How-to-set-constant-y-axis-scale-value-tp28387748p28387748.html Sent from the matplotlib - users mailing list archive at Nabble.com. ```
 Re: [Matplotlib-users] How to set constant y-axis scale value From: Eric Firing - 2010-04-29 21:51:47 ```melloncx wrote: > Hello, > > I am quite new in matplotlib, I am now facing a quite simple problem but > have no idea to solve. I just want set the y axis scale to value 100, which > means in the image, the y axis is always of scale 100, because the points in > my image indicates the percentage value(for example, 20%, 87%) which will > never exceed 100. > > So, How to set the y axis scale to constant value 100 ?? It's really hard to > find a answer from internet. If you are using the pyplot interface, then maybe what you want is the ylim function: http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.ylim Eric ```
 Re: [Matplotlib-users] How to set constant y-axis scale value From: - 2010-04-30 00:27:39 ```> -----Original Message----- > From: melons [mailto:xichen@...] > Sent: Wednesday, April 28, 2010 5:14 AM > To: matplotlib-users@... > Subject: [Matplotlib-users] How to set constant y-axis scale value > > > Hello, > > I am quite new in matplotlib, I am now facing a quite simple problem but > have no idea to solve. I just want set the y axis scale to value 100, > which > means in the image, the y axis is always of scale 100, because the points > in > my image indicates the percentage value(for example, 20%, 87%) which will > never exceed 100. > > So, How to set the y axis scale to constant value 100 ?? It's really hard > to > find a answer from internet. Give this a shot: # ---- import matplotlib.pyplot as plt import numpy as np x = np.arange(20) y = np.random.randn(20) y = y/y.max() * 100 fig = plt.figure() ax = fig.add_subplot(111) ax.plot(x,y,'ko', mfc='none') # you can do this: ax.set_ylim([0,100]) # or something like this: ax.set_ylim(ymin=0, ymax=100) plt.show() ```