Skip to content

Commit

Permalink
fix issue in labeller (arviz-devs#2200)
Browse files Browse the repository at this point in the history
* fix issue in labeller

* update changelog
  • Loading branch information
OriolAbril authored Feb 9, 2023
1 parent f50c8bf commit 3514017
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Fix gap for `plot_trace` with option `kind="rank_bars"` ([2180](https://github.com/arviz-devs/arviz/pull/2180))
- Fix `plot_lm` unsupported usage of `np.tile` ([2186](https://github.com/arviz-devs/arviz/pull/2186))
- Update `_z_scale` to work with SciPy 1.10 ([2186](https://github.com/arviz-devs/arviz/pull/2186))
- Fix bug in BaseLabeller when combining with with NoVarLabeller ([2200](https://github.com/arviz-devs/arviz/pull/2200))

### Deprecation

Expand Down
8 changes: 5 additions & 3 deletions arviz/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def make_label_vert(self, var_name: Union[str, None], sel: dict, isel: dict):
var_name_str = self.var_name_to_str(var_name)
sel_str = self.sel_to_str(sel, isel)
if not sel_str:
return var_name_str
return "" if var_name_str is None else var_name_str
if var_name_str is None:
return sel_str
return f"{var_name_str}\n{sel_str}"
Expand All @@ -121,7 +121,7 @@ def make_label_flat(self, var_name: str, sel: dict, isel: dict):
var_name_str = self.var_name_to_str(var_name)
sel_str = self.sel_to_str(sel, isel)
if not sel_str:
return var_name_str
return "" if var_name_str is None else var_name_str
if var_name_str is None:
return sel_str
return f"{var_name_str}[{sel_str}]"
Expand All @@ -136,7 +136,9 @@ def make_model_label(self, model_name, label):
model_name_str = self.model_name_to_str(model_name)
if model_name_str is None:
return label
return f"{model_name}: {label}"
if label is None or label == "":
return model_name_str
return f"{model_name_str}: {label}"


class DimCoordLabeller(BaseLabeller):
Expand Down

0 comments on commit 3514017

Please sign in to comment.