Plot with 2 X Axis. Y Axis blurry
Show older comments
Hello,
so I've created a plot that contains two datasets. I've created 2 x-axis, which worked perfectly fine. But it appears that there've been created two y-axis which arent quite overlapping. THe datasets use the same axis, its just that one of the y-axis seems to be unachored. I#Ve been struggeling with fixing this. How could I either make those y-axis overlap or better delete one of them?
I hope you guys can help!
This is the result:

This would be my code:
figure
pl2 = plot(hub_vek_ges, mu,'Color',[0, 0.447, 0.741]);
hold on
pl1 = plot(hub_vek_MOH, mu_MOH,'Color',[0.635 , 0.078, 0.184]);
hold on
grid on
axis([0 40 0 0.14])
yticks([ 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14])
xticks([0:5:40])
xlabel('Hübe [-]', 'FontSize', 20);
ylabel('Reibkoeffizient {\it µ} [-]', 'FontSize', 20);
legend('MOH','geschliffen', 'FontSize', 20)
set(gca, 'fontname','times')
set(gcf,'color', 'white')
ax1 =gca;
ax2 = axes('Position', get(ax1, 'Position'),'Color','none');
set(ax2,'XAxisLocation','top');
set(ax2, 'XLim', get(ax1, 'XLim'),'YLim', get(ax1, 'YLim')); %
set(ax2, 'XTick', get(ax1, 'XTick'), 'YTick', get(ax1, 'YTick')); %
axLabels = {'0' '250' '500' '750' '1000' '1250' '1500' '1750' '2000'};
set(ax2, 'XTickLabel', axLabels, 'YTickLabel', [ 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14] )
xlabel('Distanz {\it s} in mm', 'FontSize', 20)
set(gca, 'fontname','times')
Accepted Answer
More Answers (0)
Categories
Find more on Axes Appearance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!