Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit ed0ea179 authored by Samuël Weber's avatar Samuël Weber
Browse files

better XY and hue

parent bd67409d
......@@ -581,7 +581,7 @@ def update_box_graph(datatable, temporality, plots_options, groupby_var, species
[State('specie-dropdown', 'value'),
State('source-dropdown', 'value'),
State('options_check', 'value')])
def update_scatter_graph(datatable, tabselected, groupby, species, sources, options):
def update_scatter_graph(datatable, tabselected, xy, species, sources, options):
"""Update the scatter graph
:datatable: TODO
......@@ -625,20 +625,25 @@ def update_scatter_graph(datatable, tabselected, groupby, species, sources, opti
dfdt["Labels"] = np.nan
stations = list(dfdt["Station"].unique())
if groupby == "site":
if len(species+sources) != 2:
figure["layout"]["title"] = "Please select 2 species"
return figure
elif groupby == "specie":
if xy == "site":
hue = "specie"
elif xy == "specie":
hue = "site"
if xy == "site":
if len(stations) != 2:
figure["layout"]["title"] = "Please select 2 stations"
return figure
elif xy == "specie":
if len(species+sources) != 2:
figure["layout"]["title"] = "Please select 2 species"
return figure
# species = set(species) - set(BASE_VAR_SP) - set(notNumeric)
# sources = set(sources) - set(BASE_VAR_SRC)
variables = species + sources
if groupby == "specie":
if xy == "site":
df = dfdt[["Date", "Station"] + variables]
df = df.pivot_table(index=["Date"], columns=["Station"], values=variables)\
.reset_index()\
......@@ -651,9 +656,9 @@ def update_scatter_graph(datatable, tabselected, groupby, species, sources, opti
else:
dfdt = dfdt[variables+["Station", "Date"]].dropna()
x, y = stations if groupby == "specie" else variables
color = "Specie" if groupby == "specie" else "Station"
orders = variables if groupby == "specie" else stations
x, y = stations if hue == "specie" else variables
color = "Specie" if hue == "specie" else "Station"
orders = variables if hue == "specie" else stations
# Plot part ==============================================================
......
......@@ -268,7 +268,6 @@ class SharedComponent():
con=con
)
con.close()
print(dfmap)
markers_typo = {
"urban": "square",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment