Spaces:
Sleeping
Sleeping
skanderovitch
commited on
Commit
•
d0721e7
1
Parent(s):
0ac0e1a
Update app.py
Browse files
app.py
CHANGED
@@ -168,13 +168,21 @@ import plotly.express as px
|
|
168 |
|
169 |
|
170 |
projection = pd.DataFrame(projection,columns=['x','y'])
|
171 |
-
projection['
|
172 |
projection['color'] = parties
|
173 |
-
projection['
|
174 |
|
175 |
-
fig = px.scatter(projection,x='x', y='y', text='
|
176 |
fig.update_traces(marker=dict(size=12,
|
177 |
line=dict(width=2,
|
178 |
color='DarkSlateGrey')),
|
179 |
selector=dict(mode='markers'),)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
st.plotly_chart(fig)
|
|
|
168 |
|
169 |
|
170 |
projection = pd.DataFrame(projection,columns=['x','y'])
|
171 |
+
projection['party'] = parties
|
172 |
projection['color'] = parties
|
173 |
+
projection['manifesto'] = data.loc[themes,parties].T.apply(lambda l: '<br>'.join(l.tolist()),axis=1).values
|
174 |
|
175 |
+
fig = px.scatter(projection,x='x', y='y', text='party', color='party', hover_data=["manifesto"])
|
176 |
fig.update_traces(marker=dict(size=12,
|
177 |
line=dict(width=2,
|
178 |
color='DarkSlateGrey')),
|
179 |
selector=dict(mode='markers'),)
|
180 |
+
|
181 |
+
fig.update_layout(legend=dict(
|
182 |
+
orientation="h",
|
183 |
+
yanchor="bottom",
|
184 |
+
y=1.02,
|
185 |
+
xanchor="right",
|
186 |
+
x=1
|
187 |
+
))
|
188 |
st.plotly_chart(fig)
|