> Hi Mike,
> I'm not sure about the textpath functionality. Most of the 'easy'
> marker types have been specified already (triangles, squares etc). Are
> the latex symbols defined somewhere that you could easily extract a
> path description of them, and then pass that to the textpath code you
> have? This would be perfect, since you could then apply the properties
> changes already there (like color, size, linewidth etc), and you
> wouldnt necessarily need latex to render the markers.
> Even if you could manage to make a path description for (all) the
> markers, they might not exactly correspond to the latex symbols which
> would be one of the main aims- for eg. using text.usetex with the pdf
> backend you could match the fonts in your graph to your latex document
> and it would all look very nice ;)
> I agree that the best approach would be to make a new marker style
> '$...$' and pass the string inside to whatever renders the math text.
> I hadn't consider making a patch myself- but perhaps I'll take a look
> and see if something can be done (any pointers on the use of the math
> text code would be appreciated...)- either way I will file an
> enhancement request to keep track of it.
The functionality in textpath.py is able to turn any text (including
math with the internal render and externally-rendered LaTeX) into a path
on-the-fly. It should exactly match the rest of the text, as long as
the usetex option is passed along correctly. Look at
convert text *s* to path (a tuple of vertices and codes for
text to be converted
If True, use matplotlib usetex mode.
If True, use mathtext parser. Effective only if usetex == False.
There's an example of its usage at the bottom of the same file.
It would be great if you wanted to look into this further. Let me know
if I can provide any more pointers.
> On Mon, Oct 26, 2009 at 1:03 PM, Michael Droettboom <mdroe@...> wrote:
>> That's a very interesting idea. I actually think that with the recent
>> textpath functionality that Jae-Joon added, we may be able to tie text and
>> markers together without too much pain. Then it can advantage of all the
>> performance optimizations in draw_markers. Each of the marker styles now
>> contains a function that draws a path for the marker and then passes that to
>> draw_marker. We could add one that draws an arbitrary text path, and then
>> passes that along. I propose that Line.set_marker supports a new marker
>> style "$...$" which would render whatever "..." is as math text.
>> Were you offering to try to produce a patch yourself? Either way, it would
>> be great to file an enhancement request in the tracker so this idea doesn't
>> get lost. It's a good one.
>> tcb wrote:
>>> Is there some way to add support for latex symbols as markers?
>>> I think it would be an extension of the current methods for plotting
>>> markers- since I dont think all the color, edge, line style etc
>>> properties would be relevant (or even possible). However, it would
>>> allow arbitrary symbols (at least whatever latex can do) to be used,
>>> which would be really useful.
>>> The current marker set is fine for most simple plots- but when there
>>> are a few different symbols it quickly becomes tricky to find a set
>>> which can easily be distinguished from each other. The other problem
>>> is that when preparing a graph for publication, it is occasionally
>>> necessary to be able to refer to or quote the symbols in the caption
>>> or the main text- and latex symbols in the graphs would make this look
>>> a bit better.
>>> I've had a quick look at how the marker symbols are implemented, and
>>> it is my impression that it would be reasonably hard to implement a
>>> new symbol of choice. On the other hand, since I am already using
>>> latex to produce all the text in the graph, it seems it should be
>>> fairly straightforward (with some careful attention to the
>>> positioning...) to use the same text-drawing code which is used for
>>> the legend, axes labels etc, to put the markers on the plot.
>>> Is there any interest in this?
>>> Come build with us! The BlackBerry(R) 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!
>>> Matplotlib-devel mailing list
>> Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
> Come build with us! The BlackBerry(R) 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!
> Matplotlib-devel mailing list
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA