Add ratio in plot
Browse files
app.py
CHANGED
@@ -503,7 +503,7 @@ if "result" in st.session_state:
|
|
503 |
|
504 |
df_numeric.index = [daterange_str_to_year(daterange) for daterange in df_numeric.index]
|
505 |
for veg_index in veg_indices:
|
506 |
-
fig = px.line(df_numeric, y=[veg_index, f"{veg_index}_buffer"], markers=True)
|
507 |
fig.update_layout(xaxis=dict(tickvals=df_numeric.index, ticktext=df_numeric.index))
|
508 |
st.plotly_chart(fig)
|
509 |
|
@@ -547,13 +547,13 @@ if "result" in st.session_state:
|
|
547 |
formatted_histogram = [f"{h*100/total_pix:.2f}" for h in histogram]
|
548 |
print(histogram, bin_edges, bins, formatted_histogram)
|
549 |
m.add_legend(title="NDVI Class/Value",
|
550 |
-
legend_dict={'<0:Waterbody {}%'.format(formatted_histogram[0]): '#0000FF',
|
551 |
-
'0-0.1: Open {}%'.format(formatted_histogram[1]): '#FF0000',
|
552 |
-
'0.1-0.2: Highly Degraded {}%'.format(formatted_histogram[2]):'#FFFF00',
|
553 |
-
'0.2-0.3: Degraded {}%'.format(formatted_histogram[3]): '#FFA500',
|
554 |
-
'0.3-0.4: Moderately Degraded {}%'.format(formatted_histogram[4]): '#00FE00',
|
555 |
-
'0.4-0.5: Dense {}%'.format(formatted_histogram[5]): '#00A400',
|
556 |
-
'>0.5: Very Dense {}%'.format(formatted_histogram[6]): '#006D00',
|
557 |
},
|
558 |
position='bottomright')
|
559 |
vis_params = {'min': -0.1,
|
|
|
503 |
|
504 |
df_numeric.index = [daterange_str_to_year(daterange) for daterange in df_numeric.index]
|
505 |
for veg_index in veg_indices:
|
506 |
+
fig = px.line(df_numeric, y=[veg_index, f"{veg_index}_buffer", f"{veg_index}_ratio"], markers=True)
|
507 |
fig.update_layout(xaxis=dict(tickvals=df_numeric.index, ticktext=df_numeric.index))
|
508 |
st.plotly_chart(fig)
|
509 |
|
|
|
547 |
formatted_histogram = [f"{h*100/total_pix:.2f}" for h in histogram]
|
548 |
print(histogram, bin_edges, bins, formatted_histogram)
|
549 |
m.add_legend(title="NDVI Class/Value",
|
550 |
+
legend_dict={'<0:Waterbody ({})%'.format(formatted_histogram[0]): '#0000FF',
|
551 |
+
'0-0.1: Open ({})%'.format(formatted_histogram[1]): '#FF0000',
|
552 |
+
'0.1-0.2: Highly Degraded ({})%'.format(formatted_histogram[2]):'#FFFF00',
|
553 |
+
'0.2-0.3: Degraded ({})%'.format(formatted_histogram[3]): '#FFA500',
|
554 |
+
'0.3-0.4: Moderately Degraded ({})%'.format(formatted_histogram[4]): '#00FE00',
|
555 |
+
'0.4-0.5: Dense ({})%'.format(formatted_histogram[5]): '#00A400',
|
556 |
+
'>0.5: Very Dense ({})%'.format(formatted_histogram[6]): '#006D00',
|
557 |
},
|
558 |
position='bottomright')
|
559 |
vis_params = {'min': -0.1,
|