グラフにユーザー独自の線種を用いることはできますか?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
PLOT などでグラフを描画する際に、既存以外の線種を使用する方法を教えてください。既存の線種として、実線/破線/点線/鎖線 の4種類がありますが、一点長鎖線など他の線種を使用する方法を教えてください。
Réponse acceptée
MathWorks Support Team
le 16 Déc 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur ライン プロット dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!