peus-plot: optionally give x-range as 2nd argument

Change-Id: I445ef00487fc34343f5a0333643f61753a1c4948
This commit is contained in:
2025-04-02 14:56:05 +02:00
parent ef985f094c
commit c545e36633
2 changed files with 7 additions and 3 deletions

View File

@ -70,9 +70,10 @@ def rects(intervals, y12):
class Plot:
def __init__(self, maxy):
def __init__(self, maxy, maxx=None):
self.lines = {}
self.yaxis = ((-2 * maxy, maxy), (-maxy, 2 * maxy))
self.maxx = maxx
self.first = True
self.fig = None
@ -124,7 +125,7 @@ class Plot:
self.fig, axleft = plt.subplots(figsize=(15,7))
self.pause = Pause(self.fig)
plt.title("I/Q", fontsize=14)
axleft.set_xlim(0, curves[0][-1])
axleft.set_xlim(0, self.maxx or curves[0][-1])
self.ax = [axleft, axleft.twinx()]
self.ax[0].axhline(y=0, color='#cccccc') # show x-axis line
self.ax[1].axhline(y=0, color='#cccccc')