Content-Length: 521397 | pFad | https://github.com/fastplotlib/fastplotlib/pull/773

79 more event docs, make some things public by kushalkolar · Pull Request #773 · fastplotlib/fastplotlib · GitHub
Skip to content

more event docs, make some things public #773

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

Merged
merged 70 commits into from
Apr 7, 2025
Merged

Conversation

kushalkolar
Copy link
Member

@kushalkolar kushalkolar commented Mar 19, 2025

WIP

  • cleanup docs on events.
  • better event tables, list of dicts to encode event table info, more maintainable, parse for docs
  • More event examples
    • image data
      • click and move pointer around image to change the data, like pyqtgraph ImageItem draw example
    • cmap between image, scatter, line
    • image click
    • key events
    • line data and thickness event
    • "pointer_move" combined with get_nearest_graphics() with circles
    • scatter click, scatter "hover", i.e. pointer_move event
    • scatter "hover" to show same datapoint across data transformation, based on sklearn example
    • drag points
    • example similar to pyqtgraph Text Item example
      • have a sinc wave, scatter point at the peak with text indicating some text and the position
      • move a scatter point with a text label along the line on each draw using animation function
  • Controller examples, ids, sync, etc. all combinations
  • add docs on how to integrate with UI libs
    • ipywidget examples
  • docs on utils.plot_helpers
  • make graphics._features public under fpl.graphics, this allows the various features to be used by users for instance checks and similar purposes.
  • rename FeatureEvent -> GraphicFeatureEvent, make it a top level public import.
  • make graphics.Graphic accessible publicly, also useful for instance checks etc.
  • make Subplot accessible under fpl.Layouts

@kushalkolar kushalkolar force-pushed the docs-events-detailed branch from 3f16430 to 9999a56 Compare March 24, 2025 12:20
@kushalkolar kushalkolar changed the title more docs, march 2025 edition more docs, make some things public Mar 24, 2025
@kushalkolar kushalkolar changed the title more docs, make some things public more event docs, make some things public Mar 24, 2025
@kushalkolar kushalkolar marked this pull request as ready for review March 24, 2025 12:35
@kushalkolar kushalkolar requested a review from clewis7 as a code owner March 24, 2025 12:35
Copy link

github-actions bot commented Mar 25, 2025

📚 Docs preview built and uploaded! https://www.fastplotlib.org/ver/docs-events-detailed

@kushalkolar
Copy link
Member Author

kushalkolar commented Apr 1, 2025

@clewis7 replacing all hard-coded rst event info tables with list of dicts, more maintainable, easy to parse it into a table for docs.

class VertexPositions(BufferManager):
    property_name = "data"
    event_info_spec = [
        {
            "dict key": "key",
            "type": "slice, index (int) or numpy-like fancy index",
            "description": "key at which vertex positions data were indexed/sliced"
        },
        {
            "dict key": "value",
            "type": "int | float | array-like",
            "description": "new data values for points that were changed"
        },
    ]

I copy-pasted some code from here, it works: https://pablofernandez.tech/2019/03/21/turning-a-list-of-dicts-into-a-restructured-text-table/

@kushalkolar
Copy link
Member Author

Thoughts for making classes under graphics.features public:

  • Keep the name GraphicFeature, no renaming to GraphicProperty because then that confuses it with the actual properties on the graphics. A GraphicFeature is different from the actual property attributes on a Graphic which are the user-facing properties to modify a GraphicFeature.
  • Rename FeatureEvent to GraphicFeatureEvent ? More explicit.
  • Expose GraphicFeatureEvent at top level, i.e. fpl.GraphicFeatureEvent. Very useful for type annotations of event handlers.
  • Users will not need to use GraphicFeature classes, except for advanced users who want to make their own Graphic classes etc. I cannot think of a case where a standard user would need access to a GraphicFeature class. So, although we make graphic feature classes part of the public API it will need to be accessed explicitly, ex: from fastplotlib.graphics.features import VertexColors

@clewis7

@clewis7
Copy link
Member

clewis7 commented Apr 2, 2025

Thoughts for making classes under graphics.features public:

  • Keep the name GraphicFeature, no renaming to GraphicProperty because then that confuses it with the actual properties on the graphics. A GraphicFeature is different from the actual property attributes on a Graphic which are the user-facing properties to modify a GraphicFeature.
  • Rename FeatureEvent to GraphicFeatureEvent ? More explicit.
  • Expose GraphicFeatureEvent at top level, i.e. fpl.GraphicFeatureEvent. Very useful for type annotations of event handlers.
  • Users will not need to use GraphicFeature classes, except for advanced users who want to make their own Graphic classes etc. I cannot think of a case where a standard user would need access to a GraphicFeature class. So, although we make graphic feature classes part of the public API it will need to be accessed explicitly, ex: from fastplotlib.graphics.features import VertexColors

@clewis7

I like keeping the name the same. I also like GraphicFeatureEvent because it is more explicit.

Aside from type annotations, when would a user need fpl.GraphicFeatureEvent? If it is just for that, I am not sure we should expose it...maybe better to just have really good docs.

I like the explicit access of a GraphicFeature just because I agree no one would ever need it unless they were doing something custom.

@kushalkolar
Copy link
Member Author

Aside from type annotations, when would a user need fpl.GraphicFeatureEvent? If it is just for that, I am not sure we should expose it...maybe better to just have really good docs.

Earlier we kinda came to the conclusion that anything which is use ~80% of the time should be a top level import, and event it's used for type annotations it's still very useful and events are used very often so I've made it a top level import. It's a pretty clean import so there aren't issues with doing this.

@kushalkolar
Copy link
Member Author

@clewis7 should be gtg!

summary of major changes other than those already mentioned above:

  1. Cleaned up events docs section in user guide, graphic feature event tables are now auto-generated and in their own section: https://www.fastplotlib.org/ver/docs-events-detailed/user_guide/event_tables.html. The auto generation is done based on this: more event docs, make some things public #773 (comment)
  2. Added UI library integration section in guide.
  3. Examples gallery:
  4. Graphic._features is now a dict instead of a set which maps the graphic property name to the feature class. Right now this mapping is only used for generating the graphic feature event tables in the docs. See here. It's private so no changes to the user.

Tested all examples and they work!

@kushalkolar kushalkolar merged commit be8e0c8 into main Apr 7, 2025
52 checks passed
@kushalkolar kushalkolar deleted the docs-events-detailed branch April 7, 2025 17:34
@kushalkolar kushalkolar restored the docs-events-detailed branch April 11, 2025 03:33
@kushalkolar kushalkolar deleted the docs-events-detailed branch April 11, 2025 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/fastplotlib/fastplotlib/pull/773

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy