Skip to content

Commit

Permalink
Call align_ylabels on subset plots (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnothman committed Dec 31, 2023
1 parent b380d07 commit 262c311
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Expand Up @@ -4,6 +4,7 @@ What's new in version 0.9
- Fixes a bug where ``show_percentages`` used the incorrect denominator if
filtering (e.g. ``min_subset_size``) was applied. This bug was a regression
introduced in version 0.7. (:issue:`248`)
- Align ylabels of subplots added using ``add_catplot``. (:issue:`266`)
- Add a ``style_categories`` method to customize category plot styles, including
shading of rows in the intersection matrix, and bars in the totals plot.
(:issue:`261` with thanks to :user:`Marcel Albus <maralbus>`).
Expand Down
46 changes: 26 additions & 20 deletions upsetplot/plotting.py
Expand Up @@ -104,34 +104,36 @@ def __call__(self, *args, **kwargs):
)

_NAME_TRANSPOSE = {
"width": "height",
"height": "width",
"hspace": "wspace",
"wspace": "hspace",
"hlines": "vlines",
"vlines": "hlines",
"align_xlabels": "align_ylabels",
"align_ylabels": "align_xlabels",
"bar": "barh",
"barh": "bar",
"xaxis": "yaxis",
"yaxis": "xaxis",
"left": "bottom",
"right": "top",
"top": "right",
"bottom": "left",
"sharex": "sharey",
"sharey": "sharex",
"get_figwidth": "get_figheight",
"get_figheight": "get_figwidth",
"set_figwidth": "set_figheight",
"set_figheight": "set_figwidth",
"set_xlabel": "set_ylabel",
"set_ylabel": "set_xlabel",
"set_xlim": "set_ylim",
"set_ylim": "set_xlim",
"get_figwidth": "get_figheight",
"get_xlim": "get_ylim",
"get_ylim": "get_xlim",
"height": "width",
"hlines": "vlines",
"hspace": "wspace",
"left": "bottom",
"right": "top",
"set_autoscalex_on": "set_autoscaley_on",
"set_autoscaley_on": "set_autoscalex_on",
"set_figheight": "set_figwidth",
"set_figwidth": "set_figheight",
"set_xlabel": "set_ylabel",
"set_xlim": "set_ylim",
"set_ylabel": "set_xlabel",
"set_ylim": "set_xlim",
"sharex": "sharey",
"sharey": "sharex",
"top": "right",
"vlines": "hlines",
"width": "height",
"wspace": "hspace",
"xaxis": "yaxis",
"yaxis": "xaxis",
}


Expand Down Expand Up @@ -1116,6 +1118,10 @@ def plot(self, fig=None):
else:
raise ValueError("Unknown subset plot type: %r" % plot["type"])
out[plot["id"]] = ax

self._reorient(fig).align_ylabels(
[out[plot["id"]] for plot in self._subset_plots]
)
return out

PLOT_TYPES = {
Expand Down

0 comments on commit 262c311

Please sign in to comment.