File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55from __future__ import annotations
66
7+ import warnings
78from typing import TYPE_CHECKING , Any
89
910import numpy as np
@@ -211,16 +212,28 @@ def _style_traces_as_bars(fig: go.Figure) -> None:
211212
212213 # Build classification map
213214 class_map : dict [str , str ] = {}
215+ mixed_traces : list [str ] = []
214216 for name , flags in sign_flags .items ():
215217 if flags ["has_pos" ] and flags ["has_neg" ]:
216218 class_map [name ] = "mixed"
219+ mixed_traces .append (name )
217220 elif flags ["has_neg" ]:
218221 class_map [name ] = "negative"
219222 elif flags ["has_pos" ]:
220223 class_map [name ] = "positive"
221224 else :
222225 class_map [name ] = "zero"
223226
227+ # Warn about mixed traces
228+ if mixed_traces :
229+ warnings .warn (
230+ f"fast_bar: traces { mixed_traces } have mixed positive/negative values "
231+ "and cannot be stacked. They are shown as dashed lines. "
232+ "Consider using bar() for proper stacking of mixed data." ,
233+ UserWarning ,
234+ stacklevel = 3 ,
235+ )
236+
224237 # Apply styling to all traces
225238 for trace in all_traces :
226239 color = trace .line .color
You can’t perform that action at this time.
0 commit comments