I am a python beginner and trying to make a logarithmic chart of our solar system. Almost done, but I would like to add planet names to the plots. Any tips on how to do it?
Here is my code:
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
mass = {
"Mercury": 0.330*(10**24),
"Venus": 4.87*(10**24),
"Earth": 5.97*(10**24)
}
radius = {
"Mercury": (4879/2)*(10**3),
"Venus": (12104/2)*(10**3),
"Earth": (12756/2)*(10**3)
}
df_mass = pd.DataFrame.from_dict(mass, orient='index', columns=['kgs'])
mass = pd.to_numeric(df_mass['kgs'])
df_radius = pd.DataFrame.from_dict(radius, orient='index', columns=['m'])
radius = pd.to_numeric(df_radius['m'])
colors = np.random.rand(3)
scalar = 500
plt.xlabel('Mass (kgs)')
plt.ylabel('Radius (m)')
plt.title('Logarithmic chart of solar system planets')
plt.scatter(mass, radius, c=colors, s=scalar)
plt.grid()
plt.xscale("log")
plt.yscale("log")
plt.show()