@@ -486,13 +486,11 @@ def plot_frequencies_map_markers(
486486 self ,
487487 m ,
488488 ds : frq_params .ds_frequencies_advanced ,
489- variant : Optional [ Union [int , str ] ],
489+ variant : Union [int , str ],
490490 taxon : str ,
491491 period : pd .Period ,
492492 clear : bool = True ,
493493 ):
494- if variant is None :
495- return
496494 # Only import here because of some problems importing globally.
497495 import ipyleaflet # type: ignore
498496 import ipywidgets # type: ignore
@@ -598,13 +596,27 @@ def plot_frequencies_interactive_map(
598596 variants = ds ["variant_label" ].values
599597 taxa = ds ["cohort_taxon" ].to_pandas ().dropna ().unique () # type: ignore
600598 periods = ds ["cohort_period" ].to_pandas ().dropna ().unique () # type: ignore
599+
600+ if len (variants ) == 0 :
601+ raise ValueError ("No variants available in dataset." )
602+ if len (taxa ) == 0 :
603+ raise ValueError ("No taxons available in dataset." )
604+ if len (periods ) == 0 :
605+ raise ValueError ("No periods available in dataset." )
606+
601607 controls = ipywidgets .interactive (
602608 self .plot_frequencies_map_markers ,
603609 m = ipywidgets .fixed (freq_map ),
604610 ds = ipywidgets .fixed (ds ),
605- variant = ipywidgets .Dropdown (options = variants , description = "Variant: " ),
606- taxon = ipywidgets .Dropdown (options = taxa , description = "Taxon: " ),
607- period = ipywidgets .Dropdown (options = periods , description = "Period: " ),
611+ variant = ipywidgets .Dropdown (
612+ options = variants , value = variants [0 ], description = "Variant: "
613+ ),
614+ taxon = ipywidgets .Dropdown (
615+ options = taxa , value = taxa [0 ], description = "Taxon: "
616+ ),
617+ period = ipywidgets .Dropdown (
618+ options = periods , value = periods [0 ], description = "Period: "
619+ ),
608620 clear = ipywidgets .fixed (True ),
609621 )
610622
0 commit comments