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



Showing results of 480

1 2 3 .. 20 > >> (Page 1 of 20)
From: ringobelingo <rin...@gm...> - 2009年09月30日 23:00:43
Hi, 
I would like to add coastlines to a map but do not want interior
'coastlines'. At present, without them my continents are not distinct enough
from the data I am plotting in the background. But, when I draw them using
drawcoastlines(), I also get e.g. the great lakes showing up, and this just
makes my world maps look messy and distracts from my data which should be
the main focus. Does anyone know of a way to force this to happen, or is it
something that might be added, i.e. splitting the function into
drawcoastlines() and drawicoastlines() ... ?
Many thanks.
Ringo
-- 
View this message in context: http://www.nabble.com/Basemap-drawcoastlines-issue-tp25690572p25690572.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2009年09月30日 22:02:22
Mike,
I think this maybe related with some changes in how alpha is set (this
happened sometime early this year I guess).
I think the issue here is, when the shadow patch is created, it sets
its facecolor with alpha=0.5., i.e., its _facecolor is something like
(r, g, b, 0.5). But, shadow._alpha = 1 still. And later when the
shadow is drawn, the alpha of the facecolor is simply overridden by
_alpha. Given that alpha=0.5 is intended, I think this is a bug. But
I'm not sure what is the preferred way to fix this.
I think this is a general issue of Patch classes. While the alpha
values can be set with facecolor and edgecolor, they are simply
overridden by _alpha. If this behavior is necessary and intended, we
should change the Shadow class to set its alpha correctly.
I, personally, want to have different alphas for the facecolor and
edgecolor, which cannot be done with the current approach. However, I
believe the current backend api itself (draw_path) does not allow
different alphas for edgecolor and facecolor, so it may best stick to
the current behavior.
Regards,
-JJ
On Wed, Sep 30, 2009 at 4:51 PM, Michael Droettboom <md...@st...> wrote:
> I'm still not seeing a difference between 0.98.5 and 0.99.1 here. I
> further investigation of the code shows that there were no changes in
> how the shadow color is computed between these versions. Is it possible
> you're using an even earlier version? You can determine it using:
>
>  >>> import matplotlib
>  >>> matplotlib.__version__
>
> Are there any other differences between the two installations, such as
> backend?
>
> Cheers,
> Mike
>
> Gewton Jhames wrote:
>> sorry, this is the script:
>>
>> #!/usr/bin/python
>> # -*- coding: utf-8 -*-
>> from pylab import *
>>
>> from matplotlib.pyplot import figure, show
>> from matplotlib.patches import Ellipse
>> import numpy as np
>>
>> figure(1, figsize=(6,6), facecolor='#ffffff')
>> ax = axes([0.1, 0.1, 0.8, 0.8])
>>
>> labels = 'label1', 'label2'
>> fracs = [40, 60]
>> colors = ['#E3AB9C', '#C6E9F8']
>>
>> explode=(0, 0.05)
>>
>> plots = pie(fracs, explode=explode, labels=labels, colors=colors,
>> autopct='%0.2f%%', shadow=True)
>> plots[0][0].set_edgecolor('#E4471A')
>> plots[0][1].set_edgecolor('#1AA8E4')
>> title('Raining Hogs and Dogs', bbox={'facecolor':'0.8', 'pad':5})
>>
>>
>> show()
>>
>>
>> On Wed, Sep 30, 2009 at 5:19 PM, Michael Droettboom <md...@st...
>> <mailto:md...@st...>> wrote:
>>
>>   Can you provide the script that produces these graphs? I don't
>>   see any difference between 0.98.5 and 0.99.1 on the included
>>   pie_demo.py example. Which backend are you using?
>>
>>   Mike
>>
>>   Gewton Jhames wrote:
>>
>>     Hello, I'm having two different results in the shadow of a
>>     graph. I develop the graph in a system with matplotlib 0.98.5.
>>     When I put the code in other machine, with the same version of
>>     libpng, but with matplotlib 0.99.0, the shadow of the graph
>>     has changed to a real bad one.
>>
>>     In attachment, the two generated graphs. I wish that the
>>     graph's shadown generated in 0.99 be the same of 0.98.5.
>>
>>     Well, see the attachment and you'll understand.
>>     thanks.
>>
>>     ------------------------------------------------------------------------
>>
>>
>>     ------------------------------------------------------------------------
>>
>>     ------------------------------------------------------------------------
>>
>>     ------------------------------------------------------------------------------
>>     Come build with us! The BlackBerry&reg; Developer Conference
>>     in SF, CA
>>     is the only developer event you need to attend this year.
>>     Jumpstart your
>>     developing skills, take BlackBerry mobile applications to
>>     market and stay ahead of the curve. Join us from November
>>     9&#45;12, 2009. Register now&#33;
>>     http://p.sf.net/sfu/devconf
>>     ------------------------------------------------------------------------
>>
>>     _______________________________________________
>>     Matplotlib-users mailing list
>>     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
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Eric F. <ef...@ha...> - 2009年09月30日 21:12:52
> - I don't follow what the snippet of code below is doing:
> 
> if cbook.iterable(value):
> vtype = 'array'
> val = ma.asarray(value).astype(np.float)
> else:
> vtype = 'scalar'
> val = ma.array([value]).astype(np.float)
> 
The idea is that the norm __call__ method should return a scalar when 
given a scalar input, or an array when given a sequence input. It is 
easiest to do the calculation with masked arrays or ndarrays, however, 
so inputs are converted, keeping track of whether it is a scalar or not, 
so that if it is a scalar, the output can be converted from 1-element 
array back to a scalar.
Eric
From: Eric F. <ef...@ha...> - 2009年09月30日 21:02:00
Phillip M. Feldman wrote:
> Hello Eric-
> 
> I've looked at the code in colors.py. I think that I'm starting to 
> understand what's going on, but I'm unclear about a few things. In 
> particular:
> 
> - Why do we need to define both forward and reverse transformations? 
> Shouldn't the forward transformation be sufficient?
The inverse is used by colorbar to auto-generate the boundaries and 
values arrays when they are not specified. The norms that do not have 
inverses have special-case code in colorbar to handle this.
> 
> - I don't follow what the snippet of code below is doing:
> 
> if cbook.iterable(value):
> vtype = 'array'
> val = ma.asarray(value).astype(np.float)
> else:
> vtype = 'scalar'
> val = ma.array([value]).astype(np.float)
> 
> - In some cases I'd like to map the data values to discrete output 
> values, e.g., values below x_0 map to 0 (which the colormap in turn maps 
> to red), values between x_0 and x_1 map to 0.5 (which maps to yellow), 
> and values greater than x_1 map to 1 (which maps to green). Such a 
> function does not have a mathematical inverse because it is a many to 
> one mapping. How does one handle this situation?
BoundaryNorm does exactly this--when working with a suitable 
colormap---and its lack of an inverse is handled inside colorbar.
from matplotlib import colors
x_0 = 0
x_1 = 0.5
cmap = colors.ListedColormap(['y'])
cmap.set_under('r')
cmap.set_over('g')
norm = colors.BoundaryNorm([x_0, x_1], cmap.N)
z = (np.arange(100) / 50.0) - 1.0
z.shape = (10,10)
imshow(z, cmap=cmap, norm=norm, interpolation='nearest')
> 
> The ability to pass in an ordinary function (or a pair of functions if 
> the inverse is really necessary) would be a great benefit.
I will try to get to this ASAP.
Eric
> 
> Thanks!
> 
> Phillip
> 
> Eric Firing wrote:
>> Dr. Phillip M. Feldman wrote:
>>> I'd like to generate a scatter plot in which symbols are colored using a
>>> specified colormap, with a specified mapping from the range of the 
>>> data to
>>> the [0,1] colormap interval. I thought at first that one could use 
>>> the norm
>>> argument to specify a function that would perform this mapping, but from
>>> closer reading of the documentation (and experimentation) it seems as 
>>> though
>>> one cannot do this. Is there another mechanism for doing this? (I could
>>> remap the data itself before plotting it, but this is unacceptable 
>>> because
>>> the colorbar tic lables would then take values in [0,1] rather than 
>>> values
>>> from the range of the data).
>>>
>>
>> I don't understand--what you say you want to do is exactly what the 
>> norm is designed for. Maybe the problem is that you can't pass in a 
>> simple function--you need to subclass colors.Normalize. An example is 
>> colors.LogNorm.
>>
>> It looks like what we need is a FuncNorm, which would be initialized 
>> with two functions, the forward and inverse transformation functions, 
>> each taking vmin, vmax, and a val.
>>
>> Eric
>>
> 
From: Michael D. <md...@st...> - 2009年09月30日 20:51:28
I'm still not seeing a difference between 0.98.5 and 0.99.1 here. I 
further investigation of the code shows that there were no changes in 
how the shadow color is computed between these versions. Is it possible 
you're using an even earlier version? You can determine it using:
 >>> import matplotlib
 >>> matplotlib.__version__
