Skip to content
Snippets Groups Projects

Aggregated updates for the next release (0.8.3.5.7)

Merged Alkaid Cheng requested to merge dev into master
7 files
+ 117
19
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -58,7 +58,8 @@ from .artists import (
FillBetween,
ErrorBand,
Annotation,
Text
Text,
Ellipse
)
# Type variables for better type hints
@@ -441,6 +442,33 @@ class AbstractPlot(AbstractObject):
raise ValueError(f'config option not set: {key}')
return config[key]
def get_target_color(
self,
name: str,
target: Optional[str] = None,
fallback: bool = True
) -> Optional[str]:
"""
Get color for a domain.
Parameters
----------
name : str
The name to get the color for
...
fallback : bool, default False
Whether to fall back to name-only lookup
Returns
-------
Optional[str]
The target color if found
"""
domain = self.color_map.format(target, name)
if domain not in self.color_map and fallback:
return self.color_map.get(name)
return self.color_map.get(domain)
def get_target_label(
self,
name: str,
@@ -524,6 +552,19 @@ class AbstractPlot(AbstractObject):
artist = FillBetween(x=x, y1=y1, y2=y2, label=label, styles=kwargs)
self.add_artist(artist, name=name or label)
def add_ellipse(
self,
xy: Tuple[float, float],
width: float,
height: float,
angle: float = 0,
label: Optional[str] = None,
name: Optional[str] = None,
**kwargs
) -> None:
artist = Ellipse(xy=xy, width=width, height=height, angle=angle, label=label, styles=kwargs)
self.add_artist(artist, name=name or label)
def add_errorband(
self,
x: ArrayLike,
@@ -772,7 +813,7 @@ class AbstractPlot(AbstractObject):
handles: List[Artist] = []
labels: List[str] = []
targets = targets or self.legend_order
targets = targets or self.legend_order or self.get_labelled_legend_domains()
try:
for name in targets:
Loading