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






Showing results of 428

<< < 1 .. 5 6 7 8 9 .. 18 > >> (Page 7 of 18)
From: Friedrich R. <fri...@gm...> - 2010年10月20日 15:51:38
2010年10月20日 James Battat <jb...@mi...>:
> Hi,
> I'm having trouble with my built-from-source installation of matplotlib on
> Snow Leopard (I also tried installing from the .dmg file, but that install
> failed -- see below for details).
*SIGH* *SIGH*
YEAH, this keeps bugging us.
Please do a search in Gmane (http:/gmane.org, search for
matplotlib-users ...) for Mac OS X 10.6 or Snow Leopard and from
source or compilation or whatever you feel like.
You'll find a bunch of messages, many of them quite long, but be sure:
It's solvable!
I'll write it up somewhen and put it to the webpage if the developers
allow me for. So many ASAP thingys currently ...
Anyway, don't be frustrated by the many details, and start with the
*recent* messages, and believe them more than the old ones. In the
end, when you got a complete and non-conflicting image, compile again.
 You'll also need to compile the libpng and libfreetype2 I believe.
Try to avoid or use as last rescue make.osx, it'll install old libs in
your /usr/local namespace!
Please apologise me, I'm getting tired of explaining it again and
again, sorry again, good success with your studies,
Friedrich
Don't hesitate to ask questions but I cannot explain it from the very
beginning, it'll also be wasting of storage :-)
Second: The dmg installer requires python.org Python, not Apple one.
The Apple one is said to be "whacky", but I don't know any details.
Just use python.org MacPython, where mpl dmg installer is compiled
against and should work from the very beginning. Compile if you need
svn bleeding-edge.
Third: The installer *might* still have the bug of wrong rights for
some images used in the toolbar, so if you find those, don't be
surprised. It's some missing read right in POSIX. But it might be
fixed now, though then I missed it.
> I downloaded:
>  matplotlib-1.0.0.tar.gz
> and then built and installed:
>> tar xvzf matplotlib-1.0.0.tar.gz
>> cd matplotlib-1.0.0
>> python setup.py build
>> python setup.py install
> Then tried using pylab:
>> cd
>> python
> Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import pylab
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/Library/Python/2.6/site-packages/pylab.py", line 1, in <module>
>   from matplotlib.pylab import *
>  File "/Library/Python/2.6/site-packages/matplotlib/pylab.py", line 216, in
> <module>
>   from matplotlib import mpl # pulls in most modules
>  File "/Library/Python/2.6/site-packages/matplotlib/mpl.py", line 2, in
> <module>
>   from matplotlib import axis
>  File "/Library/Python/2.6/site-packages/matplotlib/axis.py", line 10, in
> <module>
>   import matplotlib.font_manager as font_manager
>  File "/Library/Python/2.6/site-packages/matplotlib/font_manager.py", line
> 52, in <module>
>   from matplotlib import ft2font
> ImportError: dlopen(/Library/Python/2.6/site-packages/matplotlib/ft2font.so,
> 2): Symbol not found: _FT_Attach_File
>  Referenced from: /Library/Python/2.6/site-packages/matplotlib/ft2font.so
>  Expected in: flat namespace
> in /Library/Python/2.6/site-packages/matplotlib/ft2font.so
> I've seen both of these problems listed elsewhere, but no solution posted:
>  http://www.mailinglistarchive.com/html/mat...@li.../2010-09/msg00091.html
> Any help is greatly appreciated.
> Here's information on my environment:
>
> Mac OS X 10.6.4
>> uname -a
> Darwin My-MacBook-Pro.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23
> 18:28:53 PDT 2010; root:xnu-1504年7月4日~1/RELEASE_I386 i386
> I was building from source because I was not able to install from the DMG
> installer (matplotlib-1.0.0-python.org-py2.6-macosx10.4.dmg). When I tried
> the .dmg installer, I got the following message:
>  matplotlib 1.0.0-r0 can't be installed on this disk.
>  matplotlib requires System Python 2.6 to install
> Thanks for your help,
> James
From: Friedrich R. <fri...@gm...> - 2010年10月20日 15:40:45
2010年10月20日 Stefan Mauerberger <ste...@mn...>:
> I want to make a polar plot with grid not of the full circle but a
> section (e.g. r=[5:6], phi=[-20:30]). The result should look like this:
> http://homepages.physik.uni-muenchen.de/~Stefan.Mauerberger/example.png
> I have tried a lot and had also looked to the examples but my results
> are not satisfying. This example
> http://matplotlib.sourceforge.net/examples/axes_grid/demo_curvelinear_grid.html seems to be highly relevant for my needs but i do not understand it at all.
>
> I tried two different ways:
> Using the option polar=True works fine but I was not able to shrink the
> plot to the section.
> Otherwise transforming the data to cartesian coordinates (e.g.
> pcolor(r*np.sin(phi),r*np.cos(phi),data) ) the data are plotted into a
> box. But in this case I do not know how to draw a grid.
I believe only option (2) will be feasible, I remember a discussion in
past about this to having had the same outcome.
Try here: http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.pcolor
(*faceted* option).
Notice the next functions on that page, they might help you saving
time, but some of them *might* not work in polar Axes, I'm not sure
which of them if any at all, just be warned.
Make sure you're using 1:1 aspect of the axes containing the pcolor()
Collection, or it will look distorted.
Friedrich
P.S.: If this is your first mpl-users thread, make sure to hit the
reply-to-all button ...
From: James B. <jb...@MI...> - 2010年10月20日 15:01:56
Hi,
I'm having trouble with my built-from-source installation of matplotlib on Snow Leopard (I also tried installing from the .dmg file, but that install failed -- see below for details).
I downloaded:
 matplotlib-1.0.0.tar.gz
and then built and installed:
> tar xvzf matplotlib-1.0.0.tar.gz
> cd matplotlib-1.0.0
> python setup.py build
> python setup.py install
Then tried using pylab:
> cd
> python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylab
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/Library/Python/2.6/site-packages/pylab.py", line 1, in <module>
 from matplotlib.pylab import *
 File "/Library/Python/2.6/site-packages/matplotlib/pylab.py", line 216, in <module>
 from matplotlib import mpl # pulls in most modules
 File "/Library/Python/2.6/site-packages/matplotlib/mpl.py", line 2, in <module>
 from matplotlib import axis
 File "/Library/Python/2.6/site-packages/matplotlib/axis.py", line 10, in <module>
 import matplotlib.font_manager as font_manager
 File "/Library/Python/2.6/site-packages/matplotlib/font_manager.py", line 52, in <module>
 from matplotlib import ft2font
ImportError: dlopen(/Library/Python/2.6/site-packages/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File
 Referenced from: /Library/Python/2.6/site-packages/matplotlib/ft2font.so
 Expected in: flat namespace
 in /Library/Python/2.6/site-packages/matplotlib/ft2font.so
I've seen both of these problems listed elsewhere, but no solution posted:
 http://www.mailinglistarchive.com/html/mat...@li.../2010-09/msg00091.html
Any help is greatly appreciated.
Here's information on my environment: 
 
Mac OS X 10.6.4
> uname -a
Darwin My-MacBook-Pro.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504年7月4日~1/RELEASE_I386 i386
I was building from source because I was not able to install from the DMG installer (matplotlib-1.0.0-python.org-py2.6-macosx10.4.dmg). When I tried the .dmg installer, I got the following message:
 matplotlib 1.0.0-r0 can't be installed on this disk.
 matplotlib requires System Python 2.6 to install
Thanks for your help,
James
 
From: Stefan M. <ste...@mn...> - 2010年10月20日 14:14:30
Hello everyone, 
I want to make a polar plot with grid not of the full circle but a
section (e.g. r=[5:6], phi=[-20:30]). The result should look like this:
http://homepages.physik.uni-muenchen.de/~Stefan.Mauerberger/example.png
I have tried a lot and had also looked to the examples but my results
are not satisfying. This example
http://matplotlib.sourceforge.net/examples/axes_grid/demo_curvelinear_grid.html seems to be highly relevant for my needs but i do not understand it at all.
I tried two different ways: 
Using the option polar=True works fine but I was not able to shrink the
plot to the section. 
Otherwise transforming the data to cartesian coordinates (e.g.
pcolor(r*np.sin(phi),r*np.cos(phi),data) ) the data are plotted into a
box. But in this case I do not know how to draw a grid. 
Could anyone give me some advice how to do this?
Regards
Stefan
From: Stefan M. <ste...@mn...> - 2010年10月20日 11:40:32
Ben, thanks a lot! Your way does exactly what I want. 
Scott, I do not understand your solution, unfortunately. I have already
known the example from the gallery. But up to now, I have not dealt with
masked arrays. Anyway ... 
Thanks a lot again. 
Stefan 
> There's no way around the ``Decimal``? Otherwise I cannot confirm the
> inelegancyness except this construct ;-)
the moneyfmt routine I downloaded requires the Decimal package (i.e decimal.Decimal). I didn't have time to try writing my own version. It has a bug that if you specify number of decimal places = 0 it shows the trailing decimal point.
- dharhas
> Just got Goekhan's message, try a combination of both, might be worth.
a little inelegant but I got it working by combining both ideas:
def thousands(x, pos):
 'The two args are the value and tick position'
 xnew = moneyfmt(Decimal(x.__str__()))
 return xnew
