matlab双Y坐标轴,左边bar图,右边plot图,设置x轴横坐标为文字大致程序如下:value1 = [2.98,3.19,7.17,3.05,3.97,4.76];value2 = [9,4,3,7,4,4];t = 1:6[ax,h1,h2]=plotyy(t,value1,t,value2,@bar,@plot);dr_name = {'一,'二,'三,'四,'五
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/06 01:49:44
matlab双Y坐标轴,左边bar图,右边plot图,设置x轴横坐标为文字大致程序如下:value1 = [2.98,3.19,7.17,3.05,3.97,4.76];value2 = [9,4,3,7,4,4];t = 1:6[ax,h1,h2]=plotyy(t,value1,t,value2,@bar,@plot);dr_name = {'一,'二,'三,'四,'五
matlab双Y坐标轴,左边bar图,右边plot图,设置x轴横坐标为文字
大致程序如下:
value1 = [2.98,3.19,7.17,3.05,3.97,4.76];
value2 = [9,4,3,7,4,4];
t = 1:6
[ax,h1,h2]=plotyy(t,value1,t,value2,@bar,@plot);
dr_name = {'一,'二,'三,'四,'五,'六};
set(gca,'XTickLabel',dr_name)
set(ax(1),'ytick',0:2:10);
set(ax(2),'ylim',[0 10],'ytick',0:10);
set(h1,'facecolor','y');
set(h2,'ro-');
现在问题是x轴文字和原来坐标重合和改变plot曲线的连接处有o
matlab双Y坐标轴,左边bar图,右边plot图,设置x轴横坐标为文字大致程序如下:value1 = [2.98,3.19,7.17,3.05,3.97,4.76];value2 = [9,4,3,7,4,4];t = 1:6[ax,h1,h2]=plotyy(t,value1,t,value2,@bar,@plot);dr_name = {'一,'二,'三,'四,'五
按下面语句试试
value1 = [2.98,3.19,7.17,3.05,3.97,4.76];
value2 = [9,4,3,7,4,4];
t = 1:6;
[ax,h1,h2]=plotyy(t,value1,t,value2,@bar,@plot);
dr_name = {'一','二','三','四','五','六'};
set(ax(1),'XTickLabel',dr_name,'ytick',0:2:10);
set(ax(2),'XTickLabel','','ylim',[0 10],'ytick',0:10);
set(h1,'facecolor','y');
set(h2,'marker','o','color','r','linewidth',1);