Skip to content
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

fix: unified graph captions. #410

Merged
merged 11 commits into from
Nov 13, 2023
3 changes: 2 additions & 1 deletion src/caret_analyze/plot/visualize_lib/bokeh/bokeh.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ def histogram(
raise NotImplementedError()

plot: Figure = Figure(
title=data_type if case is None else f'{data_type} --- {case} case ---',
title=f'Histogram of {data_type}'
if case is None else f'Histogram of {data_type} --- {case} case ---',
x_axis_label=x_label, y_axis_label='Probability', width=800
)

Expand Down
6 changes: 4 additions & 2 deletions src/caret_analyze/plot/visualize_lib/bokeh/stacked_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ def create_figure(self) -> Figure:
# # get stacked bar data
data: dict[str, list[int | float]]
y_labels: list[str] = []
y_axis_label = 'latency [ms]'
caption = 'latency'
y_axis_label = caption + ' [ms]'
target_objects = self._metrics.target_objects
data, y_labels = self._metrics.to_stacked_bar_data()
title: str = f"Stacked bar of '{getattr(target_objects, 'path_name')}'"
path_name = target_objects.path_name
title: str = f'Stacked bar of response_time of {path_name} --- {self._case} case ---'

fig = init_figure(title, self._ywheel_zoom, self._xaxis_type, y_axis_label)
frame_min = data['start time'][0]
Expand Down
11 changes: 3 additions & 8 deletions src/caret_analyze/plot/visualize_lib/bokeh/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def create_figure(self) -> Figure:

# Initialize figure
y_axis_label = timeseries_records_list[0].columns[1]
data_type = y_axis_label
if y_axis_label == 'frequency':
y_axis_label = y_axis_label + ' [Hz]'
elif y_axis_label in ['period', 'latency']:
Expand All @@ -61,14 +62,8 @@ def create_figure(self) -> Figure:
y_axis_label = 'Response time' + ' [ms]'
else:
raise NotImplementedError()
if isinstance(target_objects[0], CallbackBase):
title = f'Time-line of callbacks {y_axis_label}'
elif isinstance(target_objects[0], Communication):
title = f'Time-line of communications {y_axis_label}'
elif isinstance(target_objects[0], Path):
title = f'Time-line of Paths {y_axis_label} --- {self._case} case ---'
else:
title = f'Time-line of publishes/subscribes {y_axis_label}'
title: str = f'Timeseries of {data_type} --- {self._case} case --- \
'if data_type == 'response_time' else f'Timeseries of {data_type}'
fig = init_figure(title, self._ywheel_zoom, self._xaxis_type, y_axis_label)

# Apply xaxis offset
Expand Down
Loading