使用 plotmatrix 时,如何避免 y 坐标轴标签隐藏在其他绘图后面?

15 visualizaciones (últimos 30 días)
MathWorks Support Team
MathWorks Support Team el 26 de Feb. de 2020
Respondida: MathWorks Support Team el 26 de Feb. de 2020
当我执行代码:
x = rand(100,2);
y = randn(size(x));
y(:,2:end) = y(:,2:end)*1e-3;
plotmatrix(x,y);
第二行图片中,y坐标轴的标签被隐藏了,实际上应该是*10^-3。

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 26 de Feb. de 2020
我们需要获取坐标轴绘图对象,执行:
[~,ax] = plotmatrix(x,y);
此时ax是坐标轴绘图对象的句柄,通过修改ax可以修改坐标轴设置。具体修改方法有两个:
1) 调节最标轴位置:
for i = 1:numel(ax)
ax(i).Position(3:4) = ax(i).Position(3:4)*.9;
end
此时绘图会缩小10%,从而显示原本被隐藏的内容。
2) 放弃标签中的指数
for i = 1:numel(ax)
ax(i).YAxis.Exponent = 0;
end
此时绘图中的坐标轴刻度直接包含指数信息。

Más respuestas (0)

Categorías

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

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!