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
2
(2)
3
(16)
4
(22)
5
(7)
6
7
(9)
8
(2)
9
10
(7)
11
(15)
12
(7)
13
(4)
14
(7)
15
(3)
16
(6)
17
(20)
18
(18)
19
(15)
20
(27)
21
(14)
22
23
(1)
24
(18)
25
(22)
26
(36)
27
(17)
28
(6)
29
(2)
30
(3)
31
(6)





Showing 14 results of 14

From: Jeff W. <js...@fa...> - 2010年05月21日 22:16:14
On 5/21/10 3:57 PM, Benjamin Root wrote:
> I did some more digging and I think I have a hypothesis for what is 
> happening.
>
> There is only one main difference between a call to .drawstates() and 
> .readshapefiles() with respect to loading and plotting data. 
> .drawstates() loads *only* the line segments that coincide with the 
> defined map boundaries, while .readshapefiles() loads all of the data 
> in the shapefile. Therefore, the LineCollection that gets attached to 
> the axis contains data from outside the stated domain.
>
> In addition, the basemap versions of the plotting functions have the 
> benefit of finishing their calls with a call to .set_axes_limits(), 
> which keeps the axes in check. However, a non-basemap version would 
> not call that automatically, thereby having its axes automatically 
> expanded to contain all of the data in the LineCollection.
>
> I am not sure what exactly should be done about this. This is 
> certainly un-intuitive behavior, though. Maybe there could be a 
> keyword option in .readshapefile() to have only the data for the 
> stated domain loaded? That might solve the issue.
>
> Thanks,
> Ben Root
Ben: That's why you should use the basemap methods where possible (they 
handle these things for you). You could also turn autoscaling off on 
your axes using
ax.set_autoscaleon(False)
and then they won't automatically expand when you plot data outside your 
map region. Or, you could just call the set_axes_limits() methods 
before you draw the plot.
Clipping the polygons to the map projection region is non-trivial, and I 
don't think I want to add that to readshapefile.
-Jeff
>
> On Fri, May 21, 2010 at 4:08 PM, Benjamin Root <ben...@ou... 
> <mailto:ben...@ou...>> wrote:
>
> Hello,
>
> I have been tracking down an annoying (but easily worked around)
> issue with Basemap. It seems that if you call .readshapefile() to
> create, for example, roads on your image, and then call any pyplot
> command afterwards for that axis, the axis will reset itself to
> the entire domain (I guess it would be the complete domain stated
> in the shapefile, maybe?). This does not happen if you call the
> equivalent function from the Basemap instance, though. Also, this
> does not happen with drawstates() and its ilk.
>
> I have made a test script and a couple of supporting shapefile in
> a tar.gz file to demonstrate the issue. It is available here:
> http://dl.dropbox.com/u/7325604/basemaptest.tar.gz
>
>
> I have also attached a png file showing the resulting image as it
> appears on my computer. I have no clue as to the cause and I hope
> that someone here might have an idea.
>
> Thanks,
> Ben Root
>
>
>
> ------------------------------------------------------------------------------
>
> 
>
>
> _______________________________________________
> Matplotlib-devel mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
> 
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Jae-Joon L. <lee...@gm...> - 2010年05月21日 22:15:55
set_array method only update the underlying array, and no more.
The problem is that, the first imshow results in clim=(0,0) and
set_array does not change this.
You may manually update the clim of the image, or you may explicitly
call autoscale() after set_array.
Regards,
-JJ
On Fri, May 21, 2010 at 1:56 PM, Chiara Caronna
<chi...@ho...> wrote:
> Hi,
> I am trying to update the image plotted in a figure. From what I understood,
> this code should do the job:
>
> import pylab as p
>
> image=p.zeros((20,20))
> p.ion()
> ax=p.imshow(image)
> p.draw()
>
> for i in range(10):
> print i
> p.ion()
> image[i,:]=i
> ax.set_array(image)
> p.draw()
>
>
> But the image is not updated at all....
> what am I doing wrong?
>
> I have the 0.99.1.1 version of matplotlib.
>
> Cheers,
> Chiara
>
>
> ________________________________
> Hotmail: Powerful Free email with security by Microsoft. Get it now.
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Benjamin R. <ben...@ou...> - 2010年05月21日 20:35:45
Andreas,
With respect to the large PDF file, while hexbin() would help in that
regards, if you need further improvement in filesize, there is a kwarg for
some plotting functions: rasterized=True. You might need to use a svn
checkout of matplotlib for it to work though, but I am dealing with the same
problem as well.
Ben Root
On Fri, May 21, 2010 at 3:24 PM, Andreas Hilboll <li...@hi...> wrote:
> > You want to make a kernel density estimate (a.k.a. a "heatmap").
>
> Thanks for the link, i'll look into it and compare it to the suggested
> hexbin().
>
> > This approach would
> > likely
> > be a bit slow if you have a very large number of points, though. It's
> > usually less visually messy to just plot the image
>
> Well, that's not an option. I once tried to create a 'normal' scatterplot
> of my data (it's a couple of million points), and that took a *long* time.
> Plus, it made me see a 700M pdf file for the first time in my life ;)
>
> Cheers,
>
> Andreas.
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Andreas H. <li...@hi...> - 2010年05月21日 20:22:17
> You want to make a kernel density estimate (a.k.a. a "heatmap").
Thanks for the link, i'll look into it and compare it to the suggested
hexbin().
> This approach would
> likely
> be a bit slow if you have a very large number of points, though. It's
> usually less visually messy to just plot the image
Well, that's not an option. I once tried to create a 'normal' scatterplot
of my data (it's a couple of million points), and that took a *long* time.
Plus, it made me see a 700M pdf file for the first time in my life ;)
Cheers,
Andreas.
From: Stan W. <sta...@nr...> - 2010年05月21日 20:16:17
> From: MONTAGU Thierry [mailto:thi...@ce...] 
> Sent: Friday, May 21, 2010 09:37
> 
> has anyone ever tried to make a quantile-quantile plot with pylab?
> is there any build in function named say "qqplot" available ?
For a plot comparing samples to a theoretical distribution (and if you don't
need masking as in Paul's example), you might be able to use
scipy.stats.probplot, as follows:
 import matplotlib.pyplot as plt
 import scipy.stats as st
 values = st.norm.rvs(size=(100,)) # example data
 fig = plt.figure() # set up plot
 ax = fig.add_subplot(1, 1, 1)
 osm, osr = st.probplot(values, fit=0, dist='norm') # compute
 ax.plot(osm, osr, '.') # plot
One way to include the fit line is
 (osm, osr), (m, b, r) = st.probplot(values, dist='norm') # compute
 osmf = osm.take([0, -1]) # endpoints
 osrf = m * osmf + b # fit line
 ax.plot(osm, osr, '.', osmf, osrf, '-')
From: Benjamin R. <ben...@ou...> - 2010年05月21日 20:14:35
Andreas,
Check out hexbin(), it is the easiest way to do what you want.
Ben Root
On Fri, May 21, 2010 at 2:52 PM, Andreas Hilboll <li...@hi...> wrote:
> Hi there,
>
> the attached figure shows a scatterplot, where the colors indicate the
> density of measurement points.
>
> Is there any way to do this with matplotlib?
>
> Thanks for your insight,
>
> Andreas.
>
>
>
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Andreas H. <li...@hi...> - 2010年05月21日 20:08:40
Attachments: correlation.png
Hi there,
the attached figure shows a scatterplot, where the colors indicate the 
density of measurement points.
Is there any way to do this with matplotlib?
Thanks for your insight,
Andreas.
From: Chiara C. <chi...@ho...> - 2010年05月21日 17:56:38
Hi,
I am trying to update the image plotted in a figure. From what I understood, this code should do the job:
import pylab as p
image=p.zeros((20,20))
p.ion()
ax=p.imshow(image)
p.draw()
for i in range(10):
 print i
 p.ion()
 image[i,:]=i
 ax.set_array(image)
 p.draw()
But the image is not updated at all....
what am I doing wrong?
I have the 0.99.1.1 version of matplotlib.
Cheers,
Chiara
 		 	 		 
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969 
morever
computer gets stuck for code
 
from multiprocessing import Process
from matplotlib.pyplot import plot, show
def plot_graph(*args):
 for data in args:
 plot(data)
 show()
p = Process(target=plot_graph, args=([1, 2, 3],))
p.start()
print 'yay'
print 'computation continues...'
print 'that rocks.'
print 'Now lets wait for the graph be closed to continue...:'
p.join()
 
from
http://stackoverflow.com/questions/458209/is-there-a-way-to-detach-matplotlib-plots-so-that-the-computation-can-continue
 
 
since this code multipliers number of pyhon.exe running till memory is full in my case 6 GB
 
is it problem for Vista only?
Sandy
 
 
> Date: 2010年5月18日 18:14:11 -0400
> From: ala...@gm...
> To: mat...@li...
> CC: cd...@li...
> Subject: Re: [Gnuplot-py-users] is it possible to continue to Debug when figure is created??
> 
> > http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show
> 
> 
> Here is some more detail, that I actually think
> should be added to the above link.
> http://stackoverflow.com/questions/458209/is-there-a-way-to-detach-matplotlib-plots-so-that-the-computation-can-continue
> 
> hth,
> Alan Isaac
> 
 		 	 		 
_________________________________________________________________
Hotmail: Trusted email with powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969 
From: Alan G I. <ala...@gm...> - 2010年05月21日 16:59:59
On 5/21/2010 12:35 PM, Sandy Ydnas wrote:
> nothing from
> http://stackoverflow.com/questions/458209/is-there-a-way-to-detach-matplotlib-plots-so-that-the-computation-can-continue
>
> working on Vista for Wings IDE
What if you ditch the IDE and just run the script?
Alan Isaac
sorry 
but nothing from
http://stackoverflow.com/questions/458209/is-there-a-way-to-detach-matplotlib-plots-so-that-the-computation-can-continue
 
working on Vista for Wings IDE
do you use it for LInux?
Sandy
 
> Date: 2010年5月18日 18:14:11 -0400
> From: ala...@gm...
> To: mat...@li...
> CC: cd...@li...
> Subject: Re: [Gnuplot-py-users] is it possible to continue to Debug when figure is created??
> 
> > http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show
> 
> 
> Here is some more detail, that I actually think
> should be added to the above link.
> http://stackoverflow.com/questions/458209/is-there-a-way-to-detach-matplotlib-plots-so-that-the-computation-can-continue
> 
> hth,
> Alan Isaac
> 
 		 	 		 
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969 
From: <PH...@Ge...> - 2010年05月21日 16:02:19
Thierry,
You need either scipy or rpy2 (and R) to do this. I've attached some code below. Please keep in mind that I've written for the general case of having a censored data set, therefore I rely on masked arrays from numpy.ma and scipy.stats.mstats -- but I have apply the mask midway through the process, which is different than the numpy's standard operating procedure. Let me know if any of this isn't clear.
I also have code that generates a quick comparison of the results from scipy.stats.mstats and ryp2+R, if you're interested.
HTH,
-paul
# code...
import matplotlib.pyplot as pl
import scipy.stats as st
import numpy as np
def censoredProbPlot(data, mask):
 ppos = st.mstats.plotting_positions(data)
 qntl = st.distributions.norm.ppf(ppos)
 
 qntlMask = np.ma.MaskedArray(qntl, mask=mask)
 dataMask = np.ma.MaskedArray(data, mask=mask)
 
 fit = st.mstats.linregress(dataMask, qntlMask)
 mu = -fit[1]
 sigma = fit[0]
 d_ = np.linspace(np.min(data),np.max(data))
 q_ = sigma * d_ - mu
 
 maskedProbPlot = {"mskData" : dataMask,
 "mskQntl" : qntlMask,
 "unmskData" : data,
 "unmskQntl" : qntl,
 "bestFitD" : d_,
 "bestFitQ" : q_,
 "mu" : mu,
 "sigma" : sigma}
 return maskedProbPlot
if 1:
 #~~ you need to put your data here:
 #data = np.array([])
 #mask = np.array([],dtype=bool)
 mpp = censoredProbPlot(data, mask)
 fig = pl.figure()
 ax1 = fig.add_subplot(111)
 ax1.plot(mpp['mskQntl'], mpp['mskData'], 'ko', ms=6, label='Detected Samples')
 ax1.plot(mpp['unmskQntl'], mpp['unmskData'], 'r.', ms=6, label='Raw Samples')
 ax1.plot(mpp['bestFitQ'], mpp['bestFitD'], 'b-', lw=2)
 fig.savefig('example_censoredProbPlot.png')
> -----Original Message-----
> From: MONTAGU Thierry [mailto:thi...@ce...]
> Sent: Friday, May 21, 2010 6:37 AM
> To: mat...@li...
> Subject: [Matplotlib-users] qqplot
> 
> hi all
> 
> has anyone ever tried to make a quantile-quantile plot with pylab?
> is there any build in function named say "qqplot" available ?
> 
> thanks
> Thierry
> 
> -------------------------------------------------------------------------
> -----
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jae-Joon L. <lee...@gm...> - 2010年05月21日 15:01:55
On Wed, May 19, 2010 at 5:47 PM, Solomon M Negusse
<sol...@tw...> wrote:
> Hello,
> I came across problem of label rotation with autofmt_xdate() in subplothost
> too. Is there a new version with the bug fixed or a workaround to doing the
> label rotation in subplothost?
>
While this is fixed in the svn, there is no release yet.
One workaround is to turn off axisline mode.
host = SubplotHost(fig, 111)
host.toggle_axisline(False)
Note that, with this change, things like
host.axis["left"].label.set_color(drawRxByt.get_color())
won't work and you have to use the methods of original matplotlib Axes.
Regards,
-JJ
From: MONTAGU T. <thi...@ce...> - 2010年05月21日 14:14:58
hi all
has anyone ever tried to make a quantile-quantile plot with pylab?
is there any build in function named say "qqplot" available ?
thanks
Thierry

Showing 14 results of 14

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 によって変換されたページ (->オリジナル) /