How to plot solid and dashed lines?

567 ビュー (過去 30 日間)
Stefan Vermeulen
Stefan Vermeulen 2019 年 12 月 24 日
回答済み: Nikita 2024 年 12 月 24 日
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
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
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
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).

その他の回答 (1 件)

Nikita
Nikita 2024 年 12 月 24 日
plot(x,y,"--")

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by