Re: [matplotlib-devel] rcparams/traits
On Tuesday 24 July 2007 11:17:32 pm Fernando Perez wrote: > On 7/24/07, Darren Dale <[EMAIL PROTECTED]> wrote: > > On Tuesday 24 July 2007 7:28:59 pm Fernando Perez wrote: > > :) That should be plenty of information. One comment: if you load > > : mplrc2.conf, > > > > which includes an mplrc.conf with a bogus key, the error indicates the > > bad key is in mplrc2.conf. Is that a concern? > > It may be a concern to you, I suppose :) Not so much. I just wanted to give thorough feedback (No, I'm not *trying* to drive you crazy). > I guess it's now up to you guys (a collective MPL-dev you) to decide > if you want to use this system or not. We'll slowly try to replace > the ipython config with this, which I'm sure will uncover yet a few > more problems. But overall I'm quite happy with what we've got, and > I think the system is flexible enough that we should be able to solve > whatever remains. I'll start working on an option in svn-mpl to turn the new system on and wrap it in an rcParams-like object. Then maybe we can convince a few devs to try using the new system for a while. Darren - 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 [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] mpl1 + chaco
Chris Barker wrote: > Peter Wang wrote: > >>> Ah! and some good math implementation -- What does Chaco do for >>> that? >>> > > >> We've also had this discussion internally a bit. It usually >> concludes with us wishing that someone would just port jsmath to >> Python, or implement Knuth's TeX layout rules in Python. :) >> > > It looks like jsmath uses the TeX layout rules, so those are the same > thing. If you can do it in JS, you sure should be able to do it in Python! I currently have a branch (mathtext_mgd), where I am implementing the TeX layout model in Python. It does not attempt to reimplement the whole kit-and-kaboodle (especially the parser and macros etc.), just the box model and some of the math layout algorithms, so it won't support the kind of things Gael is suggesting. But the existing adjacency model was becoming somewhat of a dead end wrt implementing new features like fractions and radicals. Stay tuned -- the code is already beyond feature parity with the old implementation, so I expect to merge this back into the trunk soon. 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 [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] Mathtext improvements (merging into trunk)
The new mathtext with an underlying TeX-like box model is passing all
unit tests for all backends. I'm now at a point where I'd like to merge
this back into the trunk, but I'd like some feedback as to how to best
deal with the backward-incompatible change wrt font changes.
(This was discussed in an earlier thread, but I don't believe a
conclusion was reached, so I'm summarizing again here.) In the existing
mathtext implementation, font style changes affect the following group.
For example, in $\cal{R} x$, only the R will be in calligraphic face.
In TeX, however, font style markers stay in effect until the next font
style marker or the end of the enclosing group. Therefore, the same
example would be rendered with both the R and the x in calligraphic
face. The new mathtext adds LaTeX-style font macros (\mathcal, \mathrm
etc.) that behave as the old mathtext ones. So the example expression
could be re-written $\mathcal{R} x$. It's difficult to trap the old
case and correct for it, since both are still valid.
Becoming more TeX-like is a good thing, but does breaking existing
matplotlib plots warrant some additional care here? Should this be
merged into trunk, or onto some other branch where we're going to be
breaking a lot of things. It is probably feasible to have a
"compatibility" mode for this, but is that (in this particular case)
worth the extra maintenance burden?
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Mathtext improvements (merging into trunk)
On 7/25/07, Michael Droettboom <[EMAIL PROTECTED]> wrote:
> The new mathtext with an underlying TeX-like box model is passing all
> unit tests for all backends. I'm now at a point where I'd like to merge
> this back into the trunk, but I'd like some feedback as to how to best
> deal with the backward-incompatible change wrt font changes.
This is really, really cool stuff. On a mostly unrelated note, do
you thing the TeX box layout algorithms could be used to solve more
general figure layout problems, eg positioning axes and tick labels,
etc?
> (This was discussed in an earlier thread, but I don't believe a
> conclusion was reached, so I'm summarizing again here.) In the existing
> mathtext implementation, font style changes affect the following group.
> For example, in $\cal{R} x$, only the R will be in calligraphic face.
> In TeX, however, font style markers stay in effect until the next font
> style marker or the end of the enclosing group. Therefore, the same
> example would be rendered with both the R and the x in calligraphic
> face. The new mathtext adds LaTeX-style font macros (\mathcal, \mathrm
> etc.) that behave as the old mathtext ones. So the example expression
> could be re-written $\mathcal{R} x$. It's difficult to trap the old
> case and correct for it, since both are still valid.
>
> Becoming more TeX-like is a good thing, but does breaking existing
> matplotlib plots warrant some additional care here? Should this be
> merged into trunk, or onto some other branch where we're going to be
> breaking a lot of things. It is probably feasible to have a
> "compatibility" mode for this, but is that (in this particular case)
> worth the extra maintenance burden?
I think we should strive for TeX correctness and should not support
the incorrect usage in a
compatibility mode. The improvements you've made are sufficiently
important that mathtext users will gladly accept a little breakage.
We can put up a news flash on the main site, and note the changes in
the CHANGELOG and API_CHANGES file, as well as in the mathtext_demo.
I have a few questions about the mathtext_demo.py. A number of these
are probably just related to the bakoma fonts, which are just so
horrific it pains me to look at them (like why is the s in sin so much
lighter?)
* The i in the {i+1} subscript looks too small. It also looks to
small compared to the j in the \Delta_i^j example. Are the i and j
coming from the same file, and do you have any idea why it is small?
* There is a lot of space between the \prod symbol and the rest of
the expression and between the \mathcal{R} and the \prod symbol --
what controls this? It looks like it is being affected by the wide
\prod subscript {i=\alpha_{i+1}} -- is this correct and is this how
TeX handles it? Since the subscript is under the prod, it seems like
it's width should not affect the spacing of the R and the sin
* Have you given any thought to the "cross font" kerning problem.
Eg, if the parens comes from one file, and the 2 from another and the
\pi from a 3rd, how to we kern "( 2 \pi )?
* have you succeeded in get any non bakoma fonts to work, eg with the
UnicodeFont code?
Anyway, this is really great stuff. Thanks!
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Mathtext improvements (merging into trunk)
On Wed, Jul 25, 2007 at 11:36:17AM -0500, John Hunter wrote:
> * There is a lot of space between the \prod symbol and the rest of
> the expression and between the \mathcal{R} and the \prod symbol --
> what controls this? It looks like it is being affected by the wide
> \prod subscript {i=\alpha_{i+1}} -- is this correct and is this how
> TeX handles it?
AFAIK yes. I correct this with a lot of "\!\!". This is a hack, but it
gives good results.
Gaël
-
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Mathtext improvements (merging into trunk)
Michael Droettboom <[EMAIL PROTECTED]>
writes:
> In the existing mathtext implementation, font style changes affect the
> following group. For example, in $\cal{R} x$, only the R will be in
> calligraphic face. In TeX, however, font style markers stay in effect
> until the next font style marker or the end of the enclosing group.
To clarify a little: in Plain TeX people usually write ${\cal R}x$,
beginning the group before the font-changing macro. The LaTeX macros
such as \mathcal take an argument: for example, both $\mathcal{R}x$ and
$\mathcal Rx$ cause only R to have the calligraphic font. (The latter is
because of TeX's parsing rules: \mathcal takes one argument, and since
there is no {}-group, the argument consists of the single letter R.)
The old mathtext style font-changing commands behave like the LaTeX
macros but have names like the Plain TeX macros, and the change you
are proposing to merge makes mathtext have both Plain TeX and LaTeX
style commands.
> It's difficult to trap the old
> case and correct for it, since both are still valid.
Is it easy to detect when a Plain TeX style command is followed by an
opening brace, and output a warning? It is typically not useful to
start a new group right after a font-changing command, so such usage is
more likely to be caused by someone relying on the old behavior.
> Becoming more TeX-like is a good thing, but does breaking existing
> matplotlib plots warrant some additional care here? Should this be
> merged into trunk, or onto some other branch where we're going to be
> breaking a lot of things. It is probably feasible to have a
> "compatibility" mode for this, but is that (in this particular case)
> worth the extra maintenance burden?
IMHO this should be merged into trunk, with a warning in case of "\cal{"
if that is feasible, but no other compatibility mode.
--
Jouni K. Seppänen
http://www.iki.fi/jks
-
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Mathtext improvements (merging into trunk)
Gael Varoquaux <[EMAIL PROTECTED]>
writes:
> On Wed, Jul 25, 2007 at 11:36:17AM -0500, John Hunter wrote:
>> * There is a lot of space between the \prod symbol and the rest of
>> the expression and between the \mathcal{R} and the \prod symbol --
>> what controls this? It looks like it is being affected by the wide
>> \prod subscript {i=\alpha_{i+1}} -- is this correct and is this how
>> TeX handles it?
>
> AFAIK yes. I correct this with a lot of "\!\!". This is a hack, but it
> gives good results.
Yes, this is how TeX does it. Another hack is to cause the subscript box
to have zero width, which in principle can be done with \makebox[0pt]
(but Google for "mathclap" to find how to make it actually work).
--
Jouni K. Seppänen
http://www.iki.fi/jks
-
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] mpl1 draft
On 7/24/07, Ken McIvor <[EMAIL PROTECTED]> wrote: > Since my original comment about traits I have been working hard to > put my money where my mouth is. Attached is an experimental > rendering system with an alternative transform architecture that does > not require attribute change notification. Please let me know what > you think, everybody. Hi Ken -- sorry for the radio silence, I'm not intentionally ignoring you. Real life has made some demands on my time of late, and probably will until next week, but I was able to download, read through and test your code. It looks very clean and is an impressive piece of work. I'll agree with your assessment above that from a code reading perspective, this looks a bit more digestible that what I have done using traits. But I don't think that closes the book on the subject -- for example, I have realized I am introducing too much complexity and trait forwarding, and I think I know a way to work around this, so I will be hacking through my version one more time while at the same time taking a closer look at yours. I also would like to hear more about the "hard to optimize" part, because that is not intuitively clear to me. I confess to being a meta-class ignoramus, so I am intrigued to study how you handled the canvas primitive cache problem using meta classes. How for example, if one modifies a Rectangle object which embodies a path primitive, would the canvas get the notification to update it's internal path representation (egg the agg_path_storage)?. With traits, I use the trait event handling mechanism so that when any of the box properties (left, width, top, etc...) are modified, the PathPrimitiveAgg would get a callback. So when the user does rect.left = 0.1 the agg path knows to update itself. This is pretty cool. As for code readability, I'll also add that as a traits newbie, I am probably making things harder than necessary. But there are a lot of gotchas with traits usage, particularly in the area of instantiation, because you can easily get bitten by shared class level data structures, especially in the presence of sync_traits. vis-a-vis properties vs traits, I second Peter's comment that once you've written 8,000 setters and getters and manually constructed properties, you'll probably evolve toward something like traits, w/o all the features. This is a library that has been bug and performance vetted in production applications for years, so we should seriously consider it as a properties alternative. I strongly encourage you to download Fernando's mplconfig sandbox stuff and try the edit_traits demo in the presence of a wx enabled traits. He is somewhat blown away by the fact that he got a sophisticated, nested GUI dialog w/o writing *any* code. Since you are a committed wx user, you might find this particularly appealing. But at the end of the day, I think the *notification* aspect of traits is the killer feature. I think your approach of working on a display PDF renderer interface is also a good one, for several reasons. It uses an established specification instead of a home grown one, and it makes it easier for us to consider things like integrating with Kiva or Chaco. I am glad you interpreted my mpl1 sketch in the right vein, as a lab in which people can advocate ideas as working code. Much more productive than lots of emails, I think. Hopefully next week we can come to some consensus and start merging our two lines. PS: I'm not ignoring you either Peter, but I won't be able to get to all your questions and comments until a bit later; as you know the harder problems take longer to address - 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 [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] mpl1 draft
On Wed, Jul 25, 2007 at 12:09:01PM -0500, John Hunter wrote: > As for code readability, I'll also add that as a traits newbie, I am > probably making things harder than necessary. But there are a lot of > gotchas with traits usage, particularly in the area of instantiation, > because you can easily get bitten by shared class level data > structures, especially in the presence of sync_traits. One thing that is convenient when working with Traits, is that there already are established coding conventions. The problem when coding with metaclasses is that it is easy to prduce very beautiful code that is hard to read for the newcomer (I have fallen in that trap). Traits are nothing more but a metaclass, they also have this problem. But if they become wildy used this problem goes away. Gaël - 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 [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] rcparams/traits
On 7/25/07, Darren Dale <[EMAIL PROTECTED]> wrote: > Not so much. I just wanted to give thorough feedback (No, I'm not *trying* to > drive you crazy). Don't worry, the damage was done long ago :) More seriously, I do appreciate the feedback. It was very good to have someone at the other end checking/breaking things (as well as the conversation with John, to clarify a minimum set of functionality that could make us all happy). > > I guess it's now up to you guys (a collective MPL-dev you) to decide > > if you want to use this system or not. We'll slowly try to replace > > the ipython config with this, which I'm sure will uncover yet a few > > more problems. But overall I'm quite happy with what we've got, and > > I think the system is flexible enough that we should be able to solve > > whatever remains. > > I'll start working on an option in svn-mpl to turn the new system on and wrap > it in an rcParams-like object. Then maybe we can convince a few devs to try > using the new system for a while. Yup. Let me know of anything you need. Cheers, f - 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 [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] rcparams/traits
Darren Dale wrote: [...] > > I'll start working on an option in svn-mpl to turn the new system on and wrap > it in an rcParams-like object. Then maybe we can convince a few devs to try > using the new system for a while. I will be happy to take a look and try it out. It certainly sounds like a major improvement over the previous system. Eric - 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 [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Mathtext improvements (merging into trunk)
John Hunter wrote: > On 7/25/07, Michael Droettboom <[EMAIL PROTECTED]> wrote: > >> It's been fun working through this. You may want to check out >> mathtext_examples.py in my branch for examples that exercise other new >> features. > > Maybe you haven't committed it? Doh! Try now. 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 [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Mathtext improvements (merging into trunk)
On 7/25/07, Michael Droettboom <[EMAIL PROTECTED]> wrote: > It's been fun working through this. You may want to check out > mathtext_examples.py in my branch for examples that exercise other new > features. Maybe you haven't committed it? [EMAIL PROTECTED]:examples> pwd /home/titan/johnh/python/svn/matplotlib/mathtext_mgd/examples [EMAIL PROTECTED]:examples> svn up At revision 3613. [EMAIL PROTECTED]:examples> ls mathtext*.py mathtext2_demo.py mathtext_demo.py 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 [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Mathtext improvements (merging into trunk)
John Hunter wrote:
> On 7/25/07, Michael Droettboom <[EMAIL PROTECTED]> wrote:
>> The new mathtext with an underlying TeX-like box model is passing all
>> unit tests for all backends. I'm now at a point where I'd like to merge
>> this back into the trunk, but I'd like some feedback as to how to best
>> deal with the backward-incompatible change wrt font changes.
>
> This is really, really cool stuff. On a mostly unrelated note, do
> you thing the TeX box layout algorithms could be used to solve more
> general figure layout problems, eg positioning axes and tick labels,
> etc?
That seems like it would be worth some thought, but nothing springs to mind.
>
> I think we should strive for TeX correctness and should not support
> the incorrect usage in a
> compatibility mode. The improvements you've made are sufficiently
> important that mathtext users will gladly accept a little breakage.
> We can put up a news flash on the main site, and note the changes in
> the CHANGELOG and API_CHANGES file, as well as in the mathtext_demo.
Sounds good.
>
> I have a few questions about the mathtext_demo.py. A number of these
> are probably just related to the bakoma fonts, which are just so
> horrific it pains me to look at them (like why is the s in sin so much
> lighter?)
I think that's due to lack of hinting in the font. If you generate a
.ps and zoom in enough, they do look much better.
>
> * The i in the {i+1} subscript looks too small. It also looks to
> small compared to the j in the \Delta_i^j example. Are the i and j
> coming from the same file, and do you have any idea why it is small?
Hmmm. Both i's look identical here. Perhaps an optical illusion from
the rotation? I agree, in general, though that there is some tweaking
to font sizes and positioning that still needs to be done. Since
mathtext always uses the same glyph outlines regardless of font size,
unlike TeX which changes the actual shapes in response to font size,
some compromises had to be made in that regard.
>
> * There is a lot of space between the \prod symbol and the rest of
> the expression and between the \mathcal{R} and the \prod symbol --
> what controls this? It looks like it is being affected by the wide
> \prod subscript {i=\alpha_{i+1}} -- is this correct and is this how
> TeX handles it? Since the subscript is under the prod, it seems like
> it's width should not affect the spacing of the R and the sin
Yes, as others have pointed out, this is normal TeX behavior. The
subscript affects the width of the entire vertical list. If it didn't,
it could bump into subscripts before and after. (Think of $R_i
\prod_{i=\alpha_{i+1} $-- the subscripts would run together). The TeX
box model only supports a strict hierarchy of boxes within boxes
(excepting shifting and kerning), and doesn't ever do any checks for
boxes overlapping boxes with other parents. (It's really a lot less
smart than many, myself included, assume.) The hacks that Gael and
Jouni suggest may help, but aren't currently supported by the mathtext
parser (though they could be fairly easily). Exposing some of the
low-level commands for TeX gurus might be useful in general, though I
worry (somewhat abstractly) that since they will probably never behave
100% like TeX, they will just disappoint.
> * Have you given any thought to the "cross font" kerning problem.
> Eg, if the parens comes from one file, and the 2 from another and the
> \pi from a 3rd, how to we kern "( 2 \pi )?
I haven't looked at how TeX does this yet, though I suspect the job is
easier there, being that it has its own universe of math fonts that are
built to work together. The current implementation does kern
consecutive characters of the same font and fontsize, but that's all. I
have noticed, though, that TeX kerns a lot less in math mode than one
might expect. For instance, $AVA$ isn't kerned at all (presumably to
keep variables looking like separate entities), though $\rm AVA$ is.
>
> * have you succeeded in get any non bakoma fonts to work, eg with the
> UnicodeFont code?
No, I haven't tried that yet. I've certainly broken the UnicodeFont
classes by changing the API a little bit. Is there a font you would
suggest that was known to work with the old mathtext that I should test
with?
>
> Anyway, this is really great stuff. Thanks!
It's been fun working through this. You may want to check out
mathtext_examples.py in my branch for examples that exercise other new
features.
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotl
