> -----Original Message-----
> From: melons [mailto:xic...@cc.hut.fi]
> Sent: Wednesday, April 28, 2010 5:14 AM
> To: matplotlib-users@lists.sourceforge.net
> 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()


------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to