Re: [Matplotlib-users] Latex equations and SVG export

2007-07-10 Thread Edin Salkovic
On 7/7/07, Edin Salkovic <[EMAIL PROTECTED]> wrote:
> On 7/6/07, Kaushik Ghose <[EMAIL PROTECTED]> wrote:
> > Hi Edin,
(...)
> > Actually the original string renders as desired. Its the svg save that
> > causes the problem.
> >
> > I gather this is due to incomplete implementation of svg export.
> >
> > thanks!
> > -Kaushik
>
> Sorry, I see the problem now.  Unfortunately I wont have the resources
> to investigate into this this weekend.  It's past midnight here, and
> tomorrow early I have to travel.
>
> Best,
> Edin
>

I looked into this.  You just have to install (copy) the BaKoMa fonts
(TrueType version of the Computer Modern fonts) into your system's
font dir, so the svg viewer can see them.  These fonts are located in
the "matplotlib/mpl-data/fonts/ttf" dir (the cm*.ttf files).

HTH,
Edin

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Latex equations and SVG export

2007-07-10 Thread Kaushik Ghose

>
> I looked into this.  You just have to install (copy) the BaKoMa fonts
> (TrueType version of the Computer Modern fonts) into your system's
> font dir, so the svg viewer can see them.  These fonts are located in
> the "matplotlib/mpl-data/fonts/ttf" dir (the cm*.ttf files).
>


Thanks Edin! Yes, that worked! There is still an issue with sub/super 
scripts though. They are inverted i.e. superscripts become subscripts. 
I'm attaching an example, created using


m.text(0 ,0 ,'$\sum_{n=1}^{100} = 99^5 * q_i + 
\delta$');m.axis('off');m.savefig('eraseme.svg')


thanks!
-Kaushik


<>-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Latex equations and SVG export

2007-07-10 Thread John Hunter
On 7/10/07, Kaushik Ghose <[EMAIL PROTECTED]> wrote:
>  >
>  > I looked into this.  You just have to install (copy) the BaKoMa fonts
>  > (TrueType version of the Computer Modern fonts) into your system's
>  > font dir, so the svg viewer can see them.  These fonts are located in
>  > the "matplotlib/mpl-data/fonts/ttf" dir (the cm*.ttf files).
>  >
>
>
> Thanks Edin! Yes, that worked! There is still an issue with sub/super
> scripts though. They are inverted i.e. superscripts become subscripts.
> I'm attaching an example, created using

Hey Edin, if you get a minute, could you contribute a patch against
the faq in htdocs/faq.html.template explaining how to install the
bakoma fonts for svg viewers?  Is this sufficiently difficult that it
merits a FAQ?

JDH

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Font problem saving [e]ps

2007-07-10 Thread Giorgio F. Gilestro
Well I did fix it myself in the meanwhile. I must say I don't like
working with the CVS because I am planning to release the application
I am writing and I need to guarantee a minimal version of the packages
that the end user should eventually install without caring too much
about the CVS.

Thank you anyway.
Giorgio


On 7/7/07, Jouni K. Seppänen <[EMAIL PROTECTED]> wrote:
> > Another bug, though, comes with backend_pdf.py
> > The function embedPDF in the class PdfFile has a call to
> > encodings.cp1252.decoding_map[charcode]
>
> I believe this was fixed by Michael Droettboom in svn revision 3450.
> You can apply the patch to your copy if you don't want to use
> in-development versions:
>
>
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
> -
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Latex equations and SVG export

2007-07-10 Thread Edin Salkovic
On 7/10/07, Kaushik Ghose <[EMAIL PROTECTED]> wrote:
> Thanks Edin! Yes, that worked!

You're welcome!

> There is still an issue with sub/super
> scripts though. They are inverted i.e. superscripts become subscripts.
> I'm attaching an example, created using
>
> m.text(0 ,0 ,'$\sum_{n=1}^{100} = 99^5 * q_i +
> \delta$');m.axis('off');m.savefig('eraseme.svg')

Hmm.   I'm not sure whether this is a problem with matplotlib or
inkscape.  I had some weird problems with inkscape on Ubuntu Feisty
recently, like: when I open the file from Nautilus (right click->open
with Inkscape) it is completely turned around; when I open Inkscape
(blank file), and open the file from within inkscape everything is
displayed correctly.

Have you opened the file in other viewers?

Is anyone else having the same problem?

Cheers,
Edin

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Text line spacing control

2007-07-10 Thread Jianfu Pan
Hi,

I use Text() call of Figure() object for writing text.  Because my text is 
long, I use line breaker (\n) to write multiple lines with a single 
call.  This works fine except the line spacing is really tight and I wish I 
could set a bigger line spacing.  Does anyone know if this is 
possible?  Thanks for your time.

Jianfu 

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Text line spacing control

2007-07-10 Thread John Hunter
On 7/10/07, Jianfu Pan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I use Text() call of Figure() object for writing text.  Because my text is
> long, I use line breaker (\n) to write multiple lines with a single
> call.  This works fine except the line spacing is really tight and I wish I
> could set a bigger line spacing.  Does anyone know if this is
> possible?  Thanks for your time.

Currently not, the pad between the newline is hard coded, but we could
expose it as a parameter w/o too much work.

JDH

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Latex equations and SVG export

2007-07-10 Thread Kaushik Ghose
Hi Edin,

> Hmm.   I'm not sure whether this is a problem with matplotlib or
> inkscape.  I had some weird problems with inkscape on Ubuntu Feisty
> recently, like: when I open the file from Nautilus (right click->open
> with Inkscape) it is completely turned around; when I open Inkscape
> (blank file), and open the file from within inkscape everything is
> displayed correctly.
> 
> Have you opened the file in other viewers?
> 
Good point. I tried just now on Firefox and got the same error.
For an image of what I mean see this 
http://python-pieces.blogspot.com/2007/07/latex-and-svg-export.html


I'm attaching the svg output here in case someone wants to try it out:


http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>

http://www.w3.org/2000/svg";
xmlns:xlink="http://www.w3.org/1999/xlink";
version="1.1"
id="svg1">




1
=
n
i
±
+
q
¤
5
9
9
=
0
0
1
X





-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Text line spacing control

2007-07-10 Thread Jianfu Pan
John,

Thanks for your prompt response.  I think the option can be useful.  In my 
case, the gap between the lines are really tight with "_" in the first line 
right on the top of characters in the second line.

Regards,
Jianfu

At 12:31 PM 7/10/2007, John Hunter wrote:
>On 7/10/07, Jianfu Pan <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I use Text() call of Figure() object for writing text.  Because my text is
> > long, I use line breaker (\n) to write multiple lines with a single
> > call.  This works fine except the line spacing is really tight and I wish I
> > could set a bigger line spacing.  Does anyone know if this is
> > possible?  Thanks for your time.
>
>Currently not, the pad between the newline is hard coded, but we could
>expose it as a parameter w/o too much work.
>
>JDH
>
>-
>This SF.net email is sponsored by DB2 Express
>Download DB2 Express C - the FREE version of DB2 express and take
>control of your XML. No limits. Just data. Click to get it now.
>http://sourceforge.net/powerbar/db2/
>___
>Matplotlib-users mailing list
>Matplotlib-users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Text line spacing control

2007-07-10 Thread James Boyle
As a coincidence, just today I was trying to figure out how to  
increase the spacing between the lines in the title of my plot.
I too, would like some means to control this.

--Jim

On Jul 10, 2007, at 10:48 AM, Jianfu Pan wrote:

> John,
>
> Thanks for your prompt response.  I think the option can be  
> useful.  In my
> case, the gap between the lines are really tight with "_" in the  
> first line
> right on the top of characters in the second line.
>
> Regards,
> Jianfu
>
> At 12:31 PM 7/10/2007, John Hunter wrote:
>> On 7/10/07, Jianfu Pan <[EMAIL PROTECTED]> wrote:
>>> Hi,
>>>
>>> I use Text() call of Figure() object for writing text.  Because  
>>> my text is
>>> long, I use line breaker (\n) to write multiple lines with a single
>>> call.  This works fine except the line spacing is really tight  
>>> and I wish I
>>> could set a bigger line spacing.  Does anyone know if this is
>>> possible?  Thanks for your time.
>>
>> Currently not, the pad between the newline is hard coded, but we  
>> could
>> expose it as a parameter w/o too much work.
>>
>> JDH
>>
>> - 
>> 
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> -- 
> ---
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Text line spacing control

2007-07-10 Thread Eric Firing
John Hunter wrote:
> On 7/10/07, Jianfu Pan <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I use Text() call of Figure() object for writing text.  Because my text is
>> long, I use line breaker (\n) to write multiple lines with a single
>> call.  This works fine except the line spacing is really tight and I wish I
>> could set a bigger line spacing.  Does anyone know if this is
>> possible?  Thanks for your time.
> 
> Currently not, the pad between the newline is hard coded, but we could
> expose it as a parameter w/o too much work.

It looks to me like it is all in the text._get_layout() method, where a 
2-pixel pad is specified in one place, and an additional 3-pixel pad in 
another; both seem to be used for vertical spacing, so it is 5 pixels.

Certainly for line spacing, and probably in other places related to text 
positioning, I would think pads usually should be in fractions of the 
font size, not fixed numbers of pixels.  Comments?

Unless someone else would like to do it, I can take care of this at 
least as far as putting an rcParam entry for inter-line spacing as a 
fraction of font height, and a corresponding kwarg in Text and TextWithDash.

Eric


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Text line spacing control

2007-07-10 Thread John Hunter
On 7/10/07, Eric Firing <[EMAIL PROTECTED]> wrote:
> John Hunter wrote:

> It looks to me like it is all in the text._get_layout() method, where a
> 2-pixel pad is specified in one place, and an additional 3-pixel pad in
> another; both seem to be used for vertical spacing, so it is 5 pixels.
>
> Certainly for line spacing, and probably in other places related to text
> positioning, I would think pads usually should be in fractions of the
> font size, not fixed numbers of pixels.  Comments?

My first thought is that it should be in points, but I'm open to
arguments that it should be a fraction of font size.  It should
definitely not be in pixels -- wonder what fool wrote that :-)

JDH

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Text line spacing control

2007-07-10 Thread Eric Firing
John Hunter wrote:
> On 7/10/07, Eric Firing <[EMAIL PROTECTED]> wrote:
>> John Hunter wrote:
> 
>> It looks to me like it is all in the text._get_layout() method, where a
>> 2-pixel pad is specified in one place, and an additional 3-pixel pad in
>> another; both seem to be used for vertical spacing, so it is 5 pixels.
>>
>> Certainly for line spacing, and probably in other places related to text
>> positioning, I would think pads usually should be in fractions of the
>> font size, not fixed numbers of pixels.  Comments?
> 
> My first thought is that it should be in points, but I'm open to
> arguments that it should be a fraction of font size.  It should
> definitely not be in pixels -- wonder what fool wrote that :-)
> 
> JDH

