Skip to content

Commit

Permalink
fix: unified graph captions. (#410)
Browse files Browse the repository at this point in the history
* Unified graph captions.

Signed-off-by: emb4 <[email protected]>

* Unified conditional branching of graph captions.

Signed-off-by: emb4 <[email protected]>

* Fixed flake8 errors.

Signed-off-by: emb4 <[email protected]>

* Point corrected.

Signed-off-by: emb4 <[email protected]>

* Corrected string notation.

Signed-off-by: emb4 <[email protected]>

* Corrected string notation.

Signed-off-by: emb4 <[email protected]>

* Corrected the points pointed out.

Signed-off-by: emb4 <[email protected]>

* Corrected caption.

Signed-off-by: emb4 <[email protected]>

* Corrected caption.

Signed-off-by: emb4 <[email protected]>

---------

Signed-off-by: emb4 <[email protected]>
  • Loading branch information
emori-ctc authored Nov 13, 2023
1 parent c39fb10 commit b2a3eda
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
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

0 comments on commit b2a3eda

Please sign in to comment.