Filter löschen
Filter löschen

Plot does not have axes properties set correctly, nor saved correctly.

1 Ansicht (letzte 30 Tage)
Ivy Chen
Ivy Chen am 2 Jul. 2018
Kommentiert: Ivy Chen am 2 Jul. 2018
I have a plot need to apply for axes and save to a different size. When I use the following script, it does not save the empty plot.
H_error = CarolinaPulledPork.horizontal_error(Idx);
plot(X, H_error,'DisplayName','Horizontal Position Error','LineWidth', 2);
% Create title, x & y lables, and legend
ax=gca;
set(ax,'FontSize',24, ...
'XColor',[0.0784313753247261 0.168627455830574 0.549019634723663], ...
'YColor',[0.0784313753247261 0.168627455830574 0.549019634723663]);
set(ax,'XTick',linspace(plot_start,plot_end,16), ...
'xlim',[plot_start plot_end], 'ylim',[0 50]);
datetick('x', 'HH:MM', 'keepticks', 'keeplimits');
xlabel(plotname,'FontWeight','bold','FontAngle','italic','FontSize',24, ...
'Color',[0.0784313753247261 0.168627455830574 0.549019634723663]);
ylabel('Horizontal Position Error (m)', ...
'FontWeight','bold','FontAngle','italic','FontSize',24, ...
'Color',[0.0784313753247261 0.168627455830574 0.549019634723663]);
legend show;
set(legend,'Location','southoutside','Orientation','horizontal','Box','off','FontSize',24);
filename = sprintf('Horizontal Position Error vs Time for Day %s - Scenario %s.png', Day, Scenario);
% Convert to a different size) and Print to PNG file
set(gcf, 'Position', [0 0 2400 600]);
print(gcf, filename,'-dpng','-r0');
  2 Kommentare
jonas
jonas am 2 Jul. 2018
It is not clear to me what your desired output is
Ivy Chen
Ivy Chen am 2 Jul. 2018
thanks, I found an issue in the other part of codes. Problem resolved. thanks again

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Graphics Object Properties finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by