pythonplotjupyterlarge-data-volumes

How can I fix Python 3 not handling multiple plots in one figure?


A project I am working on requires me to put multiple plots in one figure as in 100+ plots in one figure and the dataset I am working with currently has exactly 100 plots. I am using Jupyter to test code then putting finished code into Visual Studios 2019. In Jupyter I am able to plot about 80 lines in one figure before the figure becomes distorted. It is the same in Visual Studios. At 90 lines, the figure cuts off about half of the plots and at 100 the programs crash. I was told I likely need a more powerful computer since I am just using my regular hp laptop, but I was wondering if there is a way around this or is that my only option?

For instance, maybe I could make two figures with 50 plots each then merge the two but I'm not sure if that would also crash the programs. Although that might also be a problem when the datasets contain something like 400 plots each. I am afraid any solution will be far over my head as I'm relatively new to Python.

For reference I added what the figures look like with 40 and 90 plots.

figure with 40 plots

figure with 90 plots


Solution

  • Based on your examples, I assume you mean you want to put many lines onto one graph, so I think this is a duplicate of: plotting too many lines in matplotlib: out of memory

    The solution you want is probably using a Line Collection to pass in many lines at once.