Re: [Matplotlib-users] trailing space in text string stripped, making it impossible to right-pad my text

2009-09-30 Thread Jae-Joon Lee
On Wed, Sep 30, 2009 at 4:38 PM, Christopher Barrington-Leigh
 wrote:
>
>
> 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?
>
>

0.99.0 and later should work.

text.usetex : True
text.latex.preview : True

Include these in your rc file. While the preview.sty is installed in
most tex distribution, you may need to install it if not.

>
>
>> 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.

annotate let you specify offset from (x, y).

annotate("test", (1., 0.5), (-20, 0), xycoords='data',
 textcoords='offset points', ha="right")

Check the documentation.

Regards,

-JJ


>
> 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.
>
>
> --
> 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
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Is it possible to build matplotlib in place ?

2009-09-30 Thread David Cournapeau
Michael Droettboom wrote:
> 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!  :)

That's my intention, but github downtimes and anal firewall rules at my
university makes this challenging at the moment, unfortunately

David

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] scaling arrows in quiver

2009-09-30 Thread jason-sage
Eric Firing wrote:
> jason-s...@creativetrax.com wrote:
>> A couple of us are trying to figure out how to scale arrows in a 
>> quiver plot so that we can exactly specify what the output arrows 
>> look like.  For example, we'd like to scale the vectors to half of 
>> their size, and have it look like that on the quiver plot.
>>
>> So I tried even just getting a quiver plot to plot an arrow exactly 
>> as I passed it, without it scaling anything.  My attempt is this:
>>
>> import matplotlib.pylab as plt
>> fig=plt.figure(figsize=[6,6])
>> q=plt.quiver([0],[0],[1],[1],units='x',scale=1,angles='xy')
>
> I have committed a change to svn trunk, so that if you change the
> above to
>
> q = plt.quiver([0],[0], [1], [1], scale_units='xy', angles='xy', scale=1)
>
> it should do exactly what you want.  When scale_units is given, the 
> setting of "units" controls only the specification of the arrow width, 
> so if you are not specifying the width, it doesn't have any effect.
>
> If I could start from scratch, I probably could come up with a better 
> set of kwarg names and defaults; but for reasons of 
> backwards-compatibility, this is what we have.  The new scale_units 
> kwarg makes it much easier to manually set the scale.  Previously (and 
> still with the default of scale_units=None), it was almost hopelessly 
> confusing.
>
> (Maybe I should add "width_units", identical to "units", and deprecate 
> the latter; this might make the meanings of the kwargs clearer.)
>


Thanks!

Jason


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] scaling arrows in quiver

2009-09-30 Thread Eric Firing
jason-s...@creativetrax.com wrote:
> A couple of us are trying to figure out how to scale arrows in a quiver 
> plot so that we can exactly specify what the output arrows look like.  
> For example, we'd like to scale the vectors to half of their size, and 
> have it look like that on the quiver plot.
> 
> So I tried even just getting a quiver plot to plot an arrow exactly as I 
> passed it, without it scaling anything.  My attempt is this:
> 
> import matplotlib.pylab as plt
> fig=plt.figure(figsize=[6,6])
> q=plt.quiver([0],[0],[1],[1],units='x',scale=1,angles='xy')

I have committed a change to svn trunk, so that if you change the
above to

q = plt.quiver([0],[0], [1], [1], scale_units='xy', angles='xy', scale=1)

it should do exactly what you want.  When scale_units is given, the 
setting of "units" controls only the specification of the arrow width, 
so if you are not specifying the width, it doesn't have any effect.

If I could start from scratch, I probably could come up with a better 
set of kwarg names and defaults; but for reasons of 
backwards-compatibility, this is what we have.  The new scale_units 
kwarg makes it much easier to manually set the scale.  Previously (and 
still with the default of scale_units=None), it was almost hopelessly 
confusing.

(Maybe I should add "width_units", identical to "units", and deprecate 
the latter; this might make the meanings of the kwargs clearer.)

Eric

> ax=plt.axis([0,1.5,0,1.5])
> plt.grid(True)
> plt.savefig('test.png')
> 
> I'm trying to get the arrow to go from (0,0) to (1,1).  However, with 
> units='x', it's just short, and with units='y', it's just a bit too 
> long.  Furthermore, if I don't make the aspect ratio equal to one, I get 
> wild results since the x-axis and y-axis are different units then.  It 
> would be really nice if there was a way to say units='data' (for data 
> coordinates), and then if scale=1, the arrows would be drawn with the 
> heads and tails at exactly the passed points.  If scale=2, then each 
> arrow would be drawn exactly half of its length.  I realize that 
> units='data' might mess up the other measurements of an arrow, though, 
> so maybe another parameter is called for, like a scale_units, that 
> defaults to units.
> 
> What do people think?
> 
> Thanks,
> 
> Jason
> 
> 
> --
> 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
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Customize SHADOW

2009-09-30 Thread Jae-Joon Lee
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  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='#ff')
>> 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 > > 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® 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
>>         Matplotlib-users@lists.sourceforge.net
>>         
>>         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® 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 ma

Re: [Matplotlib-users] problem with design of matplotlib.pyplot.scatter?

2009-09-30 Thread Eric Firing

> - 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

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with design of matplotlib.pyplot.scatter?

2009-09-30 Thread Eric Firing
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
>>
> 


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Customize SHADOW

2009-09-30 Thread Michael Droettboom
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='#ff')
> 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  > 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® 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
> Matplotlib-users@lists.sourceforge.net
> 
> 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® 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] trailing space in text string stripped, making it impossible to right-pad my text

2009-09-30 Thread Christopher Barrington-Leigh


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.


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Customize SHADOW

2009-09-30 Thread Gewton Jhames
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='#ff')
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  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® 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
>> Matplotlib-users@lists.sourceforge.net
>> 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
>
>
--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Customize SHADOW

2009-09-30 Thread Michael Droettboom
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® 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
> Matplotlib-users@lists.sourceforge.net
> 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


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with design of matplotlib.pyplot.scatter?

2009-09-30 Thread Phillip M. Feldman
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
>


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with design of matplotlib.pyplot.scatter?

2009-09-30 Thread Eric Firing
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

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] problem with design of matplotlib.pyplot.scatter?

2009-09-30 Thread Dr. Phillip M. Feldman

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.


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Grouper use

2009-09-30 Thread Michael Droettboom
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


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] placing a plot on top of an imshow

2009-09-30 Thread Jae-Joon Lee
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  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
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Simple gradient

2009-09-30 Thread Gewton Jhames
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.
--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] trailing space in text string stripped, making it impossible to right-pad my text

2009-09-30 Thread Jae-Joon Lee
On Tue, Sep 29, 2009 at 12:53 AM, Christopher Barrington-Leigh
 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® 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
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Grouper use

2009-09-30 Thread TP
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)


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TeX and lucidabr

2009-09-30 Thread Jouni K . Seppänen
Marco Cabizza  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


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TeX and lucidabr

2009-09-30 Thread Marco Cabizza
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


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Is it possible to build matplotlib in place ?

2009-09-30 Thread Michael Droettboom
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


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Grouper use

2009-09-30 Thread Michael Droettboom
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 
>> 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® 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
> Matplotlib-users@lists.sourceforge.net
> 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


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TeX and lucidabr

2009-09-30 Thread Darren Dale
On Wed, Sep 30, 2009 at 7:52 AM, Marco Cabizza  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

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TeX and lucidabr

2009-09-30 Thread Jouni K . Seppänen
Marco Cabizza  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


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TeX and lucidabr

2009-09-30 Thread Marco Cabizza
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


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TeX and lucidabr

2009-09-30 Thread Darren Dale
On Tue, Sep 29, 2009 at 3:28 PM, Marco Cabizza  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

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Update a contour plot

2009-09-30 Thread Ralph Kube
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

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Subplots, multiple bar3d plots + titling

2009-09-30 Thread Reinier Heeres
Hi,

I will have a look at mplot3d sub-plots next weekend and try to fix
issues like this. I'll also add a working example.

Cheers,
Reinier

On Tue, Sep 29, 2009 at 5:05 PM, Jae-Joon Lee  wrote:
> Hmm, axes3d does not seem to support it currently. I hope Reinier or
> others confirm this.
> Anyhow, here is a quick workaround you may try.
>
>
> from matplotlib.axes import subplot_class_factory
>
> class MyAxes3D(Axes3D):
>    def _button_press(self, event):
>        if event.inaxes == self:
>            Axes3D._button_press(self, event)
>
>
> Subplot3D = subplot_class_factory(MyAxes3D)
>
> This makes rotate/zoom is effective only in the axes where the initial
> button-press event occurred.
>
> While I think it is reasonable to have Subplot3D and above fix in
> place, I'll defer this to Reinier or others who better know how Axes3D
> works.
>
> Regards,
>
> -JJ
>
>
> On Tue, Sep 29, 2009 at 6:22 AM,   wrote:
>> Thanks,
>>
>> that works like a charm.
>>
>> final bonus question: How can i individually set the point of view/zoom level
>> for the different 3d subplots?
>>
>> Currently, when i rotate/zoom (with the mouse) in one subplot, the changes
>> are applied on all 3d subplots.
>>
>> Thanks again,
>> q
>>
>> On Mon, Sep 28, 2009 at 11:52:08PM -0400, Jae-Joon Lee wrote:
>>> Try below instead of Axes3D. Obviously, "131" is the geometry
>>> parameter for subplot command. You don't need to add  "ax" to "fig"
>>> since Axes3D do that by itself.
>>>
>>> from matplotlib.axes import subplot_class_factory
>>> Subplot3D = subplot_class_factory(Axes3D)
>>>
>>> ax = Subplot3D(fig, 131)
>>>
>>> This will show you the title also. However, the 3d axes will occupy
>>> smaller area than the area of the subplot.
>>>
>>> Regards,
>>>
>>> -JJ
>>>
>>>
>>> On Mon, Sep 28, 2009 at 6:23 PM,   wrote:
>>> > Greetings,
>>> >
>>> > I would like to plot to make a figure with 3 subplots
>>> > of the form (221) to (223):
>>> >  - each subplot should show a bar3d plot of a matrix
>>> >  - each subplot should have it's own title
>>> >
>>> > The problems:
>>> >  a) I don't see (nor did i find something) how i can
>>> >    use subplots combined with bar3d (from the mpl_toolkits.mplot3d)
>>> >    package.
>>> >
>>> >  b) I don't manage to give the 3d bar plot a title. In the attached
>>> >    code you will see that a title is set, but it does not show
>>> >    up in the figure
>>> >
>>> > Could someone please help me out with these problems?
>>> >
>>> > Thanks,
>>> > q
>>> >
>>> > -
>>> >
>>> > The code for the basic plot of the matrix:
>>> >
>>> >
>>> > from mpl_toolkits.mplot3d import Axes3D
>>> > import matplotlib.pyplot as plt
>>> > from matplotlib.ticker import FixedFormatter, LinearLocator, FixedLocator
>>> > from numpy import *
>>> >
>>> > psi=1/sqrt(2)*array([1, 0, 0, 1])
>>> > rho=outer(psi,psi)
>>> >
>>> > fig = plt.figure()
>>> >
>>> > ax = Axes3D(fig)
>>> >
>>> > elements = (len(rho) * len(rho))
>>> > xpos, ypos = meshgrid(array(range(len(rho)))+0.25, 
>>> > array(range(len(rho)))+0.25)
>>> >
>>> > xpos = xpos.flatten()
>>> > ypos = ypos.flatten()
>>> > zpos = zeros(elements)
>>> >
>>> > dx = 0.5 * ones_like(zpos)
>>> > dy = dx.copy()
>>> > dz = absolute(rho.flatten())
>>> >
>>> > ax.set_title('absolute')
>>> >
>>> > ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='#F8F800')
>>> >
>>> > plt.show()
>>> >
>>> >
>>> >
>>> > --
>>> > 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
>>> > Matplotlib-users@lists.sourceforge.net
>>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>> >
>>
>> --
>> The king who needs to remind his people of his rank, is no king.
>>
>> To gain that which is worth having, it may be necessary to lose everything 
>> else.
>>
>
> --
> 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
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>



