diff --git a/scripts/histogram_function_sizes.py b/scripts/histogram_function_sizes.py
index 685226bd8cf0b3e9bcc3a863133f9753b54efdc4..a98841f912719c52e70d8acb4822bf00065fee90 100755
--- a/scripts/histogram_function_sizes.py
+++ b/scripts/histogram_function_sizes.py
@@ -27,7 +27,7 @@ df = pandas.DataFrame(all_ranges, columns=["Function Size"])
 if len(sys.argv) >= 4:
     max_x = int(sys.argv[3])
 else:
-    max_x = ax.get_xlim()[1]
+    max_x = df["Function Size"].max()
 
 print(' * Statistics:')
 print('  * Number of ranges: {}'.format(len(all_ranges)))