MATLAB Answers

Legend position changed after saving a picture

4 views (last 30 days)
micholeodon on 15 May 2019
Commented: micholeodon on 15 Sep 2020
Dear All,
I have generated picture like this with legend nicely placed in the 'best' location.
However, when I save it using :
saveas(gcf, savePath);
the legend automagically changed its location.
Why is that and how to overcome that behavior?


Sign in to comment.

Answers (1)

Vasishta Bhargava
Vasishta Bhargava on 15 Sep 2020
Edited: Vasishta Bhargava on 15 Sep 2020
% if true
% code
saveas(gcf, savePath,'Renderer','pdf');
Use the saveas with renderer argument and file extension option. This ensures the saved and displayed figures properties are not modified

  1 Comment

micholeodon on 15 Sep 2020
Error using saveas
Too many input arguments.
However I found export_fig ( as a workaround.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by