-- 
Reinier Heeres
Tel: +31 6 10852639

--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need t

Re: [Matplotlib-users] Is it possible to build matplotlib in place ?

2009-09-30 Thread David Cournapeau
Hi Sandro,

(sorry for the private reply)

Sandro Tosi wrote:
> Hi David,
>
> On Wed, Sep 30, 2009 at 07:48, David Cournapeau
>  wrote:
>   
>> Hi,
>>
>>I tried to build matplotlib in place (setup.py build_ext -i), and
>> found out that I could not import it:
>> 
>
> yes, you should be able to build it in-place (even if usually run
> 'python setup.py build' because I need the full package be available
> in build/ ) even from the unpacked tarball or from svn
> trunk.
>
>   
>>  matplotlib/rcsetup.py:117: UserWarning: rcParams key "numerix" is
>> obsolete and has no effect;
>>  please delete it from your matplotlibrc file
>>  warnings.warn('rcParams key "numerix" is obsolete and has no effect;\n'
>> Traceback (most recent call last):
>>  File "", line 1, in 
>>  File "pylab.py", line 1, in 
>>from matplotlib.pylab import *
>>  File "matplotlib/pylab.py", line 206, in 
>>from matplotlib import mpl  # pulls in most modules
>>  File "matplotlib/mpl.py", line 2, in 
>>from matplotlib import axis
>>  File "matplotlib/axis.py", line 10, in 
>>import matplotlib.font_manager as font_manager
>>  File "matplotlib/font_manager.py", line 52, in 
>>from matplotlib import ft2font
>> ImportError: matplotlib/ft2font.so: undefined symbol: py_object_initializer
>> 
>
> what version are you using? 0.99.1.1, svn trunk, other?
>   

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 :)

David

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] ipython and figs with mplot3d

2009-09-30 Thread Reinier Heeres
Hi,

On Wed, Sep 30, 2009 at 8:44 AM, dave martin  wrote:
> hi
> i've just upgraded to 0.99, and trying out mplot3d for the first time -
> wondering if a few things are standard behaviour or not. any example i
> choose from the standard bunch will work fine with "%run ***" in
> ipython, but once the figure is drawn and closed, i no longer have the
> ability to plt.show().

This sounds like expected behavior to me; plot() is only supposed to
be called once to draw all the figures that have been generated up to
that point.

> also, if i don't %run anything, but try and work my way through
> interactively by ipython (with "-pylab") commands, no axes can be
> generated (Axes3D imported) with "ax=Axes3D(fig)" - just nothing
> happens in the figure brought up previously by "fig=plt.figure()".

Strange, but I indeed see the same behavior here; I'll look into it!

> if i start ipython without "-pylab", it works - sort of.  running
> step-wise through the example will work fine, though i lose the ipython
> command line while the figure is open.  when it's closed, though, i
> can't get another figure to display at all - sort of like the first
> problem i mentioned not being able to plt.show() again in the same
> interactive session.

Again, this is expected behavior.

> so, is this normal?

Concluding: partly yes, partly no, thanks for reporting!

Regards,
Reinier

>
> thanks


-- 
Reinier Heeres
Tel: +31 6 10852639

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] ipython and figs with mplot3d

2009-09-30 Thread dave martin
hi
i've just upgraded to 0.99, and trying out mplot3d for the first time -
wondering if a few things are standard behaviour or not. any example i
choose from the standard bunch will work fine with "%run ***" in
ipython, but once the figure is drawn and closed, i no longer have the
ability to plt.show().

also, if i don't %run anything, but try and work my way through
interactively by ipython (with "-pylab") commands, no axes can be
generated (Axes3D imported) with "ax=Axes3D(fig)" - just nothing
happens in the figure brought up previously by "fig=plt.figure()".

if i start ipython without "-pylab", it works - sort of.  running
step-wise through the example will work fine, though i lose the ipython
command line while the figure is open.  when it's closed, though, i
can't get another figure to display at all - sort of like the first
problem i mentioned not being able to plt.show() again in the same
interactive session.

so, is this normal?

thanks



--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users