グラフにユーザー独自の線種を用いることはできますか?
4 views (last 30 days)
Show older comments
PLOT などでグラフを描画する際に、既存以外の線種を使用する方法を教えてください。既存の線種として、実線/破線/点線/鎖線 の4種類がありますが、一点長鎖線など他の線種を使用する方法を教えてください。
Accepted Answer
MathWorks Support Team
on 16 Dec 2010
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 Comments
More Answers (0)
See Also
Categories
Find more on ライン プロット in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!