Skip to content

Commit 55175ea

Browse files
committed
Dim color in the legend when corresponding trend is not visible
Fixes #12
1 parent 86fc13d commit 55175ea

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/logplot/plot.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,14 @@ def _add_naming(self):
9898

9999
def _click_callback(self, event):
100100
if event.artist in self._legend_mapping: # click in legend
101+
visible = not self._legend_mapping[event.artist][0].get_visible()
101102
for line in self._legend_mapping[event.artist]:
102103
# toggle visibility
103-
line.set_visible(not line.get_visible())
104+
line.set_visible(visible)
105+
106+
event.artist.set_alpha(1 if visible else 0.2)
104107
self._fig.canvas.draw()
108+
105109
elif event.artist.get_visible(): # click in plot
106110
x_data, y_data = event.artist.get_data()
107111
x_val = np.take(x_data, event.ind)[0]

0 commit comments

Comments
 (0)