how to save plot with its background color without the gray color
32 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
TESFALEM ALDADA
el 16 de Abr. de 2022
Editada: TESFALEM ALDADA
el 17 de Abr. de 2022
Hello guys
Here i wanted to save a plot having an orange background color. An example code is shown below:
b_col = [255, 150, 0]; % orange color code
b_col = b_col./255;
plot(rand(10,1));
set(gca,'color',b_col);
set(gcf,'inverthardcopy','off');
print('test','-djpeg','-r900')
The above code result in a plot with orange background color, however, when i save it contains a gray color surrownding it as shown in the test image file below. At this point i needed a support in removing a gray color but instead replaced by white color.
Thanks for your supporting
0 comentarios
Respuesta aceptada
Simon Chan
el 16 de Abr. de 2022
b_col = [255, 150, 0]; % orange color code
b_col = b_col./255;
f = figure;
f.Color = [1 1 1]; % Set the color to white
plot(rand(10,1));
set(gca,'color',b_col);
1 comentario
Más respuestas (1)
Image Analyst
el 16 de Abr. de 2022
Try exportgraphics() instead of print().
3 comentarios
Image Analyst
el 16 de Abr. de 2022
@TESFALEM ALDADA, you forgot to list your version when you posted. You must have an old version. exportgraphics() was introduced in r2020a.
Ver también
Categorías
Más información sobre Modify Image Colors 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!