フィルターのクリア

Change axis colour matlab

1,064 ビュー (過去 30 日間)
Sarah Yun
Sarah Yun 2020 年 1 月 19 日
回答済み: Image Analyst 2020 年 1 月 19 日
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)?

採用された回答

Image Analyst
Image Analyst 2020 年 1 月 19 日
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

その他の回答 (1 件)

Star Strider
Star Strider 2020 年 1 月 19 日
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.

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by