From: George on
I've searched through the documentation on the axes properties and i can't seem to find anything that will allow me to label the X axes (bottom and top) with its respective labeling and the Y axes (left and right) with its respective labeling.
For example, say the X axis is labeled 0 to 100 and the Y axis is labeled 0 to 300. I need to have those labels on both sides...so, X's values on the bottom and top, and Y's values on the left and right.

I have tried using this code below for the axes called A2 and the labels only show up on the later axis location, not both locations.

set(A2,'XAxisLocation','bottom','YAxisLocation','left');
set(A2,'XLim',[xmin xmax]);
set(A2,'YLim',[ymin ymax]);
hold(A2,'on')
set(A2,'XAxisLocation','top','YAxisLocation','right');
set(A2,'XLim',[xmin xmax]);
set(A2,'YLim',[ymin ymax]);

There has to be a way to do this. I apologize if it is something trivial. thank you.
From: us on
"George " <tua16365(a)temple.edu> wrote in message <i39c94$hjb$1(a)fred.mathworks.com>...
> I've searched through the documentation on the axes properties and i can't seem to find anything that will allow me to label the X axes (bottom and top) with its respective labeling and the Y axes (left and right) with its respective labeling.
> For example, say the X axis is labeled 0 to 100 and the Y axis is labeled 0 to 300. I need to have those labels on both sides...so, X's values on the bottom and top, and Y's values on the left and right.
>
> I have tried using this code below for the axes called A2 and the labels only show up on the later axis location, not both locations.
>
> set(A2,'XAxisLocation','bottom','YAxisLocation','left');
> set(A2,'XLim',[xmin xmax]);
> set(A2,'YLim',[ymin ymax]);
> hold(A2,'on')
> set(A2,'XAxisLocation','top','YAxisLocation','right');
> set(A2,'XLim',[xmin xmax]);
> set(A2,'YLim',[ymin ymax]);
>
> There has to be a way to do this. I apologize if it is something trivial. thank you.

one of the solutions

plot(1:10);
ah=copyobj(gca,gcf);
set(ah,'xaxislocation','top','yaxislocation','right');

us
From: Jan Simon on
Dear us,

> plot(1:10);
> ah=copyobj(gca,gcf);
> set(ah,'xaxislocation','top','yaxislocation','right');

And:
set(ah, 'color', 'none');
Otherwise the lower axes is concealed.

Kind regards, Jan

PS. Of course I've thought twice before posting this.
From: George on
"us " <us(a)neurol.unizh.ch> wrote in message
> one of the solutions
>
> plot(1:10);
> ah=copyobj(gca,gcf);
> set(ah,'xaxislocation','top','yaxislocation','right');
>
> us

That does work, however it creates a problem in my GUI.

I have an underlying matrix of data that is plotted on an axes, then a transparent axes (A2) plotted on top of the data. A user can draw lines on this transparent axes to collect data points from the underlying matrix. Using the copyobj to make a new axes layer gets in the way of the drawing mechanism.

I tried using the axes 'Layer' property to see if i could push the new axes (ah) beneath the other axes, but it did not work.
From: Jan Simon on
Dear George,

> I have an underlying matrix of data that is plotted on an axes, then a transparent axes (A2) plotted on top of the data. A user can draw lines on this transparent axes to collect data points from the underlying matrix. Using the copyobj to make a new axes layer gets in the way of the drawing mechanism.

You can set the 'HandleVisibility' of the copied axes object to 'off'. Then this axes does not get the user's input, but is visible and shows the additional tick labels.

Kind regards, Jan
 |  Next  |  Last
Pages: 1 2
Prev: Excel Question
Next: Contour in a 3D domain