How can I save a figure to jpg and keep the legend background 'black'?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
My goal is to save a figure with a legend with a BLACK background and white text in jpg format.
The open figure and even the saved figure (as '.fig') and even saving the figure manually to another file format result in what I need (black legend background with white text).
Only when I try to automatically save in other file formats using saveas() with the formats 'jpg','tif','png' the figure is always saved with a WHITE legend background.
For an image displayed in a figure I tried:
iAmLegend = legend({'\color{black} myTitle'},'FontSize',30); % set legend text white
set(iAmLegend,'color','k'); % set legend background black
output_FileName = strcat(myCurrentWorkingDir, '/', 'myFileName.tif'); % set file path to save to
saveas(figureHandle, output_FileName,'tif'); % does not save BLACK legend background
I am grateful for any advice! Thank you!
3 Kommentare
hooman arad
am 10 Feb. 2023
Bearbeitet: hooman arad
am 10 Feb. 2023
check this
https://de.mathworks.com/matlabcentral/answers/425874-how-can-i-save-a-figure-to-jpg-and-keep-the-legend-background-black
Antworten (0)
Siehe auch
Kategorien
Mehr zu Legend 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!