SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: melloncx <xi...@cc...> - 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.
From: Eric F. <ef...@ha...> - 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
From: <PH...@Ge...> - 2010年04月30日 00:27:39
> -----Original Message-----
> From: melons [mailto:xi...@cc...]
> Sent: Wednesday, April 28, 2010 5:14 AM
> To: mat...@li...
> 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()
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /