複数の x 軸と y 軸があるチャートのマーカー表示
Show older comments
複数の x 軸と y 軸があるチャートを作成した際に、描画コマンドとしてlineを使用しているのですが、線でしか表示されず、マーカーを表示させたいですが、エラーが出てしまい出来ない状態です。複数の x 軸と y 軸があるチャートを作成するためにはplotは使えないようなので困っています。
4 Comments
madhan ravi
on 18 Jul 2019
Could you upload your code?
riku
on 18 Jul 2019
madhan ravi
on 18 Jul 2019
Can you provide the missing variable datas too?
riku
on 18 Jul 2019
Accepted Answer
More Answers (1)
Etsuo Maeda
on 25 Jul 2019
Kazuyaさんに便乗しまして、plot関数を使った複数軸プロットの方法をご紹介しておきます。
プロット系の関数は実行時にaxesのプロパティをリセットしてしまいます。
予めNextPlotプロパティをreplacechildrenにしておくか、plotしてからaxesのプロパティを調整するようにしておけば、plot関数を使った複数軸プロットが実現できます。
ドキュメンテーション「グラフの Figure および座標軸の準備」

xL = 1:10;
yL = sin(xL);
xR = -xL;
yR = sin(xR);
f = figure;
axL = axes('Parent', f);
axL.NextPlot = 'replacechildren';
axL.XColor = 'b';
axL.YColor = 'b';
axL.Box = 'off';
axL.Color = 'g';
myPos = axL.Position;
axR = axes('Parent', f, 'Position', myPos);
axR.NextPlot = 'replacechildren';
axR.XColor = 'r';
axR.YColor = 'r';
axR.Box = 'off';
axR.XAxisLocation = 'top';
axR.YAxisLocation = 'right';
axR.Color = 'none';
hL = plot(axL, xL, yL, 'bo-', 'MarkerFaceColor', 'b', 'MarkerSize', 8);
hR = plot(axR, xR, yR, 'ro-', 'MarkerFaceColor', 'r', 'MarkerSize', 18);
legend([hL, hR], 'Left', 'Right')
HTH
Categories
Find more on Annotations 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!