SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S



1
(19)
2
(3)
3
(12)
4
(2)
5
6
(9)
7
(27)
8
(39)
9
(17)
10
(22)
11
(5)
12
(1)
13
(11)
14
(12)
15
(14)
16
(29)
17
(32)
18
(8)
19
(3)
20
(10)
21
(27)
22
(11)
23
(8)
24
(4)
25
(4)
26
(3)
27
(18)
28
(7)
29
(29)
30
(13)
31
(4)

Showing results of 398

<< < 1 .. 7 8 9 10 11 .. 16 > >> (Page 9 of 16)
From: John H. <jdh...@ac...> - 2006年03月16日 04:05:26
>>>>> "Ryan" == Ryan Krauss <rya...@gm...> writes:
 Ryan> the GTKAgg backend does not show the plot of y2.
On my system I get the plot of y2 (cos, not sin) -- here is the
complete script I am using and the --verbose-helpful output below
Example script:
 from pylab import *
 t=arange(0,1,0.01)
 y=sin(2*pi*t)
 y2=cos(2*pi*t)
 figure(1)
 plot(t,y)
 ioff()
 cla()
 plot(t,y2)
 show()
verbose helpful output:
 matplotlib data path /usr/lib/python2.4/site-packages/matplotlib/mpl-data
 $HOME=/home/jdhunter
 CONFIGDIR=/home/jdhunter/.matplotlib
 loaded rc file /home/jdhunter/.matplotlib/matplotlibrc
 matplotlib version 0.87.2svn
 verbose.level helpful
 interactive is False
 platform is linux2
 numerix numpy 0.9.7.2247
 font search path ['/usr/lib/python2.4/site-packages/matplotlib/mpl-data']
 loaded ttfcache file /home/jdhunter/.matplotlib/ttffont.cache
 backend GTKAgg version 2.6.1
 Ryan> Is this a bug, something wrong on my system, or does it make
 Ryan> sense that the GTKAgg backend ignores everything after
 Ryan> ioff()?
All ion and ioff do is control when the drawing takes place. If "ion"
(interactive is True) then the figure should be redrawn with every
pylab command. If "ioff" (interactive is off) the figure is only
drawn with a call to savefig, draw or show. That's how it is supposed
to work -- the details are spelled out at
http://matplotlib.sf.net/interactive.html
Let us know if you see further strangeness, and be sure to report the
output of verbose-helpful 
JDH
From: John H. <jdh...@ac...> - 2006年03月16日 03:55:13
>>>>> "Daigos" == <da...@in...> writes:
 Daigos> Hi all, I am a new user of this library and scipy but I
 Daigos> see something strange when I run the following script:
