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
(8) |
2
(2) |
3
(1) |
4
(2) |
5
(15) |
6
(12) |
7
(10) |
8
(2) |
9
(5) |
10
(5) |
11
(8) |
12
(12) |
13
(26) |
14
(10) |
15
(11) |
16
(2) |
17
(3) |
18
(19) |
19
(25) |
20
(11) |
21
(8) |
22
(8) |
23
(2) |
24
|
25
(8) |
26
(4) |
27
(2) |
28
(5) |
29
(3) |
30
(5) |
I have a routine where I start outside the loop with and empty sequence > leg = [] then add at each iteration the label > leg.append('mylabel') then call legend with the sequence at the end > legend(leg) I think I once truncated the list and got part only > legend(leg[:2]) It depends on what you want to do. Paul On Wed, Jun 13, 2012 at 8:56 PM, Mike Kaufman <mc...@gm...> wrote: > On 6/13/12 3:23 PM, Steven Boada wrote: >> Whoops, I forgot to change the subject. Sorry list. >> >> List, >> >> I'm making a scatter plot using a for loop. Here's a simple example.. >> >> for i in range(10): >> x=rand() >> y=rand() >> scatter(x,y,label='point') >> >> legend() >> show() >> >> >> When you do this, you get a legend entry for every single point. In this >> case, I get 9 entries in my legend. >> >> Is there a way to only get a single entry? I have looked into creating >> the legends by hand, but I'm not having much luck. Googling, only turned >> up a single example of someone else with the same problem. >> >> Help me list, you're my only hope. > > Perhaps not exactly what you want, but an answer is don't use a loop: > > x = rand(10) > y = rand(10) > scatter(x,y, label='points') > legend() > draw() > show() > > Of course if you want to color each point differently, then this won't work. > > M > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- * * * * * * * * http://www.mssl.ucl.ac.uk/~npmk/ * * * * Dr. N.P.M. Kuin (np...@ms...) phone +44-(0)1483 (prefix) -204256 (work) -276110 (home) mobile +44(0)7806985366 skype ID: npkuin Mullard Space Science Laboratory – University College London – Holmbury St Mary – Dorking – Surrey RH5 6NT– U.K.
Well I am doing a lot more than this simple example shows. Point is that there are nine different points each with their own legend entry. I could put it all out of the for loops, but it is all already written, and I'd rather just fix the legend at the end than move sections of the code around. I'm willing to do it, if that is the only choice, but I wanted to ask before I commit my time. Wouldn't it be a good (smart) thing for the code to lump all the points with the same label together? This would be a great feature to be added IMO. S On 06/13/2012 03:01 PM, pybokeh wrote: > > Are you trying to make 9 scatter plots? In your for loop, if you are > trying to make a set of x values and a set of y values, then I think > this is wrong. Since you didn't provide import statements I don't > know which rand() function you are using. Assuming it is > scipy.rand(), you will only have one x value and one y value, not much > of scatter chart with just one point :-) > > Otherwise, Mike's suggestion is valid. > > Regards, > Daniel > > On Jun 13, 2012 3:35 PM, "Steven Boada" <bo...@ph... > <mailto:bo...@ph...>> wrote: > > Whoops, I forgot to change the subject. Sorry list. > > List, > > I'm making a scatter plot using a for loop. Here's a simple example.. > > for i in range(10): > x=rand() > y=rand() > scatter(x,y,label='point') > > legend() > show() > > > When you do this, you get a legend entry for every single point. > In this > case, I get 9 entries in my legend. > > Is there a way to only get a single entry? I have looked into creating > the legends by hand, but I'm not having much luck. Googling, only > turned > up a single example of someone else with the same problem. > > Help me list, you're my only hope. > > Steven > > On 06/13/2012 01:33 PM, Eric Firing wrote: > > On 06/13/2012 07:31 AM, jonasr wrote: > >> Hi, > >> > >> im actually trying to make a countour plot Z=f(X,Y) from two > variables X,Y . > >> My Problem is that i have to use a logarithmic scale for the Z > values. > >> If i plot the data with the logarithmic scale it gets pretty > ugly, because i > >> have a lot of values which are zero, > >> which means on the log scale the value goes to -inf. > >> Here is an example what i mean > >> > >> http://www.imagebanana.com/view/qh1khpxp/example.png > >> > >> I acutally have no idea how to make the plot look better, > >> maybe somebody has an idea ? > > Use np.ma.masked_less to mask out values below some threshold before > > taking the log. > > > > e.g., > > > > import matplotlib.pyplot as plt > > import numpy as np > > x = np.arange(0, 1, 0.01) > > y = np.arange(0, 8, 0.05) > > X, Y = np.meshgrid(x, y) > > Z = 10 ** (-5 + 11 * X * np.sin(Y)) > > Z = np.ma.masked_less(Z, 1e-4) > > Zlog = np.ma.log10(Z) > > CS = plt.contourf(X, Y, Zlog, levels=np.arange(-3, 5.01, 1.0), > > extend='both') > > plt.colorbar() > > > > > > > > Eric > > > >> thank you > > > > > ------------------------------------------------------------------------------ > > Live Security Virtual Conference > > Exclusive live event will cover all the ways today's security and > > threat landscape has changed and how IT managers can respond. > Discussions > > will include endpoint security, mobile security and the latest > in malware > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > <mailto:Mat...@li...> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > -- > Steven Boada > Dept. Physics and Astronomy > Texas A&M University > bo...@ph... <mailto:bo...@ph...> > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. > Discussions > will include endpoint security, mobile security and the latest in > malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > <mailto:Mat...@li...> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Steven Boada Dept. Physics and Astronomy Texas A&M University bo...@ph...
Are you trying to make 9 scatter plots? In your for loop, if you are trying to make a set of x values and a set of y values, then I think this is wrong. Since you didn't provide import statements I don't know which rand() function you are using. Assuming it is scipy.rand(), you will only have one x value and one y value, not much of scatter chart with just one point :-) Otherwise, Mike's suggestion is valid. Regards, Daniel On Jun 13, 2012 3:35 PM, "Steven Boada" <bo...@ph...> wrote: > Whoops, I forgot to change the subject. Sorry list. > > List, > > I'm making a scatter plot using a for loop. Here's a simple example.. > > for i in range(10): > x=rand() > y=rand() > scatter(x,y,label='point') > > legend() > show() > > > When you do this, you get a legend entry for every single point. In this > case, I get 9 entries in my legend. > > Is there a way to only get a single entry? I have looked into creating > the legends by hand, but I'm not having much luck. Googling, only turned > up a single example of someone else with the same problem. > > Help me list, you're my only hope. > > Steven > > On 06/13/2012 01:33 PM, Eric Firing wrote: > > On 06/13/2012 07:31 AM, jonasr wrote: > >> Hi, > >> > >> im actually trying to make a countour plot Z=f(X,Y) from two variables > X,Y . > >> My Problem is that i have to use a logarithmic scale for the Z values. > >> If i plot the data with the logarithmic scale it gets pretty ugly, > because i > >> have a lot of values which are zero, > >> which means on the log scale the value goes to -inf. > >> Here is an example what i mean > >> > >> http://www.imagebanana.com/view/qh1khpxp/example.png > >> > >> I acutally have no idea how to make the plot look better, > >> maybe somebody has an idea ? > > Use np.ma.masked_less to mask out values below some threshold before > > taking the log. > > > > e.g., > > > > import matplotlib.pyplot as plt > > import numpy as np > > x = np.arange(0, 1, 0.01) > > y = np.arange(0, 8, 0.05) > > X, Y = np.meshgrid(x, y) > > Z = 10 ** (-5 + 11 * X * np.sin(Y)) > > Z = np.ma.masked_less(Z, 1e-4) > > Zlog = np.ma.log10(Z) > > CS = plt.contourf(X, Y, Zlog, levels=np.arange(-3, 5.01, 1.0), > > extend='both') > > plt.colorbar() > > > > > > > > Eric > > > >> thank you > > > > > ------------------------------------------------------------------------------ > > Live Security Virtual Conference > > Exclusive live event will cover all the ways today's security and > > threat landscape has changed and how IT managers can respond. Discussions > > will include endpoint security, mobile security and the latest in malware > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > -- > Steven Boada > Dept. Physics and Astronomy > Texas A&M University > bo...@ph... > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
Hello, I am trying to make a simple pcolor plot with a datetime on the x-axis. I am able to get a time label on the x-axis fine with a regular plot command, but it doesn't appear to work if you use pcolor. This simple example below shows that it does not work. Does anyone have any idea as to why a datetime can't go on a pcolor plot? What is the best approach is to solve the problem? Thanks, Tim import numpy as np import datetime import random import matplotlib import matplotlib.pyplot as plt # create some random data, one for a line plot, and another for pcolor: data1 = np.array ([random.random() for k in range(10)]) data2 = np.zeros((10,10)) for i in range(10): for j in range(10): data2[i,j] = random.random() # build datetimes (dts): dts = [] for k in range(10): dts.append(datetime.datetime(2012,1,1+k)) # First example, showing a regular plot with datetimes in the x-axis. fig = plt.figure(1) fig.clf() ax = fig.add_subplot(111) ax.plot(dts,data1) plt.show() # Second example, showing a pcolor with datetimes in the x-axis. # This plot does not work. fig = plt.figure(2) fig.clf() ax = fig.add_subplot(111) ax.pcolor(dts,np.arange(10),data2) plt.show()
On 6/13/12 3:23 PM, Steven Boada wrote: > Whoops, I forgot to change the subject. Sorry list. > > List, > > I'm making a scatter plot using a for loop. Here's a simple example.. > > for i in range(10): > x=rand() > y=rand() > scatter(x,y,label='point') > > legend() > show() > > > When you do this, you get a legend entry for every single point. In this > case, I get 9 entries in my legend. > > Is there a way to only get a single entry? I have looked into creating > the legends by hand, but I'm not having much luck. Googling, only turned > up a single example of someone else with the same problem. > > Help me list, you're my only hope. Perhaps not exactly what you want, but an answer is don't use a loop: x = rand(10) y = rand(10) scatter(x,y, label='points') legend() draw() show() Of course if you want to color each point differently, then this won't work. M
List, I'm making a scatter plot using a for loop. Here's a simple example.. for i in range(10): x=rand() y=rand() scatter(x,y,label='point') legend() show() When you do this, you get a legend entry for every single point. In this case, I get 9 entries in my legend. Is there a way to only get a single entry? I have looked into creating the legends by hand, but I'm not having much luck. Googling, only turned up a single example of someone else with the same problem. Help me list, you're my only hope. Steven
Whoops, I forgot to change the subject. Sorry list. List, I'm making a scatter plot using a for loop. Here's a simple example.. for i in range(10): x=rand() y=rand() scatter(x,y,label='point') legend() show() When you do this, you get a legend entry for every single point. In this case, I get 9 entries in my legend. Is there a way to only get a single entry? I have looked into creating the legends by hand, but I'm not having much luck. Googling, only turned up a single example of someone else with the same problem. Help me list, you're my only hope. Steven On 06/13/2012 01:33 PM, Eric Firing wrote: > On 06/13/2012 07:31 AM, jonasr wrote: >> Hi, >> >> im actually trying to make a countour plot Z=f(X,Y) from two variables X,Y . >> My Problem is that i have to use a logarithmic scale for the Z values. >> If i plot the data with the logarithmic scale it gets pretty ugly, because i >> have a lot of values which are zero, >> which means on the log scale the value goes to -inf. >> Here is an example what i mean >> >> http://www.imagebanana.com/view/qh1khpxp/example.png >> >> I acutally have no idea how to make the plot look better, >> maybe somebody has an idea ? > Use np.ma.masked_less to mask out values below some threshold before > taking the log. > > e.g., > > import matplotlib.pyplot as plt > import numpy as np > x = np.arange(0, 1, 0.01) > y = np.arange(0, 8, 0.05) > X, Y = np.meshgrid(x, y) > Z = 10 ** (-5 + 11 * X * np.sin(Y)) > Z = np.ma.masked_less(Z, 1e-4) > Zlog = np.ma.log10(Z) > CS = plt.contourf(X, Y, Zlog, levels=np.arange(-3, 5.01, 1.0), > extend='both') > plt.colorbar() > > > > Eric > >> thank you > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Steven Boada Dept. Physics and Astronomy Texas A&M University bo...@ph...
On Wed, Jun 13, 2012 at 10:46 AM, Peter Würtz <pw...@go...>wrote: > > I'm sorry, there seems to be a mess. Nabble told me that this mail to the > list was not accepted for unknown reasons so I deleted it. Here is the > example I was talking about in the previous mail: > > import matplotlib > import pylab as p > > p.plot([1,2,3]) > p.xticks([1],["tick"]) > ax = p.gca() > fig = p.gcf() > > p.draw() > def print_texts(artist): > for t in artist.findobj(matplotlib.text.Text): > if t.get_visible() and t.get_text(): > print " %s @ %s" % (t.get_text(), t.get_position()) > > print "X-Axis" > print_texts(ax.xaxis) > print "Y-Axis" > print_texts(ax.yaxis) > This is my output using v1.1.1-rc2 X-Axis tick @ (1.0, 0.0) tick @ (0.0, 1.0) Y-Axis 1.0 @ (0.0, 1.0) 1.0 @ (1.0, 0.0) 1.5 @ (0.0, 1.5) 1.5 @ (1.0, 0.0) 2.0 @ (0.0, 2.0) 2.0 @ (1.0, 0.0) 2.5 @ (0.0, 2.5) 2.5 @ (1.0, 0.0) 3.0 @ (0.0, 3.0) 3.0 @ (1.0, 0.0) Strange indeed. Ben Root
2012年6月12日 Paul Hobson <pmh...@gm...>: > On Mon, Jun 11, 2012 at 11:03 PM, Justin R <jus...@gm...> wrote: > Justin, could you post a self-contained script that demonstrates the > issue? Where does this PCA function come from? It comes from matplotlib.mlab. Just add these imports before the OP's code: import numpy as np from matplotlib.mlab import PCA But I don't know much about PCA and can't comment on this. Goyo
On 06/13/2012 07:31 AM, jonasr wrote: > > Hi, > > im actually trying to make a countour plot Z=f(X,Y) from two variables X,Y . > My Problem is that i have to use a logarithmic scale for the Z values. > If i plot the data with the logarithmic scale it gets pretty ugly, because i > have a lot of values which are zero, > which means on the log scale the value goes to -inf. > Here is an example what i mean > > http://www.imagebanana.com/view/qh1khpxp/example.png > > I acutally have no idea how to make the plot look better, > maybe somebody has an idea ? Use np.ma.masked_less to mask out values below some threshold before taking the log. e.g., import matplotlib.pyplot as plt import numpy as np x = np.arange(0, 1, 0.01) y = np.arange(0, 8, 0.05) X, Y = np.meshgrid(x, y) Z = 10 ** (-5 + 11 * X * np.sin(Y)) Z = np.ma.masked_less(Z, 1e-4) Zlog = np.ma.log10(Z) CS = plt.contourf(X, Y, Zlog, levels=np.arange(-3, 5.01, 1.0), extend='both') plt.colorbar() Eric > > thank you
Hi, im actually trying to make a countour plot Z=f(X,Y) from two variables X,Y . My Problem is that i have to use a logarithmic scale for the Z values. If i plot the data with the logarithmic scale it gets pretty ugly, because i have a lot of values which are zero, which means on the log scale the value goes to -inf. Here is an example what i mean http://www.imagebanana.com/view/qh1khpxp/example.png I acutally have no idea how to make the plot look better, maybe somebody has an idea ? thank you -- View this message in context: http://old.nabble.com/logairthmic-contour-plot-tp34007155p34007155.html Sent from the matplotlib - users mailing list archive at Nabble.com.
Sorry looks like my smartphone's copy/paste removed carriage return in certain places in the script :-( On Jun 13, 2012 12:32 PM, "Chris Withers" <ch...@si...> wrote: > Hi all, > > I have some time series of disk usage that I'd like to do a linear > regression on an plot on a nice graph with Mb used on the y-axis and > date on the x axis. > > I tried to use pylab.polyfit(dates, usage) where: > > dates = [datetime(x, y, z), datetime(a, b, c), ...] > usage = [12123234, 2234235235, ...] > > ...but polyfit doesn't like the dates. > > How should I do this? > > Any example of a nice plot and linear regression using matplotlib? > > cheers, > > Chris > > -- > Simplistix - Content Management, Batch Processing & Python Consulting > - http://www.simplistix.co.uk > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
Check out linregress from scipy.stats module. Not sure if it will handle dates. Sample script below: from scipy.stats import pearsonr from scipy.stats import linregress from matplotlib import pyplot as plt import numpy as np sat = np.array([595,520,715,405,680,490,565]) gpa = np.array([3.4,3.2,3.9,2.3,3.9,2.5,3.5]) fig1 = plt.figure(1) ax = plt.subplot(1,1,1) pearson = pearsonr(sat, gpa) plt.scatter(sat,gpa, label="data") # Get linear regression parameters slope, intercept, r_value, p_value, std_err = linregress(sat, gpa) # Format the chart plt.xlabel("SAT Scores") plt.ylabel("GPA") plt.title("Scatter Plot with Linear Regression Fit\nY=a*X + b\na=%0.4f, b=%0.4f" % (slope, intercept)) plt.grid() # Create linear regression x values x_lr = sat # Create linear regression y values: Y = slope*X + intercept y_lr = slope * x_lr + intercept print "Pearson correlation coefficient: ", pearson[0] print "Fit x-values: ", str(x_lr) print "Fit y-values: ", str(y_lr) print "Fit slope: ",slope print "Fit intercept: ", intercept plt.plot(x_lr, y_lr, label="fit") plt.legend() plt.show() Regards, Daniel On Jun 13, 2012 12:32 PM, "Chris Withers" <ch...@si...> wrote: > Hi all, > > I have some time series of disk usage that I'd like to do a linear > regression on an plot on a nice graph with Mb used on the y-axis and > date on the x axis. > > I tried to use pylab.polyfit(dates, usage) where: > > dates = [datetime(x, y, z), datetime(a, b, c), ...] > usage = [12123234, 2234235235, ...] > > ...but polyfit doesn't like the dates. > > How should I do this? > > Any example of a nice plot and linear regression using matplotlib? > > cheers, > > Chris > > -- > Simplistix - Content Management, Batch Processing & Python Consulting > - http://www.simplistix.co.uk > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
Dear all, asking question in a good way is art and I am trying to do that :-). I spent whole day trying to put an inset axes within another hosting axes the exact position I want. and from here http://old.nabble.com/Adding-custom-axes-within-a-subplot-td22159536.html Jae-Joon Lee <http://old.nabble.com/user/UserProfile.jtp?user=1141641> gave a good answer using only four lines: Bbox = matplotlib.transforms.Bbox.from_bounds(.4, .1, .5, .3) #numbers in fraction of hosting axes trans = ax.transAxes + fig.transFigure.inverted() l, b, w, h = matplotlib.transforms.TransformedBbox(Bbox, trans).bounds axins = fig.add_axes([l, b, w, h]) It works fine. Now my question is I want inset axes to have 'equal' aspect because I want 1:1 ratio plot. and I found that using axins.set_aspect('equal') will change the position of the inset axes. Then I tried to adjust the width and height of inset axes with the hosting axes aspect ratio before I draw it so that I would expect they look already "aspect-equal" before I feed data to it. So my first question is, How can I get the axes aspect ratio, axes.get_aspect() and axes._aspect both give only 'auto' but not numerical value. (I assume it's height/width ratio in terms of figure fraction or it's inverse?, I tried this but it doesn't work.) another side-question, I have a feeling that understanding transform is of great value working with matplotlib. But I don't understand the four lines above, and I can not find further information either in the matplotlib document or online. Is there any source except having dig into source code? thanks!!!!!!!! I make an example script below to show the problem (long but easy). I hope someone could offer some help. :-) ###script showing the problem fig=plt.figure() #plot two subplot to have ax aspect far from 'equal' ax=fig.add_subplot(211) a=np.arange(0,2*np.pi,0.1) ax.plot(a,np.sin(a)) def create_inset_axes(x0,y0,width,height): #the four numbers are x0,y0,width,height Bbox = matplotlib.transforms.Bbox.from_bounds(x0,y0,width,height) trans = ax.transAxes + fig.transFigure.inverted() l, b, w, h = matplotlib.transforms.TransformedBbox(Bbox, trans).bounds return fig.add_axes([l, b, w, h]) def get_axes_aspect_ratio(ax): box=ax.get_position() ratio=(box.x1-box.x0)/(box.y1-box.y0) return ratio axins=create_inset_axes(0.1,0.05,0.2,0.2) axins.plot(np.arange(10),'ro') ax.text(0.35,0.15,'no any adjustment',transform=ax.transAxes) axins=create_inset_axes(0.1, 0.3, 0.2, 0.2) axins.plot(np.arange(10),'ro') axins.set_aspect('equal') ax.text(0.35,0.4,'explicitly set aspect as equal',transform=ax.transAxes) axins=create_inset_axes(0.1, 0.55, 0.2, 0.2*ratio) #adjust the height by ax axes width/height ratio axins.plot(np.arange(10),'ro') ax.text(0.35,0.7,'adjust with hosting axes width/length ratio',transform=ax.transAxes) cheers, Chao -- *********************************************************************************** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16 ************************************************************************************
Hi all, I have some time series of disk usage that I'd like to do a linear regression on an plot on a nice graph with Mb used on the y-axis and date on the x axis. I tried to use pylab.polyfit(dates, usage) where: dates = [datetime(x, y, z), datetime(a, b, c), ...] usage = [12123234, 2234235235, ...] ...but polyfit doesn't like the dates. How should I do this? Any example of a nice plot and linear regression using matplotlib? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk
I'm sorry, there seems to be a mess. Nabble told me that this mail to the list was not accepted for unknown reasons so I deleted it. Here is the example I was talking about in the previous mail: import matplotlib import pylab as p p.plot([1,2,3]) p.xticks([1],["tick"]) ax = p.gca() fig = p.gcf() p.draw() def print_texts(artist): for t in artist.findobj(matplotlib.text.Text): if t.get_visible() and t.get_text(): print " %s @ %s" % (t.get_text(), t.get_position()) print "X-Axis" print_texts(ax.xaxis) print "Y-Axis" print_texts(ax.yaxis) -- View this message in context: http://old.nabble.com/Duplicate-Ticks-tp34005378p34005490.html Sent from the matplotlib - users mailing list archive at Nabble.com.
I believe that the only way to add a patch is through ax.add_patch() Should there be an associated pyplot patch() command? M
Hello, I'm searching for a way to extract all text elements from a matplotlib figure including their positions, styles, alignments etc. I first tried to write a custom backend and to fetch all the texts from the "draw_text()" method of the renderer. In contrast to the documentation "draw_text()" does not receive a matplotlib.text.Text instance with all the necessary information but only a simple string and a pre-layouted position. So I found this "findobj" method to get all Text elements from a figure in a list, which is exactly what I was looking for. However, I get some weird duplicates for all the tick labels and I don't know how to handle them. This is a small example that uses findobj on the axis objects and prints the texts. import matplotlib import pylab as p p.plot([1,2,3]) p.xticks([1],["tick"]) ax = p.gca() fig = p.gcf() p.draw() def print_texts(artist): for t in artist.findobj(matplotlib.text.Text): if t.get_visible() and t.get_text(): print " %s @ %s" % (t.get_text(), t.get_position()) print "X-Axis" print_texts(ax.xaxis) print "Y-Axis" print_texts(ax.yaxis) On all my matplotlib installations, all tick labels have duplicates positioned at the end of the axis. Why? How to filter them out from a list of Text elements? Their get_visible() attribute is True. Another thing is that I first had to do a "draw()" call in order to have the ticks generated/updated at all. How do I force an update of the tick labels. Colorbar seems to have a "update_ticks()" method, but I can't find something similar for the axis ticks.
Hello, I'm searching for a way to extract all text elements from a matplotlib figure including their positions, styles, alignments etc. I first tried to write a custom backend and to fetch all the texts from the "draw_text()" method of the renderer. In contrast to the documentation "draw_text()" does not receive a matplotlib.text.Text instance with all the necessary information but only a simple string and a pre-layouted position. So I found this "findobj" method to get all Text elements from a figure in a list, which is exactly what I was looking for. However, I get some weird duplicates for all the tick labels and I don't know how to handle them. This is a small example that uses findobj on the axis objects and prints the texts. http://old.nabble.com/file/p34004789/duplicate_ticks.py On all my matplotlib installations, all tick labels have duplicates positioned at the end of the axis. Why? How to filter them out from a list of Text elements? Their get_visible() attribute is True. Another thing is that I first had to do a "draw()" call in order to have the ticks generated/updated at all. How do I force an update of the tick labels. Colorbar seems to have a "update_ticks()" method, but I can't find something similar for the axis ticks. -- View this message in context: http://old.nabble.com/Duplicate-Ticks-tp34004789p34004789.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Tuesday, June 12, 2012, wiswit wrote: > > Hi, Thanks Fernando! I am using vim and I checked a little bit the tool and > it seems of great help! > I am not saying that we need something perfect. It's already great to have > these tools (ipython, matplotlib). Just imagine what's kind of feeling > working within pure python shell... thanks for these great work. > > Chao > > Do a search for modern python IDE in vim. I found some of the tools in there to be exceptionally useful for creating scripts. Note that I usually use mpl to display a result generated from a complex script and rarely from an interactive python prompt. It sounds like you are more in the other camp, and may benefit from a slight rethinking of your overall workflow. I follow the philosophy of making a tool to do one thing and do it well. For example, I made myself a "super ncview" to view 2d netcdf data and placed it in my .local/bin folder. So, when debugging a script that uses a netcdf file, I can quickly check its contents with a simple shell call. Note, though that it is only useful to me because I typically work with netcdf files, and so you would need to make tools suited for your typical data files. Cheers! Ben Root > > >
On 06/12/2012 11:30 AM, Gustavo Goretkin wrote: > Hi, > > I'm using MPL 1.0.1 and am getting an unexpected result from using the > Path.intersects_path function. > > Here is the example: https://gist.github.com/2920237 > > There are three rectangles, two of which intersect. As such, I expect > some of the calls to intersects_path to return not 1. The reason is that get_path() does not apply any transforms. In your example, try replacing f.get_path() with f.get_patch_transform().transform_path(f.get_path()) and similarly for s.get_path(). Eric > > Thanks, > Gustavo
Hi, I'm using MPL 1.0.1 and am getting an unexpected result from using the Path.intersects_path function. Here is the example: https://gist.github.com/2920237 There are three rectangles, two of which intersect. As such, I expect some of the calls to intersects_path to return not 1. Thanks, Gustavo
Hi all, Just curious. Is there a chance that the following ticket will be fixed before the forthcoming release. https://github.com/matplotlib/matplotlib/issues/917 Nils
On Mon, Jun 11, 2012 at 11:03 PM, Justin R <jus...@gm...> wrote: > operating system Windows 7 > matplotlib version : 1.1.0 > obtained from sourceforge > > the class seems to generate the same Wt matrix for every input. The > every element of the weight matrix is either +sqrt(1/2) or -sqrt(1/2). > > dat1 = 4*np.random.randn(200,1) + 2 > dat2 = dat1*.25 + 1*np.random.randn(200,1) > pcaObj1 = PCA(np.hstack((dat1,dat2))) > print pcaObj1.Wt > > dat3 = 2*np.random.randn(200,1) + 2 > dat4 = dat3*2 + 3*np.random.randn(200,1) > pcaObj2 = PCA(np.hstack((dat1,dat2))) > print pcaObj2.Wt > > The output Y seems to be correct, and the projection function works. > only the Wt matrix seems to be messed up. Am I using this class > incorrectly, or could this be a bug? > thanks, > Justin Justin, could you post a self-contained script that demonstrates the issue? Where does this PCA function come from? In [1]: from pylab import * In [2]: PCA --------------------------------------------------------------------------- NameError Traceback (most recent call last) C:\Users\phobson\<ipython-input-2-dcf6991f51c0> in <module>() ----> 1 PCA NameError: name 'PCA' is not defined -paul