John,

My argument for fraction of font size is that this is the norm for 
setting text; in a word processor, or in LaTeX (preferred, of course), 
when you increase the font size, the physical spacing between lines (and 
between characters) increases proportionally.  Shouldn't it work the 
same way in a plot?

Eric

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Text line spacing control

2007-07-10 Thread John Hunter
On 7/10/07, Eric Firing <[EMAIL PROTECTED]> wrote:

> My argument for fraction of font size is that this is the norm for
> setting text; in a word processor, or in LaTeX (preferred, of course),

Well, if that's how latex does it, that's how we should do it too
Thanks for the offer to add this -- shouldn't be too hard.  I don't
mind also having an rc parameter for this, but probably a text
property will suffice.

JDH

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Latex equations and SVG export

2007-07-10 Thread Edin Salkovic
On 7/10/07, Kaushik Ghose <[EMAIL PROTECTED]> wrote:
> Hi Edin,
> Good point. I tried just now on Firefox and got the same error.
> For an image of what I mean see this
> http://python-pieces.blogspot.com/2007/07/latex-and-svg-export.html
>
>
> I'm attaching the svg output here in case someone wants to try it out:
(...)

This should be fixed in SVN (r3346 or r3353) --- Norbert Nemec
recently fixed the mathtext support in the SVG backend.

