help-octave
[Top][All Lists]
Advanced

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

Re: secondary x axis


From: Ben Abbott
Subject: Re: secondary x axis
Date: Mon, 08 Apr 2013 08:15:29 -0400

On Apr 8, 2013, at 4:33 AM, Jan Potac wrote:

> Trying to plot a figure with additional x axis on the top of the figure. 
> (x-axis2 = f(x-axis1))
> I have found some example but getting plots bit offset. It seems the cause is 
> the top x label which 'pushes' the second plot to move down due to keeping 
> some space from bounding box or window size. (if my observation correct)
> I have been searching for some set () parameter but not succeeded yet.
> Any hint, please?
> 
> My code looks like:
> f5 = figure(5, "visible", "on");
> %x values in radians
> hold 'on';
> x = [0:0.1:6.3];
> %y values values
> y=sin(x);
> %x values in degrees
> x2=180/pi()*(x);
> %means each new graph destroys the previous(overlay mode off)
> plot(x, y);
> hold 'off';
> %attach the current axes (gca) to handle "axes1"
> axes1=gca;
> %ensure x axis at bottom
> %see "get(axes1)" for additional properties
> %see "set(axes1)" for properties which can be altered
> set(axes1, 'XAxisLocation',  'bottom');
> %overlay mode on
> hold 'on';
> %add additional axes
> axes;
> plot(x2, y);
> axes2=gca;
> %ensure x axis at top
> set(axes2, 'XAxisLocation',  'top' );
> %make different intervals
> set(axes2, 'XTick', [x2(1):75:x2(length(x2))] );
> %overlay off
> hold 'off';
> 
> Regards,
> Jan

Does the attached do what you want?

I've changed the "activepostionproperty", set the "color" of the second axis to 
"none", removed the yaxis tick labels for the second axes and eliminated all 
plot objects from the second axes.

Ben

Attachment: jan_potac.m
Description: Binary data





reply via email to

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