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

Allow passing a figure size to Scan.plot() #262

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

Added:
- [Timepix3][extra.components.Timepix3] to access raw hits and centroids from the Timepix3 detector (!231).
- [Scan.plot()][extra.components.Scan.plot] now allows passing a `figsize` (!262).

Fixed:

Expand Down
4 changes: 2 additions & 2 deletions src/extra/components/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def positions_train_ids(self) -> list:
"""List of train IDs for each position."""
return self._positions_train_ids

def plot(self, ax=None):
def plot(self, figsize=(10, 6), ax=None):
"""Visualize the scan steps.

Each step is plotted in a different color on top of the motor
Expand All @@ -153,7 +153,7 @@ def plot(self, ax=None):
from matplotlib.patches import Rectangle
if ax is None:
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(10, 6))
fig, ax = plt.subplots(figsize=figsize)

# Show all the motor values
ax.plot(self._input_pos.trainId, self._input_pos)
Expand Down