Eric Firing | 1 Oct 04:44
Favicon
Gravatar

Re: scaling arrows in quiver

jason-sage@... 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 
(Continue reading)

jason | 1 Oct 06:04

Re: scaling arrows in quiver

Eric Firing wrote:
> jason-sage@... 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.
>
(Continue reading)

David Cournapeau | 1 Oct 06:04
Picon
Picon

Re: Is it possible to build matplotlib in place ?

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
Jae-Joon Lee | 1 Oct 06:28
Picon
Gravatar

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

On Wed, Sep 30, 2009 at 4:38 PM, Christopher Barrington-Leigh
<cpblpublic+nabble <at> gmail.com> 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,
(Continue reading)

Matthias Michler | 1 Oct 09:17
Picon

Re: mplot3d: plot_surface() and contour on grid?

Hello list,

I'm not an expert in axes3d, but in case the feature which Nicolas requested 
is not possible in an easy manner up to now, I propose an additional kwarg 
for axes3d.Axes3D.contour. Something like *offset*. If offset is None the 
z-values of the contour lines corresponds to given Z and otherwise offset is 
used for the z-values of the contour lines.
I attached a changed axes3d.py and a patch against current svn. The result is 
illustrated in the contour3d_demo.png.

Could any of the experts have a look at it and tell me if this could be 
useful, please?

Thanks in advance for any comments.

Kind regards
Matthias 

On Wednesday 30 September 2009 19:22:42 Nicolas Bigaouette wrote:
> Hi,
> I have a nice plot_surface() using mplot3d (see attachement).
>
> I'd like to project the surface on the axis xoy, xoz and yoz with a
> contour, similar to this figure:
> http://homepages.ulb.ac.be/~dgonze/INFO/matlab/fig19.jpg
>
> Is it possible using matplotlib and mplot3d?
>
> Thanx!

(Continue reading)

TP | 1 Oct 11:16
Picon
Favicon

Re: Grouper use

Michael Droettboom wrote:

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

It is done!
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&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
(Continue reading)

Cédrick FAURY | 1 Oct 15:42
Picon

Printing in wx : a solution ?

Hello,

Printing in wx (with "printing_in_wx.py" from mpl examples) doesn't work on all pc (windows) I have tested.
A crash occur as described in the thread Printing in wx

The only solution I found is to comment the line 2155 in backend_wx.py ("self.canvas.figure.draw(renderer)")
The inconvenience is that the scale of the figure change on screen (during a short moment).

I hope it could help someone ...

Cédrick

------------------------------------------------------------------------------
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
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Gewton Jhames | 1 Oct 15:13
Picon

Re: Customize SHADOW

OK, yesterday I was taking a look to the patch module. then, I went home.
Today, I'll continue to look at these properties of alpha. because, yes, that's what's happening. one have alpha .5 and the other, 1.
Answering Mike's question: the first system (the one I've wrote the code) is ubuntu 9.04, the other (with a newer version) is ubuntu server 8.04 LTS.Doesn't make any difference.

On Thu, Oct 1, 2009 at 9:37 AM, Michael Droettboom <mdroe-PfB3aINIHTeHXe+LvDLADg@public.gmane.org> wrote:
Yeah, alpha handling is a bit of a mess -- it should probably be revamped in light of the fact that most places now accept rgba.  We just need to decide if there is a good solution that doesn't break backward compatibility, or whether we should just break compatibility (e.g. remove set/get_alpha) moving forward.

As for the current problem, I'll add a set_alpha call to the Shadow class.

Mike


Jae-Joon Lee wrote:
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 <mdroe-PfB3aINIHTeHXe+LvDLADg@public.gmane.org> 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 <mdroe-PfB3aINIHTeHXe+LvDLADg@public.gmane.org
<mailto:mdroe <at> stsci.edu>> 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
       Matplotlib-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
       <mailto:Matplotlib-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
       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
Matplotlib-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
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&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
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Michael Droettboom | 1 Oct 15:02

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

Christopher Barrington-Leigh wrote:
>> 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!
>   
>
The calculation of the text bounding box was only taking into account 
the outlines of the text -- and spaces don't have any outlines.  I have 
updated this to also take into account the x-advance of each character, 
so it now works as expected.  As this has the potential to break things, 
I did this on the trunk, not the maintenance branch, so it will make it 
into the next major release, not the next bugfix release.

The patch can be found here, if you wish to apply it locally:

http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/src/ft2font.cpp?r1=7635&r2=7838

Cheers,
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&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
Michael Droettboom | 1 Oct 14:37

Re: Customize SHADOW

Yeah, alpha handling is a bit of a mess -- it should probably be 
revamped in light of the fact that most places now accept rgba.  We just 
need to decide if there is a good solution that doesn't break backward 
compatibility, or whether we should just break compatibility (e.g. 
remove set/get_alpha) moving forward.

As for the current problem, I'll add a set_alpha call to the Shadow class.

Mike

Jae-Joon Lee wrote:
> 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 <mdroe@...> 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 <mdroe@...
>>> <mailto:mdroe@...>> 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
>>>         Matplotlib-users@...
>>>         <mailto:Matplotlib-users@...>
>>>         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
>> Matplotlib-users@...
>> 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&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

Gmane