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
(24) |
2
(35) |
3
(21) |
4
(15) |
5
(1) |
6
(2) |
7
(30) |
8
(16) |
9
(11) |
10
(10) |
11
(10) |
12
(4) |
13
(2) |
14
(14) |
15
(21) |
16
(7) |
17
(5) |
18
(2) |
19
(5) |
20
|
21
(4) |
22
(8) |
23
(4) |
24
(6) |
25
(2) |
26
(2) |
27
(5) |
28
(9) |
29
(16) |
30
(14) |
31
(5) |
|
|
From: Ernest A. <ead...@gm...> - 2009-12-01 22:53:50
|
1/12/09 @ 09:16 (-0500), thus spake Michael Droettboom: > Subpixel rendering is almost never what you want when producing a > PNG file, since it is likely to be shared on a different machine > requiring different subpixel settings. But it looks like your > mozilla example is not using subpixel rendering either, though it > appears to have very strong hinting. Yes, it's not a subpixel rendering problem. I can tell that subpixel rendering is not enabled because I'm not seeing "rainbows", which I always see when it's enabled. It's definitely a hinting issue. > matplotlib's Agg backends borrows a technique used by Adobe Acrobat > which is to use strong hinting in the vertical direction, but more > subtle hinting in the horizontal. When we did a comprehensive > comparison of various hinting options about two years ago it was the > strong winner. See this: > > http://www.mail-archive.com/mat...@li.../msg01480.html > > (Unfortunately, the linked images are no longer available). > > If these settings are not to your liking, I would recommend the > Cairo backend (which should pull in the same settings as the rest of > your Gnome desktop, I believe), or one of the vector backends and > then tweaking the rendering. Confirmed. The GTK backend -haven't tried Cairo yet- honours the system settings for font rendering. It looks much better now, in my opinion. > Alternatively, we could provide this "stretched hinting" as a > configuration option. If you think that's superior to these other > options, please file a feature request so it doesn't get lost (and > it should be a fairly straightforward patch for someone new to the > code base.) Ok. I will open a feature request, if you think it's okay. I think I'll be sticking with the GTK backend for now, anyway. Thanks. Ernest |
From: Wayne W. <sie...@sb...> - 2009-12-01 16:51:38
|
I do not believe that any of those calculations are based on the pdf, frequency of occurrence-histogram. This, (1, 2,2, 4, 2,5,4) and not this (1,3, 0,2,1). The latter are the frequencies of occurrence for 1,2,3,4,5. John Hunter wrote: > On Tue, Dec 1, 2009 at 6:32 AM, Wayne Watson > <sie...@sb...> wrote: > >> Is there some statistics function that computes the mean, std. dev., min/max, etc. from a frequency distribution? >> > > numpy has many functions for basic descriptive statistics. If "data" > is an array of your data, you can do (import numpy as np) > > mean: np.mean(data) > median: np.median(data) > standard deviation: np.std(data) > min: np.min(data) > max: np.max(data) > > In scipy.stats, there are many more (skew, kurtosis, etc...) See > also, this example: > > > http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/py4science/examples/stats_descriptives.py?view=markup&pathrev=4027 > > JDH > > -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet The popular press and many authorities believe the number of pedofiles that prowl the web is 50,00. There are no figures that support this. The number of children below 18 years of age kidnapped by strangers is 1 in 600,000, or 115 per year. -- The Science of Fear by D. Gardner Web Page: <www.speckledwithstars.net/> |
From: Michael D. <md...@st...> - 2009-12-01 15:51:45
|
The PNG writer in matplotlib doesn't support writing of extended metadata. However, it may be less useful anyway, as while you can put arbitrary key/value pairs in a PNG file, I don't believe there's any standards for what the keys should be, so there aren't many tools that use it. (If I'm just not able to find it, point it out to me...) By contrast, many of the metadata fields in PDF are standardized so content management systems etc. do take advantage of them. Mike Marius Jan Klein wrote: > Thanks for your help concerning the pdf files! It was exactly what I was looking for. Is there anything similar for png-files? > > > > >> Marius Jan Klein <mjk524@ny...> writes: >> >> >>> I want to edit the metadata of pdf- or png-files when creating one of >>> these files. I do not want to use for example Pypdf because then >>> Python must read the file first before it can be edited. >>> > > > > >> Jouni K. Seppänen <jks@ik...> writes: >> >> Now there is (in the trunk, revision 7964), via the PdfPages mechanism: >> >> >from matplotlib.backends.backend_pdf import PdfPages >> >from pylab import * >> >>> pdf = PdfPages('testing.pdf') >>> plot([3,1,4]) >>> pdf.savefig() >>> d = pdf.infodict() >>> d['Title'] = 'Testing' >>> d['Author'] = u'Jouni K. Sepp\xe4nen' >>> pdf.close() >>> > > ------------------------------------------------------------------------------ > Join us December 9, 2009 for the Red Hat Virtual Experience, > a free event focused on virtualization and cloud computing. > Attend in-depth sessions from your desk. Your couch. Anywhere. > http://p.sf.net/sfu/redhat-sfdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
From: Michael (M. A. <ma...@ry...> - 2009-12-01 15:01:10
|
Sorry i was getting a bit frustrated by checking every day and seeing other problems getting solved relativly fast, again i understand its a big project, and i do appreciate your time, i hope i didn`t come off as a complete jerk. I figured since my suggested change would affect how others would interact with the existing function i should defer some interface design decisions to someone more familiar with the API and the interface philosophy before i would start suggesting my hacks to the code to get it to do what i want. again, i would love to build this functionality into the existing code, and it think it could be done via a good choice of kwargs parameters. Again i know how i can do this for my particular solution but how this should be done to minimize the effect on other users of the code i am not sure. thanks again for the response, i was going a bit crazy as i saw MPL as the perfect solution as it does just about everything i need except that one tiny variation in the surface command and i didn't want to rule it out its use in a user interface project i have work on in the coming months because of it. Mike ----- Original Message ----- From: John Hunter <jd...@gm...> Date: Monday, November 30, 2009 11:26 pm Subject: Re: [Matplotlib-users] Color in 3d plots To: Mike Alger <ma...@ry...> Cc: mat...@li..., Reinier Heeres <re...@he...> > On Mon, Nov 30, 2009 at 8:06 PM, Mike Alger <ma...@ry...> wrote: > > After a weekend of no replies I managed to figure a way out myself > > Hey Mike, sorry for the radio silence. mpl is a big project and no > one developer is equipped to answer questions about everything. We > currently have only one active developer (Reinier) working on the 3D > stuff. I've CCd him, and hopefully he can take a look at your patch. > > > > > 3.) If I do make a modification should it be as a separate > function with > > the additional variable or should I try to stuff the new capability > into the > > old function > > > > 4.) is there a clean easy to follow tutorial for submitting > changes via > > svn or can I rely on someone else to do the final commit? > > In general, if the new functionality is close to the old, we'd like to > see it incorporated into the existing API, perhaps with a new keyword > argument. We have some documentation on how to contribute to mpl at > http://matplotlib.sourceforge.net/devel/coding_guide.html; see also > the FAQ http://matplotlib.sourceforge.net/faq/howto_faq.html#contributing-howto > > > As this was “left to the reader as an exercise” I will leave the integration > > or improvement of this solution as an exercise to the next reader > > > > What I have done is basically cloned the plot surface function and replaced > > the avgz variable with a reference to the “colors” parameter i have > added to > > the function call. > > > > This code doesn’t center things perfectly with respect to the grid > (for > > some reason a 40x40 grid turns into 39x39 grid in the function) > again this > > is something else that could be improved, however I am happy with it > and a > > one pixel shift won’t be missed in my plots. I also have no real > clue as to > > what the following comments was about > > > > > > > > # The construction leaves the array with duplicate points, > > which > > > > # are removed here. > > > > > > > > but it is probably related to my non centered plots. > > > > What follows is the modified function : > > > > def plot_surface2(self, X, Y, Z, colors, *args, **kwargs): > > > What will be most helpful is an "svn diff", as explained in the coding > guide and FAQ linked above, with an example (included in the diff) > that shows the before and after behavior. That way even an naive > developer can appreciate the before and after changes and commit the > code if the original developer responsible for that part of the code > base is not available. The ideal situation is "apply this patch > generated from an svn diff and run example so_and_so.py to see the > plot with and without the patch". As explained in the FAQ, if you > don't get proper attention here on the mailing list, please post a bug > or patch on the sourceforge tracker so we don't lose it -- sometimes > our inattention is not due to lack of interest but to lack of time, > and a report filed on the tracker helps us not lose the thread. > > Thanks for the help! > > JDH |
From: Marius J. K. <mj...@ny...> - 2009-12-01 14:55:50
|
Thanks for your help concerning the pdf files! It was exactly what I was looking for. Is there anything similar for png-files? > Marius Jan Klein <mjk524@ny...> writes: > >> I want to edit the metadata of pdf- or png-files when creating one of >> these files. I do not want to use for example Pypdf because then >> Python must read the file first before it can be edited. >Jouni K. Seppänen <jks@ik...> writes: > >Now there is (in the trunk, revision 7964), via the PdfPages mechanism: > >>from matplotlib.backends.backend_pdf import PdfPages >>from pylab import * >>pdf = PdfPages('testing.pdf') >>plot([3,1,4]) >>pdf.savefig() >>d = pdf.infodict() >>d['Title'] = 'Testing' >>d['Author'] = u'Jouni K. Sepp\xe4nen' >>pdf.close() > |
From: Darren D. <dsd...@gm...> - 2009-12-01 14:38:49
|
On Mon, Nov 30, 2009 at 7:01 PM, Laurent Dufrechou <lau...@gm...> wrote: > Hi there, > > Finally with lot of try I've finally managed to make blitting of a cmap > working. > I've also patched QT4agg backend, to make a redraw immediately. > (replaced self.draw by self.repaint) > In my current project I was able to stream a 655KB network stream, do > demodulation of an IQ stream and display the spectrogram in real time (4096 > pixel per 1024) with matplotlib and QT4 backend, thx to the patch + blitting > example attached. > > Without patch, the refrech was veeery long. (waiting for QT loop to execute > code wen it wanted.) > And do NOT always work. If you've got a powerfull pc you've got chance to > see only white background... > (or simply the loop timer to 0, you will see that without patch blit does > not work). > > Only tested under windows currently, 'cause my project is on windows > currently... > > There is one bug in the example, that I didn't manage to correct yet. > Depending on screen resolution, the color of the cmap blitted area can be > kind of alpha'ed. (that is look like a little bit transparent...) , Any idea > on the root of this issue? > > By the way to make the example work I needed to do this: > self.ax2.draw_artist(self.line2) > self.blit(self.ax2.bbox) > self.restore_region(self.background2) > > that is blit before restore... don't understand why yet. > > Any comment welcomed. > > Is there any chance, after review, to find a way to include this in main > trunk? > What do think about this? I'm not able to comment on the other questions you raised, but the change to backend_qt4agg.py improved the behavior of the existing qt4 blit example (without your changes the axes labels were not drawn on my machine), so I checked the change into the trunk. Thank you! Darren |
From: Jorge S. <jor...@ya...> - 2009-12-01 14:24:00
|
Hi, How difficult would be to extend the Rectangle class so besides its permimeter it draws lines showing halfs or thirds of the width and height? I use rectangle to mark the locations of moving objects in sequences of images, and such lines would make the job easier. Thanks, Jorge |
From: Jorge S. <jor...@ya...> - 2009-12-01 14:23:51
|
Hi, I just had to label a sequence of images with the position and scale of a moving object. To do this I took the nice example from http://matplotlib.sourceforge.net/users/event_handling.html (the one using blitting) and extended to be resizeable. The extension is trivial, but it might be useful to someone. The code is inlined at the end of this message. Jorge # draggable rectangle with the animation blit techniques; see # http://www.scipy.org/Cookbook/Matplotlib/Animations import numpy as np import matplotlib.pyplot as plt class DraggableResizeableRectangle: """ Draggable and resizeable rectangle with the animation blit techniques. Based on example code at http://matplotlib.sourceforge.net/users/event_handling.html If *allow_resize* is *True* the recatngle can be resized by dragging its lines. *border_tol* specifies how close the pointer has to be to a line for the drag to be considered a resize operation. Dragging is still possible by clicking the interior of the rectangle. *fixed_aspect_ratio* determines if the recatngle keeps its aspect ratio during resize operations. """ lock = None # only one can be animated at a time def __init__(self, rect, border_tol=.15, allow_resize=True, fixed_aspect_ratio=True): self.rect = rect self.border_tol = border_tol self.allow_resize = allow_resize self.fixed_aspect_ratio = fixed_aspect_ratio self.press = None self.background = None def connect(self): 'connect to all the events we need' self.cidpress = self.rect.figure.canvas.mpl_connect( 'button_press_event', self.on_press) self.cidrelease = self.rect.figure.canvas.mpl_connect( 'button_release_event', self.on_release) self.cidmotion = self.rect.figure.canvas.mpl_connect( 'motion_notify_event', self.on_motion) def on_press(self, event): 'on button press we will see if the mouse is over us and store some data' if event.inaxes != self.rect.axes: return if DraggableRectangle.lock is not None: return contains, attrd = self.rect.contains(event) if not contains: return #print 'event contains', self.rect.xy x0, y0 = self.rect.xy w0, h0 = self.rect.get_width(), self.rect.get_height() aspect_ratio = np.true_divide(w0, h0) self.press = x0, y0, w0, h0, aspect_ratio, event.xdata, event.ydata DraggableRectangle.lock = self # draw everything but the selected rectangle and store the pixel buffer canvas = self.rect.figure.canvas axes = self.rect.axes self.rect.set_animated(True) canvas.draw() self.background = canvas.copy_from_bbox(self.rect.axes.bbox) # now redraw just the rectangle axes.draw_artist(self.rect) # and blit just the redrawn area canvas.blit(axes.bbox) def on_motion(self, event): 'on motion we will move the rect if the mouse is over us' if DraggableRectangle.lock is not self: return if event.inaxes != self.rect.axes: return x0, y0, w0, h0, aspect_ratio, xpress, ypress = self.press self.dx = event.xdata - xpress self.dy = event.ydata - ypress #self.rect.set_x(x0+dx) #self.rect.set_y(y0+dy) self.update_rect() canvas = self.rect.figure.canvas axes = self.rect.axes # restore the background region canvas.restore_region(self.background) # redraw just the current rectangle axes.draw_artist(self.rect) # blit just the redrawn area canvas.blit(axes.bbox) def on_release(self, event): 'on release we reset the press data' if DraggableRectangle.lock is not self: return self.press = None DraggableRectangle.lock = None # turn off the rect animation property and reset the background self.rect.set_animated(False) self.background = None # redraw the full figure self.rect.figure.canvas.draw() def disconnect(self): 'disconnect all the stored connection ids' self.rect.figure.canvas.mpl_disconnect(self.cidpress) self.rect.figure.canvas.mpl_disconnect(self.cidrelease) self.rect.figure.canvas.mpl_disconnect(self.cidmotion) def update_rect(self): x0, y0, w0, h0, aspect_ratio, xpress, ypress = self.press dx, dy = self.dx, self.dy bt = self.border_tol fixed_ar = self.fixed_aspect_ratio if (not self.allow_resize or (abs(x0+np.true_divide(w0,2)-xpress)<np.true_divide(w0,2)-bt*w0 and abs(y0+np.true_divide(h0,2)-ypress)<np.true_divide(h0,2)-bt*h0)): self.rect.set_x(x0+dx) self.rect.set_y(y0+dy) elif abs(x0-xpress)<bt*w0: self.rect.set_x(x0+dx) self.rect.set_width(w0-dx) if fixed_ar: dy = np.true_divide(dx, aspect_ratio) self.rect.set_y(y0+dy) self.rect.set_height(h0-dy) elif abs(x0+w0-xpress)<bt*w0: self.rect.set_width(w0+dx) if fixed_ar: dy = np.true_divide(dx, aspect_ratio) self.rect.set_height(h0+dy) elif abs(y0-ypress)<bt*h0: self.rect.set_y(y0+dy) self.rect.set_height(h0-dy) if fixed_ar: dx = dy*aspect_ratio self.rect.set_x(x0+dx) self.rect.set_width(w0-dx) elif abs(y0+h0-ypress)<bt*h0: self.rect.set_height(h0+dy) if fixed_ar: dx = dy*aspect_ratio self.rect.set_width(w0+dx) fig = plt.figure() ax = fig.add_subplot(111) rects = ax.bar(range(10), 20*np.random.rand(10)) drs = [] for rect in rects: dr = DraggableResizeableRectangle(rect) dr.connect() drs.append(dr) plt.show() |
From: Michael D. <md...@st...> - 2009-12-01 14:16:58
|
Subpixel rendering is almost never what you want when producing a PNG file, since it is likely to be shared on a different machine requiring different subpixel settings. But it looks like your mozilla example is not using subpixel rendering either, though it appears to have very strong hinting. matplotlib's Agg backends borrows a technique used by Adobe Acrobat which is to use strong hinting in the vertical direction, but more subtle hinting in the horizontal. When we did a comprehensive comparison of various hinting options about two years ago it was the strong winner. See this: http://www.mail-archive.com/mat...@li.../msg01480.html (Unfortunately, the linked images are no longer available). If these settings are not to your liking, I would recommend the Cairo backend (which should pull in the same settings as the rest of your Gnome desktop, I believe), or one of the vector backends and then tweaking the rendering. Alternatively, we could provide this "stretched hinting" as a configuration option. If you think that's superior to these other options, please file a feature request so it doesn't get lost (and it should be a fairly straightforward patch for someone new to the code base.) Mike Darren Dale wrote: > On Tue, Dec 1, 2009 at 6:37 AM, Ernest Adrogué <ead...@gm...> wrote: > >> 30/11/09 @ 22:28 (-0600), thus spake John Hunter: >> >>> The two examples in the page you link to have different font sizes and >>> possibly different font weights, which makes it difficult to do >>> side-by-side comparisons. Could you post an example with >>> similar/identical settings? >>> >> Yes, I have attached another example with different font sizes >> (8,9,10). The exact weight is impossible to replicate, I tried with >> "light" and "normal". >> >> I think that the problem might be the lack of hinting. In my >> fonts.conf file I have both "hinting" and "autohinting" enabled. if >> I disable these options then the fonts in other applications resemble >> a lot the ones I am getting now with mpl. >> > > I am pretty sure the issue here is subpixel rendering. Try comparing > the output of the gtkagg backend, which does not do subpixel > rendering, with that of gtkcairo, which does. > > Darren > > ------------------------------------------------------------------------------ > Join us December 9, 2009 for the Red Hat Virtual Experience, > a free event focused on virtualization and cloud computing. > Attend in-depth sessions from your desk. Your couch. Anywhere. > http://p.sf.net/sfu/redhat-sfdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
From: John H. <jd...@gm...> - 2009-12-01 12:48:42
|
On Tue, Dec 1, 2009 at 6:32 AM, Wayne Watson <sie...@sb...> wrote: > Is there some statistics function that computes the mean, std. dev., min/max, etc. from a frequency distribution? numpy has many functions for basic descriptive statistics. If "data" is an array of your data, you can do (import numpy as np) mean: np.mean(data) median: np.median(data) standard deviation: np.std(data) min: np.min(data) max: np.max(data) In scipy.stats, there are many more (skew, kurtosis, etc...) See also, this example: http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/py4science/examples/stats_descriptives.py?view=markup&pathrev=4027 JDH |
From: Darren D. <dsd...@gm...> - 2009-12-01 12:42:09
|
On Tue, Dec 1, 2009 at 6:37 AM, Ernest Adrogué <ead...@gm...> wrote: > 30/11/09 @ 22:28 (-0600), thus spake John Hunter: >> The two examples in the page you link to have different font sizes and >> possibly different font weights, which makes it difficult to do >> side-by-side comparisons. Could you post an example with >> similar/identical settings? > > Yes, I have attached another example with different font sizes > (8,9,10). The exact weight is impossible to replicate, I tried with > "light" and "normal". > > I think that the problem might be the lack of hinting. In my > fonts.conf file I have both "hinting" and "autohinting" enabled. if > I disable these options then the fonts in other applications resemble > a lot the ones I am getting now with mpl. I am pretty sure the issue here is subpixel rendering. Try comparing the output of the gtkagg backend, which does not do subpixel rendering, with that of gtkcairo, which does. Darren |
From: Wayne W. <sie...@sb...> - 2009-12-01 12:33:47
|
Is there some statistics function that computes the mean, std. dev., min/max, etc. from a frequency distribution? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet The popular press and many authorities believe the number of pedifiles that prowl the web is 50,00. There are no figures that support this. The number of children below 18 years of age kidnapped by strangers is 1 in 600,00, or 115 per year. -- The Science of Fear by D. Gardner Web Page: <www.speckledwithstars.net/> |
From: Ernest A. <ead...@gm...> - 2009-12-01 11:37:43
|
30/11/09 @ 22:28 (-0600), thus spake John Hunter: > The two examples in the page you link to have different font sizes and > possibly different font weights, which makes it difficult to do > side-by-side comparisons. Could you post an example with > similar/identical settings? Yes, I have attached another example with different font sizes (8,9,10). The exact weight is impossible to replicate, I tried with "light" and "normal". I think that the problem might be the lack of hinting. In my fonts.conf file I have both "hinting" and "autohinting" enabled. if I disable these options then the fonts in other applications resemble a lot the ones I am getting now with mpl. Bye. |
From: marcusantonius <mar...@st...> - 2009-12-01 11:07:51
|
I am searching a way, so that I can insert my matplotlib graphs as vector data in openoffice. I make colormaps using pcolorfast. If I save the figure as emf, the colormap inside the axes vanishes, because the normal emf backend cannot include rasterized data. Is there any way (e.g. using a different backend) which gives emf/wmf files which contain the rasterized data? Is there a convertor from svg to emf which can do the trick? (I tried uniconvertor but it also looses the rasterized data). I tried to insert svg/eps/pdf files into openoffice, but the results are less than promising -- View this message in context: http://old.nabble.com/Output-to-any-vector-format-openoffice-can-use-tp26589911p26589911.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: John H. <jd...@gm...> - 2009-12-01 04:28:45
|
On Mon, Nov 30, 2009 at 6:38 PM, Ernest Adrogué <ead...@gm...> wrote: > Hi, > I notice a big difference in quality between the text rendered > by matplotlib and that rendered by the rest of applications. > As an example, see the image attached showing the same font as > shown by firefox and matplotlib respectively. > Is there any config setting I can change to improve the font > rendering or anything? The two examples in the page you link to have different font sizes and possibly different font weights, which makes it difficult to do side-by-side comparisons. Could you post an example with similar/identical settings? JDH |
From: John H. <jd...@gm...> - 2009-12-01 04:26:19
|
On Mon, Nov 30, 2009 at 8:06 PM, Mike Alger <ma...@ry...> wrote: > After a weekend of no replies I managed to figure a way out myself Hey Mike, sorry for the radio silence. mpl is a big project and no one developer is equipped to answer questions about everything. We currently have only one active developer (Reinier) working on the 3D stuff. I've CCd him, and hopefully he can take a look at your patch. > > 3.) If I do make a modification should it be as a separate function with > the additional variable or should I try to stuff the new capability into the > old function > > 4.) is there a clean easy to follow tutorial for submitting changes via > svn or can I rely on someone else to do the final commit? In general, if the new functionality is close to the old, we'd like to see it incorporated into the existing API, perhaps with a new keyword argument. We have some documentation on how to contribute to mpl at http://matplotlib.sourceforge.net/devel/coding_guide.html; see also the FAQ http://matplotlib.sourceforge.net/faq/howto_faq.html#contributing-howto > As this was “left to the reader as an exercise” I will leave the integration > or improvement of this solution as an exercise to the next reader > > What I have done is basically cloned the plot surface function and replaced > the avgz variable with a reference to the “colors” parameter i have added to > the function call. > > This code doesn’t center things perfectly with respect to the grid (for > some reason a 40x40 grid turns into 39x39 grid in the function) again this > is something else that could be improved, however I am happy with it and a > one pixel shift won’t be missed in my plots. I also have no real clue as to > what the following comments was about > > > > # The construction leaves the array with duplicate points, > which > > # are removed here. > > > > but it is probably related to my non centered plots. > > What follows is the modified function : > > def plot_surface2(self, X, Y, Z, colors, *args, **kwargs): What will be most helpful is an "svn diff", as explained in the coding guide and FAQ linked above, with an example (included in the diff) that shows the before and after behavior. That way even an naive developer can appreciate the before and after changes and commit the code if the original developer responsible for that part of the code base is not available. The ideal situation is "apply this patch generated from an svn diff and run example so_and_so.py to see the plot with and without the patch". As explained in the FAQ, if you don't get proper attention here on the mailing list, please post a bug or patch on the sourceforge tracker so we don't lose it -- sometimes our inattention is not due to lack of interest but to lack of time, and a report filed on the tracker helps us not lose the thread. Thanks for the help! JDH |
From: John H. <jd...@gm...> - 2009-12-01 03:59:05
|
On Mon, Nov 30, 2009 at 9:04 PM, Jason Heeris <jas...@gm...> wrote: > Is it at all possible to have figimage draw the image OVER the top of > the plot area? Currently I can only get it to draw underneath — even > if I set the frame alpha to zero, it is obscured by the grid. This can > be seen from the test code below: I added support for zorder at the level of figure artists to svn HEAD. It is not a complete solution, but should be better than what we had before, and should handle your use case. The reason it is not complete is that it treats the Axes at the Figure level as a *single* artist, so draws every artist contained in the Axes at the same relative figure order (relative orders among Axes artists are still respected). But you can now specify the zorder of all artists contained by the figure, as shown in the attached example which puts the figimages above the axes. Some of this code is particularly tricky and difficult to get right across use cases (eg composite figimages) and this is exacerbated by the fact that this part of the codebase is lightly used. So testing will be helpful. I'm also posting an svn diff for other devs to review. Index: lib/matplotlib/pyplot.py =================================================================== --- lib/matplotlib/pyplot.py (revision 7992) +++ lib/matplotlib/pyplot.py (revision 7994) @@ -401,7 +401,7 @@ # allow callers to override the hold state by passing hold=True|False ret = gcf().figimage(*args, **kwargs) draw_if_interactive() - sci(ret) + #sci(ret) # JDH figimage should not set current image -- it is not mappable, etc return ret def figlegend(handles, labels, loc, **kwargs): Index: lib/matplotlib/figure.py =================================================================== --- lib/matplotlib/figure.py (revision 7992) +++ lib/matplotlib/figure.py (revision 7994) @@ -343,7 +343,8 @@ cmap=None, vmin=None, vmax=None, - origin=None): + origin=None, + **kwargs): """ call signatures:: @@ -393,11 +394,14 @@ .. plot:: mpl_examples/pylab_examples/figimage_demo.py + + Additional kwargs are Artist kwargs passed on to + :class:`~matplotlib.image.FigureImage` """ if not self._hold: self.clf() - im = FigureImage(self, cmap, norm, xo, yo, origin) + im = FigureImage(self, cmap, norm, xo, yo, origin, **kwargs) im.set_array(X) im.set_alpha(alpha) if norm is None: @@ -735,11 +739,20 @@ if self.frameon: self.patch.draw(renderer) + # a list of (zorder, func_to_call, list_of_args) + dsu = [] + + # todo: respect zorder - for p in self.patches: p.draw(renderer) - for l in self.lines: l.draw(renderer) - for a in self.artists: a.draw(renderer) + for a in self.patches: + dsu.append( (a.get_zorder(), a.draw, [renderer])) + for a in self.lines: + dsu.append( (a.get_zorder(), a.draw, [renderer])) + + for a in self.artists: + dsu.append( (a.get_zorder(), a.draw, [renderer])) + # override the renderer default if self.suppressComposite # is not None composite = renderer.option_image_nocomposite() @@ -747,8 +760,8 @@ composite = self.suppressComposite if len(self.images)<=1 or composite or not allequal([im.origin for im in self.images]): - for im in self.images: - im.draw(renderer) + for a in self.images: + dsu.append( (a.get_zorder(), a.draw, [renderer])) else: # make a composite image blending alpha # list of (_image.Image, ox, oy) @@ -762,21 +775,33 @@ im.is_grayscale = False l, b, w, h = self.bbox.bounds - gc = renderer.new_gc() - gc.set_clip_rectangle(self.bbox) - gc.set_clip_path(self.get_clip_path()) - renderer.draw_image(gc, l, b, im) - gc.restore() + def draw_composite(): + gc = renderer.new_gc() + gc.set_clip_rectangle(self.bbox) + gc.set_clip_path(self.get_clip_path()) + renderer.draw_image(gc, l, b, im) + gc.restore() + + if len(ims): + dsu.append((ims[0].get_zorder(), draw_composite, [])) + # render the axes - for a in self.axes: a.draw(renderer) + for a in self.axes: + dsu.append( (a.get_zorder(), a.draw, [renderer])) # render the figure text - for t in self.texts: t.draw(renderer) + for a in self.texts: + dsu.append( (a.get_zorder(), a.draw, [renderer])) - for legend in self.legends: - legend.draw(renderer) + for a in self.legends: + dsu.append( (a.get_zorder(), a.draw, [renderer])) + + dsu.sort() + for zorder, func, args in dsu: + func(*args) + |
From: William C. <wcc...@lb...> - 2009-12-01 03:46:53
|
Hi John, Yes, that is true if the data is truly gaussian. In my case, I know that the data have non-gaussian tails which tend to dominate the calculation of the standard deviation. I should have been clearer in my post that what I actually wanted to do was fit a gaussian to the truncated "central" part of the distribution so that I was not so sensitive to the tails. A better statement of the problem is that I would like to fit a gaussian to the part of the data that I suspect is actually gaussian while ignoring the part that isn't. Unfortunately, if I calculate the standard deviation for the truncated distribution, then I will underestimate the "sigma" parameter of the gaussian needed to get a good fit. I'll take at the scipy.stats.norm . Thanks for your help. Bill On 11/30/09 7:22 PM, "John Hunter" <jd...@gm...> wrote: > On Mon, Nov 30, 2009 at 6:44 PM, William Carithers <wcc...@lb...> > wrote: >> I would like to fit a gaussian to a histogram and then overplot it. I can >> write the code to do this but most plotting packages support such fitting. >> However I can't find it for pyplot even after scanning documentation, >> googling, etc. In fact, the only fitting functionality I could find was the >> polynomial fitting for numpy that is layered underneath matplotlib, i.e. >> Numpy.polyfit(...). >> >> Does anyone know if/how this might be built into matplotlib? > > For a Gaussian distribution, the best fit is provided by the normal > distribution which has the same mean and stddev as your empirical data > (this is not true in general for other distributions). Once you have > the mean and stddev from the data, you can use normpdf to plot the > analytic density -- see for example > > http://matplotlib.sourceforge.net/search.html?q=normpdf > > For more powerful density fitting and sampling, see scipy.stats > functions, eg scipy.stats.norm.fit > > JDH |
From: John H. <jd...@gm...> - 2009-12-01 03:22:53
|
On Mon, Nov 30, 2009 at 6:44 PM, William Carithers <wcc...@lb...> wrote: > I would like to fit a gaussian to a histogram and then overplot it. I can > write the code to do this but most plotting packages support such fitting. > However I can't find it for pyplot even after scanning documentation, > googling, etc. In fact, the only fitting functionality I could find was the > polynomial fitting for numpy that is layered underneath matplotlib, i.e. > Numpy.polyfit(...). > > Does anyone know if/how this might be built into matplotlib? For a Gaussian distribution, the best fit is provided by the normal distribution which has the same mean and stddev as your empirical data (this is not true in general for other distributions). Once you have the mean and stddev from the data, you can use normpdf to plot the analytic density -- see for example http://matplotlib.sourceforge.net/search.html?q=normpdf For more powerful density fitting and sampling, see scipy.stats functions, eg scipy.stats.norm.fit JDH |
From: Jason H. <jas...@gm...> - 2009-12-01 03:04:34
|
Hi, Is it at all possible to have figimage draw the image OVER the top of the plot area? Currently I can only get it to draw underneath — even if I set the frame alpha to zero, it is obscured by the grid. This can be seen from the test code below: ---- testplot.py ---- #!/usr/bin/python import numpy as np import matplotlib.pyplot as plt Z = np.arange(10000.0) Z.shape = 100,100 Z[:,50:] = 1. dpi = 80.0 width = 600 height = 480 data = zip(*[(x, x**2) for x in range(0, 100)]) fig = plt.figure() ax1 = fig.add_axes([0.12,0.1,0.83,0.85]) plt.plot(data[0], data[1]) # This doesn't help, the grid still gets in the way... ax1.get_frame().set_alpha(0) ax1.grid(True, color='0.78', linestyle='-', lw=((1.0/dpi)*72)) logo_fig = fig.figimage(Z, 100, 100) fig.set_size_inches(width/dpi,height/dpi) fig.set_dpi(dpi) fig.savefig("test.png", dpi=dpi) ---- So far, my best workaround is to use transform_point(...) to work out the position that I want, and run imagemagick in a subprocess when I'm done. I'd appreciate any help. Cheers, Jason |
From: Mike A. <ma...@ry...> - 2009-12-01 02:06:42
|
After a weekend of no replies I managed to figure a way out myself As this was "left to the reader as an exercise" I will leave the integration or improvement of this solution as an exercise to the next reader What I have done is basically cloned the plot surface function and replaced the avgz variable with a reference to the "colors" parameter i have added to the function call. This code doesn't center things perfectly with respect to the grid (for some reason a 40x40 grid turns into 39x39 grid in the function) again this is something else that could be improved, however I am happy with it and a one pixel shift won't be missed in my plots. I also have no real clue as to what the following comments was about # The construction leaves the array with duplicate points, which # are removed here. but it is probably related to my non centered plots. What follows is the modified function : def plot_surface2(self, X, Y, Z, colors, *args, **kwargs): ''' Create a surface plot. By default it will be colored in shades of a solid color, but it also supports color mapping by supplying the *cmap* argument. ========== ================================================ Argument Description ========== ================================================ *X*, *Y*, Data values as numpy.arrays *Z* *colors* an array the same size as z that contains a separate color data *rstride* Array row stride (step size) *cstride* Array column stride (step size) *color* Color of the surface patches *cmap* A colormap for the surface patches. ========== ================================================ ''' had_data = self.has_data() rows, cols = Z.shape tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z) rstride = kwargs.pop('rstride', 10) cstride = kwargs.pop('cstride', 10) color = kwargs.pop('color', 'b') color = np.array(colorConverter.to_rgba(color)) cmap = kwargs.get('cmap', None) polys = [] normals = [] avgz = [] for rs in np.arange(0, rows-1, rstride): for cs in np.arange(0, cols-1, cstride): ps = [] corners = [] for a, ta in [(X, tX), (Y, tY), (Z, tZ)]: ztop = a[rs][cs:min(cols, cs+cstride+1)] zleft = ta[min(cols-1, cs+cstride)][rs:min(rows, rs+rstride+1)] zbase = a[min(rows-1, rs+rstride)][cs:min(cols, cs+cstride+1):] zbase = zbase[::-1] zright = ta[cs][rs:min(rows, rs+rstride+1):] zright = zright[::-1] corners.append([ztop[0], ztop[-1], zbase[0], zbase[-1]]) z = np.concatenate((ztop, zleft, zbase, zright)) ps.append(z) # The construction leaves the array with duplicate points, which # are removed here. ps = zip(*ps) lastp = np.array([]) ps2 = [] avgzsum = 0.0 for p in ps: if p != lastp: ps2.append(p) lastp = p avgzsum += p[2] polys.append(ps2) ################################## Begin of changes ################################## #avgz.append(avgzsum / len(ps2)) avgz.append(colors[rs][cs]) ################################## end of changes ################################## v1 = np.array(ps2[0]) - np.array(ps2[1]) v2 = np.array(ps2[2]) - np.array(ps2[0]) normals.append(np.cross(v1, v2)) polyc = art3d.Poly3DCollection(polys, *args, **kwargs) if cmap is not None: # polyc.set_array(np.array(colors)) polyc.set_array(np.array(avgz)) polyc.set_linewidth(0) else: colors = self._shade_colors(color, normals) polyc.set_facecolors(colors) self.add_collection(polyc) self.auto_scale_xyz(X, Y, Z, had_data) return polyc From: Mike Alger [mailto:ma...@ry...] Sent: November-25-09 8:42 PM To: mat...@li... Subject: Re: [Matplotlib-users] Color in 3d plots I have been looking at this for the past day and in am pretty sure I could replace the instance of polyc by the "cmap if statements" my colour array and I should be able to get close to what I want. However I am new to both python & mpl, and I am not entirely sure in how I would go about testing my hypothesis. Furthermore I am also relatively new to submitting fixes to open-source projects so I have lots of questions about how I would go about suggesting a modification. 1.) can I just modify the file in the C:\python26\Lib\site-packages\mpl-toolkits\mplot3d\axes3d.py file to do my tests? a. Also, where are these files usually kept in a linux environment ? b. What do I do with the. pyc files with the same name? are they re-complied automatically when I call the function externally? 2.) Is this capability already built in with the colour argument ? if so how do I properly call it? 3.) If I do make a modification should it be as a separate function with the additional variable or should I try to stuff the new capability into the old function 4.) is there a clean easy to follow tutorial for submitting changes via svn or can I rely on someone else to do the final commit? I have attached the function in question for reference to save others from digging down into their python directories Again thanks for taking your time to help me figure this out Mike Alger < Code> def plot_surface(self, X, Y, Z, *args, **kwargs): ''' Create a surface plot. By default it will be colored in shades of a solid color, but it also supports color mapping by supplying the *cmap* argument. ========== ================================================ Argument Description ========== ================================================ *X*, *Y*, Data values as numpy.arrays *Z* *rstride* Array row stride (step size) *cstride* Array column stride (step size) *color* Color of the surface patches *cmap* A colormap for the surface patches. ========== ================================================ ''' had_data = self.has_data() rows, cols = Z.shape tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z) rstride = kwargs.pop('rstride', 10) cstride = kwargs.pop('cstride', 10) color = kwargs.pop('color', 'b') color = np.array(colorConverter.to_rgba(color)) cmap = kwargs.get('cmap', None) polys = [] normals = [] avgz = [] for rs in np.arange(0, rows-1, rstride): for cs in np.arange(0, cols-1, cstride): ps = [] corners = [] for a, ta in [(X, tX), (Y, tY), (Z, tZ)]: ztop = a[rs][cs:min(cols, cs+cstride+1)] zleft = ta[min(cols-1, cs+cstride)][rs:min(rows, rs+rstride+1)] zbase = a[min(rows-1, rs+rstride)][cs:min(cols, cs+cstride+1):] zbase = zbase[::-1] zright = ta[cs][rs:min(rows, rs+rstride+1):] zright = zright[::-1] corners.append([ztop[0], ztop[-1], zbase[0], zbase[-1]]) z = np.concatenate((ztop, zleft, zbase, zright)) ps.append(z) # The construction leaves the array with duplicate points, which # are removed here. ps = zip(*ps) lastp = np.array([]) ps2 = [] avgzsum = 0.0 for p in ps: if p != lastp: ps2.append(p) lastp = p avgzsum += p[2] polys.append(ps2) avgz.append(avgzsum / len(ps2)) v1 = np.array(ps2[0]) - np.array(ps2[1]) v2 = np.array(ps2[2]) - np.array(ps2[0]) normals.append(np.cross(v1, v2)) polyc = art3d.Poly3DCollection(polys, *args, **kwargs) ## this is where a modification could be made to allow for a separate colour matrix if cmap is not None: polyc.set_array(np.array(avgz)) polyc.set_linewidth(0) else: colors = self._shade_colors(color, normals) polyc.set_facecolors(colors) self.add_collection(polyc) self.auto_scale_xyz(X, Y, Z, had_data) return polyc </Code> From: Mike Alger [mailto:mik...@ng...] Sent: November-23-09 3:42 PM To: mat...@li... Subject: [Matplotlib-users] Color in 3d plots This may be a dumb question, however I have been scratching my head trying to figure out how to plot a 3 dimensional plot with with a colour map different from the elevation(Z) parameter. An example of this done in Matlab would be [X,Y,Z] = peaks(30); C=Z'% could be anything other than Z as long as it has the same dimensions surf(X,Y,Z,C) axis([-3 3 -3 3 -10 5]) Is this possible with matplotlib '0.99.1' If so how do i go about doing this is there some sample code? Mike Alger, M.A.Sc ma...@ry... |
From: William C. <wcc...@lb...> - 2009-12-01 00:45:00
|
I would like to fit a gaussian to a histogram and then overplot it. I can write the code to do this but most plotting packages support such fitting. However I can't find it for pyplot even after scanning documentation, googling, etc. In fact, the only fitting functionality I could find was the polynomial fitting for numpy that is layered underneath matplotlib, i.e. Numpy.polyfit(...). Does anyone know if/how this might be built into matplotlib? Thanks, Bill |
From: Ernest A. <ead...@gm...> - 2009-12-01 00:38:34
|
Hi, I notice a big difference in quality between the text rendered by matplotlib and that rendered by the rest of applications. As an example, see the image attached showing the same font as shown by firefox and matplotlib respectively. Is there any config setting I can change to improve the font rendering or anything? Cheers. |
From: Laurent D. <lau...@gm...> - 2009-12-01 00:02:10
|
Hi there, Finally with lot of try I've finally managed to make blitting of a cmap working. I've also patched QT4agg backend, to make a redraw immediately. (replaced self.draw by self.repaint) In my current project I was able to stream a 655KB network stream, do demodulation of an IQ stream and display the spectrogram in real time (4096 pixel per 1024) with matplotlib and QT4 backend, thx to the patch + blitting example attached. Without patch, the refrech was veeery long. (waiting for QT loop to execute code wen it wanted.) And do NOT always work. If you've got a powerfull pc you've got chance to see only white background... (or simply the loop timer to 0, you will see that without patch blit does not work). Only tested under windows currently, 'cause my project is on windows currently... There is one bug in the example, that I didn't manage to correct yet. Depending on screen resolution, the color of the cmap blitted area can be kind of alpha'ed. (that is look like a little bit transparent...) , Any idea on the root of this issue? By the way to make the example work I needed to do this: self.ax2.draw_artist(self.line2) self.blit(self.ax2.bbox) self.restore_region(self.background2) that is blit before restore... don't understand why yet. Any comment welcomed. Is there any chance, after review, to find a way to include this in main trunk? What do think about this? Cheers, Laurent |