Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for Experimental.
Download

Streamlit python app to show simple exoplanets plot

90 views
License: MIT
ubuntu2004
1
# file exoplanets-per-year.py
2
3
# run this from a cocalc terminal with
4
# streamlit run exoplanets-per-year.py
5
# make sure you have baseUrlPath set as in
6
# https://doc.cocalc.com/howto/streamlit.html
7
# after launching streamlit, point your browser at
8
# https://cocalc.com/<project-id>/port/8501/
9
10
import streamlit as st
11
import pandas as pd
12
import seaborn as sns
13
import matplotlib
14
from matplotlib.figure import Figure
15
16
st.markdown('# Exoplanets Found Each Year')
17
18
# csv file is generated here:
19
# https://cocalc.com/drxyzzy/experimental/exoplanets
20
21
df = pd.read_csv("exo.csv")
22
fig = Figure()
23
ax = fig.subplots()
24
g = sns.barplot(x=df['year'],
25
y=df['count'], ax=ax)
26
#g.set_yscale("log")
27
ax.set_xlabel('Year')
28
ax.set_ylabel('Number of exoplanets confirmed')
29
ax.set_xticklabels(ax.get_xticklabels(),rotation = 80)
30
st.pyplot(fig)
31
32
33