Skip to content

Commit e919dcd

Browse files
committed
Fix x-axis limits in configs plots
1 parent 21d3626 commit e919dcd

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

bench_runner/plot.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,19 @@ def _standardize_xlims(axs: Sequence[matplotlib.Axes]) -> None: # pyright: igno
358358
if not len(axs):
359359
return
360360

361-
minx, maxx = axs[0].get_xlim()
362-
for ax in axs[1:]:
361+
minx = None
362+
maxx = None
363+
for ax in axs:
363364
if not ax.has_data():
364365
continue
365-
xlim = ax.get_xlim()
366-
minx = min(minx, xlim[0])
367-
maxx = max(maxx, xlim[1])
366+
data = ax.get_lines()[0].get_data()[0]
367+
if len(data) > 1:
368+
xlim = ax.get_xlim()
369+
if minx is None or maxx is None:
370+
minx, maxx = xlim
371+
else:
372+
minx = min(minx, xlim[0])
373+
maxx = max(maxx, xlim[1])
368374

369375
for ax in axs:
370376
if ax.has_data():

0 commit comments

Comments
 (0)