Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: LineStyleOrder for plot3 function
Replies: 2   Last Post: Aug 13, 2013 11:47 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: LineStyleOrder for plot3 function
Posted: Aug 6, 2013 12:25 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"OoM " <pinyim@fiu.edu> wrote in message
news:ktr4m6$ist$1@newscl01ah.mathworks.com...
> Hi,
>
> I have a question about how to use LineStyleOrder for plot3
> I have C1 = cell (3,100); C2 = cell (2,100:);
>
> Then I used
> figure ('Color',[1 1 1]);
> markers = { '+', 'o', '*', '.', 'x', 's', 'd', '^', 'v', '>', '<', 'p',
> 'h'};
> set ( gca(), 'LineStyleOrder', markers, 'NextPlot', 'replacechildren')
> plot3 (C1{:})


I'm assuming you add data into C1 before this line.

> grid on
> box on
>
> figure ('Color',[1 1 1]);
> markers = { '+', 'o', '*', '.', 'x', 's', 'd', '^', 'v', '>', '<', 'p',
> 'h'};
> set ( gca(), 'LineStyleOrder', markers, 'NextPlot', 'replacechildren')
> plot (C2{:})
> grid on
>
> I got 2 graphs in 2D. I am doubt why I cannot plot C1 in 3D with
> LineStyleOrder.
> If I only use plot3 (C1{:}), the graph came out fine in 3D.
>
> Please help. Thank you very much.


The problem has nothing to do with LineStyleOrder. The problem does have to
do with this line of code, though.

> set ( gca(), 'LineStyleOrder', markers, 'NextPlot', 'replacechildren')

http://www.mathworks.com/help/matlab/ref/axes_props.html#NextPlot

"replacechildren ? Remove all child objects, but do not reset axes
properties (equivalent to cla)."

In particular, the properties of the axes that control how the axes is
viewed will not be reset by PLOT3. Since GCA creates an axes in the default
2-D view if one does not already exist, and you've forbidden PLOT3 to
automatically reset that view, your plot "appears" 2-D. But you can change
that.

http://www.mathworks.com/help/matlab/ref/view.html

Either:

ax = axes;
view(3)
set(ax, 'LineStyleOrder', ...

or:

set(gca, 'LineStyleOrder', ...
view(3)
plot3(C1(:))

should work. With NextPlot set to 'replacechildren', plot functions will not
automatically reset properties. But you can still explicitly change those
properties and VIEW is the recommended way to change the properties related
to the axes view.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.