Mofe commited on
Commit
230629e
β€’
1 Parent(s): 0857dea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -37
app.py CHANGED
@@ -19,7 +19,7 @@ st.markdown(
19
  <link href="https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap" rel="stylesheet">
20
  <style>
21
  .title {
22
- font-family: 'Permanent Marker', cursive;
23
  font-size: 2.0rem;
24
  }
25
  </style>""",
@@ -28,7 +28,7 @@ st.markdown(
28
 
29
  st.sidebar.write(
30
  """<center><p class="title">
31
- HESS Papers Clustering 🌎🌿
32
  </p></center>""",
33
  unsafe_allow_html=True,
34
  )
@@ -76,12 +76,6 @@ DF["opacity"] = 0.04
76
  min_year, max_year = DF["year"].min(), DF["year"].max()
77
 
78
  with st.sidebar:
79
- start_year, end_year = st.select_slider(
80
- "Publication year",
81
- options=[str(y) for y in range(min_year, max_year + 1)],
82
- value=(str(min_year), str(max_year)),
83
- )
84
-
85
  author_names = st.text_input("Author names (separated by comma)")
86
 
87
  title = st.text_input("Title")
@@ -93,6 +87,12 @@ with st.sidebar:
93
  # ["Topics 2: "],
94
  # )
95
 
 
 
 
 
 
 
96
  start_year = int(start_year)
97
  end_year = int(end_year)
98
  df_mask = (DF["year"] >= start_year) & (DF["year"] <= end_year)
@@ -110,38 +110,38 @@ with st.sidebar:
110
  DF.loc[df_mask, "opacity"] = 1.0
111
  st.write(f"Number of points: {DF[df_mask].shape[0]}")
112
 
113
- fig = px.scatter(
114
- DF,
115
- x="x",
116
- y="y",
117
- opacity=DF["opacity"],
118
- color=DF["cluster"],
119
- width=1000,
120
- height=800,
121
- custom_data=("title", "authors_trimmed", "year"),
122
- color_continuous_scale="haline",
123
- )
124
 
125
- fig.update_traces(
126
- hovertemplate="<b>%{customdata[0]}</b><br>%{customdata[1]}<br>%{customdata[2]}<br><i>"
127
  )
128
 
129
- fig.update_layout(
130
- showlegend=False,
131
- font=dict(
132
- family="Times New Roman",
133
- size=30,
134
- ),
135
- hoverlabel=dict(
136
- align="left",
137
- font_size=14,
138
- font_family="Rockwell",
139
- namelength=-1,
140
- ),
141
- )
142
 
143
- fig.update_xaxes(title="")
144
- fig.update_yaxes(title="")
145
 
146
- st.plotly_chart(fig, use_container_width=True)
147
 
 
19
  <link href="https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap" rel="stylesheet">
20
  <style>
21
  .title {
22
+ font-family: 'Permanent Marker';
23
  font-size: 2.0rem;
24
  }
25
  </style>""",
 
28
 
29
  st.sidebar.write(
30
  """<center><p class="title">
31
+ Clustering on HESS Papers 🌎🌿
32
  </p></center>""",
33
  unsafe_allow_html=True,
34
  )
 
76
  min_year, max_year = DF["year"].min(), DF["year"].max()
77
 
78
  with st.sidebar:
 
 
 
 
 
 
79
  author_names = st.text_input("Author names (separated by comma)")
80
 
81
  title = st.text_input("Title")
 
87
  # ["Topics 2: "],
88
  # )
89
 
90
+ start_year, end_year = st.select_slider(
91
+ "Publication year",
92
+ options=[str(y) for y in range(min_year, max_year + 1)],
93
+ value=(str(min_year), str(max_year)),
94
+ )
95
+
96
  start_year = int(start_year)
97
  end_year = int(end_year)
98
  df_mask = (DF["year"] >= start_year) & (DF["year"] <= end_year)
 
110
  DF.loc[df_mask, "opacity"] = 1.0
111
  st.write(f"Number of points: {DF[df_mask].shape[0]}")
112
 
113
+ fig = px.scatter(
114
+ DF,
115
+ x="x",
116
+ y="y",
117
+ opacity=DF["opacity"],
118
+ color=DF["cluster"],
119
+ width=1000,
120
+ height=800,
121
+ custom_data=("title", "authors_trimmed", "year"),
122
+ color_continuous_scale="haline",
123
+ )
124
 
125
+ fig.update_traces(
126
+ hovertemplate="<b>%{customdata[0]}</b><br>%{customdata[1]}<br>%{customdata[2]}<br><i>"
127
  )
128
 
129
+ fig.update_layout(
130
+ showlegend=False,
131
+ font=dict(
132
+ family="Times New Roman",
133
+ size=30,
134
+ ),
135
+ hoverlabel=dict(
136
+ align="left",
137
+ font_size=14,
138
+ font_family="Rockwell",
139
+ namelength=-1,
140
+ ),
141
+ )
142
 
143
+ fig.update_xaxes(title="")
144
+ fig.update_yaxes(title="")
145
 
146
+ st.plotly_chart(fig, use_container_width=True)
147