Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime error when moving contrast limits #272

Open
K-Meech opened this issue Jul 10, 2024 · 4 comments
Open

Runtime error when moving contrast limits #272

K-Meech opened this issue Jul 10, 2024 · 4 comments
Labels
Bug Something isn't working

Comments

@K-Meech
Copy link

K-Meech commented Jul 10, 2024

  • Open an example image (e.g. File > Open Sample > napari builtins > Cells (3D + 2Ch))
  • Open the histogram widget
  • Move the contrast limits in the layer controls

This throws the following error with the latest napari:

File ~\anaconda3\envs\napari-env\lib\site-packages\napari_matplotlib\histogram.py:65, in HistogramWidget._update_contrast_lims(self=<napari_matplotlib.histogram.HistogramWidget object>)
     61 def _update_contrast_lims(self) -> None:
     62     for lim, line in zip(
     63         self.layers[0].contrast_limits, self._contrast_lines
     64     ):
---> 65         line.set_xdata(lim)
        lim = 7686.227544910179
        line = <matplotlib.lines.Line2D object at 0x00000169A09ED210>
     67     self.figure.canvas.draw()

File ~\anaconda3\envs\napari-env\lib\site-packages\matplotlib\lines.py:1289, in Line2D.set_xdata(self=<matplotlib.lines.Line2D object>, x=7686.227544910179)
   1276 """
   1277 Set the data array for x.
   1278
   (...)
   1286 set_ydata
   1287 """
   1288 if not np.iterable(x):
-> 1289     raise RuntimeError('x must be a sequence')
   1290 self._xorig = copy.copy(x)
   1291 self._invalidx = True

RuntimeError: x must be a sequence
@samcunliffe samcunliffe added the Bug Something isn't working label Jul 11, 2024
@dstansby
Copy link
Member

Given the error traceback doesn't contain napari, maybe this is a problem with a newer Matplotlib release? I'm running CI over at #273 to try and debug this

@dstansby
Copy link
Member

This isn't showing up as an error in tests, so I think next steps here are to add a new test to the test suite that hits this error. @K-Meech do you think you'd be able to take a look at adding a new test?

@K-Meech
Copy link
Author

K-Meech commented Jul 15, 2024

Sure! I'll probably have time to do this tomorrow, otherwise it'll be later this week.

@K-Meech
Copy link
Author

K-Meech commented Jul 15, 2024

Ended up having some free time today, so I've made a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants