SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

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
(38)
2
(31)
3
(9)
4
(13)
5
(24)
6
(11)
7
(8)
8
(14)
9
(7)
10
(4)
11
(7)
12
(11)
13
(16)
14
(19)
15
(11)
16
(9)
17
(3)
18
(4)
19
(47)
20
(28)
21
(9)
22
(9)
23
(11)
24
25
26
(12)
27
(22)
28
(20)
29
(16)
30
(19)

Showing 24 results of 24

From: Gökhan S. <gok...@gm...> - 2010年04月05日 23:48:15
On Mon, Apr 5, 2010 at 3:17 PM, Mauro Cavalcanti <mau...@gm...> wrote:
> Dear Gökhan,
>
> Thanks for your reply, but unfortunately it was not entirely helpful.
>
> The rectangle_selector.py exemple indeed seems to do what I want, by
> means of a callback function, however in the example program this
> function should print the rectangle coordinates to the screen but it
> does nothing.
>
>
Check the shell where you called the script. It updates when select a region
and release the mouse.
> BTW, where is the documentation for the matplotlib.widgets classes? I
> could find none.
>
Just browse the actual source .../lib/matplotlib/widgets.py. Classes are
methods are nicely documented. I would suggest you to use IPython to access
the docstrings with ease.
import matplotlib.widgets as w
w?
w.<TAB>
>
> Best regards,
>
> 2010年4月5日 Gökhan Sever <gok...@gm...>:
> >
> >
> > On Mon, Apr 5, 2010 at 6:39 AM, Mauro Cavalcanti <mau...@gm...>
> wrote:
> >>
> >> Dear ALL,
> >>
> >> Good morning... Here is a question that may already have been asked
> >> (and answered), but not to my knowledge. Matplotlib's figure windows
> >> come with that handy navigation bar, which includes a Pan/Zoom button
> >> and a Zoom-to-rectangle button. Once a zoom rectangle is defined on a
> >> figure, is it possible to get the coordinates of it (that is, the
> >> lower and upper corner coordinates which define the zoom rectangle)?
> >> If so, how can this be done?
> >>
> >> Thanks in advance for any reply.
> >>
> >> With best regards,
> >>
> >> --
> >> Dr. Mauro J. Cavalcanti
> >> P.O. Box 46521, CEP 20551-970
> >> Rio de Janeiro, RJ, BRASIL
> >> E-mail: mau...@gm...
> >> Web: http://sites.google.com/site/maurobio
> >> Linux Registered User #473524 * Ubuntu User #22717
> >
> > Hi,
> >
> > Search for zoom_window.py and rectangle_selector.py in your matplotlib
> > examples directory.
> >
> > --
> > Gökhan
> >
>
>
>
> --
> Dr. Mauro J. Cavalcanti
> P.O. Box 46521, CEP 20551-970
> Rio de Janeiro, RJ, BRASIL
> E-mail: mau...@gm...
> Web: http://sites.google.com/site/maurobio
> Linux Registered User #473524 * Ubuntu User #22717
>
-- 
Gökhan
On 4/5/2010 5:08 PM, Josh Hemann wrote:
> Here is the new graphic.
>
> http://old.nabble.com/file/p28144782/Full5%252B8%252B2_vs_Bulk1%252B2.png
> 
Nice.
You might want to see 
http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001OR
if you have not already.
Alan Isaac
OK, I am in business. I read through the code that Alan linked to which
helped me understand what to do, which does not involve overlaying any
images. So, this thread is a dead end with respect to the original question.
Here is the new graphic. 
http://old.nabble.com/file/p28144782/Full5%252B8%252B2_vs_Bulk1%252B2.png 
In a publication I think I would need to mention the date range for the
sparklines. I like this, it is visually dense (marginal time series
behavior, marginal density, and relationship between two variables) but does
not seem cluttered. I'll post code tonight...
-----
Josh Hemann
Statistical Advisor 
http://www.vni.com/ Visual Numerics 
jhemann at vni dizzot com 
-- 
View this message in context: http://old.nabble.com/How-to-overlay-an-image-on-a-multi-plot--tp28111498p28144782.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Josh H. <jh...@vn...> - 2010年04月05日 18:58:16
Alan,
Thanks much for that link. I started playing with this code and after some
hacking I might get what I need. If I cobble this together successfully I'll
post the results and the code.
Josh
-----
Josh Hemann
Statistical Advisor 
http://www.vni.com/ Visual Numerics 
jhemann at vni dizzot com 
-- 
View this message in context: http://old.nabble.com/How-to-overlay-an-image-on-a-multi-plot--tp28111498p28143553.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2010年04月05日 18:54:38
Michael Droettboom wrote:
> All of those calls to "open" are being generated from the pytz import -- 
> which is why pytz seems like the likely candidate. Is it possible you 
> have pytz installed as a compressed egg, or on a remote disk, or 
> something that may be causing a file reading penalty?
Mike,
The pytz import time, at nearly 1/3 of the total mpl import time, is 
crazy even on linux, given that it adds only a tiny bit of 
functionality, and as far as I can see, even that is only rarely used.
Therefore I have committed a change so that it is imported only if and 
when it is required. Our examples still work, after I modified one that 
was trying to import timezone from mpl.dates (although it was not 
actually using timezone). This probably illustrates the way in which 
this change may break some user code: user programs requiring 
pytz.timezone and pytz.tzinfo will have to import them directly instead 
of getting them from mpl.dates. I hope this is acceptable; importing 
them from mpl.dates seems like bad practice anyway, since mpl.dates was 
not using them or modifying them but was just passing them on from pytz.
I suspect pytz could be redesigned so that it would not be so 
horrendously slow to import, but I am not going to tackle that.
After the change:
efiring@manini:~$ time python -c "import pylab"
real	0m0.441s
user	0m0.372s
sys	0m0.064s
Before the change:
efiring@manini:~$ time python -c "import pylab"
real 0m0.626s
user 0m0.480s
sys 0m0.124s
Again, this is recent linux on a 3-year-old laptop.
Eric
> 
> As Eric said, make sure you time the "import pytz" in a clean Python 
> session -- if a module is already imported in the Python interpreter, it 
> won't be reimported.
> 
> Mike
> 
>
From: Alex S <sch...@gm...> - 2010年04月05日 17:51:16
Yup, thanks for the help everyone
Michael Droettboom-3 wrote:
> 
> For the benefit of future users Googling this problem -->
> 
> After an off-list discussion, we realized there were a couple of fonts 
> on Alex' system with the names "Century Schoolbook" and "New Century 
> Schoolbook LT Std". Using one of those names instead resolved the
> problem.
> 
> Mike
> 
> Alex S wrote:
>> Ah ok, I've sent it on to you. I've just tried setting font.family to
>> "New
>> Century Schoolbook" directly but it generates something similar. I'm
>> starting to think part of the problem is that I've set the home directory
>> to
>> U: somehow, U: being a shared drive which doesn't have a font
>> directory... 
>> I don't know how I set this, it's not mentioned in the rc file anywhere
>> that
>> I can see...
>>
>>
>> Michael Droettboom-3 wrote:
>> 
>>> It would still be helpful to see the whole listing (send it to me 
>>> offlist) because that will indicate where fonts are being looked for, 
>>> and hopefully *why* this is failing.
>>>
>>> It should search for fonts in the standard Windows location (usually 
>>> C:\Windows\Fonts). Have you tried setting font.family to "New Century 
>>> Schoolbook" directly? (I wonder if the secondary lookup is failing).
>>>
>>> Cheers,
>>> Mike
>>>
>>> Alex S wrote:
>>> 
>>>> I think I'm using MPL .99.1 (is there a command to check?) on Windows
>>>> XP. 
>>>> Thanks for the debug tip, I don't think posting the whole thing is
>>>> necessary
>>>> because this line seems to be the problem:
>>>>
>>>> findfont: Could not match
>>>> :family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0.
>>>> Returning
>>>> C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf
>>>>
>>>> So I guess the font's missing from the folder. Can I add it somehow?
>>>>
>>>>
>>>>
>>>> Michael Droettboom-3 wrote:
>>>> 
>>>> 
>>>>> Can you set "verbose.level" to "debug-annoying" in your matplotlibrc 
>>>>> file, and then send the output to this list. That may help us track 
>>>>> down where the font lookup is failing. Also, what platform and
>>>>> version 
>>>>> of matplotlib are you running?
>>>>>
>>>>> Mike
>>>>>
>>>>> Alex S wrote:
>>>>> 
>>>>> 
>>>>>> Hi, sorry I wasn't too clear... I changed that, but I don't seem to
>>>>>> be
>>>>>> able
>>>>>> to choose between the different serif fonts, it just always gives me
>>>>>> the
>>>>>> default...
>>>>>>
>>>>>>
>>>>>>
>>>>>> Alex S wrote:
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> Hi there,
>>>>>>> I'm trying to change the font default on my graph to New Century
>>>>>>> Schoolbook. I'm trying to do this by editing the matplotlibrc file. 
>>>>>>> Unfortunately, although I'm able to change the font.family, I can't
>>>>>>> figure
>>>>>>> out how to make it use something other than the default in the
>>>>>>> family... 
>>>>>>> I tried changing the list further down to only include the font I
>>>>>>> want,
>>>>>>> like this:
>>>>>>>
>>>>>>> font.serif : New Century Schoolbook #Bitstream Vera Serif,
>>>>>>> New
>>>>>>> Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman,
>>>>>>> Bookman,
>>>>>>> Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
>>>>>>>
>>>>>>> (note I commented out the other fonts, just rearranging the list to
>>>>>>> put
>>>>>>> New Century Schoolbook first didn't seem to work either)
>>>>>>>
>>>>>>> Could anyone tell me what I'm doing wrong?
>>>>>>> Thanks a lot!
>>>>>>> Alex
>>>>>>>
>>>>>>>
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> -- 
>>>>> Michael Droettboom
>>>>> Science Software Branch
>>>>> Operations and Engineering Division
>>>>> Space Telescope Science Institute
>>>>> Operated by AURA for NASA
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Download Intel&#174; Parallel Studio Eval
>>>>> Try the new software tools for yourself. Speed compiling, find bugs
>>>>> proactively, and fine-tune applications for parallel performance.
>>>>> See why Intel Parallel Studio got high marks during beta.
>>>>> http://p.sf.net/sfu/intel-sw-dev
>>>>> _______________________________________________
>>>>> Matplotlib-users mailing list
>>>>> Mat...@li...
>>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>>
>>>>>
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> -- 
>>> Michael Droettboom
>>> Science Software Branch
>>> Operations and Engineering Division
>>> Space Telescope Science Institute
>>> Operated by AURA for NASA
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Download Intel&#174; Parallel Studio Eval
>>> Try the new software tools for yourself. Speed compiling, find bugs
>>> proactively, and fine-tune applications for parallel performance.
>>> See why Intel Parallel Studio got high marks during beta.
>>> http://p.sf.net/sfu/intel-sw-dev
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>> 
>>
>> 
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Changing-the-font-tp28111472p28142759.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Michael D. <md...@st...> - 2010年04月05日 17:46:08
For the benefit of future users Googling this problem -->
After an off-list discussion, we realized there were a couple of fonts 
on Alex' system with the names "Century Schoolbook" and "New Century 
Schoolbook LT Std". Using one of those names instead resolved the problem.
Mike
Alex S wrote:
> Ah ok, I've sent it on to you. I've just tried setting font.family to "New
> Century Schoolbook" directly but it generates something similar. I'm
> starting to think part of the problem is that I've set the home directory to
> U: somehow, U: being a shared drive which doesn't have a font directory... 
> I don't know how I set this, it's not mentioned in the rc file anywhere that
> I can see...
>
>
> Michael Droettboom-3 wrote:
> 
>> It would still be helpful to see the whole listing (send it to me 
>> offlist) because that will indicate where fonts are being looked for, 
>> and hopefully *why* this is failing.
>>
>> It should search for fonts in the standard Windows location (usually 
>> C:\Windows\Fonts). Have you tried setting font.family to "New Century 
>> Schoolbook" directly? (I wonder if the secondary lookup is failing).
>>
>> Cheers,
>> Mike
>>
>> Alex S wrote:
>> 
>>> I think I'm using MPL .99.1 (is there a command to check?) on Windows XP. 
>>> Thanks for the debug tip, I don't think posting the whole thing is
>>> necessary
>>> because this line seems to be the problem:
>>>
>>> findfont: Could not match
>>> :family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0.
>>> Returning
>>> C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf
>>>
>>> So I guess the font's missing from the folder. Can I add it somehow?
>>>
>>>
>>>
>>> Michael Droettboom-3 wrote:
>>> 
>>> 
>>>> Can you set "verbose.level" to "debug-annoying" in your matplotlibrc 
>>>> file, and then send the output to this list. That may help us track 
>>>> down where the font lookup is failing. Also, what platform and version 
>>>> of matplotlib are you running?
>>>>
>>>> Mike
>>>>
>>>> Alex S wrote:
>>>> 
>>>> 
>>>>> Hi, sorry I wasn't too clear... I changed that, but I don't seem to be
>>>>> able
>>>>> to choose between the different serif fonts, it just always gives me
>>>>> the
>>>>> default...
>>>>>
>>>>>
>>>>>
>>>>> Alex S wrote:
>>>>> 
>>>>> 
>>>>> 
>>>>>> Hi there,
>>>>>> I'm trying to change the font default on my graph to New Century
>>>>>> Schoolbook. I'm trying to do this by editing the matplotlibrc file. 
>>>>>> Unfortunately, although I'm able to change the font.family, I can't
>>>>>> figure
>>>>>> out how to make it use something other than the default in the
>>>>>> family... 
>>>>>> I tried changing the list further down to only include the font I
>>>>>> want,
>>>>>> like this:
>>>>>>
>>>>>> font.serif : New Century Schoolbook #Bitstream Vera Serif,
>>>>>> New
>>>>>> Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman,
>>>>>> Bookman,
>>>>>> Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
>>>>>>
>>>>>> (note I commented out the other fonts, just rearranging the list to
>>>>>> put
>>>>>> New Century Schoolbook first didn't seem to work either)
>>>>>>
>>>>>> Could anyone tell me what I'm doing wrong?
>>>>>> Thanks a lot!
>>>>>> Alex
>>>>>>
>>>>>>
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> -- 
>>>> Michael Droettboom
>>>> Science Software Branch
>>>> Operations and Engineering Division
>>>> Space Telescope Science Institute
>>>> Operated by AURA for NASA
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Download Intel&#174; Parallel Studio Eval
>>>> Try the new software tools for yourself. Speed compiling, find bugs
>>>> proactively, and fine-tune applications for parallel performance.
>>>> See why Intel Parallel Studio got high marks during beta.
>>>> http://p.sf.net/sfu/intel-sw-dev
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Mat...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>
>>>>
>>>> 
>>>> 
>>> 
>>> 
>> -- 
>> Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> 
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Alex S <sch...@gm...> - 2010年04月05日 16:17:49
Ah ok, I've sent it on to you. I've just tried setting font.family to "New
Century Schoolbook" directly but it generates something similar. I'm
starting to think part of the problem is that I've set the home directory to
U: somehow, U: being a shared drive which doesn't have a font directory... 
I don't know how I set this, it's not mentioned in the rc file anywhere that
I can see...
Michael Droettboom-3 wrote:
> 
> It would still be helpful to see the whole listing (send it to me 
> offlist) because that will indicate where fonts are being looked for, 
> and hopefully *why* this is failing.
> 
> It should search for fonts in the standard Windows location (usually 
> C:\Windows\Fonts). Have you tried setting font.family to "New Century 
> Schoolbook" directly? (I wonder if the secondary lookup is failing).
> 
> Cheers,
> Mike
> 
> Alex S wrote:
>> I think I'm using MPL .99.1 (is there a command to check?) on Windows XP. 
>> Thanks for the debug tip, I don't think posting the whole thing is
>> necessary
>> because this line seems to be the problem:
>>
>> findfont: Could not match
>> :family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0.
>> Returning
>> C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf
>>
>> So I guess the font's missing from the folder. Can I add it somehow?
>>
>>
>>
>> Michael Droettboom-3 wrote:
>> 
>>> Can you set "verbose.level" to "debug-annoying" in your matplotlibrc 
>>> file, and then send the output to this list. That may help us track 
>>> down where the font lookup is failing. Also, what platform and version 
>>> of matplotlib are you running?
>>>
>>> Mike
>>>
>>> Alex S wrote:
>>> 
>>>> Hi, sorry I wasn't too clear... I changed that, but I don't seem to be
>>>> able
>>>> to choose between the different serif fonts, it just always gives me
>>>> the
>>>> default...
>>>>
>>>>
>>>>
>>>> Alex S wrote:
>>>> 
>>>> 
>>>>> Hi there,
>>>>> I'm trying to change the font default on my graph to New Century
>>>>> Schoolbook. I'm trying to do this by editing the matplotlibrc file. 
>>>>> Unfortunately, although I'm able to change the font.family, I can't
>>>>> figure
>>>>> out how to make it use something other than the default in the
>>>>> family... 
>>>>> I tried changing the list further down to only include the font I
>>>>> want,
>>>>> like this:
>>>>>
>>>>> font.serif : New Century Schoolbook #Bitstream Vera Serif,
>>>>> New
>>>>> Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman,
>>>>> Bookman,
>>>>> Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
>>>>>
>>>>> (note I commented out the other fonts, just rearranging the list to
>>>>> put
>>>>> New Century Schoolbook first didn't seem to work either)
>>>>>
>>>>> Could anyone tell me what I'm doing wrong?
>>>>> Thanks a lot!
>>>>> Alex
>>>>>
>>>>>
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> -- 
>>> Michael Droettboom
>>> Science Software Branch
>>> Operations and Engineering Division
>>> Space Telescope Science Institute
>>> Operated by AURA for NASA
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Download Intel&#174; Parallel Studio Eval
>>> Try the new software tools for yourself. Speed compiling, find bugs
>>> proactively, and fine-tune applications for parallel performance.
>>> See why Intel Parallel Studio got high marks during beta.
>>> http://p.sf.net/sfu/intel-sw-dev
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>> 
>>
>> 
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Changing-the-font-tp28111472p28141683.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2010年04月05日 15:55:42
On Sun, Apr 4, 2010 at 2:56 AM, Levi Kilcher <lev...@gm...> wrote:
> And what the heck are the line objects in the legend? Are there
> separate marker objects that I am missing?
>
Yes.
l = legend()
l.get_lines()[0]._legmarker.set_ms(5)
The line objects in the legend handles have a _legmarker attribute
which is another line objects responsible for drawing markers. This
was necessary for such cases like when number of marker is 1.
But, still, I recommend you to stick with your workaround, which is a
preferred way.
Regards,
-JJ
From: Michael D. <md...@st...> - 2010年04月05日 15:52:02
It would still be helpful to see the whole listing (send it to me 
offlist) because that will indicate where fonts are being looked for, 
and hopefully *why* this is failing.
It should search for fonts in the standard Windows location (usually 
C:\Windows\Fonts). Have you tried setting font.family to "New Century 
Schoolbook" directly? (I wonder if the secondary lookup is failing).
Cheers,
Mike
Alex S wrote:
> I think I'm using MPL .99.1 (is there a command to check?) on Windows XP. 
> Thanks for the debug tip, I don't think posting the whole thing is necessary
> because this line seems to be the problem:
>
> findfont: Could not match
> :family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0.
> Returning
> C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf
>
> So I guess the font's missing from the folder. Can I add it somehow?
>
>
>
> Michael Droettboom-3 wrote:
> 
>> Can you set "verbose.level" to "debug-annoying" in your matplotlibrc 
>> file, and then send the output to this list. That may help us track 
>> down where the font lookup is failing. Also, what platform and version 
>> of matplotlib are you running?
>>
>> Mike
>>
>> Alex S wrote:
>> 
>>> Hi, sorry I wasn't too clear... I changed that, but I don't seem to be
>>> able
>>> to choose between the different serif fonts, it just always gives me the
>>> default...
>>>
>>>
>>>
>>> Alex S wrote:
>>> 
>>> 
>>>> Hi there,
>>>> I'm trying to change the font default on my graph to New Century
>>>> Schoolbook. I'm trying to do this by editing the matplotlibrc file. 
>>>> Unfortunately, although I'm able to change the font.family, I can't
>>>> figure
>>>> out how to make it use something other than the default in the family... 
>>>> I tried changing the list further down to only include the font I want,
>>>> like this:
>>>>
>>>> font.serif : New Century Schoolbook #Bitstream Vera Serif, New
>>>> Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman,
>>>> Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
>>>>
>>>> (note I commented out the other fonts, just rearranging the list to put
>>>> New Century Schoolbook first didn't seem to work either)
>>>>
>>>> Could anyone tell me what I'm doing wrong?
>>>> Thanks a lot!
>>>> Alex
>>>>
>>>>
>>>> 
>>>> 
>>> 
>>> 
>> -- 
>> Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> 
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Jae-Joon L. <lee...@gm...> - 2010年04月05日 15:45:27
On Fri, Apr 2, 2010 at 11:20 AM, Michael Droettboom <md...@st...> wrote:
> It seems the relevant change is in r8102: "fix some issues in the bbox
> after the postscript distiller is run". This change removed a commented
> out call to ps2eps. I'm a bit out of my depth here as to why that
> change was made, and why .eps files seemingly haven't been true .eps
> files for a long time prior to that change. Anyone else?
>
To my best knowledge, the bbox of the eps output before r8102 was
incorrect for some cases. r8102 was my attempt to fix some of the
issues. The ps backend is quite complicated in how final output is
produced (psfrag, distiller, pstoeps), and this often messes up the
initially specified bbox and results in incorrect ones. While I think
I fixed some of the issues, there still could be some left. And I hope
someone who is more knowledgeable than me take a look.
For the reported issue, I haven't take a time to investigate (but I
will soon), but I doubt if it is an issue of pstoeps function (as I
said, it seems to write a matching save-restore pair).
Regards,
-JJ
From: Alex S <sch...@gm...> - 2010年04月05日 15:23:32
I think I'm using MPL .99.1 (is there a command to check?) on Windows XP. 
Thanks for the debug tip, I don't think posting the whole thing is necessary
because this line seems to be the problem:
findfont: Could not match
:family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0.
Returning
C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf
So I guess the font's missing from the folder. Can I add it somehow?
Michael Droettboom-3 wrote:
> 
> Can you set "verbose.level" to "debug-annoying" in your matplotlibrc 
> file, and then send the output to this list. That may help us track 
> down where the font lookup is failing. Also, what platform and version 
> of matplotlib are you running?
> 
> Mike
> 
> Alex S wrote:
>> Hi, sorry I wasn't too clear... I changed that, but I don't seem to be
>> able
>> to choose between the different serif fonts, it just always gives me the
>> default...
>>
>>
>>
>> Alex S wrote:
>> 
>>> Hi there,
>>> I'm trying to change the font default on my graph to New Century
>>> Schoolbook. I'm trying to do this by editing the matplotlibrc file. 
>>> Unfortunately, although I'm able to change the font.family, I can't
>>> figure
>>> out how to make it use something other than the default in the family... 
>>> I tried changing the list further down to only include the font I want,
>>> like this:
>>>
>>> font.serif : New Century Schoolbook #Bitstream Vera Serif, New
>>> Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman,
>>> Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
>>>
>>> (note I commented out the other fonts, just rearranging the list to put
>>> New Century Schoolbook first didn't seem to work either)
>>>
>>> Could anyone tell me what I'm doing wrong?
>>> Thanks a lot!
>>> Alex
>>>
>>>
>>> 
>>
>> 
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Changing-the-font-tp28111472p28141094.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
Jeff, this is great, works fine - many thanks for all your help over the last
few days, it really is appreciated. I'm trying to build the case within my
office for switching over to Basemap from IDL, ironing out niggles like this
is really useful in this respect.
All the best,
Will.
Jeff Whitaker wrote:
> 
> On 4/5/10 7:25 AM, Will Hewson wrote:
>> I should perhaps of explained my code (included in top post) a little
>> better,
>> the values in my attached file aren't on a regular grid to start with, I
>> do
>> a little bit of juggling as follows to get them into a regular grid:
>>
>> I'm firstly setting up my 2D grid of 0.5 degree lat lons, followed by
>> identically sized grids of zeros for the data bin, and mean divisors:
>>
>> x = np.arange(-180, 180, 0.5); y = np.arange(-90, 90, 0.5)
>> grid_lon, grid_lat = np.meshgrid(x,y) #regularly spaced 2D grid
>> n_vals = np.zeros((360,720)) #mean divisor
>> dat = np.zeros((360,720)) #2D grid of zeros
>>
>> I'm then taking my input data (e.g. the .plt file attached), and rounding
>> the lat lons to the nearest 0 or 0.5:
>>
>> lon = (np.around(lon*2))/2 #round to nearest .0 or 0.5
>> lat = (np.around(lat*2))/2 #round to nearest .0 or 0.5
>>
>> Then for each row in my input file where Z is greater than 0, I'm adding
>> the
>> n'th Z value to its corresponding position in the dat zeros array, and
>> keeping a count of how many values are going into each cell in the mean
>> divisor array:
>>
>> j=0
>> for i in slcol:
>> if lon[j]< 0:
>> grid_lon_ind = 360+(lon[j]*2)
>> grid_lat_ind = 180+(lat[j]*2)
>> else:
>> grid_lon_ind = 360-(lon[j]*2)
>> grid_lat_ind = 180+(lat[j]*2)
>> if i> 0:
>> dat[grid_lat_ind, grid_lon_ind] += i #add i'th value
>> n_vals[grid_lat_ind, grid_lon_ind] += 1 #increase cell counter by 1
>> for
>> each extra value
>> j+=1
>>
>> Finally the new dat array is divided by the mean divisor array to give me
>> my
>> mean Z values:
>>
>> dat = np.nan_to_num(dat/n_vals)
>>
>> I've done it this way as opposed to interpolating *properly* in order to
>> (for instance) stop the values bleeding away from the edges of the
>> satellite
>> swath.
>>
>> Cheers,
>>
>> Will.
>> 
> 
> Will: I made some slight modifications to your original script and it 
> works fine with the ortho projection using either contourf on the 
> original lat/lon grid or pcolormesh on the interpolated map projection 
> grid.
> 
> -Jeff
>>
>> Jeff Whitaker wrote:
>> 
>>> On 4/5/10 4:16 AM, Will Hewson wrote:
>>> 
>>>> Hey Jeff,
>>>>
>>>> It's somewhere between the two - the original satellite swath is
>>>> converted
>>>> to a regular 0.5 degree grid by truncating, binning, and averaging each
>>>> point's lons and lats over the top of a 720 x 360 np.zeros array. the
>>>> plotting still works fine for non ortho/ hemispherical projections, and
>>>> I've
>>>> no big problem with using global projections for the time being. Thanks
>>>> for
>>>> your help in the meantime anyway.
>>>>
>>>> Cheers,
>>>>
>>>>
>>>> Will.
>>>>
>>>> 
>>> Will: If it's a regular 0.5 degree lat/lon grid, it should work in
>>> transform_scalar. However, I don't see how to read the data in your
>>> test.plt file into a regular 360x720 grid. It seems to only contain the
>>> points in the swath with nonzero values.
>>>
>>> -Jeff
>>> 
>>>>
>>>> Jeff Whitaker wrote:
>>>>
>>>> 
>>>>> On 4/4/10 11:06 AM, Will Hewson wrote:
>>>>>
>>>>> 
>>>>>> Hi again Jeff et al...
>>>>>>
>>>>>> I've had a play around with the extra few lines of code - on paper
>>>>>> this
>>>>>> seems like it should solve the problems I'm experiencing. However, an
>>>>>> error's being thrown up by the transform scalar function, as my lons
>>>>>> and
>>>>>> lats won't necessarily be increasing. The data I'm plotting is
>>>>>> satellite
>>>>>> data and so at the beginning and end of the orbit file lats go over
>>>>>> the
>>>>>> pole
>>>>>> from 90 to -90, with a similar problem for the lons - whereby the
>>>>>> data
>>>>>> is
>>>>>> taken across the satellite track. I've thought about sorting the data
>>>>>> before
>>>>>> passing it to transform_scalar but I'm always going to be left with
>>>>>> the
>>>>>> problem in either lats or lons.
>>>>>>
>>>>>> I've uploaded the file I'm currently working with this time. It's
>>>>>> three
>>>>>> columns of lons, lats and z values.
>>>>>>
>>>>>> Once again, many thanks for your help.
>>>>>>
>>>>>> Will.
>>>>>>
>>>>>> http://old.nabble.com/file/p28133659/test.plt test.plt
>>>>>>
>>>>>>
>>>>>> 
>>>>> Will: Is it a regular lat/lon grid or a satellite swath? If it's the
>>>>> latter, you can't use my solution.
>>>>>
>>>>> -Jeff
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Download Intel&#174; Parallel Studio Eval
>>>>> Try the new software tools for yourself. Speed compiling, find bugs
>>>>> proactively, and fine-tune applications for parallel performance.
>>>>> See why Intel Parallel Studio got high marks during beta.
>>>>> http://p.sf.net/sfu/intel-sw-dev
>>>>> _______________________________________________
>>>>> Matplotlib-users mailing list
>>>>> Mat...@li...
>>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>>
>>>>>
>>>>>
>>>>> 
>>>>
>>>> 
>>>
>>> ------------------------------------------------------------------------------
>>> Download Intel&#174; Parallel Studio Eval
>>> Try the new software tools for yourself. Speed compiling, find bugs
>>> proactively, and fine-tune applications for parallel performance.
>>> See why Intel Parallel Studio got high marks during beta.
>>> http://p.sf.net/sfu/intel-sw-dev
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>> 
>> 
> 
> 
> -- 
> Jeffrey S. Whitaker Phone : (303)497-6313
> Meteorologist FAX : (303)497-6449
> NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
> 325 Broadway Office : Skaggs Research Cntr 1D-113
> Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
> 
> 
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Basemap--orthographic-projection-plot-doesn%27t-respect-globe-boundary-tp28117654p28141052.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jeff W. <js...@fa...> - 2010年04月05日 14:30:21
Attachments: hewson.py
On 4/5/10 7:25 AM, Will Hewson wrote:
> I should perhaps of explained my code (included in top post) a little better,
> the values in my attached file aren't on a regular grid to start with, I do
> a little bit of juggling as follows to get them into a regular grid:
>
> I'm firstly setting up my 2D grid of 0.5 degree lat lons, followed by
> identically sized grids of zeros for the data bin, and mean divisors:
>
> x = np.arange(-180, 180, 0.5); y = np.arange(-90, 90, 0.5)
> grid_lon, grid_lat = np.meshgrid(x,y) #regularly spaced 2D grid
> n_vals = np.zeros((360,720)) #mean divisor
> dat = np.zeros((360,720)) #2D grid of zeros
>
> I'm then taking my input data (e.g. the .plt file attached), and rounding
> the lat lons to the nearest 0 or 0.5:
>
> lon = (np.around(lon*2))/2 #round to nearest .0 or 0.5
> lat = (np.around(lat*2))/2 #round to nearest .0 or 0.5
>
> Then for each row in my input file where Z is greater than 0, I'm adding the
> n'th Z value to its corresponding position in the dat zeros array, and
> keeping a count of how many values are going into each cell in the mean
> divisor array:
>
> j=0
> for i in slcol:
> if lon[j]< 0:
> grid_lon_ind = 360+(lon[j]*2)
> grid_lat_ind = 180+(lat[j]*2)
> else:
> grid_lon_ind = 360-(lon[j]*2)
> grid_lat_ind = 180+(lat[j]*2)
> if i> 0:
> dat[grid_lat_ind, grid_lon_ind] += i #add i'th value
> n_vals[grid_lat_ind, grid_lon_ind] += 1 #increase cell counter by 1 for
> each extra value
> j+=1
>
> Finally the new dat array is divided by the mean divisor array to give me my
> mean Z values:
>
> dat = np.nan_to_num(dat/n_vals)
>
> I've done it this way as opposed to interpolating *properly* in order to
> (for instance) stop the values bleeding away from the edges of the satellite
> swath.
>
> Cheers,
>
> Will.
> 
Will: I made some slight modifications to your original script and it 
works fine with the ortho projection using either contourf on the 
original lat/lon grid or pcolormesh on the interpolated map projection 
grid.
-Jeff
>
> Jeff Whitaker wrote:
> 
>> On 4/5/10 4:16 AM, Will Hewson wrote:
>> 
>>> Hey Jeff,
>>>
>>> It's somewhere between the two - the original satellite swath is
>>> converted
>>> to a regular 0.5 degree grid by truncating, binning, and averaging each
>>> point's lons and lats over the top of a 720 x 360 np.zeros array. the
>>> plotting still works fine for non ortho/ hemispherical projections, and
>>> I've
>>> no big problem with using global projections for the time being. Thanks
>>> for
>>> your help in the meantime anyway.
>>>
>>> Cheers,
>>>
>>>
>>> Will.
>>>
>>> 
>> Will: If it's a regular 0.5 degree lat/lon grid, it should work in
>> transform_scalar. However, I don't see how to read the data in your
>> test.plt file into a regular 360x720 grid. It seems to only contain the
>> points in the swath with nonzero values.
>>
>> -Jeff
>> 
>>>
>>> Jeff Whitaker wrote:
>>>
>>> 
>>>> On 4/4/10 11:06 AM, Will Hewson wrote:
>>>>
>>>> 
>>>>> Hi again Jeff et al...
>>>>>
>>>>> I've had a play around with the extra few lines of code - on paper this
>>>>> seems like it should solve the problems I'm experiencing. However, an
>>>>> error's being thrown up by the transform scalar function, as my lons
>>>>> and
>>>>> lats won't necessarily be increasing. The data I'm plotting is
>>>>> satellite
>>>>> data and so at the beginning and end of the orbit file lats go over the
>>>>> pole
>>>>> from 90 to -90, with a similar problem for the lons - whereby the data
>>>>> is
>>>>> taken across the satellite track. I've thought about sorting the data
>>>>> before
>>>>> passing it to transform_scalar but I'm always going to be left with the
>>>>> problem in either lats or lons.
>>>>>
>>>>> I've uploaded the file I'm currently working with this time. It's three
>>>>> columns of lons, lats and z values.
>>>>>
>>>>> Once again, many thanks for your help.
>>>>>
>>>>> Will.
>>>>>
>>>>> http://old.nabble.com/file/p28133659/test.plt test.plt
>>>>>
>>>>>
>>>>> 
>>>> Will: Is it a regular lat/lon grid or a satellite swath? If it's the
>>>> latter, you can't use my solution.
>>>>
>>>> -Jeff
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Download Intel&#174; Parallel Studio Eval
>>>> Try the new software tools for yourself. Speed compiling, find bugs
>>>> proactively, and fine-tune applications for parallel performance.
>>>> See why Intel Parallel Studio got high marks during beta.
>>>> http://p.sf.net/sfu/intel-sw-dev
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Mat...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>
>>>>
>>>>
>>>> 
>>>
>>> 
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> 
> 
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Jae-Joon L. <lee...@gm...> - 2010年04月05日 14:24:41
On Mon, Apr 5, 2010 at 10:05 AM, Michael Droettboom <md...@st...> wrote:
>> matplotlib.use('Agg')
>> import matplotlib.pyplot as mpl
>> from matplotlib.transforms import Affine2D
>> import numpy as np
>>
>> image = np.random.random((100,100))
>>
>> fig = mpl.figure()
>> ax = fig.add_subplot(1,1,1)
>> ax.pcolor(image, transform=Affine2D()) # Does not work - the image is not there!
>> fig.savefig('test1.png')
>>
> The image is there, it's just in the lower left corner of the figure,
> outside of the axes.
Note that the transform is a transform to the canvas coordinate (in
pixel scale).
-JJ
From: Jae-Joon L. <lee...@gm...> - 2010年04月05日 14:22:22
On Sun, Apr 4, 2010 at 11:55 AM, Thomas Robitaille
<tho...@gm...> wrote:
> It looks as though the set_linewidth and set_linestyle commands are silently ignored. Is this normal? I have submitted a bug report here:
linewidth and linestyle are (or looks) ignored because ticklines are
actually "markers".
To change width of the ticklines, you should use set_mew.
A change of the linestyle should also be possible, but I'm not sure if
there is a handy way to do that.
Regards,
-JJ
From: Michael D. <md...@st...> - 2010年04月05日 14:05:10
The get/set_transform on an artist (any artist really), is an internal 
implementation detail that transforms points from data space all the way 
to pixels. It's not really useful to the end user, unless you want to 
have very low-level control over plotting. If you want to change how 
data points are converted into physical plot space, you probably want to 
look at creating a custom scale or projection documented here instead:
 http://matplotlib.sourceforge.net/devel/add_new_projection.html
Additionally, we should probably make private and/or undocument 
get/set_transform, or at the very least make the docstring more explicit 
that it is an internal function.
Mike
Thomas Robitaille wrote:
> Hi,
>
> I have been trying to use the Affine2D transformation with pcolor and contour, with no success. The following script and comments illustrates my problems:
>
> matplotlib.use('Agg')
> import matplotlib.pyplot as mpl
> from matplotlib.transforms import Affine2D
> import numpy as np
>
> image = np.random.random((100,100))
>
> fig = mpl.figure()
> ax = fig.add_subplot(1,1,1)
> ax.pcolor(image, transform=Affine2D()) # Does not work - the image is not there!
> fig.savefig('test1.png')
> 
The image is there, it's just in the lower left corner of the figure, 
outside of the axes.
> fig = mpl.figure()
> ax = fig.add_subplot(1,1,1)
> ax.contour(image, transform=Affine2D()) # Ok, but transformation wouldn't change anything anyway
> fig.savefig('test2.png')
> 
> fig = mpl.figure()
> ax = fig.add_subplot(1,1,1)
> ax.contour(image, transform=Affine2D().scale(10.,10.)) # Does not work - the image is unchanged
> fig.savefig('test3.png')
> 
Contour ignores the standard transformation member -- again just an 
implementation detail.
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Gökhan S. <gok...@gm...> - 2010年04月05日 13:40:45
On Mon, Apr 5, 2010 at 6:39 AM, Mauro Cavalcanti <mau...@gm...> wrote:
> Dear ALL,
>
> Good morning... Here is a question that may already have been asked
> (and answered), but not to my knowledge. Matplotlib's figure windows
> come with that handy navigation bar, which includes a Pan/Zoom button
> and a Zoom-to-rectangle button. Once a zoom rectangle is defined on a
> figure, is it possible to get the coordinates of it (that is, the
> lower and upper corner coordinates which define the zoom rectangle)?
> If so, how can this be done?
>
> Thanks in advance for any reply.
>
> With best regards,
>
> --
> Dr. Mauro J. Cavalcanti
> P.O. Box 46521, CEP 20551-970
> Rio de Janeiro, RJ, BRASIL
> E-mail: mau...@gm...
> Web: http://sites.google.com/site/maurobio
> Linux Registered User #473524 * Ubuntu User #22717
>
Hi,
Search for zoom_window.py and rectangle_selector.py in your matplotlib
examples directory.
-- 
Gökhan
From: Michael D. <md...@st...> - 2010年04月05日 13:36:58
All of those calls to "open" are being generated from the pytz import -- 
which is why pytz seems like the likely candidate. Is it possible you 
have pytz installed as a compressed egg, or on a remote disk, or 
something that may be causing a file reading penalty?
As Eric said, make sure you time the "import pytz" in a clean Python 
session -- if a module is already imported in the Python interpreter, it 
won't be reimported.
Mike
Andrew Kelly wrote:
> import pytz only took 0.0 seconds.
> 
> I actually just ran that pstats module and there is one line that 
> stuck out at me:
> ncalls tottime percall cumtime percall filename:lineno(function)
> 1 0.000 0.000 0.000 0.000 
> C:\Python26\lib\os.py:35(_get_exports_list)
> 560 3.107 0.006 3.107 0.006 {open}
> 
> That is ~50% of the load time. I have 0 idea what this is though.
> 
> Let me try this on my os machine.....
> 
> -Andy
>
> On Fri, Apr 2, 2010 at 12:31 PM, Michael Droettboom <md...@st... 
> <mailto:md...@st...>> wrote:
>
> It looks like most of the time is being taken up by pytz (timezone
> library), which opens ~500 files. How does the total time of
> "import pytz" compare?
>
> Mike
>
> Andrew Kelly wrote:
>
> I see. I was wondering why it spit out a binary file.
>
> test.out is attached...
>
> -Andy
>
> On Fri, Apr 2, 2010 at 10:55 AM, Michael Droettboom
> <md...@st... <mailto:md...@st...>
> <mailto:md...@st... <mailto:md...@st...>>> wrote:
>
> Can you provide the actual saved profiler data? The output
> of the
> command itself doesn't provide enough information to
> diagnose the
> problem, since it doesn't have full file paths etc.
>
> When you do (thanks Gökhan for the less verbose version):
>
> python.exe -c "import cProfile; cProfile.run('import pylab',
> 'test.out')"
>
> this should produce a binary file "test.out" that can be loaded
> with the pstats module and used by GUI tools such as
> KCacheGrind
> to help us get to the bottom of this.
>
> Mike
>
> Andrew Kelly wrote:
>
> I'm back.
>
> My backend is wx. "Import wx" does not really take
> much time
> to import at all. In fact time.time() before and after
> = 0.0
>
> Some computer details:
> Processor: AMD Phenom IIx4 810 Processor 2.6 GHz
> RAM: 8.00 GB
>
> As for the cProfiler output on pylab, I have attached the
> output as test.txt.
> -Andy
>
> On Fri, Apr 2, 2010 at 7:22 AM, Gökhan Sever
> <gok...@gm... <mailto:gok...@gm...>
> <mailto:gok...@gm... <mailto:gok...@gm...>>
> <mailto:gok...@gm...
> <mailto:gok...@gm...> <mailto:gok...@gm...
> <mailto:gok...@gm...>>>>
>
> wrote:
>
>
>
> On Fri, Apr 2, 2010 at 8:28 AM, Michael Droettboom
> <md...@st... <mailto:md...@st...>
> <mailto:md...@st... <mailto:md...@st...>>
> <mailto:md...@st... <mailto:md...@st...>
> <mailto:md...@st... <mailto:md...@st...>>>> wrote:
>
> My gut says it's probably the GUI framework
> import that is
> dominating
> the time. Which backend are you using? Does
> importing it
> take a large
> amount of time as well?
>
> Can you provide a profiler output file we can
> examine
> to narrow it
> down? The following from a command prompt should be
> sufficient to write
> out a file called "import.prof":
>
> python.exe -c "import cProfile;
> prof=cProfile.Profile();
> prof.run('import pylab', 'import.prof')"
>
> Mike
>
>
> Just for the records,
>
> It reads as:
>
> python -c "import cProfile; cProfile.run('import pylab',
> filename='test.out')
>
> in Python 2.6.2
>
> These helped me to load the profile output:
>
> import pstats
> stats = pstats.Stats("test.out")
> stats.print_stats()
>
> -- Gökhan
>
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed
> compiling,
> find bugs
> proactively, and fine-tune applications for parallel
> performance.
> See why Intel Parallel Studio got high marks during
> beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> <mailto:Mat...@li...
> <mailto:Mat...@li...>>
> <mailto:Mat...@li...
> <mailto:Mat...@li...>
> <mailto:Mat...@li...
> <mailto:Mat...@li...>>>
>
> 
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> -- Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>
>
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
I should perhaps of explained my code (included in top post) a little better,
the values in my attached file aren't on a regular grid to start with, I do
a little bit of juggling as follows to get them into a regular grid:
I'm firstly setting up my 2D grid of 0.5 degree lat lons, followed by
identically sized grids of zeros for the data bin, and mean divisors:
x = np.arange(-180, 180, 0.5); y = np.arange(-90, 90, 0.5)
grid_lon, grid_lat = np.meshgrid(x,y) #regularly spaced 2D grid
n_vals = np.zeros((360,720)) #mean divisor
dat = np.zeros((360,720)) #2D grid of zeros 
I'm then taking my input data (e.g. the .plt file attached), and rounding
the lat lons to the nearest 0 or 0.5:
lon = (np.around(lon*2))/2 #round to nearest .0 or 0.5
lat = (np.around(lat*2))/2 #round to nearest .0 or 0.5
Then for each row in my input file where Z is greater than 0, I'm adding the
n'th Z value to its corresponding position in the dat zeros array, and
keeping a count of how many values are going into each cell in the mean
divisor array:
j=0
for i in slcol:
 if lon[j] < 0:
 grid_lon_ind = 360+(lon[j]*2)
 grid_lat_ind = 180+(lat[j]*2)
 else:
 grid_lon_ind = 360-(lon[j]*2)
 grid_lat_ind = 180+(lat[j]*2)
 if i > 0:
 dat[grid_lat_ind, grid_lon_ind] += i #add i'th value
 n_vals[grid_lat_ind, grid_lon_ind] += 1 #increase cell counter by 1 for
each extra value
 j+=1
Finally the new dat array is divided by the mean divisor array to give me my
mean Z values:
dat = np.nan_to_num(dat/n_vals)
I've done it this way as opposed to interpolating *properly* in order to
(for instance) stop the values bleeding away from the edges of the satellite
swath.
Cheers,
Will.
Jeff Whitaker wrote:
> 
> On 4/5/10 4:16 AM, Will Hewson wrote:
>> Hey Jeff,
>>
>> It's somewhere between the two - the original satellite swath is
>> converted
>> to a regular 0.5 degree grid by truncating, binning, and averaging each
>> point's lons and lats over the top of a 720 x 360 np.zeros array. the
>> plotting still works fine for non ortho/ hemispherical projections, and
>> I've
>> no big problem with using global projections for the time being. Thanks
>> for
>> your help in the meantime anyway.
>>
>> Cheers,
>>
>>
>> Will.
>> 
> 
> Will: If it's a regular 0.5 degree lat/lon grid, it should work in 
> transform_scalar. However, I don't see how to read the data in your 
> test.plt file into a regular 360x720 grid. It seems to only contain the 
> points in the swath with nonzero values.
> 
> -Jeff
>>
>>
>> Jeff Whitaker wrote:
>> 
>>> On 4/4/10 11:06 AM, Will Hewson wrote:
>>> 
>>>> Hi again Jeff et al...
>>>>
>>>> I've had a play around with the extra few lines of code - on paper this
>>>> seems like it should solve the problems I'm experiencing. However, an
>>>> error's being thrown up by the transform scalar function, as my lons
>>>> and
>>>> lats won't necessarily be increasing. The data I'm plotting is
>>>> satellite
>>>> data and so at the beginning and end of the orbit file lats go over the
>>>> pole
>>>> from 90 to -90, with a similar problem for the lons - whereby the data
>>>> is
>>>> taken across the satellite track. I've thought about sorting the data
>>>> before
>>>> passing it to transform_scalar but I'm always going to be left with the
>>>> problem in either lats or lons.
>>>>
>>>> I've uploaded the file I'm currently working with this time. It's three
>>>> columns of lons, lats and z values.
>>>>
>>>> Once again, many thanks for your help.
>>>>
>>>> Will.
>>>>
>>>> http://old.nabble.com/file/p28133659/test.plt test.plt
>>>>
>>>> 
>>> Will: Is it a regular lat/lon grid or a satellite swath? If it's the
>>> latter, you can't use my solution.
>>>
>>> -Jeff
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Download Intel&#174; Parallel Studio Eval
>>> Try the new software tools for yourself. Speed compiling, find bugs
>>> proactively, and fine-tune applications for parallel performance.
>>> See why Intel Parallel Studio got high marks during beta.
>>> http://p.sf.net/sfu/intel-sw-dev
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>> 
>> 
> 
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Basemap--orthographic-projection-plot-doesn%27t-respect-globe-boundary-tp28117654p28139978.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
On 4/5/10 4:16 AM, Will Hewson wrote:
> Hey Jeff,
>
> It's somewhere between the two - the original satellite swath is converted
> to a regular 0.5 degree grid by truncating, binning, and averaging each
> point's lons and lats over the top of a 720 x 360 np.zeros array. the
> plotting still works fine for non ortho/ hemispherical projections, and I've
> no big problem with using global projections for the time being. Thanks for
> your help in the meantime anyway.
>
> Cheers,
>
>
> Will.
> 
Will: If it's a regular 0.5 degree lat/lon grid, it should work in 
transform_scalar. However, I don't see how to read the data in your 
test.plt file into a regular 360x720 grid. It seems to only contain the 
points in the swath with nonzero values.
-Jeff
>
>
> Jeff Whitaker wrote:
> 
>> On 4/4/10 11:06 AM, Will Hewson wrote:
>> 
>>> Hi again Jeff et al...
>>>
>>> I've had a play around with the extra few lines of code - on paper this
>>> seems like it should solve the problems I'm experiencing. However, an
>>> error's being thrown up by the transform scalar function, as my lons and
>>> lats won't necessarily be increasing. The data I'm plotting is satellite
>>> data and so at the beginning and end of the orbit file lats go over the
>>> pole
>>> from 90 to -90, with a similar problem for the lons - whereby the data is
>>> taken across the satellite track. I've thought about sorting the data
>>> before
>>> passing it to transform_scalar but I'm always going to be left with the
>>> problem in either lats or lons.
>>>
>>> I've uploaded the file I'm currently working with this time. It's three
>>> columns of lons, lats and z values.
>>>
>>> Once again, many thanks for your help.
>>>
>>> Will.
>>>
>>> http://old.nabble.com/file/p28133659/test.plt test.plt
>>>
>>> 
>> Will: Is it a regular lat/lon grid or a satellite swath? If it's the
>> latter, you can't use my solution.
>>
>> -Jeff
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> 
> 
From: Mauro C. <mau...@gm...> - 2010年04月05日 11:39:40
Dear ALL,
Good morning... Here is a question that may already have been asked
(and answered), but not to my knowledge. Matplotlib's figure windows
come with that handy navigation bar, which includes a Pan/Zoom button
and a Zoom-to-rectangle button. Once a zoom rectangle is defined on a
figure, is it possible to get the coordinates of it (that is, the
lower and upper corner coordinates which define the zoom rectangle)?
If so, how can this be done?
Thanks in advance for any reply.
With best regards,
-- 
Dr. Mauro J. Cavalcanti
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: mau...@gm...
Web: http://sites.google.com/site/maurobio
Linux Registered User #473524 * Ubuntu User #22717
Hey Jeff,
It's somewhere between the two - the original satellite swath is converted
to a regular 0.5 degree grid by truncating, binning, and averaging each
point's lons and lats over the top of a 720 x 360 np.zeros array. the
plotting still works fine for non ortho/ hemispherical projections, and I've
no big problem with using global projections for the time being. Thanks for
your help in the meantime anyway.
Cheers,
Will.
Jeff Whitaker wrote:
> 
> On 4/4/10 11:06 AM, Will Hewson wrote:
>> Hi again Jeff et al...
>>
>> I've had a play around with the extra few lines of code - on paper this
>> seems like it should solve the problems I'm experiencing. However, an
>> error's being thrown up by the transform scalar function, as my lons and
>> lats won't necessarily be increasing. The data I'm plotting is satellite
>> data and so at the beginning and end of the orbit file lats go over the
>> pole
>> from 90 to -90, with a similar problem for the lons - whereby the data is
>> taken across the satellite track. I've thought about sorting the data
>> before
>> passing it to transform_scalar but I'm always going to be left with the
>> problem in either lats or lons.
>>
>> I've uploaded the file I'm currently working with this time. It's three
>> columns of lons, lats and z values.
>>
>> Once again, many thanks for your help.
>>
>> Will.
>>
>> http://old.nabble.com/file/p28133659/test.plt test.plt
>> 
> 
> Will: Is it a regular lat/lon grid or a satellite swath? If it's the 
> latter, you can't use my solution.
> 
> -Jeff
> 
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Basemap--orthographic-projection-plot-doesn%27t-respect-globe-boundary-tp28117654p28138677.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Guy R. <guy...@gm...> - 2010年04月05日 09:12:16
Hi Gary,
Thanks for responding. It looks like the mpmath does what I'm looking for.
Your code looks interesting, as it lowers the number of dependencies needed.
I hope I'll find the time to really incorporate this features to something
that can come as part to matplotlib.
Regarding the plots I've pointed to, I didn't make them, so I don't know how
the author did it (expect that he used Mathematica).
Thanks,
Guy
On Sat, Apr 3, 2010 at 4:29 AM, Gary Ruben <gr...@bi...> wrote:
> Hi Guy,
>
> I am also interested in the answer to this. The cplot function in the
> mpmath module does exactly this using matplotlib, but very inefficiently, as
> it computes the colour of each pixel in the image in hls colour-space and
> generates the corresponding rgb value directly. I suspect this is how it has
> to be done, as colormaps in matplotlib are 1D sequences and the black-white
> (lightness) value is really another dimension. However mpmath's method can
> be improved by doing the mapping using array operations instead of computing
> it for each pixel.
>
> I've attached a function I wrote to reproduce the Sage cplot command in my
> own work. It's a bit old and can be improved. It takes the Arg and Abs of a
> complex array as the first two arguments - you can easily change this to
> compute these inside the function if you prefer. The line
> np.vectorize(hls_to_rgb) can be replaced - recent versions of matplotlib
> have a vectorized function called hsv_to_rgb() inside colors.py - so you
> replace the return line with the commented-out version if you first import
> hsv_to_rgb from colors.
>
> I hope this helps.
>
> I'm also curious: the plots you point to also show plots of the function
> "extrema", which are the phase singularities - does mathematica have a
> function that gives you these, or did you write your own function to find
> them?
>
> regards,
> Gary
>
>
> Guy Rutenberg wrote:
>
>> Hi,
>>
>> Is there a way to generate colormaps for complex-valued functions using
>> matplotlib? The type of plots I'm looking for are like the plots in:
>> http://commons.wikimedia.org/wiki/User:Jan_Homann/Mathematics
>>
>> Thanks in advance,
>>
>> Guy
>>
>
> def cplot_like(ph, intens=None, int_exponent=1.0, s=1.0, l_bias=1.0,
> drape=0, is_like_mpmath=False):
> '''
> Implements the mpmath cplot-like default_color_function
> The combined image is generated in hls colourspace then transformed to
> rgb
> *phase*
> A filename or 2D n x m array containing phase data in the range
> -pi->pi
> *intens*
> If None, set to 1.0
> A filename or 2D n x m array containing intensity or amplitude data
> in the range 0->max
> *int_exponent*
> Default 1.0 applies the intens mask directly to the hls
> lightness-channel
> 0.6 works well when drape==0
> *s*
> saturation. Defaults to 1.0. mpmath uses 0.8.
> *l_bias*
> biases the mean lightness value away from 0.5. mpmath uses 1.0.
> Examples are: l_bias=2 -> mean=0.33 (ie darker), l_bias=0.5 ->
> mean=0.66 (lighter)
> *drape*
> If >1, drapes a structured maximum filter of size drape x drape over
> the intensity data
> *is_like_mpmath*
> If True, sets int_exponent = 0.3, s = 0.8
> '''
> from colorsys import hls_to_rgb
>
> if type(ph) is str:
> cph = plt.imread(ph)/256.*2*pi-pi # -pi->pi
> if len(cph.shape) == 3: cph = cph[...,0] # if ph is RGB or
> RGBA, extract the R-plane
> else:
> cph = ph.copy()
>
> if intens is None:
> cintens = np.ones_like(cph)
> elif type(intens) is str:
> cintens = plt.imread(intens)/255. # 0->1
> if len(cintens.shape) == 3: cintens = cintens[...,0] # if intens
> is RGB or RGBA, extract the R-plane
> else:
> cintens = intens.copy()
> cintens /= cintens.max() # autoscale intensity
> data to 0->1
>
> if drape > 1:
> # envelope the intensity
> cintens = maximum_filter(cintens, size=drape)
>
> h = ((cph + pi) / (2*pi)) % 1.0
>
> if is_like_mpmath:
> # apply mpmath values
> int_exponent = 0.3
> s = 0.8
>
> l = 1.0 - l_bias/(l_bias+cintens**int_exponent)
> v_hls_to_rgb = np.vectorize(hls_to_rgb)
>
> #~ return hsv_to_rgb(dstack((h,np.ones_like(h),l)))
> return dstack(v_hls_to_rgb(h,l,s))
>

Showing 24 results of 24

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /