diff --git a/upsetplot/plotting.py b/upsetplot/plotting.py index c69636b..8d859ab 100644 --- a/upsetplot/plotting.py +++ b/upsetplot/plotting.py @@ -532,7 +532,7 @@ def _plot_stacked_bars(self, ax, by, sum_over, colors, title): handles, labels = ax.get_legend_handles_labels() if self._horizontal: # Make legend order match visual stack order - ax.legend(reversed(handles), reversed(labels)) + ax.legend(list(reversed(handles)), list(reversed(labels))) else: ax.legend() @@ -792,10 +792,14 @@ def plot_matrix(self, ax): } ) ) - styles["linewidth"].fillna(1, inplace=True) - styles["facecolor"].fillna(self._facecolor, inplace=True) - styles["edgecolor"].fillna(styles["facecolor"], inplace=True) - styles["linestyle"].fillna("solid", inplace=True) + styles.fillna({ + "linewidth": 1, + "facecolor": self._facecolor, + "edgecolor": styles["facecolor"], + "linestyle": "solid" + }, + inplace=True + ) del styles["hatch"] # not supported in matrix (currently) x = np.repeat(np.arange(len(data)), n_cats) @@ -905,8 +909,8 @@ def make_args(val): for rect in rects: width = rect.get_width() + rect.get_x() ax.text( - width + margin, - rect.get_y() + rect.get_height() * 0.5, + float(np.ravel(width + margin)[0]), + float(np.ravel(rect.get_y() + rect.get_height() * 0.5)[0]), fmt.format(*make_args(width)), ha="left", va="center", @@ -916,8 +920,8 @@ def make_args(val): for rect in rects: width = rect.get_width() + rect.get_x() ax.text( - width + margin, - rect.get_y() + rect.get_height() * 0.5, + float(np.ravel(width + margin)[0]), + float(np.ravel(rect.get_y() + rect.get_height() * 0.5)[0]), fmt.format(*make_args(width)), ha="right", va="center", @@ -927,8 +931,8 @@ def make_args(val): for rect in rects: height = rect.get_height() + rect.get_y() ax.text( - rect.get_x() + rect.get_width() * 0.5, - height + margin, + float(np.ravel(rect.get_x() + rect.get_width() * 0.5)[0]), + float(np.ravel(height + margin)[0]), fmt.format(*make_args(height)), ha="center", va="bottom",