where moneyfmt is the function defined in Gokhan's link.
and then:
formatter = FuncFormatter(thousands)
...
ax1.yaxis.set_major_formatter(formatter)
thanks
- d
From: Jonathan S. <js...@cf...> - 2010年10月19日 19:59:05
Friedrich,
Our e-mails crossed. I don't think the numbers need to have the same
exponent. I would go with (d) as my example does. The more difficult
part to my mind is the number of significant digits to use. The current
code that determines whether to use an offset or not must look at the
number of significant digits needed to represent the ticklabels. To me
what would be optimal is to, by default, use scientific notation (when
the ticklabel numbers are larger or smaller than some range, say 10^3
and 10^-3) except when an offset is called for, say more than 3
significant digits are needed to represent the ticklabel numbers in
scientific notation.
Jon
On Tue, 2010年10月19日 at 21:41 +0200, Friedrich Romstedt wrote:
> 2010年10月19日 David Pine <dj...@gm...>:
> > I like the times symbol but others prefer the dot (which I missed in the gmane preview!). So I like your suggestion of providing an option to use either \cdot or \times.
> 
> Okay, I'll try to look into it next week, is that okay with you both?
> I don't want to do it now since there might be more under the hood,
> just thinking about automatic exponent choice, I have a module for
> that, but it needs to pick up all the range the formatter spans over.
> 
> I'd say we also have use for three other configs of the exponent choice:
> a) largest
> b) smallest
> c) mean
> d) dynamic
> exponent.
> 
> Examples:
> (a) 0.001 10^2 ... 2.0 10^2
> (b) 1.0 10^-1 ... 200.0 10^-1
> (c) 0.01 10^1 ... 20.0 10^1
> (d) 1.0 10^-1 ... 2.0 10^2
> Sorry if there's some mistake but you see the principle.
> 
> Also the number of digits present need to be configurable ... enough for a week.
> 
> I favour (c) as the default, and 2 digits precision.
> 
> Friedrich
-- 
______________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
js...@cf... 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
 cell: (781) 363-0035 USA
______________________________________________________________
From: Friedrich R. <fri...@gm...> - 2010年10月19日 19:50:24
2010年10月19日 Jonathan Slavin <js...@cf...>:
> I think that'd be fine -- i.e. the option of \cdot or \times (though in
> the gmane preview the dot looks a bit low). In the mean time, I came up
> with the method below that worked for my purpose.
Okay thx
> import matplotlib.pyplot as plt
> import numpy as np
> from matplotlib.ticker import FuncFormatter
>
> def scinot(x,pos=None):
>  if x == 0:
>    s = '0'
>  else:
>    xp = int(np.floor(np.log10(np.abs(x))))
>    mn = x/10.**xp
>    # Here we truncate to 2 significant digits -- may not be enough
>    # in all cases
>    s = '$'+str('%.1f'%mn) +'\\times 10^{'+str(xp)+'}$'
>  return s
>
> x = np.linspace(0.,2.,10)*1.E18
> y = 2.*(x/1.E18) - 1.
> fig = plt.figure()
> ax = fig.add_subplot(111)
> ax.plot(x,y)
> ax.xaxis.set_major_formatter(FucFormatter(scinot))
typo for the records although abvious: FuncFormatter
> plt.show()
Okay I can do the tedious work of changing my code ASAP but with low
priority ...
Friedrich
From: Jonathan S. <js...@cf...> - 2010年10月19日 19:42:47
I think that'd be fine -- i.e. the option of \cdot or \times (though in
the gmane preview the dot looks a bit low). In the mean time, I came up
with the method below that worked for my purpose.
Jon
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import FuncFormatter
def scinot(x,pos=None):
 if x == 0:
 s = '0'
 else:
 xp = int(np.floor(np.log10(np.abs(x))))
 mn = x/10.**xp
 # Here we truncate to 2 significant digits -- may not be enough 
 # in all cases
 s = '$'+str('%.1f'%mn) +'\\times 10^{'+str(xp)+'}$'
 return s
x = np.linspace(0.,2.,10)*1.E18
y = 2.*(x/1.E18) - 1.
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x,y)
ax.xaxis.set_major_formatter(FucFormatter(scinot))
plt.show()
On Tue, 2010年10月19日 at 15:30 -0400, David Pine wrote:
> I like the times symbol but others prefer the dot (which I missed in the gmane preview!). So I like your suggestion of providing an option to use either \cdot or \times.
> 
> David
> 
> On Oct 19, 2010, at 3:23 PM, Friedrich Romstedt wrote:
> 
> > What about inserting \cdot, that's the scientific notation I do prefer?
> > 
> > If I'm not mistaken that's what I did that time, might be unreadable
> > in the preview? I checked, when you look close you see the dot in
> > gmane preview.
> > 
> > We can make this customisable, with \times as an alternative option.
> > 
> > Friedrich
> 
-- 
______________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
js...@cf... 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
 cell: (781) 363-0035 USA
______________________________________________________________
From: Friedrich R. <fri...@gm...> - 2010年10月19日 19:41:35
2010年10月19日 David Pine <dj...@gm...>:
> I like the times symbol but others prefer the dot (which I missed in the gmane preview!). So I like your suggestion of providing an option to use either \cdot or \times.
Okay, I'll try to look into it next week, is that okay with you both?
I don't want to do it now since there might be more under the hood,
just thinking about automatic exponent choice, I have a module for
that, but it needs to pick up all the range the formatter spans over.
I'd say we also have use for three other configs of the exponent choice:
a) largest
b) smallest
c) mean
d) dynamic
exponent.
Examples:
(a) 0.001 10^2 ... 2.0 10^2
(b) 1.0 10^-1 ... 200.0 10^-1
(c) 0.01 10^1 ... 20.0 10^1
(d) 1.0 10^-1 ... 2.0 10^2
Sorry if there's some mistake but you see the principle.
Also the number of digits present need to be configurable ... enough for a week.
I favour (c) as the default, and 2 digits precision.
Friedrich
2010年10月19日 Dharhas Pothina <Dha...@tw...>:
> I'm assuming this is possible and common but I'm not finding the correct combination of search terms to find any examples on the mailing list or online on how to do this.
>
> I'd like to display the y-axis tick labels in the 'comma' notation i.e.
>
> 234004 = 234,004
> 1237689 = 1,237,689
You could write your own formatter, don't be scared. The following
might be a good starting point:
http://matplotlib.sourceforge.net/api/ticker_api.html#matplotlib.ticker.FuncFormatter
You just need to write a function inserting the comma into the
number's string repr() given a plain Python number.
If I'm not mistaken this feature has never been requested so far, AFAICT.
Just got Goekhan's message, try a combination of both, might be worth.
hthy,
Friedrich
From: David P. <dj...@gm...> - 2010年10月19日 19:30:37
I like the times symbol but others prefer the dot (which I missed in the gmane preview!). So I like your suggestion of providing an option to use either \cdot or \times.
David
On Oct 19, 2010, at 3:23 PM, Friedrich Romstedt wrote:
> What about inserting \cdot, that's the scientific notation I do prefer?
> 
> If I'm not mistaken that's what I did that time, might be unreadable
> in the preview? I checked, when you look close you see the dot in
> gmane preview.
> 
> We can make this customisable, with \times as an alternative option.
> 
> Friedrich
On Tue, Oct 19, 2010 at 1:31 PM, Dharhas Pothina
<Dha...@tw...> wrote:
> Hi All,
>
> I'm assuming this is possible and common but I'm not finding the correct combination of search terms to find any examples on the mailing list or online on how to do this.
>
> I'd like to display the y-axis tick labels in the 'comma' notation i.e.
>
> 234004 = 234,004
> 1237689 = 1,237,689
> etc
>
> thanks,
>
> - dharhas
>
Python 2.7 has format specifiers for thousands separation:
http://docs.python.org/dev/whatsnew/2.7.html#pep-378-format-specifier-for-thousands-separator
moneyfmt recipe http://docs.python.org/library/decimal.html#recipes
might provide an alternative solution. In any case you should need to
get yticklabels and set them with the converted values.
-- 
Gökhan
From: Friedrich R. <fri...@gm...> - 2010年10月19日 19:23:54
What about inserting \cdot, that's the scientific notation I do prefer?
If I'm not mistaken that's what I did that time, might be unreadable
in the preview? I checked, when you look close you see the dot in
gmane preview.
We can make this customisable, with \times as an alternative option.
Friedrich
Hi All,
I'm assuming this is possible and common but I'm not finding the correct combination of search terms to find any examples on the mailing list or online on how to do this.
I'd like to display the y-axis tick labels in the 'comma' notation i.e.
234004 = 234,004
1237689 = 1,237,689
etc
thanks,
- dharhas
From: David P. <dj...@gm...> - 2010年10月19日 18:46:18
I agree with Jonathan and would very much like to see this feature implemented. The example shown in the thread didn't show the "×ばつ" symbol, however, which would be nice to have -- e.g. it should read 2.0 ×ばつ 102 rather than 2.0 102.
David
On Oct 19, 2010, at 1:08 PM, Friedrich Romstedt wrote:
> 2010年10月18日 Jonathan Slavin <js...@cf...>:
>> I'm wondering if there's some relatively automatic way to have the
>> ticklabels to come out in scientific notation for an axis that uses a
>> linear scale (and has a range that warrants scientific notation)? For
>> example, an axis that goes from 0 to 2.E18 by default uses the labels 0,
>> 0.5, 1.0, 1.5, 2.0 and puts 1e18 at the end of the axis. To me this is
>> unappealing. 1e18 is a computer programming way to write the 10^{18} (in
>> LaTeX formatting). In IDL the ticklabels are 5.0x10^{17}, 1.0x10^{18},
>> 1.5x10^{18}, 2.0x10^{18}. This is one instance where I think IDL gets
>> it right and matplotlib gets it wrong. So, as far as I can tell, one
>> can give the ticklabels by hand, and so I could achieve my desired
>> labels that way, but it'd be nice to have a more automatic way to do it.
>> Searching the examples, I've come up empty so far. I would also
>> advocate changing the default format for labeling axes that fall in this
>> category. Do the developers have any opinions on this?
> 
> There's a thread some monthes ago about this, I provided code to do
> this. Currently, this Formatter class didn't make it into matplotlib
> due a lack of providing a patch by me. If others agree that this
> would be a good feature, I'll clean the code if necessary and provide
> another patch for this.
> 
> Looking for the thread ...
> http://article.gmane.org/gmane.comp.python.matplotlib.general/23824/match=scientific+notation+friedrich
> 
> IIRC, the formatter class does NOT provide automatic choice of
> appropriate exponent, i.e. you have to provide this in instantiation
> time.
> 
> hth, and let me know about any progress,
> Friedrich
> 
> P.S.: I just gave the thread link and didn't look into it further.
> But it should be the message I remembered.
> 
> ------------------------------------------------------------------------------
> Download new Adobe(R) Flash(R) Builder(TM) 4
> The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
> Flex(R) Builder(TM)) enable the development of rich applications that run
> across multiple browsers and platforms. Download your free trials today!
> http://p.sf.net/sfu/adobe-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Paul H. <pmh...@gm...> - 2010年10月19日 18:19:07
Use the legend method of your axes object:
http://matplotlib.sourceforge.net/examples/api/legend_demo.html?highlight=codex%20legend
On Tue, Oct 19, 2010 at 11:15 AM, Waléria Antunes David
<wal...@gm...> wrote:
> Hi,
>
> This example helped me. I have another question. How do I insert the label
> as in the example image?: Data from Riess et al (2004)
>
> Thanks,
> Waleria.
>
> On Tue, Oct 19, 2010 at 3:50 PM, Paul Hobson <pmh...@gm...> wrote:
>>
>> Waléria,
>>
>> Hopefully this example helps:
>>
>> # code...
>> import matplotlib.pyplot as plt
>> fig = plt.figure()
>> ax = fig.add_subplot(111)
>> ax.plot([0,1,2], [0,1,3], 'ko')
>>
>> # set the xticks manually
>> ax.set_xticks([0,0.5,1.0,1.5,2])
>>
>> # set the yticks using "range"
>> ytix = range(6)
>> ax.set_yticks(ytix)
>> plt.show()
>> #...done
>>
>> --paul
>>
>>
>>
>>
>>
>> On Tue, Oct 19, 2010 at 10:15 AM, Waléria Antunes David
>> <wal...@gm...> wrote:
>> > Hi all,
>> >
>> > I have a graph. I plotted using python, matplotlib. And i have an
>> > example.
>> >
>> > I need to let the x-axis of my graph, and how do I change plt.ylabel
>> > ('Y',
>> > size = 10) as the example.
>> >
>> > Example: In my graph, the x-axis this way: 0.0 ----- 0.2 ------ 0.4
>> > -----
>> > 0.6 ------- 0.8 ------- 1.0 ------- 1.2 -------- 1.4
>> > I need this way: 0 ----- 0.5 ------ 1.0 ----- 1.5 -------- 2
>> >
>> > My code: http://pastebin.com/GZqWKwZf
>> >
>> > Can you help me?
>> >
>> > Thanks
>> > Waleria
>> >
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Download new Adobe(R) Flash(R) Builder(TM) 4
>> > The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
>> > Flex(R) Builder(TM)) enable the development of rich applications that
>> > run
>> > across multiple browsers and platforms. Download your free trials today!
>> > http://p.sf.net/sfu/adobe-dev2dev
>> > _______________________________________________
>> > Matplotlib-users mailing list
>> > Mat...@li...
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> >
>> >
>
>
From: Waléria A. D. <wal...@gm...> - 2010年10月19日 18:15:42
Hi,
This example helped me. I have another question. How do I insert the label
as in the example image?: Data from Riess et al (2004)
Thanks,
Waleria.
On Tue, Oct 19, 2010 at 3:50 PM, Paul Hobson <pmh...@gm...> wrote:
> Waléria,
>
> Hopefully this example helps:
>
> # code...
> import matplotlib.pyplot as plt
> fig = plt.figure()
> ax = fig.add_subplot(111)
> ax.plot([0,1,2], [0,1,3], 'ko')
>
> # set the xticks manually
> ax.set_xticks([0,0.5,1.0,1.5,2])
>
> # set the yticks using "range"
> ytix = range(6)
> ax.set_yticks(ytix)
> plt.show()
> #...done
>
> --paul
>
>
>
>
>
> On Tue, Oct 19, 2010 at 10:15 AM, Waléria Antunes David
> <wal...@gm...> wrote:
> > Hi all,
> >
> > I have a graph. I plotted using python, matplotlib. And i have an
> example.
> >
> > I need to let the x-axis of my graph, and how do I change plt.ylabel
> ('Y',
> > size = 10) as the example.
> >
> > Example: In my graph, the x-axis this way: 0.0 ----- 0.2 ------ 0.4 -----
> > 0.6 ------- 0.8 ------- 1.0 ------- 1.2 -------- 1.4
> > I need this way: 0 ----- 0.5 ------ 1.0 ----- 1.5 -------- 2
> >
> > My code: http://pastebin.com/GZqWKwZf
> >
> > Can you help me?
> >
> > Thanks
> > Waleria
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Download new Adobe(R) Flash(R) Builder(TM) 4
> > The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
> > Flex(R) Builder(TM)) enable the development of rich applications that run
> > across multiple browsers and platforms. Download your free trials today!
> > http://p.sf.net/sfu/adobe-dev2dev
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
>
From: Justin M. <jn...@gm...> - 2010年10月19日 18:14:55
On Fri, Oct 8, 2010 at 11:10 PM, Jae-Joon Lee <lee...@gm...> wrote:
> The label_mode need to be capital "L", instead of "l". I guess this
> will fix your first problem.
> While we make "l" same as "L", but I think it actually degrade the
> readability of the code, and I;m inclined to leave it as is. Let me
> know if you have any suggestions though.
Sorry for the delayed response, but I've been trying to think of a
decent suggestion.
The capital "L" fixed the problem with the extra xticks. I had
completely misread it; I was trying to label the lower-left axes only
with a lower-case "L" ("l") and really needed a one ("1").
How about "bottom" instead of "L", and "lower left" instead of "1"?
You might consider using the "bottom", "lower left", "top", ...
pattern if you want to support other locations.
 Justin
From: Friedrich R. <fri...@gm...> - 2010年10月19日 17:51:16
2010年10月19日 Waléria Antunes David <wal...@gm...>:
> Example: In my graph, the x-axis this way: 0.0 ----- 0.2 ------ 0.4 -----
> 0.6 ------- 0.8 ------- 1.0 ------- 1.2 -------- 1.4
> I need this way: 0 ----- 0.5 ------ 1.0 ----- 1.5 -------- 2
you might use mpl.ticker.MaxNLocator(4).
Install it in the Axes using
ax.set_major_locator(mpl.ticker.MaxNLocator(4, steps=[1, 2, 5, 10])).
The number is the maximum number of bins. *steps* are the allowed
steps by which to step between bin boundaries. See the docs (module
mpl.ticker) for details!
Friedrich
From: Friedrich R. <fri...@gm...> - 2010年10月19日 17:44:00
Attachments: mpl-test.txt
Hi,
please, can someone dealing with the path simplication have a look at
the log attached?
I'm on 10.6 Mac OS X with astraw repo 10/18/2010.
The symlog mismatch is said to by fixed; for the pcolormesh mismatch I
cannot see any visual difference. Might by false alarm. But the
``len(simplified)`` things might be worth being considered I guess. I
have numpy.__version__ 1.4.1. The python running the tests is 32bit
(although compiled fat). Python 2.6. mpl compiled locally of course
by the fat Python, so both archs. gcc-4.2 on 10.6 as usual. ...
Friedrich
From: Friedrich R. <fri...@gm...> - 2010年10月19日 17:27:15
2010年10月19日 Kynn Jones <ky...@gm...>:
> I need to generate a fairly complex chart, for which I need the ability to
> specify not only subplots, but also sub-subplots. (Our group has found such
> charts useful in the past, but they were generated using horrific MATLAB
> code, which we're trying to get away from as quickly as we can, not only
> because the code is impenetrable, but because the MATLAB GUI is unstable,
> and produces very poor results when we try to print the charts.)
> I'll try to describe what I want to do in a bit more detail (it's messy).
> First imagine a simple plot (just a simple X-Y line graph connecting 3-4
> datapoints). I'll call this a level-0 plot. Now, join ~10 of these level-0
> plots side-by-side (with no space between the plots). This new aggregate is
> a level-1 plot. Next stack ~10 level-1 plots vertically, again, with no
> space between them. The resulting aggregate is a level-2 plot. Finally
> arrange ~10 of these level-2 plots side-by-side, with some spacing between
> them. The desired final product is this level-3 plot.
> (In practice, the numbers of elements within each aggregate is not exactly
> 10. For example, for my immediate application the numbers would be 8
> level-0 plots per level-1 plot; 17 level-1 plots per level-2 plot; and 8
> level-2 plots per level-3 plot. The level-0 plots should have an aspect
> ratio (H:W) of 4. Therefore, the level-2 plots will have an aspect ratio of
> almost 8.)
> How can I achieve this?
My idea would be to add another layer. Meaning to provide a class
which *creates* Axes, and which has other instances of *this class* in
an attribute. The attrib would be scalar. Repetition is done via
recursive call so some privat e method, initiated by a call to a
public commit method. So you would do in pseudo-code:
level0 = LevelAxesGenerator() # NOT actually creating the Axes, see below.
level1 = LevelAxesGenerator(leaf=level0, repeat=10, direction='x') #
NOT creating too.
level1.create(width=foo, height=bar) # Subdividing automatically,
generating Axes in the recursive calls on level0-level
This shouldn't be super-hard.
Sorry, I cannot help you with implementation currently.
When you code it, think about general usability, also for other users,
if you're inclined. I would maybe have been such a user in the past.
``.create()`` could maybe called ``.commit()``, this is more specific.
 Create can mean anything.
