[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LaTeX codes in plot text (titles, labels, etc.)

From: Jonathan Shea
Subject: Re: LaTeX codes in plot text (titles, labels, etc.)
Date: Tue, 20 Feb 2007 04:31:56 -0500

On Feb 20, 2007, at 2:23 AM, address@hidden wrote:

In Matlab you can add special characters (such as Greek variables) to
plots using LaTeX codes - for example if you want the character for pi,
you could type \pi and the character would show up.

I know that something similar exists in Octave if you set gnuplot to an
enhanced mode.  We can get the character for pi by typing {/Symbol p}

I'm with you!

If you're not afraid of dirty, dirty, hacks then I wrote a function which takes a string, and replaces any LaTeX commands it finds with the corresponding gnuplot symbol. It's not much, but it saves time looking up symbols. Gnuplot's enhanced modes already treat ^, _, and curly braces like LaTeX.

You can find the code on my homepage:

I think when I wrote this function I intended it to have a sprintf built in for formating, but when I ran it just now I got an error on all_va_args, which I assume has been deprecated or replaced.

This function was inspired by an analogous (but much more complete) parser Matt Craig wrote in IDL, for IDL.

Good luck,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]