Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Deleting part of a figure

Subject: Deleting part of a figure

From: CNN

Date: 6 Aug, 2010 20:38:04

Message: 1 of 3

I have 3 figures with the x values ending in 200, 6000 and 2000. I need to do a comparison so I need to cut figures 2 and 3 so that they too end after 200. Is there a way of doing this that will not require me re-plotting the graphs? Maybe a code that will get the values from 0-200 after cutting the graph and displaying it in a new figure?
Thank you.

Subject: Deleting part of a figure

From: the cyclist

Date: 6 Aug, 2010 20:49:04

Message: 2 of 3

"CNN " <cnln2000@yahoo.co.uk> wrote in message <i3hrrc$ft5$1@fred.mathworks.com>...
> I have 3 figures with the x values ending in 200, 6000 and 2000. I need to do a comparison so I need to cut figures 2 and 3 so that they too end after 200. Is there a way of doing this that will not require me re-plotting the graphs? Maybe a code that will get the values from 0-200 after cutting the graph and displaying it in a new figure?
> Thank you.

I am not entirely sure I understand what it is you wish to do. However, it sounds to me like you just want to change the axis limits, which you can do with the command

>> set(gca,'XLim',[0 200])

"gca" is short-hand for "get current axis" (if I recall correctly), and will work if you just drew that set of axes. If you haven't, then look for help on "handle graphics".

the cyclist

Subject: Deleting part of a figure

From: Jan Simon

Date: 6 Aug, 2010 20:51:04

Message: 3 of 3

Dear CNN,

> I have 3 figures with the x values ending in 200, 6000 and 2000. I need to do a comparison so I need to cut figures 2 and 3 so that they too end after 200. Is there a way of doing this that will not require me re-plotting the graphs? Maybe a code that will get the values from 0-200 after cutting the graph and displaying it in a new figure?

Do you mean "figures" or "axes"? You can limit the displayed range of an AXES object by using:
  set(AxesHandle, 'XLim', [0, 200]);
You can do this manually by using the menu Edit->Axes Properties also.

Kind regards, Jan

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us