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
(7) |
2
(12) |
3
(7) |
4
(23) |
5
(5) |
6
(7) |
7
(4) |
|
8
(7) |
9
(25) |
10
(17) |
11
(25) |
12
(11) |
13
(8) |
14
(6) |
|
15
(1) |
16
(22) |
17
(11) |
18
(12) |
19
(22) |
20
(32) |
21
(9) |
|
22
(4) |
23
(16) |
24
(5) |
25
(9) |
26
(26) |
27
(21) |
28
(14) |
|
29
(6) |
30
(8) |
31
(4) |
|
|
|
|
|
From: John S. <jsalvati@u.washington.edu> - 2010-08-23 19:07:00
|
Hello, I have a plot with lots of curves on it (say 30), and I would like to have some way of distinguishing the curves from each other. Just plotting them works well for a few curves because they come out as different colors unless you specify otherwise, but if you do too many you start getting repeats is there a way to have matplotlib also vary the line style that it automatically assigns? Or perhaps someone has another way of distinguishing lots of curves? Best Regards, John |
|
From: xiaoni <wa...@ya...> - 2010-08-23 18:53:19
|
Hello,
I got a problem with backend in matplotlib.
I used ipython for launching the codes and the backend of
matplotlib is GTKAgg. I have a code.py with a for loop for processing data,
and in each iteration I read and plot and save the figures. Because
there are so many figures, I set the non-interative mode and not using
"show()" in the code. Then the memory is used more and more as the
iteration number increases, and the most memory is due to write_png
function. I guess that the figures (though not shown on the screen)
from each iteration take the memory, and try to close the figures produced at
each iteration.
what I did:
modify the backend to Agg in the code
add "close('all')" before each iteration finish.
This works for removing the memory problem. But a new issue arrive.
After the run is finished, the ipython command window has no response
to any keyboard input for a few seconds, then a warning message appear:
"Warning: Timeout for mainloop thread exceeded switching to
nonthreaded mode (until mainloop wakes up again)",
and when I tried to quit ipython afterwards, it is stuck there and the
ipython is crashed.
But if I tried using "python code.py" , then it works well : no warnings.
Does it mean that we can not use ipython and a backend non-GUI at the same
time ?
Any one would like to explain a bit ? Thanks in advance !!
xiaoni
|
|
From: Michael D. <md...@st...> - 2010-08-23 16:05:45
|
On 08/23/2010 11:08 AM, Daniel Hyams wrote:
> Thanks for your response Michael!
>
> Deleting the fontList.cache indeed solved the problem. The first
> sample that I gave below now works fine under both Windows and Linux;
> whew...I would have never known about that cache file without your help.
>
> So, should the fontList.cache file be deleted each time my app runs,
> in case new fonts have been installed since the last invocation? How
> do we keep that cache up to date?
The cache exists because it can take a long time to read through all of
the font files on the system each time matplotlib is imported. It might
be fast enough to simply stat the dates on all the files in the font
directories (without reading their contents)... I don't know if
experiments were done on this when the cache was originally added (that
pre-dates me).
Mike
>>
>>
> On Mon, Aug 23, 2010 at 10:12 AM, Michael Droettboom <md...@st...
> <mailto:md...@st...>> wrote:
>
> On 08/22/2010 10:00 PM, Daniel Hyams wrote:
>> I am searching for advice on how to handle selecting a specific
>> font, and using that in a matplotlib figure. As a background,
>> the font will be picked through the wx.FontDialog (common font
>> dialog) provided by wxPython. So, what I will have is the font
>> face (Arial, Times New Roman, Algerian, etc. etc.), the weight,
>> the style (italic, normal) and the point size. All I want to do
>> is create a matplotlib font that matches this, and use it in the
>> plot. My first try was this:
>>
>> import matplotlib.pyplot as plt
>> import matplotlib.font_manager as fm
>>
>> # this does not work. The title font is wrong.
>> the_font = 'Century Schoolbook'
>> fp = fm.FontProperties()
>> fp.set_name(the_font)
>> fp.set_size(24)
>> plt.title('The Title that should be in Century
>> Schoolbook',fontproperties=fp)
>> print fp
>> plt.show()
>>
>> But that didn't work. I know that "Century Schoolbook" is not
>> really a font family, but in the docs it says that you can list a
>> font there.
> On my RHEL5 system (at least), the full name of that font is
> "Century Schoolbook L". You do, of course, have to match the font
> name exactly.
>
> You may want to experiment with using wx.Font.GetFaceName vs.
> wx.Font.GetFamilyString from the font chooser dialog and see if
> either returns the correct result.
>
> You can see the list of fonts that matplotlib found on your system
> by doing:
>
> from matplotlib import font_manager
> font_manager.fontManager.ttflist
>
> (This is not a public API -- but may help with debugging the issue
> here).
>
> Is the font you are hoping to match with in that list?
>
> Another thing you may want to try is deleting matplotlib's font
> cache, in case this font was installed after matplotlib was first
> run on your system. It is is in a file "fontList.cache" and lives
> in the user data area (can't remember the exact location of this
> on Windows off hand).
>
>>
>> The following does work, if I manually set the TrueType file
>> explicitly:
>>
>> fp = fm.FontProperties()
>> fp.set_file('c:\\Windows\Fonts\CENSCBK.TTF')
>> fp.set_size(24)
>> print fp
>> plt.title('The Title that is in Century
>> Schoolbook',fontproperties=fp)
>> plt.show()
>>
>> So I guess the question is....how does one accomplish this,
>> portably? I don't quite understand the ins and outs of fonts.....
>>
>>
>> p.s.
>> I did take a stab at creating a mapping between the font names /
>> weights / styles like this:
>>
>> all_fontfiles = fm.win32InstalledFonts()
>> allfonts = fm.createFontList(all_fontfiles)
>> fontdict = {}
>> for f in allfonts:
>> fontdict[(f.name <http://f.name>,f.style,f.weight)] = f.fname
>>
>> And I think I can get this to work, because this maps me to a TTF
>> file for any name, style, and weight combination. But this
>> seemed awfully hacky, and I don't know what problems I'll run
>> into on other platforms (obviously, I would have get
>> all_fontfiles above differently on each platform). If this is
>> the only way to do it, I guess that's OK, but I thought that
>> surely there was a better way.
> That's basically a stricter way of doing what the matplotlib code
> already does. The matplotlib lookup is actually smarter because
> it handles approximate "nearest neighbor" matches. I think the
> problem is more likely one of the above (an inexact name match or
> an out-of-date font cache).
>
> Mike
>
> --
> Michael Droettboom
> Science Software Branch
> Space Telescope Science Institute
> Baltimore, Maryland, USA
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> --
> Daniel Hyams
> dh...@gm... <mailto:dh...@gm...>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
|
|
From: Daniel H. <dh...@gm...> - 2010-08-23 15:08:35
|
Thanks for your response Michael!
Deleting the fontList.cache indeed solved the problem. The first sample
that I gave below now works fine under both Windows and Linux; whew...I
would have never known about that cache file without your help.
So, should the fontList.cache file be deleted each time my app runs, in case
new fonts have been installed since the last invocation? How do we keep
that cache up to date?
On Mon, Aug 23, 2010 at 10:12 AM, Michael Droettboom <md...@st...>wrote:
> On 08/22/2010 10:00 PM, Daniel Hyams wrote:
>
> I am searching for advice on how to handle selecting a specific font, and
> using that in a matplotlib figure. As a background, the font will be picked
> through the wx.FontDialog (common font dialog) provided by wxPython. So,
> what I will have is the font face (Arial, Times New Roman, Algerian, etc.
> etc.), the weight, the style (italic, normal) and the point size. All I
> want to do is create a matplotlib font that matches this, and use it in the
> plot. My first try was this:
>
> import matplotlib.pyplot as plt
> import matplotlib.font_manager as fm
>
> # this does not work. The title font is wrong.
> the_font = 'Century Schoolbook'
> fp = fm.FontProperties()
> fp.set_name(the_font)
> fp.set_size(24)
> plt.title('The Title that should be in Century
> Schoolbook',fontproperties=fp)
> print fp
> plt.show()
>
> But that didn't work. I know that "Century Schoolbook" is not really a
> font family, but in the docs it says that you can list a font there.
>
> On my RHEL5 system (at least), the full name of that font is "Century
> Schoolbook L". You do, of course, have to match the font name exactly.
>
> You may want to experiment with using wx.Font.GetFaceName vs.
> wx.Font.GetFamilyString from the font chooser dialog and see if either
> returns the correct result.
>
> You can see the list of fonts that matplotlib found on your system by
> doing:
>
> from matplotlib import font_manager
> font_manager.fontManager.ttflist
>
> (This is not a public API -- but may help with debugging the issue here).
>
> Is the font you are hoping to match with in that list?
>
> Another thing you may want to try is deleting matplotlib's font cache, in
> case this font was installed after matplotlib was first run on your system.
> It is is in a file "fontList.cache" and lives in the user data area (can't
> remember the exact location of this on Windows off hand).
>
>
> The following does work, if I manually set the TrueType file explicitly:
>
> fp = fm.FontProperties()
> fp.set_file('c:\\Windows\Fonts\CENSCBK.TTF')
> fp.set_size(24)
> print fp
> plt.title('The Title that is in Century Schoolbook',fontproperties=fp)
> plt.show()
>
> So I guess the question is....how does one accomplish this, portably? I
> don't quite understand the ins and outs of fonts.....
>
>
> p.s.
> I did take a stab at creating a mapping between the font names / weights /
> styles like this:
>
> all_fontfiles = fm.win32InstalledFonts()
> allfonts = fm.createFontList(all_fontfiles)
> fontdict = {}
> for f in allfonts:
> fontdict[(f.name,f.style,f.weight)] = f.fname
>
> And I think I can get this to work, because this maps me to a TTF file for
> any name, style, and weight combination. But this seemed awfully hacky, and
> I don't know what problems I'll run into on other platforms (obviously, I
> would have get all_fontfiles above differently on each platform). If this
> is the only way to do it, I guess that's OK, but I thought that surely there
> was a better way.
>
> That's basically a stricter way of doing what the matplotlib code already
> does. The matplotlib lookup is actually smarter because it handles
> approximate "nearest neighbor" matches. I think the problem is more likely
> one of the above (an inexact name match or an out-of-date font cache).
>
> Mike
>
> --
> Michael Droettboom
> Science Software Branch
> Space Telescope Science Institute
> Baltimore, Maryland, USA
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Daniel Hyams
dh...@gm...
|
|
From: Michael D. <md...@st...> - 2010-08-23 14:12:25
|
On 08/22/2010 10:00 PM, Daniel Hyams wrote:
> I am searching for advice on how to handle selecting a specific font,
> and using that in a matplotlib figure. As a background, the font will
> be picked through the wx.FontDialog (common font dialog) provided by
> wxPython. So, what I will have is the font face (Arial, Times New
> Roman, Algerian, etc. etc.), the weight, the style (italic, normal)
> and the point size. All I want to do is create a matplotlib font that
> matches this, and use it in the plot. My first try was this:
>
> import matplotlib.pyplot as plt
> import matplotlib.font_manager as fm
>
> # this does not work. The title font is wrong.
> the_font = 'Century Schoolbook'
> fp = fm.FontProperties()
> fp.set_name(the_font)
> fp.set_size(24)
> plt.title('The Title that should be in Century
> Schoolbook',fontproperties=fp)
> print fp
> plt.show()
>
> But that didn't work. I know that "Century Schoolbook" is not really
> a font family, but in the docs it says that you can list a font there.
On my RHEL5 system (at least), the full name of that font is "Century
Schoolbook L". You do, of course, have to match the font name exactly.
You may want to experiment with using wx.Font.GetFaceName vs.
wx.Font.GetFamilyString from the font chooser dialog and see if either
returns the correct result.
You can see the list of fonts that matplotlib found on your system by doing:
from matplotlib import font_manager
font_manager.fontManager.ttflist
(This is not a public API -- but may help with debugging the issue here).
Is the font you are hoping to match with in that list?
Another thing you may want to try is deleting matplotlib's font cache,
in case this font was installed after matplotlib was first run on your
system. It is is in a file "fontList.cache" and lives in the user data
area (can't remember the exact location of this on Windows off hand).
>
> The following does work, if I manually set the TrueType file explicitly:
>
> fp = fm.FontProperties()
> fp.set_file('c:\\Windows\Fonts\CENSCBK.TTF')
> fp.set_size(24)
> print fp
> plt.title('The Title that is in Century Schoolbook',fontproperties=fp)
> plt.show()
>
> So I guess the question is....how does one accomplish this, portably?
> I don't quite understand the ins and outs of fonts.....
>
>
> p.s.
> I did take a stab at creating a mapping between the font names /
> weights / styles like this:
>
> all_fontfiles = fm.win32InstalledFonts()
> allfonts = fm.createFontList(all_fontfiles)
> fontdict = {}
> for f in allfonts:
> fontdict[(f.name <http://f.name>,f.style,f.weight)] = f.fname
>
> And I think I can get this to work, because this maps me to a TTF file
> for any name, style, and weight combination. But this seemed awfully
> hacky, and I don't know what problems I'll run into on other platforms
> (obviously, I would have get all_fontfiles above differently on each
> platform). If this is the only way to do it, I guess that's OK, but I
> thought that surely there was a better way.
That's basically a stricter way of doing what the matplotlib code
already does. The matplotlib lookup is actually smarter because it
handles approximate "nearest neighbor" matches. I think the problem is
more likely one of the above (an inexact name match or an out-of-date
font cache).
Mike
--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
|
|
From: Daπid <dav...@gm...> - 2010-08-23 13:12:34
|
What I use to create animations is plainly: savefig(head+str(filecode).zfill(digits)+format, dpi=205) plt.clf() filecode+=1 where filecode is the name, digits an int and format usually .png. clf() is important in order to prevent memory leaks, because otherwise mpl stores all the figures one in top of the other, consuming a lot of resources once you have a several images. To stick all of them together, I use a video editor. On Mon, Aug 23, 2010 at 2:59 PM, Kim Hansen <sla...@gm...> wrote: > Hi list, > > I am using animated artists to generate an animation, where I save each step > in the anmantion as a png using the savefig method of the figure instance > after drawing the animated artists on a cached background and after > fig.canvas.blit. > > What I see on screen are the updated animated artists being drawn, but only > the cached background with subplots and axes and grid is being stored in the > savefig commands > called after the last blit. > > Why is only the background saved.? > > I am using matplotlib ver. 0.99.1 and the 'TkAgg' backend on a Win XP PC. > > Thanks in advance, > Kim > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: John H. <jd...@gm...> - 2010-08-23 13:11:45
|
On Mon, Aug 23, 2010 at 7:59 AM, Kim Hansen <sla...@gm...> wrote:
> Hi list,
>
> I am using animated artists to generate an animation, where I save each step
> in the anmantion as a png using the savefig method of the figure instance
> after drawing the animated artists on a cached background and after
> fig.canvas.blit.
>
> What I see on screen are the updated animated artists being drawn, but only
> the cached background with subplots and axes and grid is being stored in the
> savefig commands
> called after the last blit.
>
> Why is only the background saved.?
The animated property tells the figure to not draw the artist on a
call to figure.draw, which is wha savefig calls. This enables you to
draw the background (everything but the animated artists) with a call
to figure.canvas.draw, and then selectively draw your animated artists
when you want. It does pose a problem for saving.
The best approach is to turn off the animated property right before
saving, and turn it back on as needed. Something like
artists = fig.get_children()
animated = dict()
for artist in artists:
animated[artist] = artist.get_animated()
artist.set_animated(False)
fig.savefig('myfig.png')
for artist in artists:
artist.set_animated(animated[artist])
Also, Ryan May has been working on a nice framework for animation that may help,
http://github.com/dopplershift/Animation
JDH
|
|
From: Kim H. <sla...@gm...> - 2010-08-23 12:59:15
|
Hi list, I am using animated artists to generate an animation, where I save each step in the anmantion as a png using the savefig method of the figure instance after drawing the animated artists on a cached background and after fig.canvas.blit. What I see on screen are the updated animated artists being drawn, but only the cached background with subplots and axes and grid is being stored in the savefig commands called after the last blit. Why is only the background saved.? I am using matplotlib ver. 0.99.1 and the 'TkAgg' backend on a Win XP PC. Thanks in advance, Kim |
|
From: Daniel H. <dh...@gm...> - 2010-08-23 02:00:45
|
I am searching for advice on how to handle selecting a specific font, and
using that in a matplotlib figure. As a background, the font will be picked
through the wx.FontDialog (common font dialog) provided by wxPython. So,
what I will have is the font face (Arial, Times New Roman, Algerian, etc.
etc.), the weight, the style (italic, normal) and the point size. All I
want to do is create a matplotlib font that matches this, and use it in the
plot. My first try was this:
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
# this does not work. The title font is wrong.
the_font = 'Century Schoolbook'
fp = fm.FontProperties()
fp.set_name(the_font)
fp.set_size(24)
plt.title('The Title that should be in Century
Schoolbook',fontproperties=fp)
print fp
plt.show()
But that didn't work. I know that "Century Schoolbook" is not really a font
family, but in the docs it says that you can list a font there.
The following does work, if I manually set the TrueType file explicitly:
fp = fm.FontProperties()
fp.set_file('c:\\Windows\Fonts\CENSCBK.TTF')
fp.set_size(24)
print fp
plt.title('The Title that is in Century Schoolbook',fontproperties=fp)
plt.show()
So I guess the question is....how does one accomplish this, portably? I
don't quite understand the ins and outs of fonts.....
p.s.
I did take a stab at creating a mapping between the font names / weights /
styles like this:
all_fontfiles = fm.win32InstalledFonts()
allfonts = fm.createFontList(all_fontfiles)
fontdict = {}
for f in allfonts:
fontdict[(f.name,f.style,f.weight)] = f.fname
And I think I can get this to work, because this maps me to a TTF file for
any name, style, and weight combination. But this seemed awfully hacky, and
I don't know what problems I'll run into on other platforms (obviously, I
would have get all_fontfiles above differently on each platform). If this
is the only way to do it, I guess that's OK, but I thought that surely there
was a better way.
Thanks,
--
Daniel Hyams
dh...@gm...
|
|
From: Eric F. <ef...@ha...> - 2010-08-22 22:54:08
|
On 08/22/2010 04:51 AM, Daπid wrote: > On Sat, Aug 14, 2010 at 10:19 PM, Eric Firing<ef...@ha...> wrote: >> The problem is that the "alpha" kwarg can never be other than a scalar >> in mpl at present, as far as I know. The error message from to_rgba was >> intended to be informative, but in this case it is misleading. > > Thanks for your response. I was following the logic for colors, which > does accept lists. That was a reasonable thing to do, but unfortunately, for historical reasons, there are inconsistencies and ambiguities associates with the alpha kwarg in mpl. > > Anyway, the error message is diferent if I set the color or not, which > is not logical. Granted. This is one of many situations in which the error message is not very informative. We don't have a consistent policy for validating kwargs, so invalid values can filter down into the depths of the code before they trigger an exception. > > By the way, do you have any clue on the persistence of the problem > until the IDLE is restarted? I mean, even with the code fixed, the > error is still raised until IDLE is reopened. > If you are fixing code that is in a module that has been imported, IDLE may be using the old code, not the new. This is inherent in python--importing a module that has already been imported does not rerun the code in that module, or change any existing objects. There are ways of getting around this, at least with respect to function and class definitions, but usually it is easier, surer, and cleaner to restart the python interpreter so that everything is clearly using the new code. Eric > > Thank you again, > > David. |
|
From: Daπid <dav...@gm...> - 2010-08-22 14:51:36
|
On Sat, Aug 14, 2010 at 10:19 PM, Eric Firing <ef...@ha...> wrote: > The problem is that the "alpha" kwarg can never be other than a scalar > in mpl at present, as far as I know. The error message from to_rgba was > intended to be informative, but in this case it is misleading. Thanks for your response. I was following the logic for colors, which does accept lists. Anyway, the error message is diferent if I set the color or not, which is not logical. By the way, do you have any clue on the persistence of the problem until the IDLE is restarted? I mean, even with the code fixed, the error is still raised until IDLE is reopened. Thank you again, David. |
|
From: Jeff W. <js...@fa...> - 2010-08-22 12:45:31
|
On 8/22/10 3:14 AM, Janwillem wrote: > I want to write a script that can check whether a given coordinate is within > a given country > > I now have: > import matplotlib.nxutils as nx > test = nx.points_inside_poly(points, country) > where country is a polygon of longitude latitude pairs and points is a > number of coordinates to be tested. > > This works for manually entered coordinates but now I would like to have a > country border (see and land) as a polygon (low resolution). Is there a > simple way to extract that from the basemap data? > Tanks, Janwillem > > Janwillem: Unfortunately, the answer is no. The country data basemap uses are lines, not polygons. You will have to find another (shapefile?) dataset that provides country polygons for the countries you are interested in. -Jeff |
|
From: Janwillem <jwe...@xs...> - 2010-08-22 09:14:46
|
I want to write a script that can check whether a given coordinate is within a given country I now have: import matplotlib.nxutils as nx test = nx.points_inside_poly(points, country) where country is a polygon of longitude latitude pairs and points is a number of coordinates to be tested. This works for manually entered coordinates but now I would like to have a country border (see and land) as a polygon (low resolution). Is there a simple way to extract that from the basemap data? Tanks, Janwillem -- View this message in context: http://old.nabble.com/basemap-border-coordintes-tp29503827p29503827.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Benjamin R. <ben...@ou...> - 2010-08-21 20:15:26
|
On Sat, Aug 21, 2010 at 2:39 PM, Benjamin Root <ben...@ou...> wrote: > > > On Sat, Aug 21, 2010 at 7:03 AM, David Pine <dj...@gm...> wrote: > >> Is it possible to do animation with the mplot3d toolkit? It seems like it >> ought to work but I am having trouble. In particular, it seems that the >> set_xdata and set_ydata commands do not work. I would imagine you need a >> set_zdata function as well but that seems not to exist, which suggests that >> mplot3d isn't animation ready yet. Is that right or am I missing something? >> Thanks. >> >> David Pine >> > > Yes, it is very much possible to make 3d animations. I have written up > some examples that used Ryan May's prototype animation module. It is even > possible to do multiple 3d animated subplots. > > Check out Ryan's github repo: http://github.com/dopplershift/Animation > > I believe it contains my "fish tank" example. If not, I might have it in > my fork: http://github.com/WeatherGod/Animation > > I hope this helps, > Ben Root > > As an additional note, I dug through my fishtank example and found my update_line() function with a note to myself: def update_lines(num, dataLines, lines) : for line, data in zip(lines, dataLines) : # NOTE: there is no .set_data() for 3 dim data... line.set_data(data[0:2, num:num+2]) line.set_3d_properties(data[2,num:num+2]) return lines So that is how I updated the lines by using the 2d set_data() function, and then using set_3d_properties() to add the 3rd dimension. Ben Root |
|
From: Benjamin R. <ben...@ou...> - 2010-08-21 19:39:27
|
On Sat, Aug 21, 2010 at 7:03 AM, David Pine <dj...@gm...> wrote: > Is it possible to do animation with the mplot3d toolkit? It seems like it > ought to work but I am having trouble. In particular, it seems that the > set_xdata and set_ydata commands do not work. I would imagine you need a > set_zdata function as well but that seems not to exist, which suggests that > mplot3d isn't animation ready yet. Is that right or am I missing something? > Thanks. > > David Pine > Yes, it is very much possible to make 3d animations. I have written up some examples that used Ryan May's prototype animation module. It is even possible to do multiple 3d animated subplots. Check out Ryan's github repo: http://github.com/dopplershift/Animation I believe it contains my "fish tank" example. If not, I might have it in my fork: http://github.com/WeatherGod/Animation I hope this helps, Ben Root |
|
From: Joe K. <jki...@wi...> - 2010-08-21 19:32:18
|
Thanks for the amazingly quick turnaround!
-Joe
On Sat, Aug 21, 2010 at 1:34 PM, Eric Firing <ef...@ha...> wrote:
> On 08/20/2010 12:18 PM, Joe Kington wrote:
> > Hi,
> >
> > I've recently noticed that setting the y-tick locations on an image plot
> > changes the y-axis limits, while changing the x-tick locations does not
> > change the x-axis limits. I wouldn't have expected either to change the
> > axis limits, but it seems quite inconsistent that the y-axis and x-axis
> > behave differently in this situation.
> >
> > The axis limits are easily restored by a call to "ax.axis('image')", but
> > this seems unnecessary.
> >
> > A very quick search of the bug tracker doesn't reveal anything matching
> > this description...
> >
> > Is this expected behavior or a bug?
> >
> > As an example, setting the y-tick locations changes the y-axis limits:
> > import numpy as np
> > import matplotlib.pyplot as plt
> >
> > num = 10
> > data = np.arange(num**2).reshape((num,num))
> >
> > fig = plt.figure()
> > ax = fig.add_subplot(111)
> >
> > cax = ax.imshow(data)
> >
> > ax.set_yticks(range(num//2))
> >
> > fig.show()
> >
> > However, setting the x-tick locations does not change the axis limits...
> > import numpy as np
> > import matplotlib.pyplot as plt
> >
> > num = 10
> > data = np.arange(num**2).reshape((num,num))
> >
> > fig = plt.figure()
> > ax = fig.add_subplot(111)
> >
> > cax = ax.imshow(data)
> >
> > ax.set_xticks(range(num//2))
> >
> > fig.show()
> >
> > As a reference, I'm running matplotlib 1.0.0 with python 2.7.0 on a
> > 64-bit Linux (kernel 2.6.31) machine. I can confirm this on python 2.6
> > and matplotlib 0.99 as well, though.
> >
> > If this isn't expected behavior, I'll be glad to open a bug report.
>
> Joe,
>
> Thanks for the report. The fix is in svn 8652 and 8653.
>
> Eric
>
> >
> > Thanks!
> > -Joe
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: Eric F. <ef...@ha...> - 2010-08-21 18:35:10
|
On 08/20/2010 12:18 PM, Joe Kington wrote:
> Hi,
>
> I've recently noticed that setting the y-tick locations on an image plot
> changes the y-axis limits, while changing the x-tick locations does not
> change the x-axis limits. I wouldn't have expected either to change the
> axis limits, but it seems quite inconsistent that the y-axis and x-axis
> behave differently in this situation.
>
> The axis limits are easily restored by a call to "ax.axis('image')", but
> this seems unnecessary.
>
> A very quick search of the bug tracker doesn't reveal anything matching
> this description...
>
> Is this expected behavior or a bug?
>
> As an example, setting the y-tick locations changes the y-axis limits:
> import numpy as np
> import matplotlib.pyplot as plt
>
> num = 10
> data = np.arange(num**2).reshape((num,num))
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> cax = ax.imshow(data)
>
> ax.set_yticks(range(num//2))
>
> fig.show()
>
> However, setting the x-tick locations does not change the axis limits...
> import numpy as np
> import matplotlib.pyplot as plt
>
> num = 10
> data = np.arange(num**2).reshape((num,num))
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> cax = ax.imshow(data)
>
> ax.set_xticks(range(num//2))
>
> fig.show()
>
> As a reference, I'm running matplotlib 1.0.0 with python 2.7.0 on a
> 64-bit Linux (kernel 2.6.31) machine. I can confirm this on python 2.6
> and matplotlib 0.99 as well, though.
>
> If this isn't expected behavior, I'll be glad to open a bug report.
Joe,
Thanks for the report. The fix is in svn 8652 and 8653.
Eric
>
> Thanks!
> -Joe
|
|
From: xyz <mi...@op...> - 2010-08-21 12:27:13
|
On 21/08/10 21:14, Jose Gómez-Dans wrote:
> Use plt.text (x, y, point_labels ) or something along those lines.
>
> Jose
>
With plt.text() the plot line is sometimes covered by the point labels.
Is there any option which recognise a collusion between the line and label?
from pylab import *
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
y = [20, 24, 8, 4, 12, 22, 31, 25, 15, 28, 12, 27, 22, 22, 27, 14, 32,
28, 8, 17, 2, 8, 29, 13, 14, 20, 11, 28, 8]
point_labels = ['A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1',
'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1',
'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1']
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title('The red point should be on the path')
ax.plot(x, y, 'go-')
ax.grid(True)
# rotates and right aligns the x labels, and moves the bottom of the
# axes up to make room for them
fig.autofmt_xdate()
# set x and y labels
plt.xticks(range(0, 40, 1))
#ax.set_xticks(4.5)
plt.yticks(range(0, 40, 1))
for i, label in enumerate(point_labels):
plt.text (x[i], y[i], label )
plt.show()
|
|
From: David P. <dj...@gm...> - 2010-08-21 12:03:28
|
Is it possible to do animation with the mplot3d toolkit? It seems like it ought to work but I am having trouble. In particular, it seems that the set_xdata and set_ydata commands do not work. I would imagine you need a set_zdata function as well but that seems not to exist, which suggests that mplot3d isn't animation ready yet. Is that right or am I missing something? Thanks. David Pine |
|
From: Jose Gómez-D. <jgo...@gm...> - 2010-08-21 11:14:35
|
On Saturday 21 Aug 2010 08:00:33 xyz wrote: > I would like to label all (x[i],y[i]) points in the plot with > point_labels[i]. > > Is it possible to label all points in a plot? Use plt.text (x, y, point_labels ) or something along those lines. Jose |
|
From: Eric F. <ef...@ha...> - 2010-08-21 08:13:53
|
On 08/20/2010 12:18 PM, Joe Kington wrote:
> Hi,
>
> I've recently noticed that setting the y-tick locations on an image plot
> changes the y-axis limits, while changing the x-tick locations does not
> change the x-axis limits. I wouldn't have expected either to change the
> axis limits, but it seems quite inconsistent that the y-axis and x-axis
> behave differently in this situation.
>
> The axis limits are easily restored by a call to "ax.axis('image')", but
> this seems unnecessary.
>
> A very quick search of the bug tracker doesn't reveal anything matching
> this description...
>
> Is this expected behavior or a bug?
>
> As an example, setting the y-tick locations changes the y-axis limits:
> import numpy as np
> import matplotlib.pyplot as plt
>
> num = 10
> data = np.arange(num**2).reshape((num,num))
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> cax = ax.imshow(data)
>
> ax.set_yticks(range(num//2))
>
> fig.show()
>
> However, setting the x-tick locations does not change the axis limits...
> import numpy as np
> import matplotlib.pyplot as plt
>
> num = 10
> data = np.arange(num**2).reshape((num,num))
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> cax = ax.imshow(data)
>
> ax.set_xticks(range(num//2))
>
> fig.show()
>
> As a reference, I'm running matplotlib 1.0.0 with python 2.7.0 on a
> 64-bit Linux (kernel 2.6.31) machine. I can confirm this on python 2.6
> and matplotlib 0.99 as well, though.
>
> If this isn't expected behavior, I'll be glad to open a bug report.
It's a bug. I think I have it fixed, but I need to do some more
testing, so I won't commit anything tonight.
Eric
>
> Thanks!
> -Joe
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: xyz <mi...@op...> - 2010-08-21 07:02:03
|
Hello, I have the following code: --------------------------------------------------------------- from pylab import * import matplotlib.pyplot as plt x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] y = [20, 24, 8, 4, 12, 22, 31, 25, 15, 28, 12, 27, 22, 22, 27, 14, 32, 28, 8, 17, 2, 8, 29, 13, 14, 20, 11, 28, 8] point_labels = ['A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1', 'A=1'] fig = plt.figure() ax = fig.add_subplot(111) ax.plot(x, y, 'go-') ax.grid(True) # rotates and right aligns the x labels, and moves the bottom of the # axes up to make room for them fig.autofmt_xdate() # set x and y labels plt.xticks(range(0, 40, 1)) plt.yticks(range(0, 40, 1)) plt.show() --------------------------------------------------------------- I would like to label all (x[i],y[i]) points in the plot with point_labels[i]. Is it possible to label all points in a plot? Thank you in advance. |
|
From: Joe K. <jki...@wi...> - 2010-08-20 22:18:22
|
Hi,
I've recently noticed that setting the y-tick locations on an image plot
changes the y-axis limits, while changing the x-tick locations does not
change the x-axis limits. I wouldn't have expected either to change the
axis limits, but it seems quite inconsistent that the y-axis and x-axis
behave differently in this situation.
The axis limits are easily restored by a call to "ax.axis('image')", but
this seems unnecessary.
A very quick search of the bug tracker doesn't reveal anything matching this
description...
Is this expected behavior or a bug?
As an example, setting the y-tick locations changes the y-axis limits:
import numpy as np
import matplotlib.pyplot as plt
num = 10
data = np.arange(num**2).reshape((num,num))
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.imshow(data)
ax.set_yticks(range(num//2))
fig.show()
However, setting the x-tick locations does not change the axis limits...
import numpy as np
import matplotlib.pyplot as plt
num = 10
data = np.arange(num**2).reshape((num,num))
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.imshow(data)
ax.set_xticks(range(num//2))
fig.show()
As a reference, I'm running matplotlib 1.0.0 with python 2.7.0 on a 64-bit
Linux (kernel 2.6.31) machine. I can confirm this on python 2.6 and
matplotlib 0.99 as well, though.
If this isn't expected behavior, I'll be glad to open a bug report.
Thanks!
-Joe
|
|
From: Eric F. <ef...@ha...> - 2010-08-20 21:47:29
|
On 08/20/2010 10:51 AM, Bruce Ford wrote: > Thanks I'll give this a try. numpy.min(grid) reports 0.0 (no > negative) yet it labels as -0.0, BTW, but let me give this a try. Bruce, What matters is not min(grid), but the value of the tick. Unless you are forcing them to be the same via a kwarg (which I don't see), they may differ, as seems to be the case. Unfortunately, this is hard to debug, because there is no way to get at the set of numbers that are being formatted to give the tick labels. Doing something like this: print cbar.cax.get_yticks() will be of no help, because the tick positions are on a 0-1 scale regardless of the values they represent. You can, however, specify the desired tick values as a sequence via the ticks kwarg to colorbar. Ticks in that sequence but outside the actual colorbar range (as set by the clim() function, for example) will not appear. Eric > > Bruce > > --------------------------------------- > Bruce W. Ford > Clear Science, Inc. > br...@cl... > http://www.ClearScienceInc.com > http://www.facebook.com/clearscience > http://www.twitter.com/ROVs_rule > Phone: (904) 796-8101 > Fax: (904) 379-9704 > 8241 Parkridge Circle N. > Jacksonville, FL 32211 > Skype: bruce.w.ford > > --------------------------------------- > To schedule a meeting with Bruce, Go to: http://tungle.me/bruceford > ---------------------------------------- > > > > > On Fri, Aug 20, 2010 at 4:44 PM, Eric Firing<ef...@ha...> wrote: >> On 08/20/2010 10:14 AM, Bruce Ford wrote: >>> This effect is happening within an web app that displays gridded >>> fields from multiple datasets (~4500 lines of code). So I it's tricky >>> to create an example. Although if I use numpy.min(grid) the minimum >>> is 0. So, I think colorbar or matplotlib is interpreting the 0 as -0. >> >> >> You are talking about the colorbar tick labels, correct? The lowest >> tick label is coming out as -0.0? >> >> >>> (Matplotlib version 0.99.0 RC0) >>> >>> The colorbar call that I'm using is: >>> >>> cbar = pyplot.colorbar(plot,shrink=0.7, format="%1.1f", >>> spacing='proportional',orientation='vertical') >> >> This means your colorbar tick values are simply being formatted by >> python, like this: >> >> In [1]: "%1.1f" % -0.0000001 >> Out[1]: '-0.0' >> >> In [2]: "%1.1f" % 0.0000001 >> Out[2]: '0.0' >> >> In [3]: "%1.1f" % 0.0 >> Out[3]: '0.0' >> >> In [4]: "%1.1f" % -0.0 >> Out[4]: '-0.0' >> >> In [5]: import numpy >> >> In [6]: numpy.min(-0.0) >> Out[6]: -0 >> >> In [7]: -0.0 == 0.0 >> Out[7]: True >> >> >> So I suspect the problem is that a small negative value, or a negative >> zero, is becoming the tick value. I don't know why. You may or may not >> want to investigate. >> >> I dimly recall a problem like this cropping up on the list before--but I >> don't remember anything else about it. >> >> Here is a workaround (untested, but should be close): >> >> from matplotlib.ticker import FormatStrFormatter >> class MyCBFormatter(FormatStrFormatter): >> def __call__(self, x, pos=None): >> xstr = self.fmt % x >> if float(xstr) == 0: >> return self.fmt % 0 >> return xstr >> cbar = pyplot.colorbar(plot,shrink=0.7, format=MyCBFormatter("%1.1f"), >> spacing='proportional',orientation='vertical') >> >> >> Eric >> >>> >>> cbar.ax.set_ylabel(cbar_label(param,unit)) >>> >>> The function cbar_label is: >>> >>> def cbar_label(param,unit): >>> #Helper function for making colorbar label >>> if param == "sig": >>> if unit==1: >>> cbar_label = "Feet" >>> else: >>> cbar_label = "Meters" >>> elif param == "dir": >>> cbar_label = "Radial Direction" >>> elif param == "per": >>> cbar_label = "Seconds" >>> elif param[-5:] == "_wind": >>> if unit == 3: >>> cbar_label = "Kts" >>> else: >>> cbar_label = "M/S" >>> elif param[-4:] == "_hgt": >>> if unit == 5: >>> cbar_label = "GPFt" >>> else: >>> cbar_label = "GPM" >>> elif param == "slp": >>> cbar_label = "Millibars" >>> elif param == "1000_rh": >>> cbar_label = "%" >>> elif param == "1000_temp": >>> if unit == 9: >>> cbar_label = "Degrees F" >>> else: >>> cbar_label = "Degrees C" >>> else: >>> cbar_label = param >>> return cbar_label >>> >>> If this doesn't offer anything, I'll try to generate a >>> compartmentalized example of the issue. >>> >>> Bruce >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by >> >> Make an app they can't live without >> Enter the BlackBerry Developer Challenge >> http://p.sf.net/sfu/RIM-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Bruce F. <br...@cl...> - 2010-08-20 20:51:56
|
Thanks I'll give this a try. numpy.min(grid) reports 0.0 (no negative) yet it labels as -0.0, BTW, but let me give this a try. Bruce --------------------------------------- Bruce W. Ford Clear Science, Inc. br...@cl... http://www.ClearScienceInc.com http://www.facebook.com/clearscience http://www.twitter.com/ROVs_rule Phone: (904) 796-8101 Fax: (904) 379-9704 8241 Parkridge Circle N. Jacksonville, FL 32211 Skype: bruce.w.ford --------------------------------------- To schedule a meeting with Bruce, Go to: http://tungle.me/bruceford ---------------------------------------- On Fri, Aug 20, 2010 at 4:44 PM, Eric Firing <ef...@ha...> wrote: > On 08/20/2010 10:14 AM, Bruce Ford wrote: >> This effect is happening within an web app that displays gridded >> fields from multiple datasets (~4500 lines of code). So I it's tricky >> to create an example. Although if I use numpy.min(grid) the minimum >> is 0. So, I think colorbar or matplotlib is interpreting the 0 as -0. > > > You are talking about the colorbar tick labels, correct? The lowest > tick label is coming out as -0.0? > > >> (Matplotlib version 0.99.0 RC0) >> >> The colorbar call that I'm using is: >> >> cbar = pyplot.colorbar(plot,shrink=0.7, format="%1.1f", >> spacing='proportional',orientation='vertical') > > This means your colorbar tick values are simply being formatted by > python, like this: > > In [1]: "%1.1f" % -0.0000001 > Out[1]: '-0.0' > > In [2]: "%1.1f" % 0.0000001 > Out[2]: '0.0' > > In [3]: "%1.1f" % 0.0 > Out[3]: '0.0' > > In [4]: "%1.1f" % -0.0 > Out[4]: '-0.0' > > In [5]: import numpy > > In [6]: numpy.min(-0.0) > Out[6]: -0 > > In [7]: -0.0 == 0.0 > Out[7]: True > > > So I suspect the problem is that a small negative value, or a negative > zero, is becoming the tick value. I don't know why. You may or may not > want to investigate. > > I dimly recall a problem like this cropping up on the list before--but I > don't remember anything else about it. > > Here is a workaround (untested, but should be close): > > from matplotlib.ticker import FormatStrFormatter > class MyCBFormatter(FormatStrFormatter): > def __call__(self, x, pos=None): > xstr = self.fmt % x > if float(xstr) == 0: > return self.fmt % 0 > return xstr > cbar = pyplot.colorbar(plot,shrink=0.7, format=MyCBFormatter("%1.1f"), > spacing='proportional',orientation='vertical') > > > Eric > >> >> cbar.ax.set_ylabel(cbar_label(param,unit)) >> >> The function cbar_label is: >> >> def cbar_label(param,unit): >> #Helper function for making colorbar label >> if param == "sig": >> if unit==1: >> cbar_label = "Feet" >> else: >> cbar_label = "Meters" >> elif param == "dir": >> cbar_label = "Radial Direction" >> elif param == "per": >> cbar_label = "Seconds" >> elif param[-5:] == "_wind": >> if unit == 3: >> cbar_label = "Kts" >> else: >> cbar_label = "M/S" >> elif param[-4:] == "_hgt": >> if unit == 5: >> cbar_label = "GPFt" >> else: >> cbar_label = "GPM" >> elif param == "slp": >> cbar_label = "Millibars" >> elif param == "1000_rh": >> cbar_label = "%" >> elif param == "1000_temp": >> if unit == 9: >> cbar_label = "Degrees F" >> else: >> cbar_label = "Degrees C" >> else: >> cbar_label = param >> return cbar_label >> >> If this doesn't offer anything, I'll try to generate a >> compartmentalized example of the issue. >> >> Bruce > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |