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
(12) |
2
(14) |
3
(13) |
4
(6) |
|
5
(6) |
6
(21) |
7
(29) |
8
(30) |
9
(13) |
10
(4) |
11
(4) |
|
12
(4) |
13
(15) |
14
(22) |
15
(23) |
16
(23) |
17
(9) |
18
(23) |
|
19
(12) |
20
(10) |
21
(26) |
22
(5) |
23
(32) |
24
(5) |
25
(7) |
|
26
(4) |
27
(3) |
28
(19) |
29
(20) |
|
|
|
|
From: Fabrice S. <si...@lm...> - 2012-02-03 15:51:21
|
Le vendredi 03 février 2012 à 12:11 +0000, David Craig a écrit :
> Hi, I am using matplotlib to produce some spectrograms for seismic
> data. I am looking at a 10 day period with a sample rate of 20sps. I
> would like to have my spectrogram to be composed of 10 minute windows
> with an overlap of 90%. However when I try and run my script I run out
> of memory. I can produce the spectrogram for a maximum of 3 days
> before an error occurs.
> I have also tried to produce a spectrogram for each day and stick them
> together using subplot, but I then get the error given below. Anyone
> know a way around this??
> Thanks,
> David
It seems that the MemoryError does not occur when computing the
spectrogram, but when rendering it. A quick rule of a thumb tells me
that you have to display an image that is 12000x14400:
12000 frequencies, as you are using windows with 12000 samples
(no padded assumed)
14400 windows, due to the 90% overlap
Having a 4-channel for the RGBA image may throw the MemoryError.
Can you check by trying to "imshow" such an array ?
You can also reduce the overlap, the one you used lead to a spectrum
computation each minute...
|
|
From: Pål G. E. <pa...@gm...> - 2012-02-03 15:15:24
|
Hi
Thank you for trying to help me, though I can't see how aspect is going
to help me. As I understand of the documentation, it would require me to
know the
relationship between x and y, which I don't.
I can calculate it, but since it varies between each change in xlimits
and different plot, it would be the same as calculating the ylimits.
As for pyplot.xlim(xmin,xmax) (suggested by Ethan Swint), it does the same
as ax.set_xlim() for me.
Below is a sample code that will illustrate the problem.
Regards
Pål
####### Start code ############
#!/usr/bin/env python
import matplotlib
matplotlib.use('Qt4Agg') # generate postscript output by default
import matplotlib.pyplot as plt
import numpy as np
# Creating a function to plot
x = np.linspace(-10, 10, 200)
p = np.poly1d([2, 3, 1, 4])
y = p(x) * np.sin(x)
# plotting the full figure
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x, y)
ax.autoscale(tight=True)
plt.title('Full graph. (Press key for next plot)')
plt.draw()
plt.waitforbuttonpress()
# This is how I'm currently doing it
# x limits
xmin = 2
xmax = 6
# Calculating y limits
ymin = y[np.logical_and(xmin < x, x < xmax)].min()
ymax = y[np.logical_and(xmin < x, x < xmax)].max()
# Inserting some room
room = np.maximum(np.abs(ymin * 0.05), np.abs(ymax * 0.05))
ymin = ymin + room * np.sign(ymin)
ymax = ymax + room * np.sign(ymax)
# Setting the limits
ax.set_xlim([xmin, xmax])
ax.set_ylim([ymin, ymax])
plt.title('What I want (Press key for next plot)')
plt.draw()
plt.waitforbuttonpress()
# This is what pyplot does by default if I only set the limits
ax.autoscale(tight=True)
ax.set_xlim([2, 6])
plt.title('What I get if I only use set_xlim (Press key for exit)')
plt.draw()
plt.waitforbuttonpress()
plt.close()
####### End code ############
On 3 February 2012 15:21, Benjamin Root <ben...@ou...> wrote:
>
>
> On Friday, February 3, 2012, Pål Gunnar Ellingsen <pa...@gm...>
> wrote:
> > Hi
> >
> > I've got a plot, containing a graph.
> > I would like to look at certain parts of it.
> > To do this I zoom in on the x-axis using set_xlim()
> > Then I would like to call autoscale(axis='y') and have matplotlib
> > autoscale the y axis within the current x-axis.
> >
> > I've tried several ways of doing this, both with autoscale and
> set_ylim(auto=True)
> > but non of them have been able to do this, as they only autoscale y on
> the full graph.
> > In the end I ended up writing my own code for calculating the new ymin
> and ymax ans using set_ylim([ymin, ymax]),
> > but I feel that this should not be necessary.
> >
> > While googling for the a solution I found an earlier e-mail on the
> matplotlib list,
> >
> http://www.mail-archive.com/mat...@li.../msg19664.html
> > which describes the same problem, but was never answered.
> >
> > Is there any other solution for this that I've missed?
> >
> > Regards
> >
> > Pål
> >
>
> Actually, the autoscaling is working as it should in your case. By
> default, automatic limits will encompass all data plotted.
>
> The missing piece of your puzzle is specifying an aspect constraint.
> ax.set_aspect() will allow for some sort of relationship between the x and
> y axes to exist. For example, setting it to 'equal' means that limits are
> chosen such that a distance on the x axis is displayed the same way as the
> same distance in the y-axis. There are some other preset values and I
> think you can specify a float as well.
>
> This is what I can remember of the top of my head. I hope this helps!
>
> Ben Root
|
|
From: Benjamin R. <ben...@ou...> - 2012-02-03 14:21:57
|
On Friday, February 3, 2012, Pål Gunnar Ellingsen <pa...@gm...> wrote: > Hi > > I've got a plot, containing a graph. > I would like to look at certain parts of it. > To do this I zoom in on the x-axis using set_xlim() > Then I would like to call autoscale(axis='y') and have matplotlib > autoscale the y axis within the current x-axis. > > I've tried several ways of doing this, both with autoscale and set_ylim(auto=True) > but non of them have been able to do this, as they only autoscale y on the full graph. > In the end I ended up writing my own code for calculating the new ymin and ymax ans using set_ylim([ymin, ymax]), > but I feel that this should not be necessary. > > While googling for the a solution I found an earlier e-mail on the matplotlib list, > http://www.mail-archive.com/mat...@li.../msg19664.html > which describes the same problem, but was never answered. > > Is there any other solution for this that I've missed? > > Regards > > Pål > Actually, the autoscaling is working as it should in your case. By default, automatic limits will encompass all data plotted. The missing piece of your puzzle is specifying an aspect constraint. ax.set_aspect() will allow for some sort of relationship between the x and y axes to exist. For example, setting it to 'equal' means that limits are chosen such that a distance on the x axis is displayed the same way as the same distance in the y-axis. There are some other preset values and I think you can specify a float as well. This is what I can remember of the top of my head. I hope this helps! Ben Root |
|
From: David C. <dcd...@gm...> - 2012-02-03 12:11:29
|
Hi, I am using matplotlib to produce some spectrograms for seismic data. I
am looking at a 10 day period with a sample rate of 20sps. I would like to
have my spectrogram to be composed of 10 minute windows with an overlap of
90%. However when I try and run my script I run out of memory. I can
produce the spectrogram for a maximum of 3 days before an error occurs.
I have also tried to produce a spectrogram for each day and stick them
together using subplot, but I then get the error given below. Anyone know a
way around this??
Thanks,
David
Traceback (most recent call last):
File
"/usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtk.py", line
394, in expose_event
self._render_figure(self._pixmap, w, h)
File
"/usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py",
line 75, in _render_figure
FigureCanvasAgg.draw(self)
File
"/usr/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line
394, in draw
self.figure.draw(self.renderer)
File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in
draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/matplotlib/figure.py", line 798,
in draw
func(*args)
File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in
draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/matplotlib/axes.py", line 1946, in
draw
a.draw(renderer)
File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in
draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 354, in
draw
im = self.make_image(renderer.get_image_magnification())
File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 569, in
make_image
transformed_viewLim)
File "/usr/lib/python2.7/site-packages/matplotlib/image.py", line 201, in
_get_unsampled_image
x = self.to_rgba(self._A, self._alpha)
File "/usr/lib/python2.7/site-packages/matplotlib/cm.py", line 194, in
to_rgba
x = self.cmap(x, alpha=alpha, bytes=bytes)
File "/usr/lib/python2.7/site-packages/matplotlib/colors.py", line 551,
in __call__
rgba = np.empty(shape=xa.shape+(4,), dtype=lut.dtype)
MemoryError
|
|
From: Pål G. E. <pa...@gm...> - 2012-02-03 11:59:36
|
Hi I've got a plot, containing a graph. I would like to look at certain parts of it. To do this I zoom in on the x-axis using set_xlim() Then I would like to call autoscale(axis='y') and have matplotlib autoscale the y axis within the current x-axis. I've tried several ways of doing this, both with autoscale and set_ylim(auto=True) but non of them have been able to do this, as they only autoscale y on the full graph. In the end I ended up writing my own code for calculating the new ymin and ymax ans using set_ylim([ymin, ymax]), but I feel that this should not be necessary. While googling for the a solution I found an earlier e-mail on the matplotlib list, http://www.mail-archive.com/mat...@li.../msg19664.html which describes the same problem, but was never answered. Is there any other solution for this that I've missed? Regards Pål |
|
From: Benjamin R. <ben...@ou...> - 2012-02-03 01:19:52
|
On Thu, Feb 2, 2012 at 6:25 PM, Jerzy Karczmarczuk <
jer...@un...> wrote:
> Benjamin Root on my suggestion that one can use del instead of remove :
>
> There are methods for ax that properly handle removal of types of artists
> that have been attached to an axes. The above approach assumes that no
> other collections have been plotted that you wanted to keep. The approach
> I gave is a very surgical method that makes sure that only what is supposed
> to be removed gets removed. Both are valid, and their usefulness depends
> upon which view of the data you need (remove types of artists versus
> removing particular artists).
>
> Yes, absolutely.
> With just a little remark: remove is a Python function which *searches*
> the list for a given value. del uses indices, so
> del lst[10000]
> will be most probably faster than lst.remove(value), if this value happens
> to occur for the first time at index 10000. Unless Matplotlib uses a
> specially tuned version of remove.
>
>
Don't confuse Python's remove() method for lists with the remove() method
for matplotlib Artist (and subclassed Artists) objects. Collections are a
subclass of Artist, and remove() simply means "remove me from the Axes
object I was connected to". This is because an Axes object contains lists
to the artists, collections and others that have been attached to it, and
each Artist has a reference to the Axes object that it was connected to.
So, calling remove() on an Artist will do all the appropriate house-keeping.
matplotlib Artist objects do not implement __del__(), so deleting an Artist
before calling remove() will not properly disconnect all of the callbacks
and references. I suspect that the only reason why this works at all is
that there is a lot of usage of weakrefs and it so there might be enough
error-checking to keep everything from crashing.
Others who are much more familiar with the underlying architecture may be
able to comment better. In the meantime, the pedantic, better form of:
del ax.collections[:]
would be:
for item in ax.collections :
item.remove()
del ax.collections[:]
>
>
>> Under Windows XP, ion() is not too
>> compatible with show().
>> TKAgg (by default), WXAgg and GTKAgg bomb Bens program (and without
>> draw() nothing is plotted).
>>
>>
> That would be a bug and should be reported (assuming that it is in the
> latest version). Make sure that you are using at least v1.0.1 (preferably
> v1.1.0) to make sure that show() should do what you want. Any version
> earlier than v1.0.1 is very unpredictable with respect to multiple show()
> calls.
>
> I use 1.1.0. (Python 2.7.2) I didn't report any bug because I didn't know
> whether this was a bug...
>
Then, please do report it.
> But there are more...
> The animation module uses various timers depending on the back-end. This
> is -- perhaps -- the result of the fact that Python standard Timer (a
> subclass of Thread) is, to say it mildly, rather weak. So, under Tk the
> system uses after(), wx offers its timers, etc. Timed animation works
> differently under various backends.
>
This should also be a new thread, and possibly a new bug report as well.
Ben Root
|
|
From: Jerzy K. <jer...@un...> - 2012-02-03 00:25:20
|
Benjamin Root on my suggestion that one can use del instead of remove : > There are methods for ax that properly handle removal of types of > artists that have been attached to an axes. The above approach > assumes that no other collections have been plotted that you wanted to > keep. The approach I gave is a very surgical method that makes sure > that only what is supposed to be removed gets removed. Both are > valid, and their usefulness depends upon which view of the data you > need (remove types of artists versus removing particular artists). > Yes, absolutely. With just a little remark: remove is a Python function which *searches* the list for a given value. del uses indices, so del lst[10000] will be most probably faster than lst.remove(value), if this value happens to occur for the first time at index 10000. Unless Matplotlib uses a specially tuned version of remove. > > Under Windows XP, ion() is not too > compatible with show(). > TKAgg (by default), WXAgg and GTKAgg bomb Bens program (and without > draw() nothing is plotted). > > > That would be a bug and should be reported (assuming that it is in the > latest version). Make sure that you are using at least v1.0.1 > (preferably v1.1.0) to make sure that show() should do what you want. > Any version earlier than v1.0.1 is very unpredictable with respect to > multiple show() calls. I use 1.1.0. (Python 2.7.2) I didn't report any bug because I didn't know whether this was a bug... But there are more... The animation module uses various timers depending on the back-end. This is -- perhaps -- the result of the fact that Python standard Timer (a subclass of Thread) is, to say it mildly, rather weak. So, under Tk the system uses after(), wx offers its timers, etc. Timed animation works differently under various backends. Here: http://users.info.unicaen.fr/~karczma/TEACH/Test/isingVZ.py is a program which simulates/visualizes a simple-minded 2D Ising model (vectorized Metropolis Monte-Carlo; not *exactly* physical, but only mister Nobody is perfect...). It should update the picture dynamically, and my students can see how the ferromagnetic domains develop. When run with Tk, OK. GTK and wx -- no. The animation runs, but the figure is frozen for many seconds, and it is updated when the Slider is activated. The autonomous refreshing of the image is much much slower than under TK. I don' understand what is happening... Tested on Windows XP, and under Linux (Fedora). I repeat, the animation runs, this is a problem of refreshing the display. Thank you, and all the best. Jerzy Karczmarczuk |
|
From: Benjamin R. <ben...@ou...> - 2012-02-02 22:02:00
|
On Thu, Feb 2, 2012 at 3:52 PM, Jerzy Karczmarczuk < jer...@un...> wrote: > Benjamin Root : > > Just about any mpl plotting function (plot(), scatter(), hist(), etc.) > > returns an object. Most of the time, users do not save the result > > into a variable, but if you want to do advanced tricks, you will need > > to save those returns. > Sorry for a shameless attempt to add something to this, but actually > here you don't need it, these collections are accessible through the > current axes: > > > plt.plot([0, 1, 2, 3, 4], [4, 3, 2, 1, 0]) > pts = plt.scatter([1, 2, 3], [1, 2, 3]) > > ax=plt.gca() > ... > del ax.collections[:] > > I forget if this approach is recommended or not. There are methods for ax that properly handle removal of types of artists that have been attached to an axes. The above approach assumes that no other collections have been plotted that you wanted to keep. The approach I gave is a very surgical method that makes sure that only what is supposed to be removed gets removed. Both are valid, and their usefulness depends upon which view of the data you need (remove types of artists versus removing particular artists). > This reminds me a nuisance... Under Windows XP, ion() is not too > compatible with show(). > TKAgg (by default), WXAgg and GTKAgg bomb Bens program (and without > draw() nothing is plotted). > > That would be a bug and should be reported (assuming that it is in the latest version). Make sure that you are using at least v1.0.1 (preferably v1.1.0) to make sure that show() should do what you want. Any version earlier than v1.0.1 is very unpredictable with respect to multiple show() calls. Ben Root |
|
From: Jerzy K. <jer...@un...> - 2012-02-02 21:52:24
|
Benjamin Root : > Just about any mpl plotting function (plot(), scatter(), hist(), etc.) > returns an object. Most of the time, users do not save the result > into a variable, but if you want to do advanced tricks, you will need > to save those returns. Sorry for a shameless attempt to add something to this, but actually here you don't need it, these collections are accessible through the current axes: plt.plot([0, 1, 2, 3, 4], [4, 3, 2, 1, 0]) pts = plt.scatter([1, 2, 3], [1, 2, 3]) ax=plt.gca() ... del ax.collections[:] (Or, say, del ax.lines[:] to remove the first line ; I do it often when I plot a solution of a differential equation, a trajectory, keeping just a few last segments). == This reminds me a nuisance... Under Windows XP, ion() is not too compatible with show(). TKAgg (by default), WXAgg and GTKAgg bomb Bens program (and without draw() nothing is plotted). Jerzy Karczmarczuk |
|
From: Benjamin R. <ben...@ou...> - 2012-02-02 21:09:49
|
On Thu, Feb 2, 2012 at 3:04 PM, G Jones <gle...@gm...> wrote: > Note there is a typo. Ben assigned the output to "pts" but then referenced > "res". > > Good catch! Ben Root |
|
From: G J. <gle...@gm...> - 2012-02-02 21:04:36
|
Note there is a typo. Ben assigned the output to "pts" but then referenced "res". On Thu, Feb 2, 2012 at 12:59 PM, Benjamin Root <ben...@ou...> wrote: > On Thu, Feb 2, 2012 at 2:54 PM, Jim St.Cyr <jim...@gm...> wrote: > >> On 2/2/2012 3:41 PM, Benjamin Root wrote: >> >> On Wed, Feb 1, 2012 at 4:07 PM, Jim St.Cyr <jim...@gm...> wrote: >> >>> Hello- >>> >>> Scenario: >>> >>> Basemap used to display the East Coast of the US and the Atlantic Ocean. >>> Shapelib is used read a shapefile the contents of is pumped into a PyPlot >>> subplot hosted Line Collection which overlays the ocean with a grid >>> PyPlot text is used to label each grid with it's designator. >>> >>> What I want to do is plot a collection of points, save the result as a >>> PNG, >>> clear the first set of points, plot another collection of points, save >>> the >>> result, and so on. The problem is the if I use the Pyplot clf function >>> it wipes >>> everything previously built. >>> >>> What do I need to do in order to clear just the points without clearing >>> everything? >>> >>> Thank you. >>> >>> Jim >>> >>> >> Jim, >> >> Sorry for the delay. Most plotting functions in matplotlib returns a >> Collection object. These objects have a member function "remove()". >> >> >>> import matplotlib.pyplot as plt >> >>> plt.ion() >> >>> plt.plot([0, 1, 2, 3, 4], [4, 3, 2, 1, 0]) >> >>> pts = plt.scatter([1, 2, 3], [1, 2, 3]) >> >>> plt.show() # You see three points and a line >> >>> res.remove() >> >>> plt.show() # Now you see only the line >> >> >> I hope that helps! >> Ben Root >> >> Ben- >> >> Very helpful. A question, how do you determine the object designator? >> In your example above, res.remove(), where did the 'res' come from? >> >> Jim >> > > It was assigned when I called scatter(). Just about any mpl plotting > function (plot(), scatter(), hist(), etc.) returns an object. Most of the > time, users do not save the result into a variable, but if you want to do > advanced tricks, you will need to save those returns. > > Ben Root > > > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Benjamin R. <ben...@ou...> - 2012-02-02 21:00:15
|
On Thu, Feb 2, 2012 at 2:54 PM, Jim St.Cyr <jim...@gm...> wrote: > On 2/2/2012 3:41 PM, Benjamin Root wrote: > > On Wed, Feb 1, 2012 at 4:07 PM, Jim St.Cyr <jim...@gm...> wrote: > >> Hello- >> >> Scenario: >> >> Basemap used to display the East Coast of the US and the Atlantic Ocean. >> Shapelib is used read a shapefile the contents of is pumped into a PyPlot >> subplot hosted Line Collection which overlays the ocean with a grid >> PyPlot text is used to label each grid with it's designator. >> >> What I want to do is plot a collection of points, save the result as a >> PNG, >> clear the first set of points, plot another collection of points, save the >> result, and so on. The problem is the if I use the Pyplot clf function >> it wipes >> everything previously built. >> >> What do I need to do in order to clear just the points without clearing >> everything? >> >> Thank you. >> >> Jim >> >> > Jim, > > Sorry for the delay. Most plotting functions in matplotlib returns a > Collection object. These objects have a member function "remove()". > > >>> import matplotlib.pyplot as plt > >>> plt.ion() > >>> plt.plot([0, 1, 2, 3, 4], [4, 3, 2, 1, 0]) > >>> pts = plt.scatter([1, 2, 3], [1, 2, 3]) > >>> plt.show() # You see three points and a line > >>> res.remove() > >>> plt.show() # Now you see only the line > > > I hope that helps! > Ben Root > > Ben- > > Very helpful. A question, how do you determine the object designator? In > your example above, res.remove(), where did the 'res' come from? > > Jim > It was assigned when I called scatter(). Just about any mpl plotting function (plot(), scatter(), hist(), etc.) returns an object. Most of the time, users do not save the result into a variable, but if you want to do advanced tricks, you will need to save those returns. Ben Root |
|
From: Jim St.C. <jim...@gm...> - 2012-02-02 20:54:40
|
On 2/2/2012 3:41 PM, Benjamin Root wrote: > On Wed, Feb 1, 2012 at 4:07 PM, Jim St.Cyr <jim...@gm... > <mailto:jim...@gm...>> wrote: > > Hello- > > Scenario: > > Basemap used to display the East Coast of the US and the Atlantic Ocean. > Shapelib is used read a shapefile the contents of is pumped into a PyPlot > subplot hosted Line Collection which overlays the ocean with a grid > PyPlot text is used to label each grid with it's designator. > > What I want to do is plot a collection of points, save the result as a PNG, > clear the first set of points, plot another collection of points, save the > result, and so on. The problem is the if I use the Pyplot clf function it > wipes > everything previously built. > > What do I need to do in order to clear just the points without clearing > everything? > > Thank you. > > Jim > > > Jim, > > Sorry for the delay. Most plotting functions in matplotlib returns a > Collection object. These objects have a member function "remove()". > > >>> import matplotlib.pyplot as plt > >>> plt.ion() > >>> plt.plot([0, 1, 2, 3, 4], [4, 3, 2, 1, 0]) > >>> pts = plt.scatter([1, 2, 3], [1, 2, 3]) > >>> plt.show() # You see three points and a line > >>> res.remove() > >>> plt.show() # Now you see only the line > > > I hope that helps! > Ben Root > Ben- Very helpful. A question, how do you determine the object designator? In your example above, res.remove(), where did the 'res' come from? Jim |
|
From: Benjamin R. <ben...@ou...> - 2012-02-02 20:42:22
|
On Wed, Feb 1, 2012 at 4:07 PM, Jim St.Cyr <jim...@gm...> wrote: > Hello- > > Scenario: > > Basemap used to display the East Coast of the US and the Atlantic Ocean. > Shapelib is used read a shapefile the contents of is pumped into a PyPlot > subplot hosted Line Collection which overlays the ocean with a grid > PyPlot text is used to label each grid with it's designator. > > What I want to do is plot a collection of points, save the result as a PNG, > clear the first set of points, plot another collection of points, save the > result, and so on. The problem is the if I use the Pyplot clf function it > wipes > everything previously built. > > What do I need to do in order to clear just the points without clearing > everything? > > Thank you. > > Jim > > Jim, Sorry for the delay. Most plotting functions in matplotlib returns a Collection object. These objects have a member function "remove()". >>> import matplotlib.pyplot as plt >>> plt.ion() >>> plt.plot([0, 1, 2, 3, 4], [4, 3, 2, 1, 0]) >>> pts = plt.scatter([1, 2, 3], [1, 2, 3]) >>> plt.show() # You see three points and a line >>> res.remove() >>> plt.show() # Now you see only the line I hope that helps! Ben Root |
|
From: Sterling S. <sm...@fu...> - 2012-02-02 18:47:05
|
> Hello! > > How can I zoom exactly on the same region on two different subplots at > the same time. This option is enable when I use plotfile but not if I > use plot, and subplots? > > Thx! > Fabien Fabien, When you create the new subplots, add the sharex=ax, sharey=ax keywords, where ax is the first set of axes you create. -Sterling |
|
From: Fabien L. <laf...@gm...> - 2012-02-02 15:43:13
|
Thanks Daryl, it works!
2012/2/2 Daryl Herzmann <ak...@ia...>:
> On Thu, Feb 2, 2012 at 8:52 AM, Fabien Lafont <laf...@gm...> wrote:
>> I don't manage to put the color of my plot in the argument' list function.
>>
>> Example:
>>
>> def function(color):
>>
>> plot(x,y,'.', color, label = "this is my curve")
>>
>>
>> function('r')
>>
>> even if I put function(" 'r' ") it doesn't work.
>>
>> Any idea?
>
> I would suggest using named arguments for everything other than x and y, so
>
> plot(x,y,marker=',', color=color, label='this is my curve')
>
> http://matplotlib.sourceforge.net/api/axes_api.html?highlight=plot#matplotlib.axes.Axes.plot
>
> daryl
|
|
From: Daryl H. <ak...@ia...> - 2012-02-02 15:07:32
|
On Thu, Feb 2, 2012 at 8:52 AM, Fabien Lafont <laf...@gm...> wrote:
> I don't manage to put the color of my plot in the argument' list function.
>
> Example:
>
> def function(color):
>
> plot(x,y,'.', color, label = "this is my curve")
>
>
> function('r')
>
> even if I put function(" 'r' ") it doesn't work.
>
> Any idea?
I would suggest using named arguments for everything other than x and y, so
plot(x,y,marker=',', color=color, label='this is my curve')
http://matplotlib.sourceforge.net/api/axes_api.html?highlight=plot#matplotlib.axes.Axes.plot
daryl
|
|
From: Fabien L. <laf...@gm...> - 2012-02-02 14:52:35
|
I don't manage to put the color of my plot in the argument' list function.
Example:
def function(color):
plot(x,y,'.', color, label = "this is my curve")
function('r')
even if I put function(" 'r' ") it doesn't work.
Any idea?
|
|
From: Fabien L. <laf...@gm...> - 2012-02-02 14:22:12
|
Thx! 2012/2/2 Angus McMorland <am...@gm...>: > On 2 February 2012 08:32, Fabien Lafont <laf...@gm...> wrote: >> Hello! >> >> How can I zoom exactly on the same region on two different subplots at >> the same time. This option is enable when I use plotfile but not if I >> use plot, and subplots? > > Create the first axes object, then when you create subsequent ones, > pass the first as the value of the sharex and sharey keywords to the > subplot or add_axes command. > See this page [1] for a quick example. > > Angus > > [1] http://matplotlib.sourceforge.net/users/recipes.html?highlight=sharex%20subplot > >> Thx! >> Fabien >> >> ------------------------------------------------------------------------------ >> Keep Your Developer Skills Current with LearnDevNow! >> The most comprehensive online learning library for Microsoft developers >> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, >> Metro Style Apps, more. Free future releases when you subscribe now! >> http://p.sf.net/sfu/learndevnow-d2d >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > -- > AJC McMorland > Post-doctoral research fellow > Neurobiology, University of Pittsburgh |
|
From: Angus M. <am...@gm...> - 2012-02-02 13:41:28
|
On 2 February 2012 08:32, Fabien Lafont <laf...@gm...> wrote: > Hello! > > How can I zoom exactly on the same region on two different subplots at > the same time. This option is enable when I use plotfile but not if I > use plot, and subplots? Create the first axes object, then when you create subsequent ones, pass the first as the value of the sharex and sharey keywords to the subplot or add_axes command. See this page [1] for a quick example. Angus [1] http://matplotlib.sourceforge.net/users/recipes.html?highlight=sharex%20subplot > Thx! > Fabien > > ------------------------------------------------------------------------------ > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh |
|
From: Fabien L. <laf...@gm...> - 2012-02-02 13:32:57
|
Hello! How can I zoom exactly on the same region on two different subplots at the same time. This option is enable when I use plotfile but not if I use plot, and subplots? Thx! Fabien |
|
From: C M <cmp...@gm...> - 2012-02-01 22:35:50
|
On Wed, Feb 1, 2012 at 5:25 PM, C M <cmp...@gm...> wrote: > The standard navigation toolbar has tools that press in and stay pressed > to put the interation into a "mode", like zoom mode or pan mode. You press > the zoom tool, it stays shown as pressed in while it's in that mode. > CORRECTION: My mistake, it's not really shown pressed, more like "selected," with a blue thin line highlighting its perimeter. In any case, it's a cue to the user that the UI is in that mode. That's what I'd like my custom tool to have. |
|
From: C M <cmp...@gm...> - 2012-02-01 22:26:01
|
The standard navigation toolbar has tools that press in and stay pressed to put the interation into a "mode", like zoom mode or pan mode. You press the zoom tool, it stays shown as pressed in while it's in that mode. I am trying to add a new custom tool to the toolbar, and want it to put things into a mode as well, and therefore stay pressed in until pressed again. How do I do that? This is using the wxAgg backend. I searched through backend_wxagg and backend_bases and couldn't figure it out. Normally in wxPython you specify the style of a tool as having, to quote its API, "wxITEM_CHECK for a checkable tool (such tool stays pressed after it had been toggled) " Here I didn't see any option for that. Thanks, Che |
|
From: Jim St.C. <jim...@gm...> - 2012-02-01 22:07:27
|
Hello- Scenario: Basemap used to display the East Coast of the US and the Atlantic Ocean. Shapelib is used read a shapefile the contents of is pumped into a PyPlot subplot hosted Line Collection which overlays the ocean with a grid PyPlot text is used to label each grid with it's designator. What I want to do is plot a collection of points, save the result as a PNG, clear the first set of points, plot another collection of points, save the result, and so on. The problem is the if I use the Pyplot clf function it wipes everything previously built. What do I need to do in order to clear just the points without clearing everything? Thank you. Jim |
|
From: Benjamin R. <ben...@ou...> - 2012-02-01 19:41:51
|
On Tue, Jan 31, 2012 at 12:19 AM, Christoph Piefke < anm...@du...> wrote: > Hello everybody, > > I have a problem transferring from 3D data to a 2D representation. > I used mayavi to define a cut plane through a volume data set and got > the xyz > coordinates for the points on the plane and the data at each point. > > Now I would like to make a contour plot of that data in matplotlib. > > My first try was rotating the normal of the cut plane parallel to the > z-axes and leaving the data unchanged. > Unfortunately, this changed the number of grid points, so I do not know > how to fit these both sets together. > > Is there a convenient way how to sample these 3d data and put it on a 2d > grid? > > Thank you very much in advance, Chris > > I have attached an example that was provided by a fellow user recently that might be of use. I am seeing how to either modify it to include it into mplot3d or to at least include it in the gallary examples. I hope it is helpful to you! Ben Root |