Skip to content

Commit

Permalink
Plot all events of the current filter
Browse files Browse the repository at this point in the history
  • Loading branch information
briemla committed Feb 29, 2024
1 parent 4d9be7e commit 012054a
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions OTAnalytics/plugin_ui/visualization/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
ALPHA_BOUNDING_BOX = 0.7
LINEWIDTH_BOUNDING_BOX = 1.5
MARKERSIZE_TRACK_POINT = 6
MARKERSIZE_EVENT_FRAME = 12
MARKERSIZE_EVENT_FILTER = 6
MARKER_EVENT_FILTER = "x"
MARKER_EVENT_FRAME = "o"


class FilterEndDateProvider(VisualizationTimeProvider):
Expand Down Expand Up @@ -195,7 +199,8 @@ def build(

track_bounding_box_plotter = self._create_track_bounding_box_plotter()
track_point_plotter = self._create_track_point_plotter()
event_point_plotter = self._create_event_point_plotter()
event_point_plotter_frame = self._create_event_point_plotter_frame()
event_point_plotter_filter = self._create_event_point_plotter_filter()

layer_definitions = [
("Background", background_image_plotter, True),
Expand Down Expand Up @@ -245,9 +250,14 @@ def build(
track_point_plotter,
False,
),
(
"Show events of current filter",
event_point_plotter_filter,
False,
),
(
"Show events of current frame",
event_point_plotter,
event_point_plotter_frame,
False,
),
]
Expand Down Expand Up @@ -759,7 +769,7 @@ def _create_track_point_plotter(self) -> Plotter:
)
return PlotterPrototype(self._track_view_state, track_plotter)

def _create_event_point_plotter(self) -> Plotter:
def _create_event_point_plotter_frame(self) -> Plotter:
track_plotter = MatplotlibTrackPlotter(
TrackPointPlotter(
FilterByFrame(
Expand All @@ -771,7 +781,20 @@ def _create_event_point_plotter(self) -> Plotter:
),
self._color_palette_provider,
alpha=ALPHA_BOUNDING_BOX,
marker="h",
marker=MARKER_EVENT_FRAME,
markersize=MARKERSIZE_EVENT_FRAME,
),
)
return PlotterPrototype(self._track_view_state, track_plotter)

def _create_event_point_plotter_filter(self) -> Plotter:
track_plotter = MatplotlibTrackPlotter(
TrackPointPlotter(
self._get_event_data_provider_class_filter(),
self._color_palette_provider,
alpha=ALPHA_BOUNDING_BOX,
marker=MARKER_EVENT_FILTER,
markersize=MARKERSIZE_EVENT_FILTER,
),
)
return PlotterPrototype(self._track_view_state, track_plotter)

0 comments on commit 012054a

Please sign in to comment.