【发布时间】:2014-06-02 23:01:49
【问题描述】:
我正在努力绘制我的两个图,一个是简单的 x=y,另一个是使用 plotyy 的箱线图。这是两个:
h1=boxplot(box_panda_8(:, [8 16 24 32 128]) ,'symbol','','notch','on','whisker',0.3)
和
h2=plot([0 5],[0 5], 'k--')
假设我将 x 轴定义为
x= 0:5
为什么 plotyy 出错(返回的输入不足)
plotyy(x,h1,x,h2)
更新的问题 使用轴通过两个单独的图来解决问题:
%%% two y axes
y2 = 1:6;
x2 = 1:6;
% Plot the first data set
hl1 = boxplot(box_panda_8(:, [8 16 24 32 48 128]) ,'symbol','','notch','on','whisker',0.3)
% Get the axes and configure it
ax1 = gca;
set(ax1,'XColor','r','YColor','r')
%Create the new axes
ax2 = axes('Position',get(ax1,'Position'),...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k','YColor','k');
% Plot the second data set with the new axes
hl2 =plot(x2,y2,'Color','k','parent',ax2);
但我仍然没有以正确的方式得到我的最终情节。
【问题讨论】:
标签: matlab plot matlab-figure