Search All of the Math Forum:

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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

 Messages: [ Previous | Next ]
 Steven Lord Posts: 18,038 Registered: 12/7/04
Re: LineStyleOrder for plot3 function
Posted: Aug 6, 2013 12:25 PM

"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.
>

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