Are there any other differences between the two installations, such as 
backend?
Cheers,
Mike
Gewton Jhames wrote:
> sorry, this is the script:
>
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
> from pylab import *
>
> from matplotlib.pyplot import figure, show
> from matplotlib.patches import Ellipse
> import numpy as np
>
> figure(1, figsize=(6,6), facecolor='#ffffff')
> ax = axes([0.1, 0.1, 0.8, 0.8])
>
> labels = 'label1', 'label2'
> fracs = [40, 60]
> colors = ['#E3AB9C', '#C6E9F8']
>
> explode=(0, 0.05)
>
> plots = pie(fracs, explode=explode, labels=labels, colors=colors, 
> autopct='%0.2f%%', shadow=True)
> plots[0][0].set_edgecolor('#E4471A')
> plots[0][1].set_edgecolor('#1AA8E4')
> title('Raining Hogs and Dogs', bbox={'facecolor':'0.8', 'pad':5})
>
>
> show()
>
>
> On Wed, Sep 30, 2009 at 5:19 PM, Michael Droettboom <md...@st... 
> <mailto:md...@st...>> wrote:
>
> Can you provide the script that produces these graphs? I don't
> see any difference between 0.98.5 and 0.99.1 on the included
> pie_demo.py example. Which backend are you using?
>
> Mike
>
> Gewton Jhames wrote:
>
> Hello, I'm having two different results in the shadow of a
> graph. I develop the graph in a system with matplotlib 0.98.5.
> When I put the code in other machine, with the same version of
> libpng, but with matplotlib 0.99.0, the shadow of the graph
> has changed to a real bad one.
>
> In attachment, the two generated graphs. I wish that the
> graph's shadown generated in 0.99 be the same of 0.98.5.
>
> Well, see the attachment and you'll understand.
> thanks.
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference
> in SF, CA
> is the only developer event you need to attend this year.
> Jumpstart your
> developing skills, take BlackBerry mobile applications to
> market and stay ahead of the curve. Join us from November
> 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> 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
From: Christopher Barrington-L. <cpb...@gm...> - 2009年09月30日 20:38:56
Jae-Joon Lee wrote:
> 
> This works if you use recent version of matplotlib with preview mode
> on. Without the preview mode (or other similar ways to report the
> dimension of the text from TeX side), I don't think this can be done.
> 
> 
Ok, thanks. I hope I am understanding. Would you be able to point me to a
link to info on what you mean by "preview mode"? 
By recent version you mean something in the svn, I guess?
> This does not. First of all, "~" and "\mbox" are not supported if
> usetex=False and I guess never will be. On the other hand,
> as far as I can see, the whitespace stripping is not done in mpl
> side. And I have a feeling that it may be the freetype library. mpl
> uses FT_Glyph_Get_CBox to calculate the extents of the text and I
> think this seems to fail when there is a trailing spaces. This is
> beyond me I hope other developers have better idea.
> 
> 
Thanks, I too hope some other developers chime in!
> So, Christopher,
> I guess your best chance is to upgrade and use preview mode, or use
> annotate function.
> 
I am not clear how annotate helps. If I am willing to specify x,y locations,
I can do that with text() as well, no?. It's still a matter of calculating
how big a piece of whitespace should end up, roughly.
Thanks, JJ!
-- 
View this message in context: http://www.nabble.com/trailing-space-in-text-string-stripped%2C-making-it-impossible-to-right-pad-my-text-tp25639703p25688584.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Gewton J. <gj...@gm...> - 2009年09月30日 20:38:54
sorry, this is the script:
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pylab import *
from matplotlib.pyplot import figure, show
from matplotlib.patches import Ellipse
import numpy as np
figure(1, figsize=(6,6), facecolor='#ffffff')
ax = axes([0.1, 0.1, 0.8, 0.8])
labels = 'label1', 'label2'
fracs = [40, 60]
colors = ['#E3AB9C', '#C6E9F8']
explode=(0, 0.05)
plots = pie(fracs, explode=explode, labels=labels, colors=colors,
autopct='%0.2f%%', shadow=True)
plots[0][0].set_edgecolor('#E4471A')
plots[0][1].set_edgecolor('#1AA8E4')
title('Raining Hogs and Dogs', bbox={'facecolor':'0.8', 'pad':5})
show()
On Wed, Sep 30, 2009 at 5:19 PM, Michael Droettboom <md...@st...> wrote:
> Can you provide the script that produces these graphs? I don't see any
> difference between 0.98.5 and 0.99.1 on the included pie_demo.py example.
> Which backend are you using?
>
> Mike
>
> Gewton Jhames wrote:
>
>> Hello, I'm having two different results in the shadow of a graph. I
>> develop the graph in a system with matplotlib 0.98.5.
>> When I put the code in other machine, with the same version of libpng, but
>> with matplotlib 0.99.0, the shadow of the graph has changed to a real bad
>> one.
>>
>> In attachment, the two generated graphs. I wish that the graph's shadown
>> generated in 0.99 be the same of 0.98.5.
>>
>> Well, see the attachment and you'll understand.
>> thanks.
>>
>> ------------------------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
>> http://p.sf.net/sfu/devconf
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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: Michael D. <md...@st...> - 2009年09月30日 20:20:09
Can you provide the script that produces these graphs? I don't see any 
difference between 0.98.5 and 0.99.1 on the included pie_demo.py 
example. Which backend are you using?
Mike
Gewton Jhames wrote:
> Hello, I'm having two different results in the shadow of a graph. I 
> develop the graph in a system with matplotlib 0.98.5.
> When I put the code in other machine, with the same version of libpng, 
> but with matplotlib 0.99.0, the shadow of the graph has changed to a 
> real bad one.
>
> In attachment, the two generated graphs. I wish that the graph's 
> shadown generated in 0.99 be the same of 0.98.5.
>
> Well, see the attachment and you'll understand.
> thanks.
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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: Phillip M. F. <pfe...@ve...> - 2009年09月30日 20:18:22
Hello Eric-
I've looked at the code in colors.py. I think that I'm starting to 
understand what's going on, but I'm unclear about a few things. In 
particular:
- Why do we need to define both forward and reverse transformations? 
Shouldn't the forward transformation be sufficient?
- I don't follow what the snippet of code below is doing:
 if cbook.iterable(value):
 vtype = 'array'
 val = ma.asarray(value).astype(np.float)
 else:
 vtype = 'scalar'
 val = ma.array([value]).astype(np.float)
