Skip to content

Instantly share code, notes, and snippets.

@sefffal
Last active February 9, 2023 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sefffal/48db1500a0c22594d8bc984e7678fbce to your computer and use it in GitHub Desktop.
Save sefffal/48db1500a0c22594d8bc984e7678fbce to your computer and use it in GitHub Desktop.
Plot planets from the NASA exoplanet archive in Julia
using GLMakie, CSV, DataFrames
df = CSV.read(
download("https://exoplanetarchive.ipac.caltech.edu/TAP/sync?query=select+pl_rade,pl_masse,discoverymethod+from+ps+where+default_flag=1&format=csv"),
DataFrame
);
fig=Figure()
ax=Axis(fig[1,1],
xlabel=L"M_⨁",
ylabel=L"R_⨁",
yscale=log10,
xscale=log10
)
for method in unique(df.discoverymethod)
planets = df[df.discoverymethod.==method,:]
scatter!(ax, planets.pl_masse, planets.pl_rade, label=method)
end
Legend(fig[1,2], ax)
fig
[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
[compat]
CSV="0.10.9"
DataFrames="1.4.4"
GLMakie="0.8.2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment