Giter VIP home page Giter VIP logo

Comments (7)

kushalkolar avatar kushalkolar commented on June 8, 2024

from fastplotlib.

XuAn-universe avatar XuAn-universe commented on June 8, 2024

install fastplotlib directly from main solves the above problem. But I got an error here:
iw.plot.canvas.close()


AttributeError Traceback (most recent call last)
Cell In[9], line 1
----> 1 iw.plot.canvas.close()

AttributeError: 'ImageWidget' object has no attribute 'plot'

When I tested the fastplotlib example, this error came up:

create a Plot instance

plot = Plot()

get a grayscale image

data = iio.imread("imageio:camera.png")

plot the image data

image_graphic = plot.add_image(data=data, name="sample-image")

show the plot

plot.show(sidecar=True)


ZeroDivisionError Traceback (most recent call last)
Cell In[6], line 2
1 # create a Plot instance
----> 2 plot = Plot()
4 # get a grayscale image
5 data = iio.imread("imageio:camera.png")

File H:\fastplotlib\fastplotlib\layouts_plot.py:48, in Plot.init(self, canvas, renderer, camera, controller, size, **kwargs)
12 def init(
13 self,
14 canvas: Union[str, WgpuCanvasBase] = None,
(...)
19 **kwargs,
20 ):
21 """
22 Simple Plot object.
23
(...)
46
47 """
---> 48 super().init(
49 parent=None,
50 position=(0, 0),
51 parent_dims=(1, 1),
52 canvas=canvas,
53 renderer=renderer,
54 camera=camera,
55 controller=controller,
56 **kwargs,
57 )
58 RecordMixin.init(self)
59 Frame.init(self)

File H:\fastplotlib\fastplotlib\layouts_subplot.py:73, in Subplot.init(self, parent, position, parent_dims, camera, controller, canvas, renderer, name)
31 """
32 General plot object that composes a Gridplot. Each Gridplot instance will have [n rows, n columns]
33 of subplots.
(...)
68
69 """
71 super(GraphicMethodsMixin, self).init()
---> 73 canvas, renderer = make_canvas_and_renderer(canvas, renderer)
75 if position is None:
76 position = (0, 0)

File H:\fastplotlib\fastplotlib\layouts_utils.py:30, in make_canvas_and_renderer(canvas, renderer)
24 raise TypeError(
25 f"canvas option must either be a valid WgpuCanvas implementation, a pygfx Texture"
26 f" or a str with the wgpu gui backend name."
27 )
29 if renderer is None:
---> 30 renderer = WgpuRenderer(canvas)
31 elif not isinstance(renderer, Renderer):
32 raise TypeError(
33 f"renderer option must be a pygfx.Renderer instance such as pygfx.WgpuRenderer"
34 )

File C:\ProgramData\anaconda3\envs\mescore\lib\site-packages\pygfx\renderers\wgpu_renderer.py:136, in WgpuRenderer.init(self, target, pixel_ratio, pixel_filter, show_fps, blend_mode, sort_objects, enable_events, gamma_correction, *args, **kwargs)
132 raise TypeError(
133 f"Render target must be a Canvas or Texture, not a {target.class.name}"
134 )
135 self._target = target
--> 136 self.pixel_ratio = pixel_ratio
137 self.pixel_filter = pixel_filter
139 # Make sure we have a shared object (the first renderer creates the instance)

File C:\ProgramData\anaconda3\envs\mescore\lib\site-packages\pygfx\renderers\wgpu_renderer.py:234, in WgpuRenderer.pixel_ratio(self, value)
232 target_lsize = self.logical_size
233 # Determine target ratio
--> 234 target_ratio = target_psize[0] / target_lsize[0]
235 # Use 2 on non-hidpi displays. On hidpi displays follow target.
236 self._pixel_ratio = float(target_ratio) if target_ratio > 1 else 2.0

ZeroDivisionError: division by zero

from fastplotlib.

XuAn-universe avatar XuAn-universe commented on June 8, 2024

I have fastplotlib 0.1.0a16, pygfx 0.1.18, and wgpu 0.15.1 installed.

from fastplotlib.

kushalkolar avatar kushalkolar commented on June 8, 2024

from fastplotlib.

XuAn-universe avatar XuAn-universe commented on June 8, 2024

It came with mesmerize-core pachage here: https://github.com/nel-lab/mesmerize-core

from fastplotlib.

kushalkolar avatar kushalkolar commented on June 8, 2024

from fastplotlib.

kushalkolar avatar kushalkolar commented on June 8, 2024

also see nel-lab/mesmerize-core#295 (comment)

from fastplotlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.