Borrar filtros
Borrar filtros

tiledlayou​tにおける第2軸を含​むプロットが表示され​ません

2 visualizaciones (últimos 30 días)
SHromaneko
SHromaneko el 31 de Ag. de 2022
Respondida: SHromaneko el 1 de Sept. de 2022
tiledlayoutの2つ目のグラフに第2軸を指定しようとしているのですが、グラフが表示されません。
どのように指定すればよろしいでしょうか?
time = 1:1200;
cal = time.^2;
tiledlayout(2,1)
nexttile
plot(time,cal)
hold on
plot(time,cal*2)
grid on
hold off
xlabel("time")
ylabel("sum")
legend(["cal1" "cal2"],"Location","northwest");
grid on
%2つ目のプロット
nexttile;
plot(time,cal*8)
hold on
plot(time,cal*6)
xlabel("time s")
ylabel("sum")
yyaxis("right")
plot(incatime,deactivateidx)
legend(["cal1" "cal2" "cal3"],"location","southeast")
ax = gca;
ax.YAxis(2).Color = [0 0 0];
grid on
yyaxis right
cla
cla reset
hold off
  1 comentario
Kojiro Saito
Kojiro Saito el 31 de Ag. de 2022
コードをそのまま実行するとincatimeが定義されていないというエラーは出ますが、2つ目のプロットの右軸は表示されました。
time = 1:1200;
cal = time.^2;
tiledlayout(2,1)
nexttile
plot(time,cal)
hold on
plot(time,cal*2)
grid on
hold off
xlabel("time")
ylabel("sum")
legend(["cal1" "cal2"],"Location","northwest");
grid on
%2つ目のプロット
nexttile;
plot(time,cal*8)
hold on
plot(time,cal*6)
xlabel("time s")
ylabel("sum")
yyaxis("right")
plot(incatime,deactivateidx)
Unrecognized function or variable 'incatime'.
legend(["cal1" "cal2" "cal3"],"location","southeast")
ax = gca;
ax.YAxis(2).Color = [0 0 0];
grid on
yyaxis right
cla
cla reset
hold off
上記のコードと実際のコードで何か違いはありますか?

Iniciar sesión para comentar.

Respuestas (1)

SHromaneko
SHromaneko el 1 de Sept. de 2022
失礼致しました、自己解決しました。
最後のcla resetの位置が不適切で自分で描画したグラフを自分で削除するようになっていたみたいです。

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!