- In some cases I'd like to map the data values to discrete output 
values, e.g., values below x_0 map to 0 (which the colormap in turn maps 
to red), values between x_0 and x_1 map to 0.5 (which maps to yellow), 
and values greater than x_1 map to 1 (which maps to green). Such a 
function does not have a mathematical inverse because it is a many to 
one mapping. How does one handle this situation?
The ability to pass in an ordinary function (or a pair of functions if 
the inverse is really necessary) would be a great benefit.
Thanks!
Phillip
Eric Firing wrote:
> Dr. Phillip M. Feldman wrote:
>> I'd like to generate a scatter plot in which symbols are colored using a
>> specified colormap, with a specified mapping from the range of the 
>> data to
>> the [0,1] colormap interval. I thought at first that one could use 
>> the norm
>> argument to specify a function that would perform this mapping, but from
>> closer reading of the documentation (and experimentation) it seems as 
>> though
>> one cannot do this. Is there another mechanism for doing this? (I could
>> remap the data itself before plotting it, but this is unacceptable 
>> because
>> the colorbar tic lables would then take values in [0,1] rather than 
>> values
>> from the range of the data).
>>
>
> I don't understand--what you say you want to do is exactly what the 
> norm is designed for. Maybe the problem is that you can't pass in a 
> simple function--you need to subclass colors.Normalize. An example is 
> colors.LogNorm.
>
> It looks like what we need is a FuncNorm, which would be initialized 
> with two functions, the forward and inverse transformation functions, 
> each taking vmin, vmax, and a val.
>
> Eric
>
From: Eric F. <ef...@ha...> - 2009年09月30日 19:52:41
Dr. Phillip M. Feldman wrote:
> I'd like to generate a scatter plot in which symbols are colored using a
> specified colormap, with a specified mapping from the range of the data to
> the [0,1] colormap interval. I thought at first that one could use the norm
> argument to specify a function that would perform this mapping, but from
> closer reading of the documentation (and experimentation) it seems as though
> one cannot do this. Is there another mechanism for doing this? (I could
> remap the data itself before plotting it, but this is unacceptable because
> the colorbar tic lables would then take values in [0,1] rather than values
> from the range of the data).
> 
I don't understand--what you say you want to do is exactly what the norm 
is designed for. Maybe the problem is that you can't pass in a simple 
function--you need to subclass colors.Normalize. An example is 
colors.LogNorm.
It looks like what we need is a FuncNorm, which would be initialized 
with two functions, the forward and inverse transformation functions, 
each taking vmin, vmax, and a val.
Eric
From: Dr. P. M. F. <pfe...@ve...> - 2009年09月30日 19:28:42
I'd like to generate a scatter plot in which symbols are colored using a
specified colormap, with a specified mapping from the range of the data to
the [0,1] colormap interval. I thought at first that one could use the norm
argument to specify a function that would perform this mapping, but from
closer reading of the documentation (and experimentation) it seems as though
one cannot do this. Is there another mechanism for doing this? (I could
remap the data itself before plotting it, but this is unacceptable because
the colorbar tic lables would then take values in [0,1] rather than values
from the range of the data).
-- 
View this message in context: http://www.nabble.com/problem-with-design-of-matplotlib.pyplot.scatter--tp25687299p25687299.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Michael D. <md...@st...> - 2009年09月30日 17:33:29
You can use the twinx/twiny methods to join two axes after they've been 
created.
I don't think we currently provide a way to unjoin the subplots (either 
in the axes or in the Grouper class itself.) I think that's 
functionality we would need to add. If you can be so kind as to add a 
feature request to the tracker, it won't get lost.
Mike
TP wrote:
> Michael Droettboom wrote:
>
> 
>> Yes -- I'll update the docstring. The weakref support was added
>> afterward during one of my many memory leak crusades ;)
>>
>> What were you attempting to do with the Grouper? You shouldn't have to
>> use the class directly to use the sharex/sharey functionality -- it's
>> only an implementation detail.
>> 
>
> I have not found any way to share an axis after the creation of the
> subplot/axis. That is why I use the "join" method of a Grouper after the
> subplot/axis has been created. But I would need also a means to "unjoin"
> the subplots. Is it possible?
>
> Thanks
>
> Julien
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Jae-Joon L. <lee...@gm...> - 2009年09月30日 16:42:16
Can you just reuse the ax1 for plotting? I guess that might be the easiest way.
With imshow, the location of ax1 is determined at the drawing time,
therefore you need a way to adjust the location of ax2 after this
happens. Doing this manually requires some internal knowledge of mpl.
If you use 0.99 and later, you can use axes_grid toolkits. Here is an
example code.
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.inset_locator import inset_axes
fig = plt.figure(1, [5.5, 3])
ax = fig.add_subplot(1,1,1)
ax.set_aspect(1.)
axins1 = inset_axes(ax, width="100%", height="20%",
 loc=3, borderpad=0,
 axes_kwargs=dict(frameon=False)
 )
