matlab - plotyy function showing two x-axes but only want one -



matlab - plotyy function showing two x-axes but only want one -

i using plotyy function produce chart in image below.

i have 2 issues chart. first issue beingness having 2 x-axes want 0 on left hand side of chart level 0 on right hand side. there anyway can create happen?

lastly want set labels on x-axis can labels have numbers on top of them. want labels visible cannot seem do?

below code.

x_labels = data_cell(2:end, 1); risk_tot = cell2mat(data_cell(2:end, 2)); risk_cont = cell2mat(data_cell(2:end, 3)); [pp,h1,h2]=plotyy((1:length(risk_tot)),risk_tot,(1:length(risk_tot)),risk_cont,'bar','stem'); set(gca,'xtickl',x_labels); set(h1,'facecolor',my_blue2(40,:),'edgecolor',my_blue2(40,:)) set(h2,'color',my_orange(1,:),'linewidth',0.5,'markeredgecolor',my_orange(1,:)) set(pp(1),'box','off') set(pp(2),'box','off')

update

i have managed resolve sec issue x-axis labels. added line below. sets sec x-axis labels empty.

still can't prepare first issue.

set(pp(2),'xticklabel',[]);

try linkaxes:

linkaxes(pp,'y')

you may need adjust axes limits pp(1).ylim = ... desired result.

matlab

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -