Skip to content

Commit

Permalink
Merge pull request #262 from European-XFEL/scan-plot
Browse files Browse the repository at this point in the history
Allow passing a figure size to Scan.plot()
  • Loading branch information
JamesWrigley authored Nov 27, 2024
2 parents 9f63420 + 535fcd9 commit 9544407
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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

0 comments on commit 9544407

Please sign in to comment.