First off, I'm new to matlab, so sorry for ugly codes and maybe an easy question. Anyway, I would like to add a secondary -log2 X axis on top to an existing histogram and curve with linear axes. It will be the same curve, but different units, so I really only need to adjust the top scale to -log base 2 units. I tried using: 'xscale','log' in ax3, but I'm not sure how to change the base?
figurebar(size_phi, vol_percent,'LineWidth',0.05,'EdgeColor',[0.6 0.6 0.6],'FaceColor',[0.42 0.42 0.42]);ax1 = gca;set(gca, 'box','off');ax1.XColor = 'k';ax1.YColor = [0.4 0.4 0.4];ax1.YAxisLocation = 'right';ax1.XLim = [-2 15];ax1.TickDir = 'out';ax1.XLabel.String = 'Size (\phi)';ax1.YLabel.String = {'Volume (%)'; 'histogram'};ax1_pos = ax1.Position;ax2 = axes('Position',ax1_pos,'box','off','YAxisLocation','left','XTickLabel',[],'Color','none','TickDir','out','XLim',[-2 15],'YLim',[0 100]);hold onplot(GStablePlot.size_phi,GStablePlot.vol_cumulative,'Color',[0 0 0],'LineWidth',2);ax3 = axes('Position',ax1_pos,'box','off','YAxisLocation','left','YTickLabel',[],'Color','none','TickDir','out','YLim',[0 100],'XAxisLocation','top','XDir','reverse');hold onsemilogx(log2(GStablePlot.size_mm),GStablePlot.vol_cumulative);
Best Answer