Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions upsetplot/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down