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:
Plotting a 3-D line plot with user defined axis.

Subject: Plotting a 3-D line plot with user defined axis.

From: CNN

Date: 10 May, 2010 10:20:23

Message: 1 of 3

I have the x, y and z coordinates of a particle at different times in a matrix and I plotted them on a graph

plot3(point(:,1),point(:,2),point(:,3))

However, I need the x and z axis to switch positions i.e. the x axis should be the vertical one while the z axis the right hand axis. Is there a way to write a code to do this? The above code is in an m-file and I want to add that option to the file.

Subject: Plotting a 3-D line plot with user defined axis.

From: Joshua Arnott

Date: 10 May, 2010 10:28:06

Message: 2 of 3

"CNN " <cnln2000@yahoo.co.uk> wrote in message <hs8ml7$r3$1@fred.mathworks.com>...
> I have the x, y and z coordinates of a particle at different times in a matrix and I plotted them on a graph
>
> plot3(point(:,1),point(:,2),point(:,3))
>
> However, I need the x and z axis to switch positions i.e. the x axis should be the vertical one while the z axis the right hand axis. Is there a way to write a code to do this? The above code is in an m-file and I want to add that option to the file.

swapAxis = true; % modify to suit
if(swapAxis)
    plot3(point(:,3),point(:,2),point(:,1))
else
    plot3(point(:,1),point(:,2),point(:,3))
end

Do I misunderstand?

J.

Subject: Plotting a 3-D line plot with user defined axis.

From: CNN

Date: 10 May, 2010 15:47:18

Message: 3 of 3

"Joshua Arnott" <j.arnott@lancs.ac.uk.matlab> wrote in message <hs8n3m$t48$1@fred.mathworks.com>...
> "CNN " <cnln2000@yahoo.co.uk> wrote in message <hs8ml7$r3$1@fred.mathworks.com>...
> > I have the x, y and z coordinates of a particle at different times in a matrix and I plotted them on a graph
> >
> > plot3(point(:,1),point(:,2),point(:,3))
> >
> > However, I need the x and z axis to switch positions i.e. the x axis should be the vertical one while the z axis the right hand axis. Is there a way to write a code to do this? The above code is in an m-file and I want to add that option to the file.
>
> swapAxis = true; % modify to suit
> if(swapAxis)
> plot3(point(:,3),point(:,2),point(:,1))
> else
> plot3(point(:,1),point(:,2),point(:,3))
> end
>
> Do I misunderstand?
>
> J.

Hi,
The code didn't work. I need the x values to plot along the vertical axis. The code didn't change anything.

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