This looks like a bug in the AutoLocator, possibly in resulting from
the new MaxNLocator introduced recently. Thanks for the report.
Eric: below is a script which exposes the bug more clearly (with gplt
commented out -- I don't have it on my system). If you uncomment the
ylim command, you will see the correct plot. It looks like the auto
locator is choosing a ylim range that does not encompass the data. If
I had to guess, this bug is caused by floating point approximation
error -- all the ydata in this example are very close to 1.0 and the
recent MaxNLocator changes made some changes to how we handled
floating point approximations.
Charlie: let's hold on 0.87.2 until we get this sorted out.
JDH
from scipy import *
import pylab
b = [0.0,1.0,0.0]
a = 1
w,h = signal.freqz(b,a)
Magnitude = []
phase = []
for i in h:
 magnitude.append(sqrt(i.real**2. +i.imag**2.))
 phase.append(arctan(i.imag/i.real))
print len(w)
print len(h)
print len(magnitude)
print len(phase)
i = range(len(magnitude))
#gplt.plot(i,magnitude)
print magnitude
pylab.plot(i,magnitude, 'o')
#pylab.ylim(0,2) # uncomment this to see correct plot
pylab.show()
From: Ryan K. <rya...@gm...> - 2006年03月16日 03:20:22
ioff seems to work o.k. with the GTKAgg backend as long as the figure
hasn't been created yet:
ioff()
figure(2)
plot(t,y)
plot(t,y2)
show()
works fine if figure(2) doesn't exist yet.
Ryan
On 3/15/06, Ryan Krauss <rya...@gm...> wrote:
> I ran into a difference between the GTKAgg and TkAgg backends that is
> confusing me. If I run this set of commands using the two different
> backends, I get different results:
>
> t=3Darange(0,1,0.01)
> y=3Dsin(2*pi*t)
> figure(1)
> plot(t,y)
> ioff()
> cla()
> show()
>
> With the TkAgg backend, after show(), the figure is blank. With the
> GTKAgg backend, once I call ioff, it seems to be ignoring me. In
> fact, if I run this:
>
> t=3Darange(0,1,0.01)
> y=3Dsin(2*pi*t)
> y2=3Dcos(2*pi*t)
> figure(1)
> plot(t,y)
> ioff()
> cla()
> plot(t,y2)
> show()
>
> the GTKAgg backend does not show the plot of y2.
>
> Is this a bug, something wrong on my system, or does it make sense
> that the GTKAgg backend ignores everything after ioff()?
>
> Thanks,
>
> Ryan
>
From: Ryan K. <rya...@gm...> - 2006年03月16日 03:18:22
I ran into a difference between the GTKAgg and TkAgg backends that is
confusing me. If I run this set of commands using the two different
backends, I get different results:
t=3Darange(0,1,0.01)
y=3Dsin(2*pi*t)
figure(1)
plot(t,y)
ioff()
cla()
show()
With the TkAgg backend, after show(), the figure is blank. With the
GTKAgg backend, once I call ioff, it seems to be ignoring me. In
fact, if I run this:
t=3Darange(0,1,0.01)
y=3Dsin(2*pi*t)
y2=3Dcos(2*pi*t)
figure(1)
plot(t,y)
ioff()
cla()
plot(t,y2)
show()
the GTKAgg backend does not show the plot of y2.
Is this a bug, something wrong on my system, or does it make sense
that the GTKAgg backend ignores everything after ioff()?
Thanks,
Ryan
From: <da...@in...> - 2006年03月16日 00:25:22
Hi all,
I am a new user of this library and scipy but I see 
something strange when I run the following script:
from scipy import *
import pylab
b = [0.0,1.0,0.0]
a = 1
w,h = signal.freqz(b,a)
magnitude = []
phase = []
for i in h:
 magnitude.append(sqrt(i.real**2. +i.imag**2.))
 phase.append(arctan(i.imag/i.real))
print len(w)
print len(h)
print len(magnitude)
print len(phase)
i = range(len(magnitude))
gplt.plot(i,magnitude)
pylab.plot(i,magnitude)
pylab.show()
This script show me the magnitude response of a digital 
filter. In this case the magnitude response is a costant 
with value equal to 1.
Now if I use the gplt.plot I can see the correct response 
while pylab.plot doesn't show me the correct one.
Am I doing something wrong?
Thanks
Daigos
INFINITO ADSLFLAT 4 MEGA: SOLO 27,90 EURO AL MESE IVA INCLUSA IP STATICO, BANDA GARANTITA 256Kbps ANTIVIRUS E FIREWALL INCLUSI NEL PREZZO
http://adsl.infinito.it
From: Robert K. <rob...@gm...> - 2006年03月15日 23:38:16
Carol Leger wrote:
> What is 3D? I see it in a lot of these posts, but I do not see it in
> any or the examples.
> 
> In reply to my question about color in quiver, it was suggested that I try:
> 
> quiver(x,y,u,v,color =3D (v>0)*1.) to draw arrows with positive v to the
> color corresponding to index 1 in the color map, and the arrows with
> negative v to the color corresponding to 0.
Some mail programs encode the text in a funny way that uses = as an escape
character. The encoded representation of a real = character is =3D.
http://en.wikipedia.org/wiki/Quoted-printable
-- 
Robert Kern
rob...@gm...
"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
 -- Umberto Eco
From: Carol L. <car...@sr...> - 2006年03月15日 23:25:24
What is 3D? I see it in a lot of these posts, but I do not see it in 
any or the examples.
In reply to my question about color in quiver, it was suggested that I try:
quiver(x,y,u,v,color =3D (v>0)*1.) to draw arrows with positive v to the 
color corresponding to index 1 in the color map, and the arrows with 
negative v to the color corresponding to 0.
-- 
Ms. Carol A. Leger
SRI International			Phone: (650) 859-4114
333 Ravenswood Avenue G-273
Menlo Park, CA 94025 e-mail: le...@sr...
From: David H. <dav...@gm...> - 2006年03月15日 21:23:10
Hi Carol,
For the first question, you could do something like
quiver(x,y,u,v,color =3D (v>0)*1.)
which would draw the arrows with positive v to the color corresponding
to index 1 in the colormap, and the arrows with negative v to the
color corresponding to 0. For the jet colormap, these are red and blue
respectively.
If you don't like red and blue, you could change the colors by
changing the colormap.
I tried using the "color array" to tell explicitely quiver what color
to use but I haven't been able to work it out.
Cheers,
David
2006年3月15日, Carol Leger <car...@sr...>:
> Hi Folks,
>
> It looks like quiver might be able to what I want.
>
> However, I have a few more questions. Assume the form
> QUIVER( X, Y, U, V, S)
> 1)
> I see from the on-line documentation that:
>
> "color can be an array of colors in which case the arrows can be
> colored according to another dataset."
>
> What is an array of colors? I want to make vectors one color if an
> element of U is negative and another color if it is zero or positive.
>
> 2)
> I want to make several plots, i.e a series of png or ps files, and have
> a vector with magnitude N be the same size on each plot. Is this what
> setting S equal to zero is supposed to accomplish?
>
>
> --
> Ms. Carol A. Leger
> SRI International Phone: (650) 859-4114
> 333 Ravenswood Avenue G-273
> Menlo Park, CA 94025 e-mail: le...@sr...
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting langua=
ge
> that extends applications into web and mobile media. Attend the live webc=
ast
> and join the prime developer group breaking into this new coding territor=
y!
> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=
=3D121642
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Carol L. <car...@sr...> - 2006年03月15日 19:05:36
Hi Folks,
It looks like quiver might be able to what I want.
However, I have a few more questions. Assume the form
QUIVER( X, Y, U, V, S)
1)
I see from the on-line documentation that:
"color can be an array of colors in which case the arrows can be
colored according to another dataset."
What is an array of colors? I want to make vectors one color if an 
element of U is negative and another color if it is zero or positive.
2)
I want to make several plots, i.e a series of png or ps files, and have 
a vector with magnitude N be the same size on each plot. Is this what 
setting S equal to zero is supposed to accomplish?
-- 
Ms. Carol A. Leger
SRI International			Phone: (650) 859-4114
333 Ravenswood Avenue G-273
Menlo Park, CA 94025 e-mail: le...@sr...
From: Michael P. M. <mo...@jp...> - 2006年03月15日 18:44:42
I want to make a legend. Looking at the existing Legend class, I'm not 
sure I have precise control over positioning, which I would like to have 
(i.e., put it in a specific rectangle). I would also like to put legend 
items in a horizontal layout, or perhaps put them in columns.
I'm not sure Legend can do this. However, it is easy enough to make a 
do-it-yourself legend by creating an Axes and plotting points and text 
on it. Will this be necessary?
Mike
From: Imara J. <im...@gm...> - 2006年03月15日 16:11:16
Thanks!
By pairing every figure command with a close, I avoid memory leaks and solv=
e
my problem.
On 3/15/06, John Hunter <jdh...@ac...> wrote:
>
> >>>>> "Alan" =3D=3D Alan Isaac <ai...@am...> writes:
>
> Alan> On 2006年3月15日, Imara Jarrett wrote:
> >> I would like to generate matplotlib scatter plots in a python
> >> 'for' loop.
>
> Alan> Use 'figure'.
>
> You have to be a little careful here -- remember whenever you are
> creating plots in a loop you should pair every figure command with a
> close to avoid memory leaks
>
> for i in somerange:
> figure(1)
> scatter(mydata, ...)
> savefig(myfile)
> close(1)
>
> You have a few other alternatives.... The hold state affects whether
> new plot commands to an Axes/Subplot will overwrite the existing one
> or add on to it
>
> scatter(mydata, ..., hold=3DFalse) # clear the existing axes
> scatter(mydata, ..., hold=3DTrue) # add to the existing axes
>
> See also the commands clf (clear current figure) and cla (clear
> current axes)
>
> JDH
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=
=3D121642
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: John H. <jdh...@ac...> - 2006年03月15日 15:51:42
>>>>> "Alan" == Alan Isaac <ai...@am...> writes:
 Alan> On 2006年3月15日, Imara Jarrett wrote:
 >> I would like to generate matplotlib scatter plots in a python
 >> 'for' loop.
 Alan> Use 'figure'.
You have to be a little careful here -- remember whenever you are
creating plots in a loop you should pair every figure command with a
close to avoid memory leaks
for i in somerange:
 figure(1)
 scatter(mydata, ...)
 savefig(myfile)
 close(1)
You have a few other alternatives.... The hold state affects whether
new plot commands to an Axes/Subplot will overwrite the existing one
or add on to it
 scatter(mydata, ..., hold=False) # clear the existing axes
 scatter(mydata, ..., hold=True) # add to the existing axes
See also the commands clf (clear current figure) and cla (clear
current axes)
JDH
From: Alan I. <ai...@am...> - 2006年03月15日 15:45:14
On 2006年3月15日, Imara Jarrett wrote: 
> I would like to generate matplotlib scatter plots in a python 'for' loop. 
Use 'figure'.
hth,
Alan Isaac
From: Imara J. <im...@gm...> - 2006年03月15日 15:38:24
Hi folks,
I would like to generate matplotlib scatter plots in a python 'for' loop.
However, I am running into the following problem. The first scatter plot i=
s
fine, each subsequent scatter plot still has the points from the previous
scatter plot, even though I am generating a new list with each iteration.
This results in the last scatter plot to have a gigantic number of points.
Here is sample code:
for x in dates:
 xpoints =3D [ ]
 ypoints =3D [ ]
 size =3D [ ]
 . . . .
 . . . . .
 xticker =3D arange(0,6000, 1000)
 yticker =3D arange(-4, 10, 1)
 xticks(xticker)
 yticks(yticker)
 scatter(xpoints,ypoints, s =3D size)
 savefig('example.png')
Any suggestions?
Thanks in advance.
>>>>> "Nils" == Nils Wagner <nw...@me...> writes:
 >>>> matplotlib.__version__
 Nils> '0.87.2svn'
This question is really for the matplotlib list. Please try to avoid
cross posting. There is a lot of overlap between the readers of both
lists and you can be pretty sure that most of the mpl and scipy
developers will see it in either place.
What is your numerix setting and what is it's version? You can obtain
this by creating a little script that just does 'import pylab'
and then running it with
> python myscript.py --verbose-helpful
and reporting the output.
Thanks,
JDH
From: Mark B. <ma...@gm...> - 2006年03月15日 12:51:32
Carol -
The ax.set_xlim and ax.set_ylim functions are ignoring the 'equal' status;
not sure why, or whether that is wrong .
But since you are already using pylab, there is a much easier way that does
work.
After your plot(4*cos(an),4*sin(an)) command, simply type
axis('equal')
axis((xmin,xmax,ymin,ymax)) (both -5 and +5 I guess)
and it will work as expected.
If you insist on working the way you were, you have to use the right order,
and fix the limits:
ax.set_xlim(-5, 5)
ax.set_ylim(-5, 5)
ax.set_aspect('equal',fixLimits=3DTrue)
Mark
--__--__--
Hi folks,
I am trying to use quiver with equal axes. I have not been successful.
 I suspect it is something simple such as not grabbing the correct axes.
If I use figure(figsize(7,7)), the plot seems to be a square, but it is
not. This is apparent when I run the script using:
 python quiver6.py -dPS
and make two printouts which I then overlay with one rotated by 90 degrees.
I am using matplotlib 0.87.1 with numarray and GTKAgg backend.
Here is my code:
from pylab import *
an =3D linspace(0,2*pi,100)
X,Y =3D meshgrid( arange(-pi,pi,.2),arange(-pi,pi,.2) )
U =3D cos(X)
V =3D sin(Y)
#figure(figsize=3D(7,7))
quiver( X,Y, U, V, color=3DTrue )
plot(4*cos(an),4*sin(an))
ax =3D gca() # Return the current axes
ax.set_aspect('equal')
ax.set_xlim(-5, 5)
ax.set_ylim(-5, 5)
savefig('quiver6', orientation =3D 'landscape')
--
Ms. Carol A. Leger
SRI International Phone: (650) 859-4114
333 Ravenswood Avenue G-273
Menlo Park, CA 94025 e-mail: le...@sr...
From: Bruce <ep...@gm...> - 2006年03月15日 08:26:25
Hi group,
I wonder how I can change the default colors MPL uses? Now, when I
plot 3 arrays in one subplot I get blur, green and red colors on
these. These are nice colors, but I still want to change the defaults.
thx
From: Nils W. <nw...@me...> - 2006年03月15日 07:50:54
 >>> matplotlib.__version__
