help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting grid with personalized scale


From: Ben Abbott
Subject: Re: Setting grid with personalized scale
Date: Wed, 25 Nov 2009 12:50:12 -0500

On Wednesday, November 25, 2009, at 09:28AM, "Renato S. Yamane" 
<address@hidden> wrote:
>On 25-11-2009 10:07, Ben Abbott wrote:
>> On Nov 25, 2009, at 5:45 AM, Renato S. Yamane wrote:
>>> I'm using semilogx to generate my graph, but I would like to get a
>>> x-axis like this:
>>> <http://www.elitebastards.com/hanners/auzentech/forte/charts/rmaa/noise96.png>
>>>
>>> But octave is generating a x-axis with grids 10, 100, 1000, 10000, 100000.
>>>
>>> Is possible personalize the grid?
>>
>> Does this do what you need?
>>
>> clf
>> x = 1:1000;
>> semilogx (x, sqrt(x))
>> a = [1, 2, 3, 5];
>> xtick = [a, 10*a, 100*a, 1000];
>
>So, xtick is:
>1, 2, 3, 5, 10, 20, 30, 50, 100, 200, 300, 500, 1000
>
>> set (gca, 'xtick', xtick)
>
>What it does?
>
>> set (gca, 'xticklabel', 
>> {'1','2','3','5','10','20','30','50','100','200','300','500','10k'})
>
>So sorry for this questions, I did it because I try change somethings in 
>your suggestion but it don't work...
>
>Like this:
>- X-axis:
>20, 30, 50, 100, 200, 300, 500, 1k, 2k, 3k, 5k, 10k, 20k
>
>Regards,
>Renato

The "xtick" axis property defines where the tick marks are to be placed for the 
x-axis.

The "xticklabel" property defines the text lables for each x-axis tick mark.

For your example, try

set (gca, "xtick", [20, 30, 50, 100, 200, 300, 500, 1000, 2000, 3000, 5000, 
10000, 20000]);
set (gca, "xticklabel", {"20", "30", "50", "100", "200", "300", "500", "1k", 
"2k", "3k", "5k", "10k", "20k"]);

If that doesn't work, tell us what version of octave you are running. You'll 
need to be running 3.2.x for this to work.

Ben





reply via email to

[Prev in Thread] Current Thread [Next in Thread]