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
(21) |
3
(21) |
4
(14) |
5
(8) |
|
6
(12) |
7
(16) |
8
(27) |
9
(39) |
10
(19) |
11
(12) |
12
(3) |
|
13
(3) |
14
(18) |
15
(14) |
16
(6) |
17
(7) |
18
(19) |
19
(5) |
|
20
(8) |
21
(24) |
22
(42) |
23
(12) |
24
(11) |
25
(16) |
26
(2) |
|
27
(4) |
28
(10) |
|
|
|
|
|
|
From: Thomas R. <tho...@gm...> - 2011-02-28 22:24:51
|
Hi,
In the following example:
---
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.imshow(np.random.random((1024, 1024)), interpolation='nearest')
fig.savefig('test_1.eps')
mpl.rc('text', usetex=True)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.imshow(np.random.random((1024, 1024)), interpolation='nearest')
fig.savefig('test_2.eps')
---
the file test_2.eps is almost 6 times larger than test_1.eps, and takes much longer to draw. It looks like in the first case, the image is rendered as a bitmap (the way it should be), whereas in the second case each pixel is drawn individually as a polygon. Is this a bug?
I am using r8988 of matplotlib.
Thanks for any help!
Thomas
|
|
From: Goyo <goy...@gm...> - 2011-02-28 21:17:22
|
David, the preferred way to custom plots seems to be passing an Axes
instance to the plotting function. Some tricks allow use of
pylab/pyplot style:
def custom_plot(x, y, axes=None):
...
if axes is None: axes = pyplot.gca()
axes.plot(x, y)
....
What you don't get this way is the axes.custom_plot(x, y) sintax,
which requires subclassing Axes. But doing this is not common and not
straighforward if you want it to work well with pyplot.subplot() and
the like.
Maybe monkey patching would work but well, you know... I never tried it anyway.
Goyo
|
|
From: Paul I. <piv...@gm...> - 2011-02-28 19:30:22
|
Gökhan Sever, on 2011-02-28 11:32, wrote: > On Mon, Feb 28, 2011 at 10:48 AM, Andrea Crotti > <and...@gm...>wrote: > > > So since I wanted some space on the borders of my graph, I did this > > really extremely convoluted thing, which apparently works... > > I get a 10% more area on each side, but I'm quite sure there's a better > > way to this, right? > > > > I didn't find any function to pass an increment to the size that's why I > > did this mess... > > > > --8<---------------cut here---------------start------------->8--- > > old_axes = plt.axis() > > sizes = old_axes[1] - old_axes[0], old_axes[3] - old_axes[2] > > offset = lambda x: int((float(x) / 10)) > > new_axes = [] > > > > for i in range(len(old_axes)): > > new_val = old_axes[i] + (((-1) ** (i + 1)) * offset(sizes[i % > > 2])) > > new_axes.append(new_val) > > > > plt.axis(new_axes) > > --8<---------------cut here---------------end--------------->8--- > > You can try: > > fig, ax = plt.subplots(1,1) > ax.plot(range(10)) > fig.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95) Hi Andrea, I think Gökhan is pointing out a different feature than the one you want. You seem to want to adjust the x and y limits of the plot to be some fraction larger than the data that's plotted. You can do this with: ax = plt.subplot(111) ax.plot(range(10)) ax.set_ymargin(.2) ax.set_xmargin(.1) # or ax.margins(.1,.2) ax.autoscale() plt.draw() see also the docstring for ax.autoscale_view for more. best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
|
From: Paul I. <piv...@gm...> - 2011-02-28 18:59:32
|
Boyle, Jim, on 2011-02-28 08:40, wrote: > I am using AxesGrid (from mpl_toolkits.axes_grid1 import > AxesGrid) to generate multi-panel plots. It does very well > except I have a problem with a blank subplot. I have 5 plots > to display and the geometry of nrows_ncols=(3,2) produces the > plot that I want except there is a frame placed in the last > position - for which I did not call a plot. > > I cannot figure out an elegant way to supress this frame. The > kludge I use now is to just set the edgecolor of the last grid > subplot to the background and so it is not visible. > > All the examples have an even number of subplot figures so the > grid is filled and this situation does not occur. Hi Jim, how's this: import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import AxesGrid ag = AxesGrid(plt.figure(),(0,0,1,1),(2,3)) ag.axes_all[-1].set_visible(False) best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
|
From: Benjamin R. <ben...@ou...> - 2011-02-28 18:39:09
|
On Sun, Feb 27, 2011 at 4:49 PM, David Andrews <irb...@gm...> wrote: > Hi All, > > I'm looking for some suggestions about two problems: > > 1) I'm converting some figure generating code from IDL into > Python/matplotlib. Image attached showing this figure. > IDL being a functional programming language for the most part, > creating wrappers around various subroutines is trivial and generally > the simplest way to modify their behavior. > For example, in dealing with phase data (which can take values between > 0º and 360º, and are 'wrapped' around this interval, such that 270º + > 180º = 90º and so on), I have some stuff in IDL that instead over > simply 'overplotting' some (x,y) data, it will do a quick loop and > instead overplot (x, y + n * 360º) for n = -1, ..., 1 (or some other > number of repetitions, you get the idea). > > Now, in matplotlib, while I can do this pretty easily, I suspect there > are better ways? I suppose I could write a subclass of > matplotlib.axes.Axes for example, that does the 360º repetition itself > across not just the plot() method but for others also? But > implementing a whole new class for this may be complicated, and I am > sort of lost as to how I would then get that working with the pylab > stateful interface? > > I'm reasonably new to OO programming, and I'm still getting my head > round the 'best' way to do things like this. > > Alternatively, having a class that describes individual data points, I > could define a plot() method for them? > > class MyData(): > ... > plot(self, axes): > ... > axes.plot(self.x, self.y + n * 360) > > But then, that seems to 'break' some rules, as I don't see much > matplotlib code in which you do 'data.plot()' as opposed to > 'axes.plot()' - the order seems wrong? > > 2) Somewhat similar to the first question. The figure includes (at > the top) some ancillary data (showing lengths of orbit and year > numbers). In IDL its done simply by filling polygons in normal / page > coordinates - but again, I think it could be better done using OO > somehow? Effectively, that top row could be thought of as a separate > subplot. What would be the efficient / sensible / pythonic way to go > about reproducing this. Another subclass of Axes? > > Many thanks, > > Dave > > Dave, Generally speaking, if your first thought is "Should I subclass the Axes class?" then you might need to take a second look at what matplotlib has to offer out of the box. Granted, the graph you wish to duplicate is very complex, but let us break it down into various components. First, you want multiple subplots to appear vertically "stacked" and share the same x-axis. Here is an example of how to do that: http://matplotlib.sourceforge.net/examples/pylab_examples/ganged_plots.html (Note that I personally advocate against the "from pylab import *" code style, and this example could easily be redone from the pyplot interface instead.) Here is another example where the person used LineCollections with defined offsets. This has the advantage of using a single axes object, but might be difficult to handle the y-axis. http://matplotlib.sourceforge.net/examples/pylab_examples/mri_with_eeg.html To have multiple x-axis tick labels for a common y-axis is a concept called twiny. The following is an example of doing twinx (multiple y-axis tick labels for a common x-axis), but the concept is the same: http://matplotlib.sourceforge.net/examples/api/two_scales.html This is another example showing a different way of doing that: http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline4.html As for some of the markings around the graph, I am not entirely certain how to implement that. I will leave that for others to suggest ideas for. I hope this is helpful! Ben Root |
|
From: Gökhan S. <gok...@gm...> - 2011-02-28 18:32:56
|
On Mon, Feb 28, 2011 at 10:48 AM, Andrea Crotti <and...@gm...>wrote: > So since I wanted some space on the borders of my graph, I did this > really extremely convoluted thing, which apparently works... > I get a 10% more area on each side, but I'm quite sure there's a better > way to this, right? > > I didn't find any function to pass an increment to the size that's why I > did this mess... > > --8<---------------cut here---------------start------------->8--- > old_axes = plt.axis() > sizes = old_axes[1] - old_axes[0], old_axes[3] - old_axes[2] > offset = lambda x: int((float(x) / 10)) > new_axes = [] > > for i in range(len(old_axes)): > new_val = old_axes[i] + (((-1) ** (i + 1)) * offset(sizes[i % > 2])) > new_axes.append(new_val) > > plt.axis(new_axes) > --8<---------------cut here---------------end--------------->8--- > > > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs and other IT data in > Real-Time with Splunk. Collect, index and harness all the fast moving IT > data > generated by your applications, servers and devices whether physical, > virtual > or in the cloud. Deliver compliance at lower cost and gain new business > insights. http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > Hi, You can try: fig, ax = plt.subplots(1,1) ax.plot(range(10)) fig.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95) If you choose WXAgg as your backend you get a nice config tool to adjust spacing in the figure. Then just pass those numbers into .subplots_adjust method once you are satisfied. -- Gökhan |
|
From: Andrea C. <and...@gm...> - 2011-02-28 18:18:51
|
So since I wanted some space on the borders of my graph, I did this
really extremely convoluted thing, which apparently works...
I get a 10% more area on each side, but I'm quite sure there's a better
way to this, right?
I didn't find any function to pass an increment to the size that's why I
did this mess...
--8<---------------cut here---------------start------------->8---
old_axes = plt.axis()
sizes = old_axes[1] - old_axes[0], old_axes[3] - old_axes[2]
offset = lambda x: int((float(x) / 10))
new_axes = []
for i in range(len(old_axes)):
new_val = old_axes[i] + (((-1) ** (i + 1)) * offset(sizes[i % 2]))
new_axes.append(new_val)
plt.axis(new_axes)
--8<---------------cut here---------------end--------------->8---
|
|
From: Boyle, J. <bo...@ll...> - 2011-02-28 16:40:14
|
I am using AxesGrid (from mpl_toolkits.axes_grid1 import AxesGrid) to generate multi-panel plots. It does very well except I have a problem with a blank subplot. I have 5 plots to display and the geometry of nrows_ncols=(3,2) produces the plot that I want except there is a frame placed in the last position - for which I did not call a plot. I cannot figure out an elegant way to supress this frame. The kludge I use now is to just set the edgecolor of the last grid subplot to the background and so it is not visible. All the examples have an even number of subplot figures so the grid is filled and this situation does not occur. --Jim |
|
From: Thorsten K. <tho...@go...> - 2011-02-28 07:03:31
|
Hi, I usually plot my multichannel-EEG data using a constant offset for each channel and then setting the channel-names as yticks on the y-axis. I stumbled across http://www.scipy.org/Cookbook/Matplotlib/MultilinePlots where exactly this problem is addressed, and I tried the example using transformations. Sadly, it doesn't work anymore as the transforms-module has changed. I know that the old methods all have new versions, so it shouldn't be too hard to get it working again, but I have a different question. It is mentioned that this functionality was planned to (maybe) encapsulate in a method plot_signal, but I didn't find it in current mpl. Does such a method exist or was it somehow else implemented? Greetings, Thorsten |
|
From: Jouni K. S. <jk...@ik...> - 2011-02-28 05:22:06
|
Jouni Seppänen <jk...@ik...> writes: > pbkdo8y URWBookmanL-DemiBold ".167 SlantFont TeXnANSIEncoding ReEncodeFont" <texnansi.enc <8r.enc <ubkd8a.pfb > > I guess we will need to implement slightly more of a PostScript > interpreter inside matplotlib to figure out which file is to be used > for re-encoding the font, unless this really means some kind of a > combination of the two encodings. I'll try to find out what pdftex > does with this. The author of pdftex reports that pdftex just takes the last encoding file specified (so this font probably gets encoded wrong): http://thread.gmane.org/gmane.comp.tex.pdftex/4913/focus=4914 This is very likely a bug in TeX Live, or whatever software caused that line to be added to the pdftex.map file. -- Jouni K. Seppänen http://www.iki.fi/jks |
|
From: David A. <irb...@gm...> - 2011-02-27 22:49:45
|
Hi All,
I'm looking for some suggestions about two problems:
1) I'm converting some figure generating code from IDL into
Python/matplotlib. Image attached showing this figure.
IDL being a functional programming language for the most part,
creating wrappers around various subroutines is trivial and generally
the simplest way to modify their behavior.
For example, in dealing with phase data (which can take values between
0º and 360º, and are 'wrapped' around this interval, such that 270º +
180º = 90º and so on), I have some stuff in IDL that instead over
simply 'overplotting' some (x,y) data, it will do a quick loop and
instead overplot (x, y + n * 360º) for n = -1, ..., 1 (or some other
number of repetitions, you get the idea).
Now, in matplotlib, while I can do this pretty easily, I suspect there
are better ways? I suppose I could write a subclass of
matplotlib.axes.Axes for example, that does the 360º repetition itself
across not just the plot() method but for others also? But
implementing a whole new class for this may be complicated, and I am
sort of lost as to how I would then get that working with the pylab
stateful interface?
I'm reasonably new to OO programming, and I'm still getting my head
round the 'best' way to do things like this.
Alternatively, having a class that describes individual data points, I
could define a plot() method for them?
class MyData():
...
plot(self, axes):
...
axes.plot(self.x, self.y + n * 360)
But then, that seems to 'break' some rules, as I don't see much
matplotlib code in which you do 'data.plot()' as opposed to
'axes.plot()' - the order seems wrong?
2) Somewhat similar to the first question. The figure includes (at
the top) some ancillary data (showing lengths of orbit and year
numbers). In IDL its done simply by filling polygons in normal / page
coordinates - but again, I think it could be better done using OO
somehow? Effectively, that top row could be thought of as a separate
subplot. What would be the efficient / sensible / pythonic way to go
about reproducing this. Another subclass of Axes?
Many thanks,
Dave
|
|
From: Benjamin R. <ben...@ou...> - 2011-02-27 17:39:27
|
On Sun, Feb 27, 2011 at 6:48 AM, andrea crotti <and...@gm...>wrote: > 2011/2/18 Benjamin Root <ben...@ou...>: > > > > > > Automatic layouts are difficult to do in matplotlib. This was a design > > decision trade-off made early in its development. Instead of having > > matplotlib determining optimal layouts and such, the developers decided > that > > it would be better to give the programmers full control over all > placement, > > and merely establish good defaults. > > > > Just for completeness, I like this page because it talks about the > multiple > > different ways you can specify coordinates for a text object (and > > corresponding arrow) for placement: > > > > http://matplotlib.sourceforge.net/users/annotations.html > > > > Knowing ahead of time how much space an annotation will take is very > > difficult, especially if your text involves any LaTeX symbols. However, > it > > is possible. The Text object has some method calls that can return > bounding > > boxes for the text object after it is made: > > > > > http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.text.Text.get_bbox_patch > > > http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.text.Text.get_window_extent > > > > I haven't used these myself, so I don't know exactly what is the > difference > > between them (I think they are different coordinate systems). Once > knowing > > the size of your text object, you can change the position of the object > > using its set_position() method. It is tricky, but if positioning and > > layout is very important to you, it is possible to do. > > > > I hope this helps! > > > > Ben Root > > > > Thanks for the answer, I tried something out but well it's not so trivial. > And I think it doesn't make much sense to add the text inside the same > plot, so I thought about subplot. > > I want a bigger subplot on top and one are splitted in two parts below it. > > But if I do > subplot(221) > ... > subplot(222) > ... > subplot(223) > ... > it doesn't like it, and I didn't find any example which has this "more > advanced" subplotting. > > Once that works it might be easier to compute the size that I need > since the coordinate for the subplot are always from 0 to 1... > Andrea, If you would like more advanced control over your subplots, matplotlib v1.0.x has the new gridspec feature: http://matplotlib.sourceforge.net/users/whats_new.html#sophisticated-subplot-grid-layout Maybe this can help you? Ben Root |
|
From: andrea c. <and...@gm...> - 2011-02-27 12:48:30
|
2011/2/18 Benjamin Root <ben...@ou...>: > > > Automatic layouts are difficult to do in matplotlib. This was a design > decision trade-off made early in its development. Instead of having > matplotlib determining optimal layouts and such, the developers decided that > it would be better to give the programmers full control over all placement, > and merely establish good defaults. > > Just for completeness, I like this page because it talks about the multiple > different ways you can specify coordinates for a text object (and > corresponding arrow) for placement: > > http://matplotlib.sourceforge.net/users/annotations.html > > Knowing ahead of time how much space an annotation will take is very > difficult, especially if your text involves any LaTeX symbols. However, it > is possible. The Text object has some method calls that can return bounding > boxes for the text object after it is made: > > http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.text.Text.get_bbox_patch > http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.text.Text.get_window_extent > > I haven't used these myself, so I don't know exactly what is the difference > between them (I think they are different coordinate systems). Once knowing > the size of your text object, you can change the position of the object > using its set_position() method. It is tricky, but if positioning and > layout is very important to you, it is possible to do. > > I hope this helps! > > Ben Root > Thanks for the answer, I tried something out but well it's not so trivial. And I think it doesn't make much sense to add the text inside the same plot, so I thought about subplot. I want a bigger subplot on top and one are splitted in two parts below it. But if I do subplot(221) ... subplot(222) ... subplot(223) ... it doesn't like it, and I didn't find any example which has this "more advanced" subplotting. Once that works it might be easier to compute the size that I need since the coordinate for the subplot are always from 0 to 1... |
|
From: Sandy Oz <ale...@co...> - 2011-02-27 08:30:58
|
Hello everyone,
I'm building and application which will display a collection
of several wxpanels each of which displays a
FigureCanvasWxAgg with a particular subplot.
The user is allowed to remove these panels.
However, after a panel is deleted (call wxPanel.Destroy()),
and the mouse moves over the now empty space, I get the
following exception:
File
"/usr/lib/pymodules/python2.6/matplotlib/backends/backend_wx.py",
line 1316, in _onMotion
FigureCanvasBase.motion_notify_event(self, x, y,
guiEvent=evt)
File
"/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py",
line 1244, in motion_notify_event
guiEvent=guiEvent)
File
"/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py",
line 899, in __init__
LocationEvent.__init__(self, name, canvas, x, y,
guiEvent=guiEvent)
File
"/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py",
line 817, in __init__
self._update_enter_leave()
File
"/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py",
line 844, in _update_enter_leave
last.canvas.callbacks.process('axes_leave_event', last)
File
"/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 14586, in __getattr__
raise PyDeadObjectError(self.attrStr % self._name)
wx._core.PyDeadObjectError: The C++ part of the
FigureCanvasWxAgg object has been deleted, attribute access
no longer allowed.
Looks like the deleted canvas is still listening for mouse
move events.
How can I prevent this?
Thank you,
Sandy
|
|
From: Daniel M. <dan...@go...> - 2011-02-26 14:41:36
|
I have slightly modified the example from http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels in order to demonstrate what I mean. It works with the manual string tick labels but not with regular auto-generated numerical ones. Maybe someone knows how to fix this? And I *really* think this should work automatically. As a compromise, maybe an rcParam would help in order to keep the current dumb behavior... Thanks in advance, Daniel import matplotlib.pyplot as plt import matplotlib.transforms as mtransforms fig = plt.figure(figsize=(5,3)) ax = fig.add_subplot(111) #ax.plot(range(10)) #ax.set_yticks((2,5,7)) #labels = ax.set_yticklabels(('really, really, really', 'long', 'labels')) ax.plot(range(100),[100000]*100) labels = ax.get_yticklabels() def on_draw(event): bboxes = [] for label in labels: bbox = label.get_window_extent() print bbox # the figure transform goes from relative coords->pixels and we # want the inverse of that bboxi = bbox.inverse_transformed(fig.transFigure) bboxes.append(bboxi) # this is the bbox that bounds all the bboxes, again in relative # figure coords bbox = mtransforms.Bbox.union(bboxes) if fig.subplotpars.left < bbox.width: # we need to move it over fig.subplots_adjust(left=1.1*bbox.width) # pad a little fig.canvas.draw() return False fig.canvas.mpl_connect('draw_event', on_draw) plt.show() |
|
From: Benjamin R. <ben...@ou...> - 2011-02-26 00:17:40
|
On Fri, Feb 25, 2011 at 5:34 PM, Philipp A. <fly...@we...> wrote: > 2011/2/25 Philipp A. <fly...@we...> > > 2011/2/25 Benjamin Root <ben...@ou...> >> >>> On Fri, Feb 25, 2011 at 8:09 AM, Philipp A. <fly...@we...> wrote: >>> >>>> hi, >>>> Axes3D from mpl_toolkits.mplot3d does not override set_*ticklabels. >>>> this bug<http://sourceforge.net/tracker/index.php?func=detail&aid=2874110&group_id=80706&atid=560720>is about the issue. >>>> to get a crude replacement, i have to do the following: >>>> >>>> for x, s in enumerate(ticks): >>>>> ax.text3D(x, -.1, -.5, s) >>>>> for a in ax.w_xaxis.get_ticklabels(): >>>>> a.set_visible(False) >>>>> >>>> >>>> is there a way to do better and hack my values into the real tick >>>> labels (i bet they are drawn internally the same as text3D, but there is no >>>> way to access the values)? >>>> >>>> >>> In matplotlib in the development branch, I am able to call >>> ax.w_xaxis.set_ticklabels() (or ax.w_yaxis, or ax.w_zaxis) and have the >>> ticks show up appropriately. I have not tested earlier versions of >>> matplotlib, though. Which version are you using? >>> >>> Admittedly, the control of the ticks is very poor in mplot3d. I hope to >>> improve that over the next several months. >>> >>> Ben Root >>> >> >> i use 0.99.3 both in university and at home, but somehow at home, >> matplotlib complains about ValueError: Unknown projection '3d' at home. >> >> i’ll try 1.0.1 and report if it works. >> > > update: i’ll see if a dev build does the trick tomorrow, as a local build > of 1.0.1 doesn’t show the x/yticklabels and there doesn’t exist a function > named set_zticklabels. > Phillipp, The ability to call ax = fig.gca(projection='3d') was new for version 1.0.0. This morning, I also noticed that functions like "set_zticklabels()" did not exist. I currently have a patch submitted for that and it should be merged into the git repository tonight. In the meantime, you can always do something like: ax.w_zaxis.set_ticklabels() The functions like ax.set_zticks() merely call that function for the appropriate axis. Ben Root |
|
From: Paul I. <piv...@gm...> - 2011-02-25 23:59:17
|
Jeff Kowalczyk, on 2011-02-25 23:20, wrote: > I am trying to plot multiple series on one axes and a bar chart on a shared x, > new y axes. I'm using twinx. The following test code works, but I need to render > the bar plot *behind* the line plots. Can I somehow control zorder globally > within a figure? Hi Jeff, add these two lines before your plt.show() ax1.set_zorder(ax2.get_zorder()+1) # put ax in front of ax2 ax1.patch.set_visible(False) # hide the 'canvas' > > Alternatively, I could make the bar chart the first plot/axes ax1, but the > position for its y-axis must be on the right, the line chart's y-axis on the > left. Can this be controlled? ax1.yaxis.tick_right() ax2.yaxis.tick_left() best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
|
From: Jeff K. <jt...@ya...> - 2011-02-25 23:35:19
|
I am trying to plot multiple series on one axes and a bar chart on a shared x,
new y axes. I'm using twinx. The following test code works, but I need to render
the bar plot *behind* the line plots. Can I somehow control zorder globally
within a figure?
Alternatively, I could make the bar chart the first plot/axes ax1, but the
position for its y-axis must be on the right, the line chart's y-axis on the
left. Can this be controlled?
Thanks.
test.py:
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
width_bar = 0.4
width_line = 6
for i in range(0,1):
data = np.loadtxt(open('test.csv','r'), delimiter=',',
dtype={'names': ('x','y1','y2','count'),
'formats': ('f4', 'i4', 'i4', 'i4', 'i4')},
usecols=(1,3,4,7))
x,y1,y2,count = data['x'],data['y1'],data['y2'],data['count']
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(x, y1, linewidth=width_line, zorder=3)
ax1.plot(x, y2, linewidth=width_line, zorder=2)
ax2 = ax1.twinx()
ax2.bar(x, count, width=width_bar, color='0.9', zorder=1)
plt.show()
test.csv:
1,3.0,3.2,6,0,-10,29,8
1,3.5,3.5,20,12,-4,55,29
1,4.0,4.0,51,29,15,97,71
1,4.5,4.5,82,62,37,136,143
1,5.0,5.0,130,102,69,197,154
1,5.5,5.5,186,147,115,275,164
1,6.0,6.0,256,202,159,382,187
1,6.5,6.5,351,265,236,522,183
1,7.0,7.0,446,340,308,646,192
1,7.5,7.5,562,426,376,826,184
1,8.0,8.0,654,526,437,934,193
1,8.5,8.5,797,648,553,1080,190
1,9.0,9.0,940,765,648,1271,173
1,9.5,9.5,1111,910,782,1457,180
1,10.0,10.0,1240,1040,919,1564,199
1,10.5,10.5,1333,1175,1011,1655,209
1,11.0,11.0,1449,1285,1112,1775,210
1,11.5,11.5,1458,1366,1120,1793,173
1,12.0,12.0,1449,1427,1089,1799,156
1,12.5,12.5,1441,1460,1073,1809,136
1,13.0,13.0,1458,1483,1100,1803,174
1,13.5,13.5,1446,1491,1080,1809,134
1,14.0,14.0,1447,1497,1081,1814,139
1,14.5,14.5,1424,1498,1046,1810,112
1,15.0,15.0,1433,1500,1065,1817,85
1,15.5,15.5,1427,1500,1048,1819,66
1,16.0,15.9,1428,1500,1036,1817,41
1,16.5,16.5,1383,1500,990,1799,29
1,17.0,17.0,1379,1500,935,1820,29
1,17.5,17.5,1352,1500,899,1817,16
1,18.0,18.0,1347,1500,861,1825,9
1,18.5,18.4,1464,1500,1130,1818,4
1,19.0,18.9,1449,1500,1065,1819,3
|
|
From: Philipp A. <fly...@we...> - 2011-02-25 23:34:25
|
2011/2/25 Philipp A. <fly...@we...> > 2011/2/25 Benjamin Root <ben...@ou...> > >> On Fri, Feb 25, 2011 at 8:09 AM, Philipp A. <fly...@we...> wrote: >> >>> hi, >>> Axes3D from mpl_toolkits.mplot3d does not override set_*ticklabels. >>> this bug<http://sourceforge.net/tracker/index.php?func=detail&aid=2874110&group_id=80706&atid=560720>is about the issue. >>> to get a crude replacement, i have to do the following: >>> >>> for x, s in enumerate(ticks): >>>> ax.text3D(x, -.1, -.5, s) >>>> for a in ax.w_xaxis.get_ticklabels(): >>>> a.set_visible(False) >>>> >>> >>> is there a way to do better and hack my values into the real tick labels >>> (i bet they are drawn internally the same as text3D, but there is no way to >>> access the values)? >>> >>> >> In matplotlib in the development branch, I am able to call >> ax.w_xaxis.set_ticklabels() (or ax.w_yaxis, or ax.w_zaxis) and have the >> ticks show up appropriately. I have not tested earlier versions of >> matplotlib, though. Which version are you using? >> >> Admittedly, the control of the ticks is very poor in mplot3d. I hope to >> improve that over the next several months. >> >> Ben Root >> > > i use 0.99.3 both in university and at home, but somehow at home, > matplotlib complains about ValueError: Unknown projection '3d' at home. > > i’ll try 1.0.1 and report if it works. > update: i’ll see if a dev build does the trick tomorrow, as a local build of 1.0.1 doesn’t show the x/yticklabels and there doesn’t exist a function named set_zticklabels. |
|
From: Philipp A. <fly...@we...> - 2011-02-25 22:45:30
|
2011/2/25 Benjamin Root <ben...@ou...> > > > On Fri, Feb 25, 2011 at 8:09 AM, Philipp A. <fly...@we...> wrote: > >> hi, >> Axes3D from mpl_toolkits.mplot3d does not override set_*ticklabels. >> this bug<http://sourceforge.net/tracker/index.php?func=detail&aid=2874110&group_id=80706&atid=560720>is about the issue. >> to get a crude replacement, i have to do the following: >> >> for x, s in enumerate(ticks): >>> ax.text3D(x, -.1, -.5, s) >>> for a in ax.w_xaxis.get_ticklabels(): >>> a.set_visible(False) >>> >> >> is there a way to do better and hack my values into the real tick labels >> (i bet they are drawn internally the same as text3D, but there is no way to >> access the values)? >> >> > In matplotlib in the development branch, I am able to call > ax.w_xaxis.set_ticklabels() (or ax.w_yaxis, or ax.w_zaxis) and have the > ticks show up appropriately. I have not tested earlier versions of > matplotlib, though. Which version are you using? > > Admittedly, the control of the ticks is very poor in mplot3d. I hope to > improve that over the next several months. > > Ben Root > i use 0.99.3 both in university and at home, but somehow at home, matplotlib complains about ValueError: Unknown projection '3d' at home. i’ll try 1.0.1 and report if it works. |
|
From: Daniel M. <dan...@go...> - 2011-02-25 18:46:18
|
There is the one in the code, as suggested on the FAQ site :) >> thanks for pointing out the rcParams solution! For the time being, >> this seems an OK approach. I'd like to use the automatic solution, >> though > > There isn't one. |
|
From: Benjamin R. <ben...@ou...> - 2011-02-25 15:09:53
|
On Fri, Feb 25, 2011 at 8:09 AM, Philipp A. <fly...@we...> wrote: > hi, > Axes3D from mpl_toolkits.mplot3d does not override set_*ticklabels. > this bug<http://sourceforge.net/tracker/index.php?func=detail&aid=2874110&group_id=80706&atid=560720>is about the issue. > to get a crude replacement, i have to do the following: > > for x, s in enumerate(ticks): >> ax.text3D(x, -.1, -.5, s) >> for a in ax.w_xaxis.get_ticklabels(): >> a.set_visible(False) >> > > is there a way to do better and hack my values into the real tick labels > (i bet they are drawn internally the same as text3D, but there is no way to > access the values)? > > In matplotlib in the development branch, I am able to call ax.w_xaxis.set_ticklabels() (or ax.w_yaxis, or ax.w_zaxis) and have the ticks show up appropriately. I have not tested earlier versions of matplotlib, though. Which version are you using? Admittedly, the control of the ticks is very poor in mplot3d. I hope to improve that over the next several months. Ben Root |
|
From: Darren D. <dsd...@gm...> - 2011-02-25 14:42:33
|
On Fri, Feb 25, 2011 at 6:03 AM, Daniel Mader <dan...@go...> wrote: > Hi Goyo and Darren, > > thanks for pointing out the rcParams solution! For the time being, > this seems an OK approach. I'd like to use the automatic solution, > though There isn't one. |
|
From: Philipp A. <fly...@we...> - 2011-02-25 14:09:45
|
hi, Axes3D from mpl_toolkits.mplot3d does not override set_*ticklabels. this bug<http://sourceforge.net/tracker/index.php?func=detail&aid=2874110&group_id=80706&atid=560720>is about the issue. to get a crude replacement, i have to do the following: for x, s in enumerate(ticks): > ax.text3D(x, -.1, -.5, s) > for a in ax.w_xaxis.get_ticklabels(): > a.set_visible(False) > is there a way to do better and hack my values into the real tick labels (i bet they are drawn internally the same as text3D, but there is no way to access the values)? |
|
From: Yuri D'E. <wa...@us...> - 2011-02-25 12:20:17
|
In the following:
<<<<<<<<<<<
import matplotlib as mpl
import matplotlib.figure
import matplotlib.backends.backend_agg
fig = mpl.figure.Figure()
cvs = mpl.backends.backend_agg.FigureCanvasAgg(fig)
fig.set_size_inches((20,20))
fig.suptitle("Horray!", fontsize=20)
plot = fig.add_subplot(111)
plot.set_title("Subtitle")
plot.plot([1,2,3], [3,2,1])
fig.savefig("out.png", bbox_inches='tight')
>>>>>>>>>>>
suptitle is stripped from the figure.
Of course the title is present if you unset bbox_inches, but that's unexpected behavior for me.
Is this a bug?
Thanks
|