axins1.xaxis.set_visible(False)
axins1.yaxis.set_visible(False)
axins1.plot([0, 0.5, 1], [0,1,0])
plt.show()
See here for more details.
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html
One thing to note, the current design of mpl does not allow you to
share axis when aspect is set(i.e., w/ imshow) (or you have to have
adjustable="datalim"), although there is a way to do it with
axes_grid.
Regards,
-JJ
On Wed, Sep 30, 2009 at 1:50 AM, rafa5 <rap...@ya...> wrote:
>
> Hi guys,
>
> I'm having problems creating a plot. I attached a crude version that I drew
> with Gimp to show what I actually want to do with matplotlib
> http://www.nabble.com/file/p25667058/example2.png example2.png . Basically
> it boils down to placing an axes instance on top of an existing axes with an
> imshow already on it. In the end I would like to have a kind of lineout of
> the values of the array of the imshow along an x=constant & y=constant line.
> So my pathetic (and unsuccesful attempt) is something like:
>
> import matplotlib.pyplot as p
> fig = p.figure(1)
>
> ax1_box = [0.1, 0.1, 0.5, 0.5]
> ax2_box = [0.1, 0.1, 0.5, 0.1]
>
> ax1 = fig.add_axes( ax1_box )
> ax1.imshow(data)
>
> ax2 = fig.add_axes( ax2_box, frameon=False)
> ax2.plot( data[5 , :] )               #lineout of 6th row for
> example
> p.setp(ax2b, xticks=[], yticks=[])
>
>
> My problems:
> as I don't want to add axis labels ax2 data plot is wider than ax1 data
> plot.
> when i resize the window ax1 and ax2 move relative to another.
> I hope it's possible to also do the lineput along the vertical (y) axis.
> I'm too stupid to figure this out myself.
>
> Thanks a lot in advance for any suggestions :)
>
> Raphael
> --
> View this message in context: http://www.nabble.com/placing-a-plot-on-top-of-an-imshow-tp25667058p25667058.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry® Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9-12, 2009. Register now!
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Gewton J. <gj...@gm...> - 2009年09月30日 16:21:58
Hello everyone,
I wish a simple sample of creating a pie graph filled with a gradient from
blue(#98D0D8) to a lighter blue(#BAE5EB).
Here's the code (I got from the samples):
from pylab import *
# make a square figure and axes
figure(1, figsize=(6,6))
ax = axes([0.1, 0.1, 0.8, 0.8])
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
fracs = [15,30,45, 10]
explode=(0, 0.05, 0, 0)
pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True)
title('Raining Hogs and Dogs', bbox={'facecolor':'0.8', 'pad':5})
show()
Thanks.
On Tue, Sep 29, 2009 at 12:53 AM, Christopher Barrington-Leigh
<cpb...@gm...> wrote:
>
>
>
> Jae-Joon Lee wrote:
>>
>> Hmm, I'm afraid that this only works if you use preview mode. I
>> haven't tested, but I guess it will fail without it. Check if
>> rcParams["text.latex.preview"]==True.
>>
>
> Hm, I don't know about mpl's mathtext mode, but I'm actually always
> working in usetex mode. Unfortunately, even so,
> "text.latex.preview" does not exist in rcParams for me. However,... :
>
> I think the following behaviour is definitely
> buggy! Please try the following one at a time, in ion() mode (or just see
> sequence of png's produced). None of these succeeds in getting the desired
> alignment.
>
>
> from matplotlib import rc
>
> figure(1)
> clf()
> plot([0,0],[1,1])
>
> rc('text', usetex=True)
>
> text(xlim()[1],.96,r'$r^2$~~~\mbox{}',horizontalalignment='right')
> savefig('t10.png')
This works if you use recent version of matplotlib with preview mode
on. Without the preview mode (or other similar ways to report the
dimension of the text from TeX side), I don't think this can be done.
>
> rc('text', usetex=False)
> show()
> savefig('t20.png')
>
> text(xlim()[1],.97,r'$r^2$~~~\mbox{}',horizontalalignment='right')
> savefig('t30.png')
>
This does not. First of all, "~" and "\mbox" are not supported if
usetex=False and I guess never will be. On the other hand,
 as far as I can see, the whitespace stripping is not done in mpl
side. And I have a feeling that it may be the freetype library. mpl
uses FT_Glyph_Get_CBox to calculate the extents of the text and I
think this seems to fail when there is a trailing spaces. This is
beyond me I hope other developers have better idea.
So, Christopher,
I guess your best chance is to upgrade and use preview mode, or use
annotate function.
Regards,
-JJ
> rc('text', usetex=True)
>
> show()
> savefig('t40.png')
>
> --
> View this message in context: http://www.nabble.com/trailing-space-in-text-string-stripped%2C-making-it-impossible-to-right-pad-my-text-tp25639703p25656912.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: TP <par...@fr...> - 2009年09月30日 15:46:51
Michael Droettboom wrote:
> Yes -- I'll update the docstring. The weakref support was added
> afterward during one of my many memory leak crusades ;)
> 
> What were you attempting to do with the Grouper? You shouldn't have to
> use the class directly to use the sharex/sharey functionality -- it's
> only an implementation detail.
I have not found any way to share an axis after the creation of the
subplot/axis. That is why I use the "join" method of a Grouper after the
subplot/axis has been created. But I would need also a means to "unjoin"
the subplots. Is it possible?
Thanks
Julien
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"
"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)
From: Jouni K. S. <jk...@ik...> - 2009年09月30日 15:01:45
Marco Cabizza <ma...@gm...> writes:
>> \
>> u
>> s
>> e
Sounds like the value of your text.latex.preamble got interpreted as a
list of one-character strings and not a list of one longer string. What
exactly do you have in the rc file as the contents of tex.latex.*
variables in the file? What does 
matplotlib.rcParams['text.latex.preamble']
return? If you do
matplotlib.rcParams['text.latex.preamble'] = [r'\usepackage{lucidabr}']
does it start working?
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Marco C. <ma...@gm...> - 2009年09月30日 14:53:11
Il giorno 30 set 09, alle ore 15.13, Darren Dale ha scritto:
> all on one line:
> text.latex.preamble :
> \usepackage[T1]{fontenc},\usepackage{textcomp},\usepackage{lucidabr}
>
> You may need to clear your tex.cache as Jouni suggests.
	Here's what I get:
> \usepackage{courier}
>
> \
> u
> s
> e
> p
> a
> c
> k
> a
	Just until
> \usepackage[papersize={72in,72in}, body={70in,70in}, margin={1in, 
> 1in}]{geometry}
	Which looks fine.
~m
From: Michael D. <md...@st...> - 2009年09月30日 14:09:18
David Cournapeau wrote:
>
> It ended up a confusion between the distutils build and the new scons
> scripts I was working on, sorry for the noise.
>
> The good news is that matplotlib can now be built with numscons, with
> all scons goodies :)
> 
Please share! :) What steps are required to do this? I wonder if 
would get around this long-standing problem with distutils not selecting 
a C++ compiler that prevents us from using the Solaris compilers:
http://bugs.python.org/issue1222585
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Michael D. <md...@st...> - 2009年09月30日 13:25:43
Yes -- I'll update the docstring. The weakref support was added 
afterward during one of my many memory leak crusades ;)
What were you attempting to do with the Grouper? You shouldn't have to 
use the class directly to use the sharex/sharey functionality -- it's 
only an implementation detail.
Mike
Eric Firing wrote:
> TP wrote:
> 
>> Hi everybody,
>>
>> I try to play with "sharex" feature. Then, I have been guided to the
>> class "Grouper" of module cbook:
>>
>> http://matplotlib.sourceforge.net/api/cbook_api.html
>>
>> So I tried the following example:
>>
>> ##############################
>> from matplotlib.cbook import *
>>
>> g = Grouper()
>> g.join('a', 'b')
>> ##############################
>>
>> I obtain:
>>
>> Traceback (most recent call last):
>> File "test_grouper.py", line 4, in <module>
>> g.join('a', 'b')
>> File ".../matplotlib/cbook.py", line 1118, in join
>> set_a = mapping.setdefault(ref(a), [ref(a)])
>> TypeError: cannot create weak reference to 'str' object
>>
>> What is the problem?
>> 
>
> Grouper is implemented using weak references, which are supported only 
> for some types of objects, as described here:
> http://docs.python.org/library/weakref.html
>
> Evidently the cbook Grouper docstring was written when the 
> implementation was different, and did not use weakref. So, you have 
> found a major bug in the docstring.
>
> Eric
>
> 
>> Thanks in advance,
>>
>> Julien
>>
>> 
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> 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: Darren D. <dsd...@gm...> - 2009年09月30日 13:13:45
On Wed, Sep 30, 2009 at 7:52 AM, Marco Cabizza <ma...@gm...> wrote:
> Il giorno 30 set 09, alle ore 13.25, Darren Dale ha scritto:
>>
>> Probably setting the preamble in rc is your best option. I added the
>> note that it is not supported not because it is broken, but because I
>> don't want the mpl mailing lists to turn into a latex support forum.
>
>    The point is that when i put \usepackage{lucidabr} it complains about
> a missing \begin{document}. Does the text.latex.preamble variable replace
> the whole LaTeX preamble ?
No. Have you looked at texmanager.py? It injects the contents of the
preamble after the default font settings and before \begin{document},
see make_tex. I don't have lucidabr.sty on my system so I cant test
it, but I think you should be able to set a string list in rcparams:
all on one line:
text.latex.preamble :
\usepackage[T1]{fontenc},\usepackage{textcomp},\usepackage{lucidabr}
You may need to clear your tex.cache as Jouni suggests.
Daren
From: Jouni K. S. <jk...@ik...> - 2009年09月30日 13:06:17
Marco Cabizza <ma...@gm...> writes:
> 	The point is that when i put \usepackage{lucidabr} it complains about 
> a missing \begin{document}. Does the text.latex.preamble variable 
> replace the whole LaTeX preamble ?
No, it shouldn't do that. Run rm ~/.matplotlibrc/tex.cache/*, then run
your script once, and take a look at the tex file created in the
tex.cache directory. Can LaTeX compile it directly?
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Marco C. <ma...@gm...> - 2009年09月30日 11:53:40
Il giorno 30 set 09, alle ore 13.25, Darren Dale ha scritto:
> Probably setting the preamble in rc is your best option. I added the
> note that it is not supported not because it is broken, but because I
> don't want the mpl mailing lists to turn into a latex support forum.
	The point is that when i put \usepackage{lucidabr} it complains about 
