Save figure as image in R2014b without causing legend customization to revert
1 view (last 30 days)
Show older comments
How can I keep the increases in line width in the legend of my plot when I save the figure as an image? It always reverts it to the corresponding data's line width and saves like that. When put into a document it is nearly impossible to tell what the line color is in the legend. I went back to my R2013b install and it worked no problem.
Using the following commands in both versions:
[hLeg,objLeg,outh,outm] = legend(...); set(objLeg,'LineWidth',5); saveas(hFig,[FileName '.png']);
0 Comments
Answers (1)
Adam Hug
on 1 Jul 2015
Edited: Adam Hug
on 1 Jul 2015
I think a better way of doing this is to adjust the linewidth of your plot. For example,
hold on
plot(t, sin(t), 'LineWidth', 5);
plot(t, cos(t), 'LineWidth', 5);
legend('Sine', 'Cosine');
hold off
saveas(gcf, 'test.png');
This way the "saveas" command will not trample over any changes you made to the legend. Additionally, you will be able to see the lines better in your image.
0 Comments
See Also
Categories
Find more on Printing and Saving 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!