Best,
Edin

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting a contour of gridded data

2007-07-10 Thread Peter I. Hansen
Hello

I have gridded data of the shape:

x_1 y_1 z_1
x_1 y_2 z_2
.   .   .
x_1 y_N z_N

x_2 y_1 z_(N+1)
x_2 y_2 z_(N+2)
.   .   .
x_2 y_N z_(2N)

x_M y_1 z_(MN)
x_M y_2 z_(MN)
..  .
x_M y_N z_(MN)

I've tried to follow the contour_demo script by making

x = arange(M numbers)
y = arange(N numbers)
X,Y = meshgrid(x,y)

M = load('zdata.dat')

Z = reshape(M, (M,N))

figure()
CS = contour(X,Y,Z)

But I get errors that x and y are not 1D or 2D... Can someone help me
to do this right?
thanks, Peter

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] FigureCanvasAgg.draw() very slow

2007-07-10 Thread Devin Halperin
I'm trying to figure out why this command is taking on average over 14 seconds 
to render a drawing of a fairly simple plot.  If anyone has ideas, I'd really 
appreciate some help.

fig = figure(figsize=(12.5,3.75), dpi=80,facecolor = 'y', edgecolor='b')

start_date = "20050710"
start_date += "T00"
my_dates = list(rrule(DAILY, dtstart=parse(start_date), until=datetime.today()))
formatted_dates = [date2num(parse(start_date))]
for date in my_dates :
formatted_dates.append(date2num(date))
formatted_dates.append(date2num(datetime.today()))

y_ticks = []
for x in xrange(0,11):
my_string = str(x*10)+' Percent'
y_ticks.append(my_string)

yticks(arange(0.0, 1.1, .1), y_ticks)

y_data = rand(len(formatted_dates))

ax = fig.add_subplot(111)
ax.plot_date(formatted_dates, y_data, '-')

labels = ax.get_xticklabels()
setp(labels, rotation=20, fontsize=8)
ax.autoscale_view()

#xlabel('')
#ylabel('')
title('Could put start date and end date here')
grid(True)

canvas = FigureCanvasAgg(fig)

# 90% Run-time


canvas.draw()



imageSize = canvas.get_width_height()
imageRgb = canvas.tostring_rgb()
pilImage = Image.fromstring("RGB", imageSize, imageRgb)
pilImage.show()

   
-
Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV. -
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting a contour of gridded data

2007-07-10 Thread Eric Firing
Peter I. Hansen wrote:
> Hello
> 
> I have gridded data of the shape:
> 
> x_1 y_1 z_1
> x_1 y_2 z_2
> .   .   .
> x_1 y_N z_N
> 
> x_2 y_1 z_(N+1)
> x_2 y_2 z_(N+2)
> .   .   .
> x_2 y_N z_(2N)
> 
> x_M y_1 z_(MN)
> x_M y_2 z_(MN)
> ..  .
> x_M y_N z_(MN)
> 
> I've tried to follow the contour_demo script by making


You don't need to make your own X, Y, so delete the following 3 lines.
> 
> x = arange(M numbers)
> y = arange(N numbers)
> X,Y = meshgrid(x,y)
> 
> M = load('zdata.dat')

