diff --git a/statannotations/_Plotter.py b/statannotations/_Plotter.py index 09db5b2..92d1685 100644 --- a/statannotations/_Plotter.py +++ b/statannotations/_Plotter.py @@ -347,6 +347,10 @@ def _get_value_pos_for_path_collection(self, child, data_to_ax): return group_name, value_pos[value_coord] def _get_value_pos_for_line2d_or_rectangle(self, child, data_to_ax): + + if (type(child) == Rectangle) and ((child.get_width()<=0) or (child.get_height()<=0)): + return None, None + bbox = self.ax.transData.inverted().transform( child.get_window_extent(self.fig.canvas.get_renderer()))