You could even add a .populate() method, so that you can derive from
``LevelAxesGenerator`` and the instances automatically populate their
axes based on the "coordinate" tuple (level0, level1, level2, ...).
This would be really neat, and it's not too specific, because it'll be
the main use of this level-functionality.
Success,
Friedrich
From: Friedrich R. <fri...@gm...> - 2010年10月19日 17:08:13
2010年10月18日 Jonathan Slavin <js...@cf...>:
> I'm wondering if there's some relatively automatic way to have the
> ticklabels to come out in scientific notation for an axis that uses a
> linear scale (and has a range that warrants scientific notation)? For
> example, an axis that goes from 0 to 2.E18 by default uses the labels 0,
> 0.5, 1.0, 1.5, 2.0 and puts 1e18 at the end of the axis. To me this is
> unappealing. 1e18 is a computer programming way to write the 10^{18} (in
> LaTeX formatting). In IDL the ticklabels are 5.0x10^{17}, 1.0x10^{18},
> 1.5x10^{18}, 2.0x10^{18}. This is one instance where I think IDL gets
> it right and matplotlib gets it wrong. So, as far as I can tell, one
> can give the ticklabels by hand, and so I could achieve my desired
> labels that way, but it'd be nice to have a more automatic way to do it.
> Searching the examples, I've come up empty so far. I would also
> advocate changing the default format for labeling axes that fall in this
> category. Do the developers have any opinions on this?
There's a thread some monthes ago about this, I provided code to do
this. Currently, this Formatter class didn't make it into matplotlib
due a lack of providing a patch by me. If others agree that this
would be a good feature, I'll clean the code if necessary and provide
another patch for this.
Looking for the thread ...
http://article.gmane.org/gmane.comp.python.matplotlib.general/23824/match=scientific+notation+friedrich
IIRC, the formatter class does NOT provide automatic choice of
appropriate exponent, i.e. you have to provide this in instantiation
time.
hth, and let me know about any progress,
Friedrich
P.S.: I just gave the thread link and didn't look into it further.
But it should be the message I remembered.
From: vaishu <vai...@gm...> - 2010年10月19日 15:44:20
Hey guys,
I am a new user to the python & matplotlib, this might be a simple question
but I searched the internet for hours and couldn't find a solution for this.
I am plotting precipitation data from which is in the NetCDF format. What I
find weird is that, the data doesn't have any negative values in it.(I
checked that many times,just to make sure). But the value in the colorbar
starts with a negative value (like -0.0000312 etc). It doesnt make sense
because I dont do any manipulations to the data, other that just selecting a
part of the data from the big file and plotting it.
So my code doesn't much to it. Here is the code:
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
from netCDF4 import Dataset
cd progs
f=Dataset('V21_GPCP.1979-2009.nc')
lats=f.variables['lat'][:]
lons=f.variables['lon'][:]
prec=f.variables['PREC'][:]
la=lats[31:52]
lo=lons[18:83]
pre=prec[0,31:52,18:83]
m = Basemap(width=06.e6,height=05.e6,projection='gnom',lat_0=15.,lon_0=80.)
x, y = m(*np.meshgrid(lo,la))
m.drawcoastlines()
m.drawmapboundary(fill_color='lightblue')
m.drawparallels(np.arange(-90.,120.,5.),labels=[1,0,0,0])
m.drawmeridians(np.arange(0.,420.,5.),labels=[0,0,0,1])
cs=m.contourf(x,y,pre,50,cmap=plt.cm.jet)
plt.colorbar()
The output that I got for that code was a beautiful plot, with the colorbar
starting from the value -0.00001893, and the rest are positive values, and I
believe are correct. Its just the minimum value thats bugging me.
http://old.nabble.com/file/p30001558/jan1979plot.png 
I would like to know:
Is there anything wrong in my code? cos I know that the data is right.
Is there a way to manually change the value to 0?
Is it right for the values in the colorbar to change everytime we run the
code, cos for the same data, the next time I run the code, the values go
like this " -0.00001893, 2.00000000, 4.00000000, 6.00000000 etc"
I want to customize them to "0.0, 2.0, 4.0, 6.0 etc"
Thanks, 
Vaishu
-- 
View this message in context: http://old.nabble.com/weird-range-value-in-the-colorbar%2C-matplotlib-tp30001558p30001558.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
7 messages has been excluded from this view by a project administrator.

Showing results of 428

<< < 1 .. 5 6 7 8 9 .. 18 > >> (Page 7 of 18)
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 によって変換されたページ (->オリジナル) /