Save figure as image in R2014b without causing legend customization to revert

1 visualización (últimos 30 días)
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']);

Respuestas (1)

Adam Hug
Adam Hug el 1 de Jul. de 2015
Editada: Adam Hug el 1 de Jul. de 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.

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by