'0.87.2svn'
Python 2.4.1 (#1, Sep 12 2005, 23:33:18)
[GCC 4.0.2 20050901 (prerelease) (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylab
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "/usr/lib64/python2.4/site-packages/pylab.py", line 1, in ?
 from matplotlib.pylab import *
 File "/usr/lib64/python2.4/site-packages/matplotlib/pylab.py", line
200, in ?
 from axes import Axes, PolarAxes
 File "/usr/lib64/python2.4/site-packages/matplotlib/axes.py", line 14,
in ?
 from artist import Artist, setp
 File "/usr/lib64/python2.4/site-packages/matplotlib/artist.py", line
4, in ?
 from transforms import identity_transform
 File "/usr/lib64/python2.4/site-packages/matplotlib/transforms.py",
line 193, in ?
 from matplotlib.numerix.linear_algebra import inverse
ImportError: cannot import name inverse
Nils
From: Carol L. <car...@sr...> - 2006年03月15日 01:04:50
Hi folks,
I am trying to use quiver with equal axes. I have not been successful. 
 I suspect it is something simple such as not grabbing the correct axes.
If I use figure(figsize(7,7)), the plot seems to be a square, but it is 
not. This is apparent when I run the script using:
 python quiver6.py -dPS
and make two printouts which I then overlay with one rotated by 90 degrees.
I am using matplotlib 0.87.1 with numarray and GTKAgg backend.
Here is my code:
from pylab import *
an = linspace(0,2*pi,100)
X,Y = meshgrid( arange(-pi,pi,.2),arange(-pi,pi,.2) )
U = cos(X)
V = sin(Y)
#figure(figsize=(7,7))
quiver( X,Y, U, V, color=True )
plot(4*cos(an),4*sin(an))
ax = gca()	# Return the current axes
ax.set_aspect('equal')
ax.set_xlim(-5, 5)
ax.set_ylim(-5, 5)
savefig('quiver6', orientation = 'landscape')
-- 
Ms. Carol A. Leger
SRI International			Phone: (650) 859-4114
333 Ravenswood Avenue G-273
Menlo Park, CA 94025 e-mail: le...@sr...
From: David H. <dav...@gm...> - 2006年03月14日 19:17:26
Well, I'm not aware of any special way, but again, I'm no guru.
Given these lists : left, height you could simply do something like :
>>> bar(left, height, width)
>>> for l,h in zip(left,height):
>>> text(l+width/2., h + dh, str(h), horizontalalignment =3D 'center')
where dh is the distance wanted between the top of the bar and the text.
David
2006年3月13日, Francis Penney <fp...@gm...>:
> Just a simple bar chart question. How do I display the values above each
> bar?
>
From: John H. <jdh...@ac...> - 2006年03月14日 18:49:12
>>>>> "Derek" == Derek Basch <db...@ya...> writes:
 Derek> I am trying to plot a linear regression on a logarithmic
 Derek> scale and am not quite sure how to do it. I used examples
 Derek> that I had found online but the linear regression line
 Derek> doesn't plot the same on a logarithmic scale. Can anyone
 Derek> help me? Here is what I have so far:
This is not an issue of log versus non-log. You should sort your
xdata before plotting the line; you just don't notice it when you plot
nonsorted data that all lie on the same line.
Just do this after your data definition
 prediction_experiment.sort()
Also, rather than
 x = [f[0] for f in prediction_experiment]
 y = [z[1] for z in prediction_experiment]
 x = array(x)
 y = array(y)
you might prefer
 x, y = map(array, zip(*prediction_experiment))
JDH
From: Derek B. <db...@ya...> - 2006年03月14日 18:23:40
I am trying to plot a linear regression on a logarithmic scale and am not quite sure how to do it.
I used examples that I had found online but the linear regression line doesn't plot the same on a
logarithmic scale. Can anyone help me? Here is what I have so far:
from pylab import *
prediction_experiment = [(313.11000000000001, 25.797999999999998), (4499.1999999999998, 25000.0),
(168830.0, 440000.0), (143090.0, 78571.399999999994), (34811.0, 78571.399999999994), (161240.0,
70967.699999999997), (1000000.0, 78571.399999999994), (0.93820000000000003, 1.4666699999999999),
(3.0781000000000001, 2.8571399999999998), (64.768000000000001, 78571.399999999994),
(42.656999999999996, 10576.9), (11.473000000000001, 193.05000000000001), (173.90000000000001,
14.666700000000001), (2815.1999999999998, 16.8933), (78387.0, 78571.399999999994), (31665.0,
78571.399999999994), (1000000.0, 4000.0), (59298.0, 2638.8499999999999), (13179.0, 25000.0),
(1496.9000000000001, 188.08199999999999), (815.99000000000001, 24.601900000000001),
(386.07999999999998, 68750.0), (273750.0, 34896.800000000003), (28435.0, 25000.0),
(9699.2000000000007, 25000.0), (13515.0, 40000.0), (19219.0, 25000.0), (379170.0, 25000.0),
(379560.0, 78571.399999999994), (427.58999999999997, 25000.0), (638.86000000000001, 25000.0),
(89046.0, 25000.0), (151440.0, 25000.0), (1602.5, 25000.0), (4242.8000000000002, 25000.0),
(118700.0, 25000.0), (11454.0, 5500.0), (4094.5, 511.62799999999999), (17730.0, 25000.0),
(754.64999999999998, 1692.3099999999999), (2183.9000000000001, 25000.0), (192330.0, 25000.0),
(241170.0, 25000.0), (1.4981, 7.2522099999999998), (9.3475999999999999, 147.07400000000001),
(14.512, 5.4083300000000003), (194.66999999999999, 152.30199999999999), (10.856999999999999,
7.9026300000000003), (5.1627999999999998, 94.151399999999995), (1000000.0, 53658.5),
(912.51999999999998, 448.98000000000002), (18511.0, 25000.0), (1870.7, 6027.3999999999996),
(2665.5999999999999, 10138.200000000001), (14708.0, 55000.0), (38.012, 222.988),
(295.61000000000001, 44898.0), (5.4006999999999996, 6.6227600000000004), (1000000.0,
78571.399999999994), (1000000.0, 2050.3299999999999), (1549.5, 25000.0), (19.260999999999999,
13.0), (16.82, 3.5536300000000001), (67.953999999999994, 83.956599999999995), (1651.2,
3384.6199999999999), (104.84999999999999, 38.357599999999998), (1435.2, 10091.700000000001),
(78.744, 27.834), (351.27999999999997, 28.004100000000001), (27.716000000000001,
68.239699999999999), (380.61000000000001, 25000.0), (423.26999999999998, 5500.0), (342660.0,
155000.0), (60756.0, 25000.0), (155060.0, 25000.0), (1000000.0, 78571.399999999994),
(228.90000000000001, 40.740699999999997), (1355.5, 25000.0), (4744.1999999999998,
1235.0799999999999), (1000000.0, 43239.5), (5800.6000000000004, 78571.399999999994),
(73.650000000000006, 15.1372), (66.897999999999996, 666.66700000000003), (16031.0, 25000.0),
(82.275000000000006, 78571.399999999994), (1000000.0, 25000.0), (3287.6999999999998, 25000.0),
(418600.0, 78571.399999999994), (126.83, 1739.1300000000001), (139.5, 37288.099999999999),
(13376.0, 25000.0), (268.54000000000002, 25000.0), (175630.0, 25000.0), (29286.0,
78571.399999999994), (405.25, 1.0), (2048.8000000000002, 25000.0), (1569.0999999999999,
63.398800000000001), (1378.5, 70967.699999999997), (16883.0, 25000.0), (3467.3000000000002,
25000.0), (138140.0, 78571.399999999994), (24807.0, 523.80999999999995), (434.27999999999997,
7.0816499999999998), (31013.0, 25000.0), (48096.0, 78571.399999999994), (1510.3, 1093.98),
(1574.4000000000001, 3283.5799999999999), (7285.5, 880.0), (9767.5, 12500.0), (1000000.0,
78571.399999999994), (6.4268000000000001, 314.0), (22.384, 36.363399999999999),
(46.899999999999999, 5.2683299999999997), (347.31, 220.0), (66.600999999999999,
165.83099999999999), (1361.5999999999999, 78571.399999999994), (436640.0, 4782.6099999999997),
(171290.0, 57032.300000000003), (52.948999999999998, 29733.299999999999), (192.00999999999999,
329.0), (1171.4000000000001, 3666.6700000000001), (474.16000000000003, 782.64300000000003),
(42.241, 1.99908), (184960.0, 25000.0), (1867.2, 15714.299999999999), (5690.5, 2480.0),
(3382.5999999999999, 1157.8900000000001), (1000000.0, 78571.399999999994), (1301.2,
372.62900000000002), (1608.8, 25000.0), (98.102999999999994, 57.258899999999997), (42922.0,
78571.399999999994), (3068.0999999999999, 1.0621700000000001), (210.25999999999999, 16176.5),
(611.63999999999999, 31884.099999999999), (211700.0, 78571.399999999994), (11631.0,
240.30600000000001), (1798.0999999999999, 654.76199999999994), (67.960999999999999,
17728.099999999999), (23457.0, 25000.0), (2092.0999999999999, 25000.0), (3984.8000000000002,
25000.0), (1000000.0, 78571.399999999994), (4816.3000000000002, 25000.0), (20144.0, 25000.0),
(1000000.0, 70967.699999999997), (34961.0, 6287.0), (276.86000000000001, 767.16999999999996),
(1000000.0, 70967.699999999997), (665.45000000000005, 1398.5999999999999), (650750.0,
78571.399999999994), (15336.0, 5500.0), (1000000.0, 78571.399999999994), (167.88,
733.33299999999997), (19191.0, 4.3558700000000004), (15329.0, 956.52200000000005), (922060.0,
25000.0), (1000000.0, 78571.399999999994), (1000000.0, 2885.8499999999999), (235890.0, 25000.0),
(1000000.0, 78571.399999999994), (29382.0, 78571.399999999994), (128.03999999999999, 2219.98),
(100.16, 708.53499999999997), (585.59000000000003, 17322.799999999999), (1000000.0,
78571.399999999994), (268.68000000000001, 20.957599999999999), (73322.0, 25000.0), (112410.0,
25000.0), (7489.1000000000004, 25000.0), (2382.4000000000001, 31.6875), (260540.0,
78571.399999999994), (518.32000000000005, 25000.0), (1000000.0, 25000.0), (1000000.0,
10051.299999999999), (1000000.0, 25000.0), (89655.0, 25000.0), (818.88, 25000.0), (759950.0,
25000.0), (46101.0, 18837.200000000001), (79.030000000000001, 5.5999999999999996),
(339.06999999999999, 5500.0), (3427.6999999999998, 25000.0), (126660.0, 4174.5699999999997),
(26801.0, 25000.0), (980.72000000000003, 293333.0), (136190.0, 25000.0), (3505.9000000000001,
742.24000000000001), (33.753, 222.51400000000001), (436760.0, 25000.0), (135.43000000000001,
25000.0), (305.18000000000001, 25000.0), (1349.0999999999999, 25000.0), (12096.0,
758.62099999999998), (1000000.0, 44898.0), (240.83000000000001, 20.0), (134.13,
50.645099999999999), (35997.0, 25000.0), (1000000.0, 78571.399999999994), (7.2370000000000001,
2.2916699999999999), (600.94000000000005, 19.6416), (13117.0, 4150.9399999999996),
(1188.0999999999999, 78571.399999999994), (799680.0, 78571.399999999994), (14954.0,
78571.399999999994), (479.23000000000002, 25000.0), (7310.8000000000002, 1050.6199999999999),
(1000000.0, 234.24199999999999), (12.324, 2.5555300000000001), (414240.0, 25000.0), (16625.0,
25000.0), (10895.0, 60.009999999999998), (241.34999999999999, 796.81299999999999), (1000000.0,
25000.0), (11247.0, 1692.3099999999999), (13030.0, 25000.0), (59775.0, 78571.399999999994),
(2506.5999999999999, 160.0), (9283.2999999999993, 25000.0), (1000000.0, 78571.399999999994),
(1000000.0, 78571.399999999994), (1000000.0, 9909.9099999999999), (932.30999999999995,
14.982100000000001), (2996.3000000000002, 1375.0), (1000000.0, 78571.399999999994),
(6337.1000000000004, 27500.0), (267.69, 787.68299999999999), (7534.5, 25000.0),
(4675.8999999999996, 27.0943), (1057.2, 3.7930999999999999), (5138.0, 25000.0), (36588.0,
58688.699999999997), (1000000.0, 78571.399999999994), (148.02000000000001, 2.6151200000000001),
(473.39999999999998, 36.369), (1000000.0, 78571.399999999994), (4123.1000000000004,
1973.0899999999999), (554500.0, 78571.399999999994), (1000000.0, 25000.0), (13519.0, 26445.0),
(533.91999999999996, 22000.0), (189.97999999999999, 3.8650000000000002), (73.228999999999999,
27848.099999999999), (697.75999999999999, 1000.0), (145420.0, 78571.399999999994),
(8319.2000000000007, 22000.0), (6829.3000000000002, 8.2332999999999998), (3313.8000000000002,
17600.0), (4224.8000000000002, 1294.1199999999999), (1705.8, 25000.0), (49627.0,
70967.699999999997), (125460.0, 78571.399999999994), (11.382999999999999, 7.9088900000000004),
(153.88, 71.488900000000001), (49.518999999999998, 25000.0), (8976.7999999999993, 25000.0),
(377.97000000000003, 607.06399999999996), (202910.0, 19674.200000000001), (395.48000000000002,
2109.3000000000002), (23.899999999999999, 29.602499999999999), (1000000.0, 25000.0), (159980.0,
550.0), (11661.0, 25000.0), (6065.0, 25000.0), (1000000.0, 11399.0), (540.85000000000002,
1571.4300000000001), (886.70000000000005, 767.35299999999995), (315.69, 62857.0), (3640.0, 427.0),
(2753.3000000000002, 25000.0), (1000000.0, 78571.399999999994), (1000000.0, 25000.0),
(83.905000000000001, 18032.799999999999), (1220.9000000000001, 29.352499999999999),
(1357.4000000000001, 63.269300000000001), (4245.1999999999998, 19550.900000000001),
(969.55999999999995, 25000.0), (1482.9000000000001, 758.62099999999998), (5051.3999999999996,
17632.599999999999), (580.74000000000001, 75.862099999999998), (79868.0, 2696.0799999999999),
(42.079999999999998, 1.0), (9.0183999999999997, 5.9118700000000004), (45.177, 3379.4200000000001),
(881.97000000000003, 84.410899999999998), (1245.2, 5138.4799999999996), (2044.4000000000001,
8429.1200000000008), (3889.6999999999998, 78571.399999999994), (292.23000000000002, 25000.0),
(51.344999999999999, 3.1993499999999999), (21.702999999999999, 25.287400000000002),
(4552.6999999999998, 25000.0), (12536.0, 197.983), (65.808999999999997, 105.723),
(2555.0999999999999, 25000.0), (539.64999999999998, 5500.0), (112.56, 6267.8299999999999),
(2950.6999999999998, 25000.0), (3805.8000000000002, 7333.3299999999999), (883.62,
209.18600000000001), (455.74000000000001, 12.0718), (294.00999999999999, 889.0),
(11.066000000000001, 31.7607)]
x = [f[0] for f in prediction_experiment]
y = [z[1] for z in prediction_experiment]
x = array(x)
y = array(y)
def log10Product(x, pos):
 """The two args are the value and tick position.
 Label ticks with the product of the exponentiation"""
 return '%1i' % (x)
ax = subplot(111)
ax.set_xscale('log')
ax.set_yscale('log')
formatter = FuncFormatter(log10Product)
ax.xaxis.set_major_formatter(formatter)
ax.yaxis.set_major_formatter(formatter)
 
# the bestfit line from polyfit
m, b = polyfit(x, y, 1) # a line is 1st order polynomial...
plot(x, y, 'bs', x, m*x+b, 'r-', linewidth=1, markersize=2)
# Must add 1 to allow the last decades label to be shown
ax.set_xlim(1e-1, max(x)+1)
ax.set_ylim(1e-1, max(y)+1)
grid(True) 
xlabel(r"Prediction", fontsize = 12)
ylabel(r"Experimental IC50 [nM]", fontsize = 12)
show()
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
From: John H. <jdh...@ac...> - 2006年03月14日 18:14:42
This problem was resolved off list and I'm including it here for
others benefit. If you upgrade to a newer version of numpy and are
compiling mpl from src, you will need to=20
 1) install the new numpy
 2) flush all traces of your previous matplotlib build, eg by
 removing the build dir
 3) re-install matplotlib
