Fixed correlation plot
Browse files
app.py
CHANGED
|
@@ -2,14 +2,14 @@
|
|
| 2 |
|
| 3 |
# Contributors - Harshi, Sharanya, Jeenal
|
| 4 |
|
|
|
|
| 5 |
import streamlit as st
|
| 6 |
import altair as alt
|
| 7 |
import pandas as pd
|
| 8 |
import pycountry
|
| 9 |
from vega_datasets import data
|
| 10 |
-
|
| 11 |
-
st.write('Group 14 - Harshi, Sharanya & Jeenal')
|
| 12 |
|
|
|
|
| 13 |
|
| 14 |
st.title('World Bank Contracts Analysis')
|
| 15 |
|
|
@@ -92,7 +92,7 @@ st.header('Trend of contracts acquired by country in the past years')
|
|
| 92 |
st.write('This interactive map highlights the countries that have received World Bank contracts. By hovering over a country, you can explore its name and status. This visualization provides an overview of global contract distribution, emphasizing regions with significant activity.')
|
| 93 |
|
| 94 |
# Prompt for selecting country
|
| 95 |
-
st.write("
|
| 96 |
|
| 97 |
if selection != 'none':
|
| 98 |
line_plot = alt.Chart(merged_data).mark_line().encode(
|
|
@@ -111,7 +111,9 @@ if selection != 'none':
|
|
| 111 |
|
| 112 |
st.altair_chart(final_chart, use_container_width=True)
|
| 113 |
else:
|
|
|
|
| 114 |
st.write('Choose a country to learn more about contract trends')
|
|
|
|
| 115 |
|
| 116 |
|
| 117 |
# Plot 3 - Correlation plot
|
|
@@ -129,8 +131,8 @@ correlation_plot = (
|
|
| 129 |
alt.Chart(df)
|
| 130 |
.mark_circle(size=60)
|
| 131 |
.encode(
|
| 132 |
-
x=alt.X(f"{col1}:Q", title=col1),
|
| 133 |
-
y=alt.Y(f"{col2}:Q", title=col2),
|
| 134 |
color="Region:N", # Color by region for additional context
|
| 135 |
tooltip=["Project Name", "Supplier", col1, col2],
|
| 136 |
)
|
|
|
|
| 2 |
|
| 3 |
# Contributors - Harshi, Sharanya, Jeenal
|
| 4 |
|
| 5 |
+
|
| 6 |
import streamlit as st
|
| 7 |
import altair as alt
|
| 8 |
import pandas as pd
|
| 9 |
import pycountry
|
| 10 |
from vega_datasets import data
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
st.write('Group 14 - Harshi, Sharanya & Jeenal')
|
| 13 |
|
| 14 |
st.title('World Bank Contracts Analysis')
|
| 15 |
|
|
|
|
| 92 |
st.write('This interactive map highlights the countries that have received World Bank contracts. By hovering over a country, you can explore its name and status. This visualization provides an overview of global contract distribution, emphasizing regions with significant activity.')
|
| 93 |
|
| 94 |
# Prompt for selecting country
|
| 95 |
+
st.write("Hover over a country to see its contract data over time")
|
| 96 |
|
| 97 |
if selection != 'none':
|
| 98 |
line_plot = alt.Chart(merged_data).mark_line().encode(
|
|
|
|
| 111 |
|
| 112 |
st.altair_chart(final_chart, use_container_width=True)
|
| 113 |
else:
|
| 114 |
+
st.altair_chart(map_chart, use_container_width=True)
|
| 115 |
st.write('Choose a country to learn more about contract trends')
|
| 116 |
+
|
| 117 |
|
| 118 |
|
| 119 |
# Plot 3 - Correlation plot
|
|
|
|
| 131 |
alt.Chart(df)
|
| 132 |
.mark_circle(size=60)
|
| 133 |
.encode(
|
| 134 |
+
x=alt.X(f"{col1}:Q", title=col1, scale=alt.Scale(zero=False)),
|
| 135 |
+
y=alt.Y(f"{col2}:Q", title=col2, scale=alt.Scale(zero=False)),
|
| 136 |
color="Region:N", # Color by region for additional context
|
| 137 |
tooltip=["Project Name", "Supplier", col1, col2],
|
| 138 |
)
|