Plotting two different plots(y axes), sharing the same x in matlab -
considering this question, trying tackling issue 2 separate plots using axes instead of plotyy doesn't work 'boxplot' , 'plot':
%%% definition of x=y line axes y2 = 1:6; x2 = 1:6; % plot first data set using boxplot, results in 6 boxes load carsmall; boxplot(mpg,origin) % axes , configure ax1 = gca; set(ax1,'xcolor','r','ycolor','r') %create new axes ax2 = axes('position',get(ax1,'position'),... 'xaxislocation','top',... 'yaxislocation','right',... 'color','none',... 'xcolor','k','ycolor','k'); % plot second data set new axes hl2 =plot(x2,y2,'color','k','parent',ax2);
but still dont final plot in right way. know why?
there hold on
missing before last line.
Comments
Post a Comment