Giter Site home page Giter Site logo

Comments (4)

kushalkolar avatar kushalkolar commented on May 22, 2024

I think we should try and minimize the number of imports that have to be written, try to avoid becoming messy like bokeh. Maybe have the widgets importable at top level since those will probably be used more frequently. Should see what we come up with for the events system as well in #39 and see where that will go.

from fastplotlib.

EricThomson avatar EricThomson commented on May 22, 2024

This sounds like a good strategy to me! The one question I have here is where the line is between things that would fall into the Plot and graphics functionality. E.g., again with my usual thought: try to emulate matplotlib where it is strong, but break from it where it is not (and where people don't really use it much anyway).

import fastplotlib.Plot as plot
plot = Plot()
plot.scatter() #does a scatter plot
plot.plot()  # plots a line (don't make ppl think about what special objects are needed)
plot.imshow()  # again, just let people do what they already expect

But then for special widgets with a ui component, you need widgets because matplotlib is not great, so you have special things for that, because you don't want to emulate matplotlib.

Anyway, just thinking out loud here as usual. I may well be wrong, esp as I am not yet a power user of fastplotlib.

from fastplotlib.

kushalkolar avatar kushalkolar commented on May 22, 2024

Kind of, this is how the simple plot functionality works:

from fastplotlib import Plot()

plot = Plot()  # create a plotter

plot.image()  # image plot
plot.line()  # line plot, put on the same canvas since we're using the same plot instance
plot.scatter()  # scatter plot, put on top of the previous
... etc.

It's similar to matplotlib but I think a bit more explicity, image, line, scatter are the same exact names as the Graphic classes. That's how it's actually implemented in the Plot class anyways and probably makes it easy for a user to go between the simple Plot interfaces and Graphics if necessary.

For widgets, currently the image widget works like this:

from fastplotlib.widgets import ImageWidget

iw = ImageWidget(data=<data>, cmap="plasma")

# if it's a single data array, they can access the `Plot` instance of the imagewidget and add more things
iw.plot.line(data=<some line data>)

from fastplotlib.

EricThomson avatar EricThomson commented on May 22, 2024

Just using with recent changes, it seems there are a lot of imports I'm doing right now, e.g.,:

from fastplotlib import Plot
from fastplotlib.layouts import GridPlot
from fastplotlib.graphics import ImageGraphic

This seems like too much for the simplicity of what I'm trying to do.

I see the utility of having these layout/graphics things in separate modules, but I wonder if you might want to set up the package (with imports in __init__) so people can just from fastplotlib import Plot, GridPlot, Image and all the things, but also maybe more importantly for the future they can just import fastplotlib as fpl and then just use these different widgets as needed? grid_plot = fpl.GridPlot(...things..).

FOr people that like to keep things logically ordered, they could still import as above.

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.