Re: [matplotlib-devel] matplotlib installation error

2007-08-30 Thread Ken McIvor
On Aug 29, 2007, at 5:12 PM, Hardeep Nahal wrote:
>
> Yes, I think my libpng library was corrupt, but when I tried
> reinstalling, it still wouldn't work.

It's not corrupt, it's just not the correct kind of library.  There  
are two types: static libraries (.a), which get compiled into a  
program, and shared libraries (.so), which are stored outside of the  
program.  Trying to compile a shared library that uses a static  
library is always a bit dodgy and sometimes fails completely.  If you  
really need to use your own copy of libpng you should re-run the  
configure script with the "--enable-shared" option and then  
recompile.  Since you're using Debian I'd advise you to just use the  
libraries it provides whenever possible.  That ought to make your  
life easier.

> It appears the matplotlib and numpy packages that come with Debian are
> incompatible.

I have been unable to reproduce the problem you were having with the  
Debian matplotlib and numpy packages.  I'd appreciate more details  
about the packages you had installed, if you don't mind breaking your  
system again briefly.  Could you please reinstall them, verify that  
the problem still occurs, and then email me the output of the  
following four commands?  If you don't have time to work on this  
right now don't worry about it.

Here are the commands which will provide me with the information I  
require:

$ cat /etc/debian_version
$ dpkg -s python
$ dpkg -s python-numpy
$ dpkg -s python-numarray

Thanks,
Ken

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] mathtext rotation

2007-08-30 Thread Paul Kienzle
Hi all,

I replaced one of the text_rotation examples with r'$\rm{mathtext_{225}}$'
to see if rotation is supported for mathtext.  It is not in the current
trunk downloaded today.

Before I look to deeply into this myself, is there anyone working on it 
already?  Is there anything I need to look out for when implementing it?

Thanks in advance...

- Paul

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] mathtext in wx widgets

2007-08-30 Thread Paul Kienzle
Hi,

It would be great to be able to display math markup in other parts of my
application, such as labels, tables, lists and menus.  Has anyone ever
tried doing this for wx or gtk?

Thanks in advance,

- Paul

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mathtext rotation

2007-08-30 Thread Michael Droettboom
Paul Kienzle wrote:
> Hi all,
> 
> I replaced one of the text_rotation examples with r'$\rm{mathtext_{225}}$'
> to see if rotation is supported for mathtext.  It is not in the current
> trunk downloaded today.

It's only not supported in the bitmap (Agg and Gdk) backends.  It works 
fine in the vector backends.

> Before I look to deeply into this myself, is there anyone working on it 
> already?  Is there anything I need to look out for when implementing it?

I've made a few excursions down that road --

For bitmap font rendering, the entire math expression is first laid out 
in a greyscale bitmap buffer, which is cached and then transferred to 
the main plot bitmap.  It was already that way when I got here, and I 
assume that's an important optimization (so the text doesn't have to be 
re-laid-out when the plot is zoomed/panned).  I say "perhaps" because I 
have no data to back it up, and don't know if that came out of profiling 
or not.

There are a few key low level pieces that are missing for rotation:

- FT2Font.draw_glyph_to_bitmap does not support rotation.  This would 
have to be added, or there may be a way to use 
set_text/draw_glyphs_to_bitmap which does support rotation.  However, 
that would make rendering the entire expression to a single buffer much 
more difficult.

- The horizontal lines are all drawn as filled rectangles aligned to the 
pixel grid, directly into the font buffers.  That will probably have to 
be pushed upward into the Agg layer to get good line drawing at 
arbitrary angles -- but that also makes caching the bitmap a little more 
difficult.  So maybe it makes sense to implement our own Breshenham's 
algorithm in ft2font.cpp.


All this will be affected by John's proposed refactoring of the 
backends, of course, which has kind of kept me off of it in a "wait and 
see" kind of mode.  Right now, each backend has a custom interface to 
communicate with mathtext -- whereas mathtext should simply be calling 
the same low-level methods on all backends to get its job done.  That, 
of course, would make this buffer optimization harder (or at least it 
would have to be thought about differently).

Let me know if you decide to implement this and let me know if you have 
any questions about the code.  Otherwise I'm happy to add it to my queue.

Cheers,
Mike

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mathtext in wx widgets

