[Matplotlib-users] interrupted line with maskedarray (normal behavior ?)

2008-02-10 Thread David Trémouilles

Hi,

 I've just start playing with maskedarray (the new implementation) 
using fresh svn matplotib (0_91 maintenance).

Plotting masked array does not behave as I would have expected.
Indeed when drawing a line graph the masked walues interrupted the 
line (see attach example). I would prefer to see a continues line...

Is it the expected behavior? Is there a way to change it?

Thanks in advance,

David
import pylab
import maskedarray as ma

x = ma.arange(10)
y = ma.sin(x/10.0)

y[2]=ma.masked

pylab.plot(x,y,'-o')
pylab.show()
inline: interupt.png-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] interrupted line with maskedarray (normal behavior ?)

2008-02-10 Thread Jeff Whitaker
David Trémouilles wrote:
 Hi,

  I've just start playing with maskedarray (the new implementation) 
 using fresh svn matplotib (0_91 maintenance).
 Plotting masked array does not behave as I would have expected.
 Indeed when drawing a line graph the masked walues interrupted the 
 line (see attach example).

David:  Yes, this is the correct behavior.  The masked values are 
treated as missing data.  No attempt is made to fill, or interpolate, 
the missing data.
 I would prefer to see a continues line...

Then you should interpolate the missing values yourself.  I think it 
would be unwise for matplotlib to guess how you might want to do that.

-Jeff
 Is it the expected behavior? Is there a way to change it?

 Thanks in advance,

 David
 

 

 -
 This SF.net email is sponsored by: Microsoft
 Defy all challenges. Microsoft(R) Visual Studio 2008.
 http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
 

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC  R/PSD1FAX   : (303)497-6449
325 BroadwayBoulder, CO, USA 80305-3328


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] scatter plot onto background image

2008-02-10 Thread John Hunter
On Feb 10, 2008 9:43 AM, John Hunter [EMAIL PROTECTED] wrote:

  I want to create a scatter plot onto a background image. Anybody could help
  me?Thank you!

 The mri_demo.py example in the matplotlib/examples in the src
 distribution illustrates this.

Sorry -- wrong example.  The example I was thinking of is
examples/image_demo2.py, also at

http://matplotlib.sf.net/examples/image_demo2.py

but if you want to run it you will need to get the matplotlib src
directory which also has the data file for the CT image

JDH

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] interrupted line with maskedarray (normal behavior ?)

2008-02-10 Thread David Trémouilles
Thanks Jeff, I think now I get the purpose of maskedearray the way it is 
used in matplotlib.

I have a slightly different objective: I just want to remove outliers 
from my curves. I think I will still play with maskedarray and used the 
compressed() function before 'sending' to matplotlib.
Any comments on that, any other idea?

Thanks,

David

Jeff Whitaker a écrit :
 David Trémouilles wrote:
 Hi,

  I've just start playing with maskedarray (the new implementation) 
 using fresh svn matplotib (0_91 maintenance).
 Plotting masked array does not behave as I would have expected.
 Indeed when drawing a line graph the masked walues interrupted the 
 line (see attach example).
 
 David:  Yes, this is the correct behavior.  The masked values are 
 treated as missing data.  No attempt is made to fill, or interpolate, 
 the missing data.
 I would prefer to see a continues line...
 
 Then you should interpolate the missing values yourself.  I think it 
 would be unwise for matplotlib to guess how you might want to do that.
 
 -Jeff
 Is it the expected behavior? Is there a way to change it?

 Thanks in advance,

 David
 

 

 -
 This SF.net email is sponsored by: Microsoft
 Defy all challenges. Microsoft(R) Visual Studio 2008.
 http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
 

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] interrupted line with maskedarray (normal behavior ?)

2008-02-10 Thread Pierre GM
On Sunday 10 February 2008 12:40:38 David Trémouilles wrote:

 I have a slightly different objective: I just want to remove outliers
 from my curves. I think I will still play with maskedarray and used the
 compressed() function before 'sending' to matplotlib.
 Any comments on that, any other idea?

So, you have two arrays x and y, with missing values in y that you don't want 
to plot ?
Assuming that your arrays are 1D, you can try something like:
plot(x[logical_not(y.mask)], y.compressed())
in order to ensure that the x and y to be plotted have the same size.

Note that in this simple case, you don't need masked arrays, you just want to 
plot point satisfying a given condition, right ?
So:
condition = (y=min_value)  (y= max_value)
plot(x[condition],y[condition])
will give the same results.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] interrupted line with maskedarray (normal behavior ?)

2008-02-10 Thread David Trémouilles
Thank you very much Pierre!
You made me discover boolean index (numpy is fantastic !)
In the mean time, I now understand the purpose of maskedarray that I 
totally missed at a first sight.

Thanks to all of you,

David

Pierre GM a écrit :
 On Sunday 10 February 2008 12:40:38 David Trémouilles wrote:
 
 I have a slightly different objective: I just want to remove outliers
 from my curves. I think I will still play with maskedarray and used the
 compressed() function before 'sending' to matplotlib.
 Any comments on that, any other idea?
 
 So, you have two arrays x and y, with missing values in y that you don't want 
 to plot ?
 Assuming that your arrays are 1D, you can try something like:
 plot(x[logical_not(y.mask)], y.compressed())
 in order to ensure that the x and y to be plotted have the same size.
 
 Note that in this simple case, you don't need masked arrays, you just want to 
 plot point satisfying a given condition, right ?
 So:
 condition = (y=min_value)  (y= max_value)
 plot(x[condition],y[condition])
 will give the same results.
 
 -
 This SF.net email is sponsored by: Microsoft
 Defy all challenges. Microsoft(R) Visual Studio 2008.
 http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] interrupted line with maskedarray (normal behavior ?)

2008-02-10 Thread Pierre GM
On Sunday 10 February 2008 13:23:13 David Trémouilles wrote:
 Thank you very much Pierre!
 You made me discover boolean index (numpy is fantastic !)
 In the mean time, I now understand the purpose of maskedarray that I
 totally missed at a first sight.

You're quite welcome. Masked arrays are great when you need a way to flag 
invalid or missing data. For simpler cases, boolean indexing can be faster 
and easier to understand.
And now, for a shameless plug: if you work with series indexed with time, you 
might be interested in the timeseries package (available as a scikit in 
http://svn.scipy.org/svn/scikits/trunk/timeseries/). The package relies on 
the new numpy.ma package.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] font

2008-02-10 Thread chuckwhite8
I would like to be able to use Cambria font  
(http://en.wikipedia.org/wiki/Cambria_(typeface)) for all text on my charts. 

I am adding these charts to a MS Word 2007 document written in the same font.

I tried to add Cambria as the fist string in rcsetup.py | defaultParams | 
'font.serif'.  That didn't work.  Can I use this font for the charts?


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] interrupted line with maskedarray (normal behavior ?)

2008-02-10 Thread Alan G Isaac
On Sun, 10 Feb 2008, David Trémouilles apparently wrote:
 I have a slightly different objective: I just want to 
 remove outliers 

Do you just want to filter out the outliers?

newdata = [datum for datum in data if not isoutlier(datum)]

You can define ``isoutlier`` to return True for outliers
in your data.

Apologies if this proves OT.

fwiw,
Alan Isaac




-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] searchable text chart format

2008-02-10 Thread chuckwhite8
The following script creates a chart in pdf format. All the text on the chart 
is searchable. I need to create a chart which will be put in a MS Word 2007 
document (as part of a much larger document) and then converted to a Pdf.  
Which format should my chart be and which backend should I use? Thus far, I 
have been using Agg and putting in pngs...the quality is great but they are not 
searchable! Thanks.

=
import matplotlib as ML
ML.use('Pdf')
import pylab as PL

fig = PL.figure()
ax1 = fig.add_subplot(111)

lstX = range(1,100)
lstY = map(lambda x:PL.sin(x/PL.pi),lstX)
ax1.plot(lstX, lstY, color=(0.87,0.0,0.0), lw=2, alpha=0.6)
ax1.set_ylabel('control of line styles, font properties, axes properties')
ax1.set_xlabel('trys to make easy things easy and hard things')

ax1.set_title('python 2D plotting library which produces', weight='bold', 
size='large')
fig.savefig('out', dpi=72)
=


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users