GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — beginning base logic for interactivity impl by clewis7 · Pull Request #61 · fastplotlib/fastplotlib

beginning base logic for interactivity impl #61

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.

Sign up for GitHub

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

Closed
clewis7 wants to merge 23 commits into master from interaction

Uh oh!

There was an error while loading. Please reload this page.

Closed

beginning base logic for interactivity impl #61

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2c00596
beginning base logic for interactivity impl
Dec 12, 2022
10aeca8
further changes and ideas
Dec 12, 2022
f19c9c1
wip
Dec 14, 2022
ac6c67a
grrrrr
Dec 15, 2022
ad6a8d6
oops
Dec 15, 2022
95e77a1
reorg
Dec 15, 2022
71eb48f
small changes and reorg
Dec 15, 2022
e203cff
updates to line, works w previous example
Dec 17, 2022
0f22531
small changes
Dec 18, 2022
16922e7
git is so agitating sometimes
Dec 18, 2022
70a3be6
fixing z_position
Dec 19, 2022
a999094
Merge branch 'master' into interaction
clewis7 Dec 19, 2022
bc688fc
implementing reset_feature
Dec 19, 2022
24fb5a5
blah
Dec 19, 2022
7667224
blah
Dec 19, 2022
b3767ff
Delete event_handler.ipynb
clewis7 Dec 19, 2022
462f098
Delete event_linecollection.ipynb
clewis7 Dec 19, 2022
7099783
Delete event_single_contour.ipynb
clewis7 Dec 19, 2022
c523c28
accidentally deleted heatmap file
Dec 19, 2022
38a3f3a
Merge branch 'interaction' of https://github.com/kushalkolar/fastplot…
Dec 19, 2022
9309b41
ugly but functional
Dec 20, 2022
a6b53ee
LineCollection has @world_object, fix float64 bug in LineGraphic
kushalkolar Dec 21, 2022
0cb73ca
Merge branch 'master' into interaction
kushalkolar Dec 23, 2022
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
reorg
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

Caitlin Lewis
Caitlin Lewis committed Dec 15, 2022
commit 95e77a142f8afb38ea320bcdde8f5b51814448fc

There are no files selected for viewing

15 changes: 13 additions & 2 deletions 15 fastplotlib/graphics/_base.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from typing import Any
from typing import Any, List
Comment thread
clewis7 marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.


import numpy as np
import pygfx

from fastplotlib.utils import get_colors, map_labels_to_colors

from abc import ABC, abstractmethod
from dataclasses import dataclass

class Graphic:
def __init__(
Expand Down Expand Up @@ -91,7 +92,7 @@ def _set_feature(self, name: str, new_data: Any, indices: Any):
pass

Comment thread
clewis7 marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

@abstractmethod
def link(self, event: str, feature: Any, feature_data: Any, target: Graphic, target_feature: Any, target_data: Any, indices_mapper: Any):
def link(self, event: str, target: Graphic, feature: str, new_data: Any, indices_mapper: callable = None):
# event occurs, causes change in feature of current graphic to data indices from pick_info,
# also causes change in target graphic to target feature at target data with corresponding or mapped
# indices based on the indice_mapper function
Expand All @@ -101,4 +102,14 @@ def link(self, event: str, feature: Any, feature_data: Any, target: Graphic, tar
# indice mapper takes in source features and maps to target features
pass

@abstractmethod
def event_handler(self, event):
Comment thread
clewis7 marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

pass

@dataclass
class EventData:
Comment thread
clewis7 marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

"""Class for keeping track of the info necessary for interactivity after event occurs."""
def __init__(self, target: Graphic, feature: str, new_data: Any):
self.target = target
self.feature = feature
self.new_data = new_data
17 changes: 9 additions & 8 deletions 17 fastplotlib/graphics/line.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import *

from ._base import Graphic
from ._base import EventData

class LineGraphic(Graphic):
def __init__(self, data: np.ndarray, zlevel: float = None, size: float = 2.0, colors: np.ndarray = None, cmap: str = None, *args, **kwargs):
Expand All @@ -24,7 +25,7 @@ def __init__(self, data: np.ndarray, zlevel: float = None, size: float = 2.0, co
material=material(thickness=size, vertex_colors=True)
)

self.events = {}
self.registered_callbacks = {}
Comment thread
clewis7 marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.


def fix_data(self):
# TODO: data should probably be a property of any Graphic?? Or use set_data() and get_data()
Expand Down Expand Up @@ -79,13 +80,13 @@ def link(self, event: str, target: Graphic, feature: str, new_data: Any, indices
else:
raise ValueError("event not possible")

if event in self.events.keys():
self.events[event].append((target, feature, new_data))
if event in self.registered_callbacks.keys():
self.registered_callbacks[event].append(EventData(target=target, feature=feature, new_data=new_data))
else:
self.events[event] = list()
self.events[event].append((target, feature, new_data))
self.registered_callbacks[event] = list()
self.registered_callbacks[event].append(EventData(target=target, feature=feature, new_data=new_data))

def event_handler(self, event):
if event.type in self.events.keys():
for target_info in self.events[event.type]:
target_info[0]._set_feature(name=target_info[1], new_data=target_info[2], indices=None)
if event.type in self.registered_callbacks.keys():
for target_info in self.registered_callbacks[event.type]:
target_info.target._set_feature(name=target_info.feature, new_data=target_info.new_data, indices=None)
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.