グラフにユーザー独自​の線種を用いることは​できますか?

4 次查看(过去 30 天)
MathWorks Support Team
PLOT などでグラフを描画する際に、既存以外の線種を使用する方法を教えてください。既存の線種として、実線/破線/点線/鎖線 の4種類がありますが、一点長鎖線など他の線種を使用する方法を教えてください。

采纳的回答

MathWorks Support Team
MATLAB では線種に実線/破線/点線/鎖線 の4種類のみ用いることができます。
回避方法として、PLOT を用いて線種を定義してください。下記例では '|' を実現しています。
function h = plotbar(x,y)
x = x(:);
y = y(:);
newx = zeros(1,length(x)*3);
newx(1:3:end) = x;
newx(2:3:end) = x;
newx(3:3:end) = nan;
newy = zeros(1,length(y)*3);
newy(1:3:end) = y;
newy(2:3:end) = y+((max(y)-min(y))/20);
newy(3:3:end) = nan;
h = plot(newx,newy);
上記関数を使用する例が以下になります。
plotbar(1:10,1:10);
plotbar(rand(10),rand(10));
plotbar(magic(5),inv(magic(5)));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 ライン プロット 的更多信息

Community Treasure Hunt

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

Start Hunting!