help-octave
[Top][All Lists]

## Re: Exponential notation in tick labels?

 From: Carlo de Falco Subject: Re: Exponential notation in tick labels? Date: Wed, 9 Sep 2009 14:10:26 +0200

```2009/9/9 Matthias Brennwald <address@hidden>:
> Dear all
>
> I'm sure this has been discussed before, but I couldn't find anything
> (maybe I did not chose the right search terms). I'd like to use
> exponential notation for tick-mark labels in plots. For instance "plot
> ([0:1e4:1E6])" yields a plot with y-axis labels 0, 200000, 400000,
> 600000, 700000, 1e+6. I'd like these to be 0, 2e5, 4e5, 6e5, 8e5, 1e6.
> Or, even better, 0, 2x10^5, 4x10^5,..., 10^6. How can I achieve this?

octave-3.2.2:40> plot ([0:1e2:1e6])
octave-3.2.2:41> xt = get(gca, 'xtick');
octave-3.2.2:42> yt = get(gca, 'ytick');
octave-3.2.2:43> set(gca, 'xticklabel', sprintf('%1.1e|', xt));
octave-3.2.2:44> set(gca, 'yticklabel', sprintf('%1.1e|', yt));

HTH,
c.

> Matthias
>
> ----
> Matthias Brennwald
> Eawag, CH-8600 DÃ¼bendorf
> Office Eawag BU-C08: +41 44 823 53 05
> Lab Eawag LA-C76: +41 44 823 53 06
> Lab ETHZ CLA A31.6: +41 632 09 36/39
>
>
> _______________________________________________
> Help-octave mailing list