[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tick label format and color
From: |
Pantxo |
Subject: |
Re: Tick label format and color |
Date: |
Fri, 29 Jan 2016 06:33:30 -0800 (PST) |
oxyopes wrote
> Hi all,
>
> i could not find a straightforward manner of setting the tick label
> format (to, say '%.2f').
>
> I also would like to change the color of only the ytick labels and of
> the Ylabel to blue.
>
> The axes themselves and and the ytick labels should remain black.
>
> Can anyone help me on that?
>
> Thx a lot in advance!
>
> _______________________________________________
> Help-octave mailing list
> Help-octave@
> https://lists.gnu.org/mailman/listinfo/help-octave
Hi,
For your first request you could try:
plot (1:.01:1.2)
yticks = get (gca, "ytick");
ylabels = arrayfun (@(x) sprintf ("%.2f", x), yticks, "uniformoutput",
false);
set (gca, "yticklabel", ylabels)
Now changing the color of labels without changing the corresponding axes
color is not possible to my knowledge. The tex interpreter doesn't work for
labels in Octave 4.0 but will in 4.2. You will then be able to use tex
markup:
...
ylabels = arrayfun (@(x) sprintf ("\\color{red}{%.2f}", x), yticks,
"uniformoutput", false);
set (gca, "yticklabel", ylabels)
Pantxo
--
View this message in context:
http://octave.1599824.n4.nabble.com/Tick-label-format-and-color-tp4674571p4674573.html
Sent from the Octave - General mailing list archive at Nabble.com.