[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gset format x "%.1f"
From: |
Henry F. Mollet |
Subject: |
Re: gset format x "%.1f" |
Date: |
Wed, 31 Mar 2010 19:25:13 -0700 |
User-agent: |
Microsoft-Entourage/11.1.0.040913 |
on 3/30/10 7:44 PM, Henry F. Mollet at address@hidden wrote:
> I'd like the same format for the xticks on the x axis.
> E.g. 0.0, 0.2,...1.0, 1.2 *not* *0*, 0.2, .... *1*, 1.2
> In an earlier version of Octave I used
> gset format x "%.1f"
> to accomplish this. I searched with google and MATLAB site but could not
> find the solution.
>
> I had no luck with the following and I don't understand the formats that
> appear. My plot shows the x-axis from 0 to 1.2 whereas get (gca, 'Xtick')
> only goes from 0.0000 to 1.0000 and showing a different format. After
> defining the xticks I want (again getting an unexpected different format in
> 'answer') and then setting them, the x ticks disappear on the plot. When I
> call my script again, the xticks appear again in the original form.
>
> octave-3.2.2:55> Xticks = get (gca, 'Xtick')
> Xticks =
>
> 0.00000 0.20000 0.40000 0.60000 0.80000 1.00000
>
> octave-3.2.2:56> Xticks = 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2
> Xticks = 0
> ans = 0.20000
> ans = 0.40000
> ans = 0.60000
> ans = 0.80000
> ans = 1
> ans = 1.2000
> octave-3.2.2:57> set (gca, 'Xtick', Xticks)
> octave-3.2.2:58> ScrTriLHTFig100OnlyMar2010Oct322
>
> Is there an easy way to accomplish this task, similar to the
> old gset format x "%.1f"
> Henry
>
Correcting an error but problem remains.
There was an error when trying to change Xticks. It should have used
Xticks = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2] % Brackets were missing
But this will not change the format on the graph. It still is 0 and 1
instead of 0.0 and 1.0 that I would prefer. Apparently, using
Xticks = get (gca, 'Xtick') is not the way to accomplish uniform formatting
on the x-axis (or any axis for that matter).
Henry