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

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

How to plot a complicated 3D graph

Asked by John on 11 Jan 2012

Hi there,

I'm only new to matlab but I'm trying to plot a graph like this

http://img823.imageshack.us/img823/4365/deparr.jpg

I would appreciate any feedback, suggestions, advice on how you could achieve this

I have an array of arrival times and departure times.

x=load('arrivaltimes.txt'); y=load('departuretimes.txt');

Would I start off by plotting a histogram of departure times and arrival times. Then a scatter plot of arrival and departure times. And then some how make them 3D?

Thank you

0 Comments

John

Tags

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson on 11 Jan 2012

hist() calls bar() to create the plots. bar() creates a hggroup object whose children are patch objects, each of which has XData and YData properties defining where the patch should be drawn. Each of those patches will also have an empty ZData property.

You can play tricks such as grabbing the YData, setting the ZData to that, and setting the YData to an array of constant value.

For the scatter plot, use scatter3()

0 Comments

Walter Roberson

Contact us