Adding Greek Characters To Plots

Ben Abbott bpabbott at mac.com
Wed Oct 15 13:48:02 CDT 2008


On Wednesday, October 15, 2008, at 02:39PM, "John W. Eaton" <jwe at bevo.che.wisc.edu> wrote:
>On 15-Oct-2008, Ben Abbott wrote:
>
>| On Wednesday, October 15, 2008, at 12:03PM, "Thomas Markovich" <thomasmarkovich at gmail.com> wrote:
>| >Hi,
>| >
>| >So I have a few different parts of the various plots that I am trying  
>| >label with greek characters. The first is, I would like my tick marks  
>| >to be at every pi/2 but obviously, I would like the pi symbol. I have  
>| >found the command set(gca,'xtick',-2*pi:pi/2:2*pi) and  
>| >set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'})
>| >, however this only gives the numbers and no symbols.
>| >
>| >Also, I would like to set an axis label for Y that is f(phi) and for  
>| >X, phi. Additionally, I would like to label my graphs with V(phi) for  
>| >one and \Psi_{1+} for the other. I have found the command
>| >xlabel()
>| >ylabel() But I can't figure out this one either.
>| >
>| >Regards,
>| >
>| >Thomas Markovich
>| >thomasmarkovich at gmail.com
>| 
>| To do this in Matlab
>| 
>|   set (gca, 'fontname', 'symbol')
>| 
>| My octave does not support that behavior which may be a problem local to my computer (?).
>
>The following works for me with the current development sources:
>
>  axis ([-pi, pi, 0, 1]);
>  set (gca, 'fontname', 'symbol')
>  set (gca, 'xtick', [-pi, -pi/2, 0, pi/2, pi])
>  set (gca, 'xticklabel', {'-p', '-p/2', '0', 'p/2', 'p'})
>
>and I think this is compatible behavior.  However, it does not seem
>like a good general solution to me as I don't see how you would mix
>symbol and non-symbol 'p' this way.  Also, shouldn't we be able to use
>TeX notation in the tick labels to avoid that problem?  That doesn't
>work for me.
>
>jwe

I agree it is compatible behavior. Unfortunately for me, my gnuplot doesn't handle the symbol font correctly.

I also agree it is not a good solution. Do you suggest we deviate from Matlab's approach? ... perhaps we should add an "interpreter" property to the axes? (that it is missing in Matlab is a long frustration for me).

Ben





More information about the Help-octave mailing list