help-octave
[Top][All Lists]
Advanced

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

Re: extra tick marks at top x-axis: strategy?


From: Ben Abbott
Subject: Re: extra tick marks at top x-axis: strategy?
Date: Thu, 08 Sep 2011 12:39:11 -0400

On Sep 8, 2011, at 12:31 PM, indium wrote:

> On Thu, Sep 08, 2011 at 10:24:18AM -0400, Ben Abbott wrote:
>> 
>> On Sep 8, 2011, at 10:17 AM, indium wrote:
>> 
>>> Hi all,
>>> 
>>> I have attempted to add extra tick marks to a plot by adding another
>>> x-axis that is positioned on 'top'. But then the original plot is
>>> 'blanked' by the following plot command. I saw this because the second
>>> set of axes is not 'perfectly' overlapping with the first set (it quite
>>> far off, actually).
>>> 
>>> Is this the way to make these second sets of tick mark labels? I'd
>>> like to have for instance temperature on the x-axis on the bottom and
>>> inverse temperature tick marks on the top axis.
>>> 
>>> If so, how do I realign those two axes? I have set the 'position' of the
>>> two the same, but I think that due to margins needed for the labels,
>>> title, etc, the axes do not overlap.
>>> 
>>> many thanks for any suggestions!
>> 
>> To make the axis on top transparent set its color to "none", and its 
>> position to that of the bottom axis. The code below is untested, and ax_top 
>> and ax_bot refer to the handles for the top and bottom axes.
>> 
>>      set (ax_bot, "activepositionproperty", "position")
>>      set (ax_top, "position", get (ax_bot, "position"))
>>      set (ax_top, "color", "none")
>> 
>> Ben
>> 
>> 
> 
> okay, thanks! 
> for 'the record' I have put some commands together that work for me:
> 
> ax_bot=axes();                                                                
> ax_top=axes();
> set(ax_bot,'activepositionproperty','position')
> set(ax_top,'position',get(ax_bot,'position'))
> set(ax_top,'color','none')
> 
> x=1:10; y=sin(x) ; 
> plot(ax_bot,x,y)      % this will be in the standard color (blue)
> plot(ax_top,x,y,'or') % this will be red dots, associated with top axis
> 
> set(ax_top,'activepositionproperty','position')
> set(ax_top,'xaxislocation','top')
> 
> xtt=(0:3)*pi;
> xttl={'0','\pi','2\pi','3\pi'} % is \pi converted to the symbol?
> set(ax_top,'xtick',xtt)
> set(ax_top,'xticklabel',xttl)
> grid
> 
> 
> remarks:
> 1. In my case, \pi does not convert to the greek symbol.
> 2. Both 'activepositionproperty' settings are needed for aligment

I tried ...

plot (1:10)
xtt=(0:3)*pi;
xttl={'0','\pi','2\pi','3\pi'} % is \pi converted to the symbol?
set(gca,'xtick',xtt)
set(gca,'xticklabel',xttl)
grid

... and see the expected result (\pi is converted to the Greek symbol)

Is the axis "interperter" property set to "tex"?

Ben




reply via email to

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