I have a code which goes like this:
clear;clc;close all;
x1=(linspace(1,3,1800))';
y1=(linspace(1,2,1800))';
y2=(linspace(2,3,1800))';
y3=(linspace(3,4,1800))';
y4=(linspace(4,5,1800))';
y5=(linspace(5,6,1800))';
y6=(linspace(6,7,1800))';
y7=(linspace(7,8,1800))';
y8=(linspace(8,9,1800))';
y9=(linspace(9,10,1800))';
plot(x1,y1,x1,y2,'--',x1,y3,':',x1,y4,'-.',x1,y5,x1,y6,x1,y7,x1,y8,x1,y9,'LineWidth',2)
As one can see from the plot, nine lines are there. Matlab gives variety of coloring option, but as far as line style is concerned, one can have only 4 options: -, --, : and :. . How can i increase this options?? I have to emphasis that I would NOT like to have markers in the plot.
I have generated the same plots on Grapher software, where once have variety of options. For instance, see the figure below. This has been made with following line options: Solid, 0.1 inch dash, 0.3 inch dash, 0.5 inch dash, Dash dot, Dash dot dot, Dash dot dot dot, Dash Dash dot dot, Dash Dash dot dot dot.
How can one plot like this??? A hint lies at this link.
Thanks in advance...

댓글 수: 2

HiWave
HiWave 2020년 3월 12일
I've wondered this for years. How can Matlab have such a poor selection of linestyles?
Zhibin Deng
Zhibin Deng 2020년 4월 27일
Same here. Even in MATLAB 2019, there are only FOUR line styles.
I'm wondering whether it is too difficult to add some line styles for MATHWORKS?

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2020년 3월 12일
편집: Walter Roberson 2021년 8월 12일

0 개 추천

댓글 수: 5

Sreeraj T
Sreeraj T 2020년 3월 12일
But how to incorporate hold on command?
Walter Roberson
Walter Roberson 2020년 3월 12일
In your original code you do not need hold: the form of plot() you used with multiple x y lists will automatically hold after the first data is drawn and restore the hold state after the last one in the list.
In general you just use hold on after the initial graphics command and use hold off when you have reached the end of the graphics commands.
Thanks for the suggesion. I understood your point. But, even with the modiifcation as described as follows,
figure(1)
plot(x1,y1,x1,y2,'--',x1,y3,':',x1,y4,'-.',x1,y5,x1,y6,x1,y7,x1,y8,x1,y9,'LineWidth',2)
figure(2)
dashline(x1,y1,'-.r',3,'.g',6)
hold on
dashline(x1,y2,'-.r',3,'.g',6)
I am not able to get the desired plot. Seems like only
dashline(x1,y1,'-.r',3,'.g',6)
is getting executed. What am I doing wrong?
Walter Roberson
Walter Roberson 2020년 3월 13일
Can you attach some sample data for testing?
Sreeraj T
Sreeraj T 2020년 3월 13일
y1, y2, y3, ... are all listed in the above main program.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

madhan ravi
madhan ravi 2018년 10월 23일
편집: madhan ravi 2018년 10월 23일

0 개 추천

plot(x,y,'-','LineWidth',10)

댓글 수: 4

madhan ravi
madhan ravi 2018년 10월 23일
편집: madhan ravi 2018년 10월 23일
Didn’t read your NoT marker part , okay use linewidth with varying sizes
h=plot(x1,y1,x2,y2,'LineWidth',8);
set(h(1),'linewidth',5);
set(h(2),'linewidth',10);
madhan ravi
madhan ravi 2018년 10월 23일
you could also try above example using Linewidth
Sreeraj T
Sreeraj T 2018년 10월 23일
Thanks for the effort, but I want it in the same form as i asked in the question. A plot with this much thickness does not look good in paper.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

릴리스

R2017b

태그

질문:

2018년 10월 23일

편집:

2021년 8월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by