Skip to content

Commit

Permalink
Boxplot: Add axis label
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Aug 23, 2024
1 parent 6c742f7 commit 3664b1d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Orange/widgets/visualize/owboxplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,12 +960,20 @@ def draw_axis(self):
self.box_scene.addLine(
bottom * scale_x - 4, 0, top * scale_x + 4, 0, self._pen_axis)

t = QGraphicsSimpleTextItem(self.attribute.name)
t.setFont(self._axis_font)
t.setFlag(QGraphicsItem.ItemIgnoresTransformations)
t.setPos(
self.scene_min_x + (self.scene_width - t.boundingRect().width()) / 2,
8 + 1.5 * self._axis_font.pixelSize())
self.box_scene.addItem(t)

def draw_stat(self):
if self.stat_test:
label = QGraphicsSimpleTextItem(self.stat_test)
brect = self.box_scene.sceneRect()
label.setPos(brect.center().x() - label.boundingRect().width()/2,
8 + self._axis_font.pixelSize()*2)
label.setPos(brect.center().x() - label.boundingRect().width() / 2,
8 + self._axis_font.pixelSize() * 3.6)
label.setFlag(QGraphicsItem.ItemIgnoresTransformations)
self.box_scene.addItem(label)

Expand Down

0 comments on commit 3664b1d

Please sign in to comment.