Change axis colour matlab

1.667 visualizaciones (últimos 30 días)
Sarah Yun
Sarah Yun el 19 de En. de 2020
Respondida: Image Analyst el 19 de En. de 2020
Hi,
I want a black figure background and white figure axis.
subplot(2, 2, [1 3]);
hold on
plotc(X, Y);
xlabel('UTM Easting (m)');
ylabel('UTM Northing (m)');
% This sets background color to black
set(gca,'color','k');
hold off
How can I set figure axis to white (against the black figure background)?

Respuesta aceptada

Image Analyst
Image Analyst el 19 de En. de 2020
Try this, where I change several properties. There are lots more things you can tweak individually, just click the "See all properties" link in the command window to see a list of them.
X = 1 : 20;
Y = rand(1, 20);
subplot(2, 2, [1 3]);
hold on
plot(X, Y, 'gs-');
grid on;
xlabel('UTM Easting (m)');
ylabel('UTM Northing (m)');
% Get handle to current axes.
ax = gca
% This sets background color to black
ax.Color = 'k'
ax.YColor = 'r';
darkGreen = [0, 0.6, 0];
ax.XColor = darkGreen;
ax.GridColor = 'y';
ax.GridAlpha = 0.9;
ax.FontSize = 15;
ax.FontWeight = 'bold';
hold off
0000 Screenshot.png

Más respuestas (1)

Star Strider
Star Strider el 19 de En. de 2020
Try this:
x = linspace(20, 50, 29);
y = sin((x-20)/30 * 2 * pi);
figure
plot(x, y)
xt = xticks(gca);
xt2 = compose('%.0f\\circW',xt);
set(gca,'xtickLabel',xt2);
set(gca, 'Color','k', 'XColor','w', 'YColor','w')
set(gcf, 'Color','k')
producing:
1Change axis colour matlab - 2020 01 19.png
Make appropriate changes to get the result you want.
Also see: Axis Properties and Figure Properties for more options.

Categorías

Más información sobre Graphics Object Properties 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