Problems with ticks and grid lines when saving PDF
Show older comments
I'm trying to save a plot which consists of a linear scale on the Y axis and a Log scale on the X axis. I want minor grid lines and ticks on both of the axis. The plot is being saved as a PDF, the figures themselves have everything I require if view the plots in full screen but the PDF document only has the ticks and grid lines on the Y axis.
Here is the code that I am using to save the PDFs:
save_graph = '2024_Stress_Vs_life.pdf';
figure(1);
scatter(Mayer(:,1),Mayer(:,2), 45, 'd');
hold on;
scatter(UHCF(:,1),UHCF(:,2), 45, '+');
hold on;
scatter(Stanzel(:,1),Stanzel(:,2), 45, 's');
hold on;
scatter(Chen(:,1),Chen(:,2), 45, 'x');
hold on;
scatter(Lesperance(:,1),Lesperance(:,2));
hold on;
set(gca,'xscale','log')
title ('Fatigue Life of Al2024 Comparison');
xlabel('Number of Cycles');
ylabel('Stress (MPa)');
grid(gca,'minor')
grid on;
set(gca,'FontSize',20);
set(gca,'YMinorTick','on','YMinorGrid','on');
set(gca,'XMinorTick','on','XMinorGrid','on');
legend('Mayer','UHCF','Stanzel','Chen','Lesperance','Location','Best');
saveas(figure(1),save_graph);
1 Comment
xavier lesperance
on 7 Sep 2019
Answers (0)
Categories
Find more on Grid Lines, Tick Values, and Labels 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!