Axes Label Question

  • Follow


Hi,

So this should be simple for someone to answer, I have looked through the information on axes and not quite found what I am looking for.

I produce a plot with imagesc, which works well. So let us imagine that my x and y values go from 0 to 100. On the x and y axes then, it says that they go from 0 to 100, which makes perfect sense. How do I make it such that the x axes label says it goes from say 0 to 200 (even though it does not) and maybe the y label says it goes from -50 to 50. Does that make sense?

Thank you,
Michael
0
Reply Michael 5/13/2010 7:35:21 PM

Michael Coughlin
Look up ticks in the help and you'll find info, plus this example:

x = -pi:.1:pi;
y = sin(x);
plot(x,y)
set(gca,'XTick',-pi:pi/2:pi)
set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'})
0
Reply ImageAnalyst 5/13/2010 7:54:06 PM


ImageAnalyst <imageanalyst@mailinator.com> wrote in message <5f9c658f-c570-4c01-b9c5-4bcb27d8a4b9@k2g2000yqe.googlegroups.com>...
> Michael Coughlin
> Look up ticks in the help and you'll find info, plus this example:
> 
> x = -pi:.1:pi;
> y = sin(x);
> plot(x,y)
> set(gca,'XTick',-pi:pi/2:pi)
> set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'})

A possibly simpler solution is to call imagesc with the axes arguments, so Matlab can handle the axes in the normal way...
>> imagesc(xticks,yticks,im)

imagesc() is essentially equivalent to image(), so you can see the actual documentation for it with
>> help image 
0
Reply Alan 5/13/2010 8:38:04 PM

Hi,

That works very well! One last question: the y axis has its values inverted whether I flip the y vector values or not. Is there a way to turn on ascending or descending order to force it to do it one way?

Michael

"Alan B" <monguin61REM@OVETHIS.yahoo.com> wrote in message <hshnvc$g75$1@fred.mathworks.com>...
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message <5f9c658f-c570-4c01-b9c5-4bcb27d8a4b9@k2g2000yqe.googlegroups.com>...
> > Michael Coughlin
> > Look up ticks in the help and you'll find info, plus this example:
> > 
> > x = -pi:.1:pi;
> > y = sin(x);
> > plot(x,y)
> > set(gca,'XTick',-pi:pi/2:pi)
> > set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'})
> 
> A possibly simpler solution is to call imagesc with the axes arguments, so Matlab can handle the axes in the normal way...
> >> imagesc(xticks,yticks,im)
> 
> imagesc() is essentially equivalent to image(), so you can see the actual documentation for it with
> >> help image 
0
Reply Michael 5/14/2010 12:39:04 AM

On May 13, 8:39=A0pm, "Michael Coughlin" <cough...@carleton.edu> wrote:
> Hi,
>
> That works very well! One last question: the y axis has its values invert=
ed whether I flip the y vector values or not. Is there a way to turn on asc=
ending or descending order to force it to do it one way?
>
> Michael
---------------------------------------------------------------------------=
-
from the help on axes properties:

XDir, YDir, ZDir

    {normal} | reverse

    Direction of increasing values. A mode controlling the direction
of increasing axis values. Axes form a right-hand coordinate system.
By default,

        *

          x-axis values increase from left to right. To reverse the
direction of increasing x values, set this property to reverse.

          set(gca,'XDir','reverse')

        *

          y-axis values increase from bottom to top (2-D view) or
front to back (3-D view). To reverse the direction of increasing y
values, set this property to reverse.

          set(gca,'YDir','reverse')

        *

          z-axis values increase pointing out of the screen (2-D view)
or from bottom to top (3-D view). To reverse the direction of
increasing z values, set this property to reverse.

          set(gca,'ZDir','reverse')
0
Reply ImageAnalyst 5/14/2010 12:46:05 AM

4 Replies
318 Views

(page loaded in 0.064 seconds)


Reply: