Javascript Limit Array Size Python Compiler Matplotlib