Skip to content

Commit 1587f6e

Browse files
committed
improved dice plots
1 parent c7203a0 commit 1587f6e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/napari_cellseg_annotator/plugin_metrics.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ def plot_dice(self, dice_coeffs):
106106

107107
for coeff in dice_coeffs:
108108
if coeff < 0.5:
109-
colors.append("r")
109+
colors.append("#72071d") # 72071d # crimson red
110110
else:
111-
colors.append("cyan")
111+
colors.append("#8dd3c7") # 8dd3c7 # turquoise cyan
112112
with plt.style.context("dark_background"):
113113
if self.canvas is None:
114114
self.canvas = FigureCanvas(Figure(figsize=(1.75, 4)))
@@ -118,15 +118,23 @@ def plot_dice(self, dice_coeffs):
118118
self.canvas.figure.set_facecolor(bckgrd_color)
119119
dice_plot = self.canvas.figure.add_subplot(1, 1, 1)
120120
labels = np.array(range(len(dice_coeffs))) + 1
121-
dice_plot.barh(labels, dice_coeffs)#, color=colors)
121+
dice_plot.barh(labels, dice_coeffs, color=colors)
122122
dice_plot.set_facecolor(bckgrd_color)
123-
self.canvas.draw_idle()
123+
124124
self.plots.append(self.canvas)
125+
dice_plot.axvline(0.5, color="#72071d")
126+
dice_plot.set_title(f"Session {len(self.plots)}")
127+
dice_plot.set_xlabel("Dice coefficient")
128+
dice_plot.set_ylabel("Labels pair id")
129+
130+
self.canvas.draw_idle()
125131

126132
def remove_plots(self):
127133
if len(self.plots) != 0:
128134
for p in self.plots:
129135
p.setVisible(False)
136+
self.plots = []
137+
self.btn_reset_plot.setVisible(False)
130138

131139
def compute_dice(self):
132140
# u = 0

0 commit comments

Comments
 (0)