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
(20) |
2
(16) |
3
(9) |
4
(12) |
5
(14) |
6
(22) |
7
(17) |
8
(33) |
9
(26) |
10
(32) |
11
(47) |
12
(26) |
13
(7) |
14
(24) |
15
(44) |
16
(42) |
17
(22) |
18
(31) |
19
(8) |
20
(4) |
21
(15) |
22
(27) |
23
(41) |
24
(33) |
25
(31) |
26
(24) |
27
(10) |
28
(20) |
|
|
|
|
|
|
Hi all, One of the most persistent problems I have with matplotlib is finding out which kwargs and args are available for some commands. For instance, I am looking at manipulating axis ticks and labels in mplot3d, so I went to the mplot3d api page, and looked for useful commands and found: set_xlabel(xlabel, fontdict=None, **kwargs)¶ Set xlabel. set_xlim3d(*args, **kwargs)¶ Set 3D x limits. However, there is no information that I can find about "args" and "kwargs" that I can use to figure out how to make my changes. For the record, I want to be able to change the size of the font, the # and values of the tick marks, and to move the axis labels to one or the other end of the axis they are labelling. Cheers Michael
Sourav K. Mandal wrote: > Hello, > > (This is a different question for the same project that led me to file a > bug about alpha blending in "contour" .) > > I want to overlay a number of exclusion regions in a 2D parameter scan. > I generate each region with contourf in succession, like: > > contourf(x,y,unphys,(1),alpha=1,colors=('w','k')) > contourf(x,y,excl,(1),alpha=0.5,colors=('w','m')) > ... > > The problem as you might guess is that if I overlay many regions, the > white level at each new region washes out the underlying non-white > colors. > > Is there a "transparent" color I can use instead of white? Or, is there > an alternative way to overlay regions that avoids this problem? > Until a grand reworking of the alpha mess occurs, here is a (verbose) workaround showing how to set regions to be uncolored (transparent): In [3]:cs = contourf(rand(10,10), colors=('r', 'g', 'b')) In [4]:cs.levels Out[4]:array([ 0. , 0.15, 0.3 , 0.45, 0.6 , 0.75, 0.9 , 1.05]) In [5]:cs.collections Out[5]:<a list of 7 collections.PathCollection objects> In [6]:cst = cs.collections[::3] In [7]:for c in cst: ...: c.set_color('none') ...: ...: In [8]:draw() Alternatively, and more simply, why make the transparent regions in the first place? cs = contourf(rand(10,10), [0.5, 0.7], colors=('b')) Here we specify a single pair of limits between which the color will be blue. Eric
Hello, (This is a different question for the same project that led me to file a bug about alpha blending in "contour" .) I want to overlay a number of exclusion regions in a 2D parameter scan. I generate each region with contourf in succession, like: contourf(x,y,unphys,(1),alpha=1,colors=('w','k')) contourf(x,y,excl,(1),alpha=0.5,colors=('w','m')) ... The problem as you might guess is that if I overlay many regions, the white level at each new region washes out the underlying non-white colors. Is there a "transparent" color I can use instead of white? Or, is there an alternative way to overlay regions that avoids this problem? Thank you again! Best, Sourav
Works for me! Although I did not test with Jorges's original code which caused the regression. Do you still want me to file a bug report so the issue is tracked? Thanks, -Ben -----Original Message----- From: John Hunter [mailto:jd...@gm...] Sent: Monday, February 01, 2010 5:47 PM To: Jae-Joon Lee Cc: Ben Axelrod; mat...@li... Subject: Re: [Matplotlib-users] Label picker broken? Importance: Low On Mon, Feb 1, 2010 at 4:34 PM, John Hunter <jd...@gm...> wrote: > On Mon, Feb 1, 2010 at 3:47 PM, Jae-Joon Lee <lee...@gm...> wrote: > >> I agree. >> Unfortunately, event handling is not my specialty, and given no >> response from other developers, I recommend you file a bug (and hope >> other developers fix this). > > I wrote the original functionality and example and do consider this a > regression, so do file a bug report and I'll try and get it fixed. Here is the bug report and fix that caused the current regression http://www.mail-archive.com/mat...@li.../msg11806.html The solution I propose is to do the axes comparison test only when the mouseevent.inaxes is not None (which happens when you are outside the axes rectangle). Then you could pick artists associated with an axes that are outside the rectangle, and still not get confused between two different axes with the same coord system. Try svn r8106. JDH
On Mon, Feb 1, 2010 at 4:34 PM, John Hunter <jd...@gm...> wrote: > On Mon, Feb 1, 2010 at 3:47 PM, Jae-Joon Lee <lee...@gm...> wrote: > >> I agree. >> Unfortunately, event handling is not my specialty, and given no response >> from other developers, I recommend you file a bug (and hope other developers >> fix this). > > I wrote the original functionality and example and do consider this a > regression, so do file a bug report and I'll try and get it fixed. Here is the bug report and fix that caused the current regression http://www.mail-archive.com/mat...@li.../msg11806.html The solution I propose is to do the axes comparison test only when the mouseevent.inaxes is not None (which happens when you are outside the axes rectangle). Then you could pick artists associated with an axes that are outside the rectangle, and still not get confused between two different axes with the same coord system. Try svn r8106. JDH
On Mon, Feb 1, 2010 at 3:47 PM, Jae-Joon Lee <lee...@gm...> wrote: > I agree. > Unfortunately, event handling is not my specialty, and given no response > from other developers, I recommend you file a bug (and hope other developers > fix this). I wrote the original functionality and example and do consider this a regression, so do file a bug report and I'll try and get it fixed. JDH
On Mon, Feb 1, 2010 at 4:30 PM, Ben Axelrod <BAx...@co...> wrote: > This still seems like a regression bug to me. Especially since > matplotlib's own example code clearly shows that picking labels, titles, and > tick labels outside the axes region should be possible with the standard > picker. If the current picker behavior is the desired behavior, then the > example code should at least be updated to show the new way to pick objects > outside the axes. > I agree. Unfortunately, event handling is not my specialty, and given no response from other developers, I recommend you file a bug (and hope other developers fix this). Regards, -JJ
Here is a slightly revised version of your script. It has a separate axes for labeling whose width is determined by the maximum width of the labels (using MaxExtent from axes_grid toolkit). Give it a try and see if it fits your needs. Regards, -JJ import numpy as np import matplotlib.pyplot as plt from scipy.stats import gamma from mpl_toolkits.axes_grid import make_axes_locatable fig = plt.figure(1, (10, 10)) ax1 = fig.add_subplot(1, 1, 1) labels = ('0-9', '10-19', '20-29', '30-39', '40-49', '50-59', '60-69', '70-79', '80-89', '90-99') pad = np.max([len(i) for i in labels]) * .15 divider = make_axes_locatable(ax1) from mpl_toolkits.axes_grid.axes_size import MaxExtent labeltexts = [] labelextent = MaxExtent(labeltexts, "width") padsmall=0.1 label_axes = divider.new_horizontal(size=labelextent, pad=padsmall, sharey=ax1, frame_on=False) label_axes.xaxis.set_visible(False) label_axes.yaxis.set_visible(False) fig.add_axes(label_axes) ax2 = divider.new_horizontal(size="100%", pad=padsmall, sharey=ax1) fig.add_axes(ax2) N = 10 ind = np.arange(N) # the x locations for the groups width = 0.35 # the width of the bars x = [gamma.pdf(i, 1, scale=2) for i in range(N)] y = [gamma.pdf(i, 5, scale=1) for i in range(N)] ind = np.arange(N) ax1.barh(ind, x, align="center") ax2.barh(ind, y, align="center") for loc, spine in ax1.spines.iteritems(): if loc in ['left','top']: spine.set_color('none') # don't draw spine for loc, spine in ax2.spines.iteritems(): if loc in ['right','top']: spine.set_color('none') # don't draw spine ax1.set_title('Men') ax2.set_title('Women') ax1.set_ylim(-0.5, N-0.5) #ax2.set_ylim(0, N) # Name bars ax1.set_yticks(ind) ax1.xaxis.set_ticks_position('bottom') ax2.xaxis.set_ticks_position('bottom') ax1.yaxis.set_ticks_position('right') ax2.yaxis.set_ticks_position('left') for tl in ax1.get_yticklabels()+ax2.get_yticklabels(): tl.set_visible(False) for i, l in zip(ind, labels): l = label_axes.annotate("$%s$"%l, (0.5, i), ha="center", va="center") labeltexts.append(l) ax1.set_xlim(0.5, 0) ax2.set_xlim(0, 0.5) plt.show() On Sun, Jan 31, 2010 at 7:40 PM, Renato Alves <rj...@ig...> wrote: > Hi everyone > > I've been going around matplotlib objects trying to find a way to > pre-calculate positions depending on input. > > I'm trying to create a function that draws two barplots facing opposite > directions. > > This is what I managed so far: > > ### > > import numpy as np > import matplotlib.pyplot as plt > from scipy.stats import gamma > from mpl_toolkits.axes_grid import make_axes_locatable > > fig = plt.figure(1, (10, 10)) > ax1 = fig.add_subplot(1, 1, 1) > > ax1.set_xlim(1,0) > > labels = ('0-9', '10-19', '20-29', '30-39', '40-49', > '50-59', '60-69', '70-79', '80-89', '90-99') > > pad = np.max([len(i) for i in labels]) * .15 > > divider = make_axes_locatable(ax1) > ax2 = divider.new_horizontal(size="100%", pad=pad, sharey=ax1) > fig.add_axes(ax2) > > N = 10 > ind = np.arange(N) # the x locations for the groups > width = 0.35 # the width of the bars > > x = [gamma.pdf(i, 1, scale=2) for i in range(N)] > y = [gamma.pdf(i, 5, scale=1) for i in range(N)] > > ind = np.arange(N) > > ax1.barh(ind, x) > ax2.barh(ind, y) > > for loc, spine in ax1.spines.iteritems(): > if loc in ['left','top']: > spine.set_color('none') # don't draw spine > > for loc, spine in ax2.spines.iteritems(): > if loc in ['right','top']: > spine.set_color('none') # don't draw spine > > ax1.set_title('Men') > ax2.set_title('Women') > > ax1.set_ylim(0, N) > ax2.set_ylim(0, N) > > # Name bars > ax1.set_yticks(ind + width) > ax1.xaxis.set_ticks_position('bottom') > ax2.xaxis.set_ticks_position('bottom') > ax1.yaxis.set_ticks_position('right') > ax2.yaxis.set_ticks_position('left') > > for tl in ax1.get_yticklabels(): > tl.set_visible(False) > > ax2.set_yticklabels(labels, > horizontalalignment='center' > ) > > for i in ax2.get_yticklabels(): > i.set_position((-(pad * .12) , 0)) > > plt.show() > > ### > > However I would like to generalize this function but he space between > the two plots and the position of the labels is giving me a hard time. > > In particular, the lines: > > pad = np.max([len(i) for i in labels]) * .15 > i.set_position((-(pad * .12) , 0)) > > include two values (.15 and .12) that are completely arbitrary and > defined by trial and error for current labels. > > However with different labels: > labels = ('0000-9000', '10-19', '20-29', '30-39', '40-49', > '50-59', '60-69', '70-79', '80-89', '90000-99000') > > the values are no longer valid and the final image is no longer properly > aligned. > > I know my current approach is not the proper way but due to the > complexity of matplotlib, my very superficial knowledge about it and the > overwhelming documentation this was the closest I could get. > > In the end I would like to contribute the final result as something to > be included in the gallery/examples section of the website as I'm > positive that it will be helpful to others. > > Any comment or suggestion is extremely welcome. > > Cheers, > Renato > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
See if the example below works. plot([1,2,3], label="test") a=legend() import matplotlib.offsetbox as offsetbox txt=offsetbox.TextArea("Test 2") box = a._legend_box box.get_children().append(txt) box.set_figure(box.figure) For more control of legend, see the link below. http://abitofpythonabitofastronomy.blogspot.com/2010/01/customized-legend.html Regards, -JJ On Sun, Jan 31, 2010 at 11:59 AM, Ernest Adrogué <ead...@gm...> wrote: > Hi, > > I would like to add some text relative to the legend, > let's say below it, and I don't know how to get the legend > coordinates so I can pass them to the text() method. > > Does anyone know how to do it? > > Alternatively, if there was a way to add text inside the > legend itself, it would also do the trick. > > Thank you in advance. > > Ernest > > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
Are you using the axes_grid toolkit? Standard matplotlib axis instance does not have "major_ticklabels" attribute, while axes_grid axis does. Please post a simple, but complete example that can be run and tested. Regards, -JJ On Sun, Jan 31, 2010 at 11:06 AM, <kc1...@ya...> wrote: > BTW: I tried to use set_position to change the position of the axes label as suggested by previous posting. No effect. > > ----- Original Message ---- >> > Hello, >> > >> > I am creating a plot with multiple y-axis (up to 6) and twinx >> works pretty well. The problem is that there are too much wasted spaces used up >> by the axes. Since I have multiple axes, it cuts into the amount of space >> available for the plot area. I need to know how I can squeeze some spaces out of >> the standard axes. First thing I discovered was that I can rotate the tick >> labels to vertical by: >> > >> > plt.setp(ax.major_ticklabels, rotation="vertical") >> > >> > where ax is my y-axis. But then: >> > >> > (1) How to reduce the space between the tick and the axes label? >> > >> > First I tried to place the label on top but couldn't get that to work. Then I >> tried to change the position property of the axis label object and that have no >> effect. So, can somebody please tell me how I can do these 2 things? >> > >> > (2) How to avoid overlapping tick labels? >> > >> > With the way the standard x and y axis are drawn, after I do a vertical rotate >> of the y tick labels, the first y tick label overlaps with the last x tick label >> since they are both center aligned. Is there any way to change the alignment of >> only the first and last tick labels of an axes (while keeping the rest center >> aligned)? >> > >> > Thanks, >> > >> >> > > -- > John Henry > > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
I would like to use Axes3D embedded in Wx. This works, but there is no mouse rotation. Clicking and dragging the mouse on the plot does not rotate the 3D axes like it does in the "scatter3d_demo.py". I tried: WX, WXAgg, and TkAgg with similar results. Can this be fixed soon, or can someone point me to where I can try to fix it? I tested with the latest SVN tree on Linux and Windows. Thanks, -Ben Below is some sample code adapted from "embedding_in_wx2.py", but with an Axes3D instead of the regular plot: #!/usr/bin/env python # adapted from example code "embedding_in_wx2.py" # Used to guarantee to use at least Wx2.8 import wxversion wxversion.ensureMinimal('2.8') import numpy as np import matplotlib # uncomment the following to use wx rather than wxagg #matplotlib.use('WX') #from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas # comment out the following to use wx rather than wxagg matplotlib.use('WXAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure from mpl_toolkits.mplot3d import Axes3D import wx class CanvasFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) self.SetBackgroundColour(wx.NamedColor("WHITE")) self.figure = Figure() self.axes = Axes3D(self.figure) xs = np.random.rand(100) ys = np.random.rand(100) zs = np.random.rand(100) self.axes.scatter(xs, ys, zs) self.canvas = FigureCanvas(self, -1, self.figure) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.SetSizer(self.sizer) self.Fit() self.add_toolbar() # comment this out for no toolbar def add_toolbar(self): self.toolbar = NavigationToolbar2Wx(self.canvas) self.toolbar.Realize() if wx.Platform == '__WXMAC__': # Mac platform (OSX 10.3, MacPython) does not seem to cope with # having a toolbar in a sizer. This work-around gets the buttons # back, but at the expense of having the toolbar at the top self.SetToolBar(self.toolbar) else: # On Windows platform, default window size is incorrect, so set # toolbar width to figure width. tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. # As noted above, doesn't work for Mac. self.toolbar.SetSize(wx.Size(fw, th)) self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) # update the axes menu on the toolbar self.toolbar.update() def OnPaint(self, event): self.canvas.draw() class App(wx.App): def OnInit(self): 'Create the main window and insert the custom frame' frame = CanvasFrame() frame.Show(True) return True app = App(0) app.MainLoop() #end code
Yannick Copin wrote: > Hi, > > I would like to plot lots of error ellipses on my plot. I thought I > could use an EllipseCollection to do so, but I didn't manage to get the > ellipse sizes, expressed in data units, right (see test script attached). > > When using a plain list of Ellipse's, everything looks fine: > > ells = [ P.matplotlib.patches.Ellipse(xy=xyi, > width=wi, height=hi, > angle=ai, > edgecolor='b', > facecolor='b', > alpha=0.3) > for xyi,wi,hi,ai in zip(xy,w,h,a)] > for ell in ells: > ax.add_artist(ell) > > But when using EllipseCollection (as explained in > http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_collection.html), > > > coll = P.matplotlib.collections.EllipseCollection(widths=w, > heights=h, > angles=a, > units='x', > offsets=xy, > transOffset=ax.transData, > edgecolor='r', > facecolor='r', > alpha=0.3) > ax.add_collection(coll) > > the size of the ellipses (expressed in data units) appears incorrect, > and depends furthermore of the aspect ratio of the figure (try pan/zoom > or resize the interactive window). Maybe I am misunderstanding, but the EllipseCollection in the example is panning and zooming as I expect. The shapes and orientations are staying the same while the scale expands and contracts with the x-axis. The problem is that the option you are looking for does not exist yet. I am not sure yet whether what you need is identical to an option I added to quiver (from which I partially derived EllipseCollection). I suspect it is. Do you want width to scale with x and height to scale with y? And the angle to scale such that a 45-degree angle always corresponds to equal increments in x and in y, all in data units? > > I naively thought the two approaches should give the same result... Did > I miss something in the way to use EllipseCollections? EllipseCollection is derived more from quiver than from Ellipse. Eric
Scott Sinclair wrote: >> On 1 February 2010 11:34, Torsten Andre <qa...@ta...> wrote: >> I've got a a pylab 2D array which I plot using imshow() which just works >> fine. But part of the data within the array is not to be considered nor >> plotted. >> >> My problem is that I don't know how to plot the data again. > > Hi Torsten, > > Use NumPy masked arrays with imshow() > [http://docs.scipy.org/doc/numpy/reference/maskedarray.html]. You can > use the masked array just as you have been using your regular NumPy > array, they are designed for this purpose and Matplotlib will not plot > the masked portion of your data. > > The pylab interface actually imports numpy so your pylab array is > really a NumPy ndarray object (try calling >>> print > type(your_pylab_array) to see this). > > Cheers, > Scott > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users Hi Scott, thank you very much. MA is exactly what I was looking for. Works perfectly fine. Cheers, Torsten
Hi thanks for the answers, but I do not think it is applicable in this situation. In the application I have an event that triggered (e.g., a button is pressed) the opening of the window by pylab.figure() and then the application shows (via figure pylab.show()) it to the user. So, the user defines when the figure will be closed. So, if I use pylab.close(1) in the application, I cannot use pylab.show() afterwards in the code (because it will be nothing to show...) The only way I found to 'flush' the memory is via bind() based on the 'master' (e.g., master = Tkinter.Tk(), master.bind('<Destroy>', self.close_showed_figures()) but it is already late for the application because the memory leak is only of concern when 'master' does not destroyed. Kind regards, Tanja On Mon, Feb 1, 2010 at 3:33 PM, Bruno Santos <bac...@gm...> wrote: > Have you tried the pylab.close() this should force the flush of the > memory. > > 2010年2月1日 Tanja Gurzhiy <tan...@gm...> > >> Hi, >> >> >> >> I have already submitted this issue as a possible problem to Tracker, >> however there is no response till now >> http://sourceforge.net/tracker/?func=detail&aid=2940967&group_id=80706&atid=560720. >> Probably, someone could help me with possible workaround for this >> problem. >> >> I use the pylab.figure in the other application where a user should close >> the figure manually. After the figure is closed, I would expect the memory >> goes back to the level it was before. However, it is not the case, I have >> noticed a memory leak when using pylab.figure(), pylab.show().If I try to >> let show figure via pylan.ion(), then pylab.figure() and pylab.iof(), I also >> see the memory leak. >> Below is simple example: >> >> >> >> pylab.ion() >> >> for i in range(10): >> >> pylab.figure() >> >> pylab.draw() >> >> val = cbook.report_memory(i) >> >> print i, val >> >> pylab.ioff() >> >> >> >> the same loop is used for show(): >> >> for i in range(10): >> >> pylab.figure() >> >> pylab.plot([1,3]) >> >> val = cbook.report_memory(i) >> >> print i, val >> >> pylab.show() >> >> >> I use the python version 2.5.1, the matplotlib version 0.99.0, OS: SunOs5 >> (Solaris), backend: TkAgg. >> >> >> >> Thanks in advance, >> >> Tanja >> >> >> >> >> >> ------------------------------------------------------------------------------ >> The Planet: dedicated and managed hosting, cloud storage, colocation >> Stay online with enterprise data centers and the best network in the >> business >> Choose flexible plans and management services without long-term contracts >> Personal 24x7 support from experience hosting pros just a phone call away. >> http://p.sf.net/sfu/theplanet-com >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >
Have you tried the pylab.close() this should force the flush of the memory. 2010年2月1日 Tanja Gurzhiy <tan...@gm...> > Hi, > > > > I have already submitted this issue as a possible problem to Tracker, > however there is no response till now > http://sourceforge.net/tracker/?func=detail&aid=2940967&group_id=80706&atid=560720. > Probably, someone could help me with possible workaround for this > problem. > > I use the pylab.figure in the other application where a user should close > the figure manually. After the figure is closed, I would expect the memory > goes back to the level it was before. However, it is not the case, I have > noticed a memory leak when using pylab.figure(), pylab.show().If I try to > let show figure via pylan.ion(), then pylab.figure() and pylab.iof(), I also > see the memory leak. > Below is simple example: > > > > pylab.ion() > > for i in range(10): > > pylab.figure() > > pylab.draw() > > val = cbook.report_memory(i) > > print i, val > > pylab.ioff() > > > > the same loop is used for show(): > > for i in range(10): > > pylab.figure() > > pylab.plot([1,3]) > > val = cbook.report_memory(i) > > print i, val > > pylab.show() > > > I use the python version 2.5.1, the matplotlib version 0.99.0, OS: SunOs5 > (Solaris), backend: TkAgg. > > > > Thanks in advance, > > Tanja > > > > > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the > business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >
Hi, I have already submitted this issue as a possible problem to Tracker, however there is no response till now http://sourceforge.net/tracker/?func=detail&aid=2940967&group_id=80706&atid=560720. Probably, someone could help me with possible workaround for this problem. I use the pylab.figure in the other application where a user should close the figure manually. After the figure is closed, I would expect the memory goes back to the level it was before. However, it is not the case, I have noticed a memory leak when using pylab.figure(), pylab.show().If I try to let show figure via pylan.ion(), then pylab.figure() and pylab.iof(), I also see the memory leak. Below is simple example: pylab.ion() for i in range(10): pylab.figure() pylab.draw() val = cbook.report_memory(i) print i, val pylab.ioff() the same loop is used for show(): for i in range(10): pylab.figure() pylab.plot([1,3]) val = cbook.report_memory(i) print i, val pylab.show() I use the python version 2.5.1, the matplotlib version 0.99.0, OS: SunOs5 (Solaris), backend: TkAgg. Thanks in advance, Tanja
>On 1 February 2010 11:34, Torsten Andre <qa...@ta...> wrote: > I've got a a pylab 2D array which I plot using imshow() which just works > fine. But part of the data within the array is not to be considered nor > plotted. > > My problem is that I don't know how to plot the data again. Hi Torsten, Use NumPy masked arrays with imshow() [http://docs.scipy.org/doc/numpy/reference/maskedarray.html]. You can use the masked array just as you have been using your regular NumPy array, they are designed for this purpose and Matplotlib will not plot the masked portion of your data. The pylab interface actually imports numpy so your pylab array is really a NumPy ndarray object (try calling >>> print type(your_pylab_array) to see this). Cheers, Scott
Hi there, I've got a a pylab 2D array which I plot using imshow() which just works fine. But part of the data within the array is not to be considered nor plotted. To keep it simple let's assume the data I need is shaped like a triangle. It is no problem to extract the data from the matrix converting the matrix to a list and dropping all unnecessary data. My problem is that I don't know how to plot the data again. A possible work around would be to set data elements which I don't need to some value not in the data. But I since I need to compute histograms for the data, for example, I have to drop the data anyways. Is there a way to solve my problem? Thanks for your help. Cheers, Torsten
Hi again, I've fixed the issue on my box. The issue lies in the definition of the hash_map. For ICC for Linux, the GCC headers should be used. Matthieu 2010年1月29日 Matthieu Brucher <mat...@gm...>: > Hi, > > It seems that the compilation of base_format needs a C++ compiler, but > distutils launches icc instead of icpc. This may work with gcc, but > with Intel Compiler, I can't force icc to understand C++. > I don't know what happened between 0.98.5 and 0.99.2, but I can't use > Matplotlib anymore :| > > Matthieu > -- > Information System Engineer, Ph.D. > Blog: http://matt.eifelle.com > LinkedIn: http://www.linkedin.com/in/matthieubrucher > -- Information System Engineer, Ph.D. Blog: http://matt.eifelle.com LinkedIn: http://www.linkedin.com/in/matthieubrucher
Hi everyone I've been going around matplotlib objects trying to find a way to pre-calculate positions depending on input. I'm trying to create a function that draws two barplots facing opposite directions. This is what I managed so far: ### import numpy as np import matplotlib.pyplot as plt from scipy.stats import gamma from mpl_toolkits.axes_grid import make_axes_locatable fig = plt.figure(1, (10, 10)) ax1 = fig.add_subplot(1, 1, 1) ax1.set_xlim(1,0) labels = ('0-9', '10-19', '20-29', '30-39', '40-49', '50-59', '60-69', '70-79', '80-89', '90-99') pad = np.max([len(i) for i in labels]) * .15 divider = make_axes_locatable(ax1) ax2 = divider.new_horizontal(size="100%", pad=pad, sharey=ax1) fig.add_axes(ax2) N = 10 ind = np.arange(N) # the x locations for the groups width = 0.35 # the width of the bars x = [gamma.pdf(i, 1, scale=2) for i in range(N)] y = [gamma.pdf(i, 5, scale=1) for i in range(N)] ind = np.arange(N) ax1.barh(ind, x) ax2.barh(ind, y) for loc, spine in ax1.spines.iteritems(): if loc in ['left','top']: spine.set_color('none') # don't draw spine for loc, spine in ax2.spines.iteritems(): if loc in ['right','top']: spine.set_color('none') # don't draw spine ax1.set_title('Men') ax2.set_title('Women') ax1.set_ylim(0, N) ax2.set_ylim(0, N) # Name bars ax1.set_yticks(ind + width) ax1.xaxis.set_ticks_position('bottom') ax2.xaxis.set_ticks_position('bottom') ax1.yaxis.set_ticks_position('right') ax2.yaxis.set_ticks_position('left') for tl in ax1.get_yticklabels(): tl.set_visible(False) ax2.set_yticklabels(labels, horizontalalignment='center' ) for i in ax2.get_yticklabels(): i.set_position((-(pad * .12) , 0)) plt.show() ### However I would like to generalize this function but he space between the two plots and the position of the labels is giving me a hard time. In particular, the lines: pad = np.max([len(i) for i in labels]) * .15 i.set_position((-(pad * .12) , 0)) include two values (.15 and .12) that are completely arbitrary and defined by trial and error for current labels. However with different labels: labels = ('0000-9000', '10-19', '20-29', '30-39', '40-49', '50-59', '60-69', '70-79', '80-89', '90000-99000') the values are no longer valid and the final image is no longer properly aligned. I know my current approach is not the proper way but due to the complexity of matplotlib, my very superficial knowledge about it and the overwhelming documentation this was the closest I could get. In the end I would like to contribute the final result as something to be included in the gallery/examples section of the website as I'm positive that it will be helpful to others. Any comment or suggestion is extremely welcome. Cheers, Renato