gpt4 book ai didi

matlab - 更改 Matlab 中第二个 Y 轴的颜色(使用新的 yyaxis 工具)

转载 作者:行者123 更新时间:2023-12-04 03:10:28 24 4
gpt4 key购买 nike

我使用matlab R2016a。我想制作 2 个特定颜色的 Y 轴。我不能以某种方式做到这一点。

(手册说,右侧的 Y 轴颜色继承了出现在右轴图定义下的第一个图形的颜色。左轴图也应如此。)

这是图上的问题:

我的左边是蓝色的,而它应该是绿色的:

(my left side is blue, while it should be green) :

这是代码:

yyaxis left
hold all;
plot(bdates,normcdf(-DD_proxy_list),'r')
plot(bdates,normcdf(-DDstar_proxy_list),'b')
yyaxis right
plot(bdates,BBDP_slice,'g')

最佳答案

对于其他像我一样遇到这种情况的人,check these docs .

假设您想更改正确的 yyaxis 并绘制了您的数据:

yyaxis right
ax = gca;
ax.YColor = 'g'

对于旧版本的 MATLAB ( pre-2014b ) 或那些不喜欢点索引的人:
yyaxis right 
set(gca,'YColor','g')

关于matlab - 更改 Matlab 中第二个 Y 轴的颜色(使用新的 yyaxis 工具),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45758444/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com