How to plot solid and dashed lines?
조회 수: 1,214 (최근 30일)
이전 댓글 표시
I want to plot a graph with a dashed and a solid line. Therefore, I use the script "subplot(221); spm1d.plot.plot_meanSD(Y0, 'color','k','--'); hold on ; spm1d.plot.plot_meanSD(Y1, 'color','r','-');"
However, I always get the following error: "Error using spm1d.plot.plot_meanSD (line 12) '--' is not a recognized parameter".
How can I plot it correctly?
댓글 수: 3
J. Alex Lee
2019년 12월 24일
or to more closely align with original attempts
plot(x,y,'Color','k','LineStyle','--')
so "LineStyle" is the parameter you want to have the value "--"
Image Analyst
2019년 12월 24일
편집: Image Analyst
2019년 12월 24일
Can you transfer your "Comments" to the official "Answers" section down below? You'll be able to earn reputation points down there, but not if they're just up here as a Comment (usually meant for asking for more clarification from the original poster).
채택된 답변
J. Alex Lee
2020년 1월 6일
You need to precede the linestyle you want with the keyword 'LineStyle'
plot(x,y,'Color','k','LineStyle','--')
so "LineStyle" is the parameter you want to have the value "--"
Darova's answer is the typical shorthand for combining linestyle and color into a single key-less option, which has to be the 3rd argument (or 2nd, if there's not 1st argument, I think).
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!