Now you have X, Y, and Z, each as a column in your file, so you need to 
split them apart and reshape them.  Let's assume M, N are the number of 
X and Y values in your grid; to avoid name confusion, change the load to

XYZ = load('zdata.dat')

X = XYZ[:,0]
X.shape = (M,N)
Y = XYZ[:,1]
Y.shape = (M,N)
Z = XYZ[:,2]
Z.shape = (M,N)

CS = contour(X.transpose(), Y.transpose(), Z.transpose())

The reason for all the transposing is that pcolor and contour display 
images with column number increasing with X, and row number increasing 
with Y.  Since you have M X-values and N Y-values, everything has to end 
up N by M, not the reverse.

Eric

> 
> Z = reshape(M, (M,N))
> 
> figure()
> CS = contour(X,Y,Z)
> 
> But I get errors that x and y are not 1D or 2D... Can someone help me
> to do this right?
> thanks, Peter
> 
> -
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting a contour of gridded data

2007-07-10 Thread Peter I. Hansen
On 7/11/07, Eric Firing <[EMAIL PROTECTED]> wrote:
> Peter I. Hansen wrote:
> > Hello
> >
> > I have gridded data of the shape:
> >
> > x_1 y_1 z_1
> > x_1 y_2 z_2
> > .   .   .
> > x_1 y_N z_N
> >
> > x_2 y_1 z_(N+1)
> > x_2 y_2 z_(N+2)
> > .   .   .
> > x_2 y_N z_(2N)
> >
> > x_M y_1 z_(MN)
> > x_M y_2 z_(MN)
> > ..  .
> > x_M y_N z_(MN)
> >
> > I've tried to follow the contour_demo script by making
>
>
> You don't need to make your own X, Y, so delete the following 3 lines.
> >
> > x = arange(M numbers)
> > y = arange(N numbers)
> > X,Y = meshgrid(x,y)
> >
> > M = load('zdata.dat')
>
> Now you have X, Y, and Z, each as a column in your file, so you need to
> split them apart and reshape them.  Let's assume M, N are the number of
> X and Y values in your grid; to avoid name confusion, change the load to
>
> XYZ = load('zdata.dat')
>
> X = XYZ[:,0]
> X.shape = (M,N)
> Y = XYZ[:,1]
> Y.shape = (M,N)
> Z = XYZ[:,2]
> Z.shape = (M,N)
>
> CS = contour(X.transpose(), Y.transpose(), Z.transpose())
>
> The reason for all the transposing is that pcolor and contour display
> images with column number increasing with X, and row number increasing
> with Y.  Since you have M X-values and N Y-values, everything has to end
> up N by M, not the reverse.

Perfect. That was just what i needed to know. Thanks!

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] FigureCanvasAgg.draw() very slow

2007-07-10 Thread John Hunter
On 7/10/07, Devin Halperin <[EMAIL PROTECTED]> wrote:
> I'm trying to figure out why this command is taking on average over 14
> seconds to render a drawing of a fairly simple plot.  If anyone has ideas,
> I'd really appreciate some help.

> fig = figure(figsize=(12.5,3.75), dpi=80,facecolor = 'y', edgecolor='b')
///snip
> canvas = FigureCanvasAgg(fig)

You can't do this.  You are combining pylab figure management (eg
figure) with explicit use of FigureCanvasAgg.  Who the hell knows what
will happen.

If you want to use pylab, just create the figure as above and you can
access the cancas directly w/ fig.canvas and set your backend to Agg,
eg with

import matplotlib
matplotlib.use('Agg')

before importing pylab.

If you don't want to use pylab, follow the approach of

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

Note there we use matplotlib.figure.Figure to create the figure, not
pylab.figure.

This is probably your problem.  If I were to guess, you are getting
caught up somewhere in some GUI nastiness inadvertently by using
pylab.figure and this is causing the slowdown.

JDH

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users