Skip to content

Commit

Permalink
fix hover on 1d figures
Browse files Browse the repository at this point in the history
  • Loading branch information
nvaytet committed Mar 8, 2024
1 parent e8ff21f commit 382107e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/plopp/backends/matplotlib/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,19 @@ def format_coord(self, x: float, y: float) -> str:
xstr = _cursor_formatter(x, self.dtypes['x'], self.units['x'])
ystr = _cursor_formatter(y, self.dtypes['y'], self.units['y'])
out = f"({self._cursor_x_prefix}{xstr}, {self._cursor_y_prefix}{ystr})"
if not self._coord_formatters:
return out
xpos = (
self.dims['x'],
_cursor_value_to_variable(x, self.dtypes['x'], self.units['x']),
)
ypos = (
self.dims['y'],
_cursor_value_to_variable(y, self.dtypes['y'], self.units['y']),
(
self.dims['y'],
_cursor_value_to_variable(y, self.dtypes['y'], self.units['y']),
)
if 'y' in self.dims
else None
)
extra = [formatter(xpos, ypos) for formatter in self._coord_formatters]
extra = [e for e in extra if e is not None]
Expand Down

0 comments on commit 382107e

Please sign in to comment.