Effacer les filtres
Effacer les filtres

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

4 vues (au cours des 30 derniers jours)
Gunnar
Gunnar le 29 Juin 2015
Modifié(e) : Adam Hug le 1 Juil 2015
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']);

Réponses (1)

Adam Hug
Adam Hug le 1 Juil 2015
Modifié(e) : Adam Hug le 1 Juil 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.

Catégories

En savoir plus sur Printing and Saving dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by