Adding Greek Characters To Plots

David Bateman dbateman at dbateman.org
Wed Oct 15 14:57:54 CDT 2008


Ben Abbott wrote:
> On Wednesday, October 15, 2008, at 02:39PM, "John W. Eaton" <jwe at bevo.che.wisc.edu> wrote:
>> 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).

I can't test this at the moment, but is it really the compatible 
behavior? The "Right (TM)" way to do this would be to replace 
[x|y|z]ticklabel with a text object in the same manner as [x|y|z]label 
of the axes are. However, that certainly isn't compatible.

I also don't think its a good idea to include a an interpreter property 
in the axes object itself..

Maybe a reasonable hack would be just to assume that the interpreter 
property for the ticks are set to "tex" and munge the text for the ticks 
with

for i = 1 : numel(labels)
  labels{i} = __tex2enhanced__ (labels{i}, "Helvetica", false, false);
endfor

at the appropriate place in "__go_draw_axes__.m (do_tics_1)".

D.


-- 
David Bateman                                dbateman at dbateman.org
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)


More information about the Help-octave mailing list