Skip to content

Interactivity #84

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

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
further changes and ideas
  • Loading branch information
clewis7 committed Dec 23, 2022
commit 68a89d7d26c28f86bba0c7c0d4c10377e046bf8f
10 changes: 9 additions & 1 deletion fastplotlib/graphics/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from ..utils import get_colors
from .features import GraphicFeature, DataFeature, ColorFeature, PresentFeature

from abc import ABC, abstractmethod

class Graphic:
def __init__(
Expand Down Expand Up @@ -107,28 +108,35 @@ def __repr__(self):
<<<<<<< HEAD
=======

class Interaction:
class Interaction(ABC):
# make them abstract properties
@property
@abstractmethod
def indices(self) -> Any:
pass

@indices.setter
@abstractmethod
def indices(self, indices: Any):
pass

@property
@abstractmethod
def features(self) -> List[str]:
pass

@abstractmethod
def _set_feature(self, name: str, new_data: Any, indices: Any):
pass

@abstractmethod
def link(self, event: str, feature: Any, feature_data: Any, target: Graphic, target_feature: Any, target_data: Any, indices_mapper: Any):
# 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

# events can be feature changes, when feature changes want to trigger an event

# indice mapper takes in source features and maps to target features
pass

Expand Down
22 changes: 21 additions & 1 deletion fastplotlib/graphics/heatmap.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import numpy as np
import pygfx
from typing import *

from fastplotlib.graphics._base import Graphic

from .image import ImageGraphic

from ..utils import quick_min_max, get_cmap_texture

from ._base import Interaction


default_selection_options = {
"mode": "single",
Expand Down Expand Up @@ -40,7 +45,22 @@ def __init__(
self.callbacks = callbacks


class HeatmapGraphic(ImageGraphic):
class HeatmapGraphic(ImageGraphic, Interaction):
@property
def indices(self) -> Any:
pass

@property
def features(self) -> List[str]:
pass

def _set_feature(self, name: str, new_data: Any, indices: Any):
pass

def link(self, event: str, feature: Any, feature_data: Any, target: Graphic, target_feature: Any, target_data: Any,
indices_mapper: Any):
pass

def __init__(
self,
data: np.ndarray,
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy