axis off sets background color back to white despite set(gca....

33 visualizaciones (últimos 30 días)
Krystian
Krystian el 26 de En. de 2022
Comentada: Star Strider el 3 de Feb. de 2022
set(gca,'color',[0 0 0]);
set(gca,'color','black');
set(gcf,'inverthardcopy','off');
daspect([1 1 1])
axis off % this sets background back to default !!!!!!!...:( why?
set(gca,'color',[0 0 0]);

Respuestas (2)

Biraj Khanal
Biraj Khanal el 26 de En. de 2022
Editada: Biraj Khanal el 26 de En. de 2022
The axis off does not set your 'background color' to default. It removes the axes from the figure making it practically hide it. This is why you see the default background. Just turn the axis on to see the axis of which you set the color to black.

Star Strider
Star Strider el 26 de En. de 2022
If the desired result is simply to make the axes invisible, perhaps using the Axes Properties XColor, YColor, and ZColor values to 'none' will work. Also see the documentation section on NumericRuler Properties.
.
  2 comentarios
Krystian
Krystian el 3 de Feb. de 2022
The desired result is a plot without axes on black background
Star Strider
Star Strider el 3 de Feb. de 2022
Like this?
x = 1:10;
y = rand(1,10);
figure
plot(x, y, '-r', 'LineWidth',2)
Ax = gca;
Ax.Color = 'k';
Ax.XColor = 'none';
Ax.YColor = 'none';
Add other function calls to change other properties, as necessary.
.

Iniciar sesión para comentar.

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by