2007-08-30 Thread Michael Droettboom
Cool idea.  I don't know if anyone has tried this.  I assume you'd want 
to get something that you could pass to wx.ImageFromBuffer() (and the 
equivalent in Gtk).  It would just be a matter of or'ing together all of 
the greyscale ft2font buffers (which aren't currently exposed to Python) 
and converting them to an RGB buffer and Alpha buffer.  Not that 
difficult, but it would require some additional C routines in ft2font.cpp.

(And long term, as cool as matplotlib is, it would be nice to refactor 
this out as a separate library for apps that don't do any plotting...)

Cheers,
Mike

Paul Kienzle wrote:
> Hi,
> 
> It would be great to be able to display math markup in other parts of my
> application, such as labels, tables, lists and menus.  Has anyone ever
> tried doing this for wx or gtk?
> 
> Thanks in advance,
> 
>   - Paul
> 
> -
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> ___
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mathtext rotation

2007-08-30 Thread John Hunter
On 8/30/07, Michael Droettboom <[EMAIL PROTECTED]> wrote:

> - FT2Font.draw_glyph_to_bitmap does not support rotation.  This would
> have to be added, or there may be a way to use
> set_text/draw_glyphs_to_bitmap which does support rotation.  However,
> that would make rendering the entire expression to a single buffer much
> more difficult.

I was envisioning simply rotating the entire text expression by
rotating the ft2font pixel buffer.  Agg could do this and still
preserve subpixel effects, but we would need to expose a little code
(presumably in the agg SWIG module).  One couldn't rotate individual
glyphs  in a larger expression this way, but by far the most common
use case is to rotate the entire expression so this limitation doesn't
concern me much.

> All this will be affected by John's proposed refactoring of the
> backends, of course, which has kind of kept me off of it in a "wait and
> see" kind of mode.  Right now, each backend has a custom interface to

The rest of my life has intervened a bit here and I hope to return to
the refactoring soon, but I don't think it should hold you up.
Despite my initial revolutionary fervor, I have tempered a bit, and
favor a more integrationist approach than espoused in some of my
original emails on mpl1.  So if you have an approach that will improve
the backend mathtext handling, by all means go for it and we will
incorporate this into further revisions.

JDH

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mathtext in wx widgets

2007-08-30 Thread John Hunter
On 8/30/07, Michael Droettboom <[EMAIL PROTECTED]> wrote:

> (And long term, as cool as matplotlib is, it would be nice to refactor
> this out as a separate library for apps that don't do any plotting...)

I agree, the mathtext stuff is becoming really good, and will be
really good when we have a good set of fonts to work with.  I can see
it being useful in lots of contexts, and more users in other contexts
will make it more useful for us down the road.

JDH

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mathtext rotation

2007-08-30 Thread Michael Droettboom
John Hunter wrote:
> On 8/30/07, Michael Droettboom <[EMAIL PROTECTED]> wrote:
> 
>> - FT2Font.draw_glyph_to_bitmap does not support rotation.  This would
>> have to be added, or there may be a way to use
>> set_text/draw_glyphs_to_bitmap which does support rotation.  However,
>> that would make rendering the entire expression to a single buffer much
>> more difficult.
> 
> I was envisioning simply rotating the entire text expression by
> rotating the ft2font pixel buffer.  Agg could do this and still
> preserve subpixel effects, but we would need to expose a little code
> (presumably in the agg SWIG module).  

I was concerned about loss of quality doing the rotation in raster 
space, particularly due to all of the trouble to get the hinting just 
right.  (Though I'm not sure how much hinting to a grid matters when the 
glyphs aren't actually parallel with the grid anymore.)

I suppose it's worth some experimentation, though, as that is definitely 
the path of least resistance.

> One couldn't rotate individual
> glyphs  in a larger expression this way, but by far the most common
> use case is to rotate the entire expression so this limitation doesn't
> concern me much.

Agreed.  My usual response is: TeX doesn't support it, so why should we? ;)

Cheers,
Mike

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Aligning text to baseline

2007-08-30 Thread Michael Droettboom
I just committed code to allow vertical alignment of text by the 
baseline (rather than the bottom of all the descenders).


I think it should be useful, however, it behaves rather strangely with 
rotation, and I thought I'd solicit some feedback from the list.


The "problem" (if it is one) is that halignment and valignment don't 
rotate along with the text (and there's lots of good reasons why it 
doesn't.)  However, when you rotate text by 90 degrees, does that mean 
you would want the baseline to be horizontally aligned to the baseline? 
  Does this suggest that baseline alignment is not really a property of 
valignment?  But then what do you do with non-rectilinear rotations?


Does this even matter?  Is it good enough to just ignore the rotation 
problems?


Cheers,
Mike
<>-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mathtext rotation

2007-08-30 Thread Paul Kienzle
On Thu, Aug 30, 2007 at 02:19:47PM -0400, Michael Droettboom wrote:
> Paul Kienzle wrote:
> > Hi all,
> > 
> > I replaced one of the text_rotation examples with r'$\rm{mathtext_{225}}$'
> > to see if rotation is supported for mathtext.  It is not in the current
> > trunk downloaded today.
> 
> It's only not supported in the bitmap (Agg and Gdk) backends.  It works 
> fine in the vector backends.

Okay.  wxAgg works with $90^\circ$ rotations as well.  This will work for
me short term (though $45^\circ$ is better).

> > Before I look to deeply into this myself, is there anyone working on it 
> > already?  Is there anything I need to look out for when implementing it?
> 
> I've made a few excursions down that road --
> 
> For bitmap font rendering, the entire math expression is first laid out 
> in a greyscale bitmap buffer, which is cached and then transferred to 
> the main plot bitmap.  It was already that way when I got here, and I 
> assume that's an important optimization (so the text doesn't have to be 
> re-laid-out when the plot is zoomed/panned).  I say "perhaps" because I 
> have no data to back it up, and don't know if that came out of profiling 
> or not.
> 
> There are a few key low level pieces that are missing for rotation:
> 
> - FT2Font.draw_glyph_to_bitmap does not support rotation.  This would 
> have to be added, or there may be a way to use 
> set_text/draw_glyphs_to_bitmap which does support rotation.  However, 
> that would make rendering the entire expression to a single buffer much 
> more difficult.

Adding rotation to draw_glyph_to_bitmap looks like the easier option...

> 
> - The horizontal lines are all drawn as filled rectangles aligned to the 
> pixel grid, directly into the font buffers.  That will probably have to 
> be pushed upward into the Agg layer to get good line drawing at 
> arbitrary angles -- but that also makes caching the bitmap a little more 
> difficult.  So maybe it makes sense to implement our own Breshenham's 
> algorithm in ft2font.cpp.

...but if we need to go into agg anyway, why not use Agg's font handling
capabilities directly?

> 
> All this will be affected by John's proposed refactoring of the 
> backends, of course, which has kind of kept me off of it in a "wait and 
> see" kind of mode.  Right now, each backend has a custom interface to 
> communicate with mathtext -- whereas mathtext should simply be calling 
> the same low-level methods on all backends to get its job done.  That, 
> of course, would make this buffer optimization harder (or at least it 
> would have to be thought about differently).

I haven't followed the refactoring proposal close enough to know if it
makes more sense to implement mathtext via freetype in agg or to use
freetype directly like you are currently doing.  Once that decision is
clear, we can certainly prototype the handling of rotated text in the Agg
backend.

Presumably this will have to be repeated for Cairo.

> 
> Let me know if you decide to implement this and let me know if you have 
> any questions about the code.  Otherwise I'm happy to add it to my queue.

I can get by for now with limited text rotation, at least until the
backend refactoring has settled.

  - Paul

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mathtext rotation

2007-08-30 Thread Michael Droettboom
Paul Kienzle wrote:
> On Thu, Aug 30, 2007 at 02:19:47PM -0400, Michael Droettboom wrote:
>> Paul Kienzle wrote:
>>> Hi all,
>>> Before I look to deeply into this myself, is there anyone working on it 
>>> already?  Is there anything I need to look out for when implementing it?
>> I've made a few excursions down that road --
>>
>> For bitmap font rendering, the entire math expression is first laid out 
>> in a greyscale bitmap buffer, which is cached and then transferred to 
>> the main plot bitmap.  It was already that way when I got here, and I 
>> assume that's an important optimization (so the text doesn't have to be 
>> re-laid-out when the plot is zoomed/panned).  I say "perhaps" because I 
>> have no data to back it up, and don't know if that came out of profiling 
>> or not.
>>
>> There are a few key low level pieces that are missing for rotation:
>>
>> - FT2Font.draw_glyph_to_bitmap does not support rotation.  This would 
>> have to be added, or there may be a way to use 
>> set_text/draw_glyphs_to_bitmap which does support rotation.  However, 
>> that would make rendering the entire expression to a single buffer much 
>> more difficult.
> 
> Adding rotation to draw_glyph_to_bitmap looks like the easier option...
 >
>> - The horizontal lines are all drawn as filled rectangles aligned to the 
>> pixel grid, directly into the font buffers.  That will probably have to 
>> be pushed upward into the Agg layer to get good line drawing at 
>> arbitrary angles -- but that also makes caching the bitmap a little more 
>> difficult.  So maybe it makes sense to implement our own Breshenham's 
>> algorithm in ft2font.cpp.
> 
> ...but if we need to go into agg anyway, why not use Agg's font handling
> capabilities directly?

Perhaps historical reasons.  I wonder if they're still relevant.

>> All this will be affected by John's proposed refactoring of the 
>> backends, of course, which has kind of kept me off of it in a "wait and 
>> see" kind of mode.  Right now, each backend has a custom interface to 
>> communicate with mathtext -- whereas mathtext should simply be calling 
>> the same low-level methods on all backends to get its job done.  That, 
>> of course, would make this buffer optimization harder (or at least it 
>> would have to be thought about differently).
> 
> I haven't followed the refactoring proposal close enough to know if it
> makes more sense to implement mathtext via freetype in agg or to use
> freetype directly like you are currently doing.  Once that decision is
> clear, we can certainly prototype the handling of rotated text in the Agg
> backend.
> 
> Presumably this will have to be repeated for Cairo.

Cairo already works, as of a few weeks ago, it no longer uses bitmaps 
for mathtext rendering.  (I should have been more clear earlier -- my 
brain has it filed in with the vector backends, though obviously it has 
a resterizer.)

>> Let me know if you decide to implement this and let me know if you have 
>> any questions about the code.  Otherwise I'm happy to add it to my queue.
> 
> I can get by for now with limited text rotation, at least until the
> backend refactoring has settled.

That may be a while (re: John's latest message).  In the meantime, I'm 
going to explore, as he suggested, how bad doing a raster rotation would 
look, as that's the easiest path forward.

Cheers,
Mike

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mathtext in wx widgets

2007-08-30 Thread Christopher Barker
Paul Kienzle wrote:
> It would be great to be able to display math markup in other parts of my
> application, such as labels, tables, lists and menus.  Has anyone ever
> tried doing this for wx or gtk?

It's worth a post to the wxPython-users list -- it gets talked about now 
and again.

It shouldn't be too hard to use the ustex stuff from MPL -- doesn't that 
use TeX, etc to make a png or something? If so, it could be stuck on a 
wx.widget easily.

Michael Droettboom wrote:
> (And long term, as cool as matplotlib is, it would be nice to refactor 
> this out as a separate library for apps that don't do any plotting...)

Yes, that would be great -- a kind of mini-TeX that's embeddable. 
Another plus to that is you'd expand the user base, and with that 
hopefully the developer base, so it could get fuller featured faster.

How tied in with MPL is the code? Could it just be it's own module?

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] mathtext in wx widgets

2007-08-30 Thread Paul Kienzle
On Thu, Aug 30, 2007 at 01:56:36PM -0500, John Hunter wrote:
> On 8/30/07, Michael Droettboom <[EMAIL PROTECTED]> wrote:
> 
> > (And long term, as cool as matplotlib is, it would be nice to refactor
> > this out as a separate library for apps that don't do any plotting...)
> 
> I agree, the mathtext stuff is becoming really good, and will be
> really good when we have a good set of fonts to work with.  I can see
> it being useful in lots of contexts, and more users in other contexts
> will make it more useful for us down the road.

The challenge is to separate the backends from matplotlib.

If mathtext takes over all of the font handling then matplotlib won't need
to include freetype.  If matplotlib handles bitmap rotation, then mathtext
won't need to include agg.  Then mathtext need only take the format string
and return a bounding box, a bitmap, or the PDF/PS/SVG instructions
necessary to render the text.

I don't know if PDF/PS/SVG can rotate the coordinate system prior to
rendering.  If not, then rotation will need to be moved into mathtext
as well.

- Paul

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel