How to obtain coloured circles/spheres with and without a colour gradient in plots?

4 ビュー (過去 30 日間)
Hi to everyone, I need to insert colored circles and a sphere (only for the Sun) with and without color gradient in plots that represent the Sun and the Earth/Moon system, indicated as "Sun" and "Earth+Moon" in the following figures . The following ones are my current figures:
I want to replace the Sun and Earth+Moon(three objects that I simply plotted with a marker and its properties in matlab), with the following ones:
Can you help me to get the latter ones?

採用された回答

Vishesh
Vishesh 2022 年 10 月 4 日
You can use the following MATLAB code for replacing the sun.
%position of sun
x=5;
y=5;
dark_yel=[255,143,0]/255;
yel=[255,242,0]/255;
length=100;
color_code=[linspace(dark_yel(1),yel(1),length)', linspace(dark_yel(2),yel(2),length)', linspace(dark_yel(3),yel(3),length)'];
msize=100;
for i=1:length
plot(x,y,'o','MarkerFaceColor',color_code(i,:),'MarkerSize',msize,'MarkerEdgeColor','none');
msize=msize-1;
hold on;
end
hold off;
For Earth and moon , you can use the following MATLAB code.
%position of moon and earth
x=1;
y=1;
plot(x,y,'O','MarkerFaceColor','#0000FF','MarkerSize',50);
hold on;
plot(x,y,'o','MarkerFaceColor','#808080','MarkerSize',20,'MarkerEdgeColor','none');
  2 件のコメント
Giuseppe
Giuseppe 2022 年 10 月 4 日
編集済み: Giuseppe 2022 年 10 月 4 日
Thank you very much @Vishesh! Can you also show how to plot the Sun as a 3-D sphere with the same colors gradient of 2-D case?
Giuseppe
Giuseppe 2022 年 10 月 8 日
@Vishesh can you show how to insert text (for instance, "Sun") and fix its position with respect to the size of the marker independently from units of plots?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by