a missing \begin{document}. Does the text.latex.preamble variable 
replace the whole LaTeX preamble ?
Ciao
~m
From: Darren D. <dsd...@gm...> - 2009年09月30日 11:25:57
On Tue, Sep 29, 2009 at 3:28 PM, Marco Cabizza <ma...@gm...> wrote:
> Hello,
>
>    I'm writing my thesis with the Lucida Bright font ( provided by the
> lucidabr package ) and I can't seem to get properly rendered fonts in
> any Matplotlib eps file. Setting the preamble with the rc variable
> doesn't look like a good idea, I even tried adding lucidabr to
> texmanager.py but I keep getting Computer Modern text.
>
>    Any ideas ?
>
> Ciao
> ~m
>
> P.S.: the TeX preamble for lucidabr should be:
>
> \usepackage[T1]{fontenc}
> \usepackage{textcomp}
> \usepackage{lucidabr}
Probably setting the preamble in rc is your best option. I added the
note that it is not supported not because it is broken, but because I
don't want the mpl mailing lists to turn into a latex support forum.
Darren
From: Ralph K. <ral...@go...> - 2009年09月30日 10:12:35
Hey Eric,
> 
> The colorbar method or pyplot function optionally resizes the image axes 
> and uses the liberated space to make an axes for itself. For your 
> application, you don't want to use this option; you need to make the 
> axes object manually and use the cax kwarg to tell colorbar to use it. 
> Or you could generate it automatically the first time, and then reuse it 
> for all subsequent colorbar calls.
this is exactly what I worked out ;)
I create the first colorbar and save the axis object it plots itself in:
	self.colorbar = self.ui.widget.canvas.fig.colorbar(plt, ax = 
self.ui.widget.canvas.ax.get_axes())
Then I plot each new colorbar into that axes object by specifying the 
cax keyword via
	self.ui.widget.canvas.fig.colorbar(plt, cax = self.colorbar.ax)
Thank you for your help.
Cheers, Ralph
12 messages has been excluded from this view by a project administrator.

Showing results of 480

1 2 3 .. 20 > >> (Page 1 of 20)
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 によって変換されたページ (->オリジナル) /