Thread Subject: Wrap a plot?

Subject: Wrap a plot?

From: David Doria

Date: 4 Jun, 2008 18:35:10

Message: 1 of 3

I have values of x between 0 and 360 (angles). I have values
corresponding to those angles in y.

for example
x = [1 4.5 7 9.8];
y = [1 2 3 4];

I am interested in what happens at the 0/360 line, and now
those things are on opposite sides of the plot. I'd like to
have the plot like this

270....360/0...90

rather than

0....180....360

Is there a way to specify this in the plot properties?

Thanks,
Dave

Subject: Wrap a plot?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 4 Jun, 2008 19:04:40

Message: 2 of 3

In article <g26n8u$mhd$1@fred.mathworks.com>,
David Doria <daviddoria@gmail.com> wrote:
>I have values of x between 0 and 360 (angles). I have values
>corresponding to those angles in y.

>for example
>x = [1 4.5 7 9.8];
>y = [1 2 3 4];

>I am interested in what happens at the 0/360 line, and now
>those things are on opposite sides of the plot. I'd like to
>have the plot like this

>270....360/0...90

>rather than

>0....180....360

>Is there a way to specify this in the plot properties?

No. But you can

xph = x >= 270 & x < 360;
xpl = x >= 0 & x <= 90;
plot([x(xph),360+x(xpl)], y([xph xpl]) );

and then set the XTick to [270:step:450]
and set the XTickLabels to [270:step:360-step 0:step:90]
for appropriate step size.

--
Q: Why did the chicken cross the Mobius strip?

A: There were manifold reasons.

Subject: Wrap a plot?

From: us

Date: 4 Jun, 2008 19:09:02

Message: 3 of 3

"David Doria":
<SNIP axis acrobatics...

one of the solutions

% the data
     x=0:45:360;
     y=x+25*(rand(size(x))-.5);
     xc=270;
% the plot
     ix=find(x>=xc,1,'first'); % FP issues
     ix=[ix:numel(x),1:ix-1];
     plot(x,y(ix),'o-r');
     set(gca,...
        'xtick',x,...
        'xticklabel',x(ix));

us

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
indexing us 4 Jun, 2008 15:10:11
xticklabel us 4 Jun, 2008 15:10:11
xtick us 4 Jun, 2008 15:10:10
plot us 4 Jun, 2008 15:10:10
code us 4 Jun, 2008 15:10:10
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com