How to set LineStyle for matrix plotting?

22 Ansichten (letzte 30 Tage)
András am 5 Mai 2015
Kommentiert: András am 5 Mai 2015
I have a matrix that I would like to plot, but I would like each column to be plotted using a different LineStyle. To do so I set the Axes LineStyleOrder property to the desired value, then I set the NextPlot property to 'replacechildren', but for some reason all columns get the same (the first value in LineStyleOrder) LineStyle. I works well with ColorOrder, but not with LineStyles.
Anyone knows why, or how I should solve my problem?
Thanks in advance!

Akzeptierte Antwort

Michael Haderlein
Michael Haderlein am 5 Mai 2015
Bearbeitet: Michael Haderlein am 5 Mai 2015
It's not very intuitive, but that's the point (from here):
Axes increments the line style only after using all of the colors in the ColorOrder property .
Plus, you need to set hold all:
set(axes,'LineStyleOrder',{'-','--',':','-.'}') %create axes with respective LineStyleOrder
hold all %Prevent clearing LineStyleOrder
plot(1:3,bsxfun(@plus,rand(3,15),0:14)) %use it
(similar information is given in the help of the axes properties, here)
  3 Kommentare
András am 5 Mai 2015

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)


Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by