Le Mardi 14 Mars 2006 13:58, vous avez =E9crit=A0:
> >>>>> "manouchk" =3D=3D manouchk <man...@gm...> writes:
>
> manouchk> Well, I use the src.rpm to rebuild so the build is done
> manouchk> in a cleaned directory (Ijust modified the name of the
> manouchk> package to respect mandriva policy python-NumPy...)
>
> manouchk> By the way I use mandriva 2005 I did build in that order
> manouchk> numpy-0.9.6 then scipy-0.4.6 (maybe not relevant for
> manouchk> matplotlib) and then matplotlib-0.87.1
>
> manouchk> I see that coocker is not yet chipping version 0.87.1
>
> I'm still willing to bet the problem is caused by an unclean build.
> Please make sure you rm -rf all build dirs and the
> site-packages/matplotlib install dir for good measure. Travis
> Oliphant and I both separately tested a matplotlib 87.1 build against
> numpy 0.9.6. At first I got a segfault when I did not have a clean
> build. After removing the build dirs and reinstalling, everything
> went fine and my tests passed.
you are right (at least I think)
I done the build again step by step... and the simplest example work!
I think that I stupidly(?) forgot to install Numpy-0.4.6 before compiling=
=20
matplotlib 0.87.1
sorry for the disturbance.
> You'll know you get a clean build if it takes a long time <wink>
it was not too long (few minutes?)
> JDH
From: manouchk <man...@gm...> - 2006年03月14日 16:52:46
Le Mardi 14 Mars 2006 11:21, vous avez =E9crit :
> >>>>> "manouchk" =3D=3D manouchk <man...@gm...> writes:
>
> manouchk> Simply reverting Numpy from version 0.9.6 to version
> manouchk> 0.9.4 solved the problem! Does someone understand
> manouchk> something to that?
>
> If you are building from source, you need to do a clean rebuild after
> upgrading numpy
>
> > cd matplotlib_src
> > sudo rm -rf build
> > sudo python setup.py install
>
> If you still encounter problems after that, be sure to let us know.
>
> JDH
Well, I use the src.rpm to rebuild so the build is done in a cleaned direct=
ory=20
(Ijust modified the name of the package to respect mandriva policy=20
python-NumPy...)
By the way I use mandriva 2005
I did build in that order=20
numpy-0.9.6
then scipy-0.4.6 (maybe not relevant for matplotlib)
and then matplotlib-0.87.1
From: John H. <jdh...@ac...> - 2006年03月14日 16:34:59
>>>>> "John" == John Hunter <jdh...@ac...> writes:
>>>>> "Yogesh" == Yogesh Wadadekar <wad...@st...> writes:
 Yogesh> Hi,
 Yogesh> I encounter problems with the solution below. My test case
 Yogesh> from yesterday was really not a 'test case' because both
 Yogesh> images had near identical values. Thus, the auto vmin,vmax
 Yogesh> settings were the same in both images.
 John> I think the difference we are seeing may due to the fact
 John> that the norm attributes are not set until the figure is
 John> drawn. So in a script with interactive off, the vmin and
 John> vmax attrs are not updated from None to their True values.
 John> You can fix this either by working in interactive mode or by
 John> forcing a draw
Here is a more elegant solution: you don't need to force a draw, you
just need to force an autoscale (which draw does)
 from pylab import imshow, rand, show
 im = imshow(rand(10,10))
 im.autoscale()
 print im.norm.vmin, im.norm.vmax
Now you can pass the vmin and vmax attrs to your new image and expect
them to work. FYI, in your case before when you were passing None,
imshow interprets None to mean "autoscale". 
JDH
5 messages has been excluded from this view by a project administrator.

Showing results of 398

<< < 1 .. 7 8 9 10 11 .. 16 > >> (Page 9 of 16)
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 によって変換されたページ (->オリジナル) /