Ask Your Question

list_plot generator

asked 2019-10-09 00:02:55 +0200

JoalHeagney gravatar image

updated 2019-10-09 00:04:03 +0200

I have created a python generator that yeilds a list of single values (e.g. like [1,971,15,341,..]) up to some defined length of n,and wanted to plot them in sagemath.

When I pass the generator to list_plot, I get an error as list_plot only accepts lists, tuples and dictionaries.

Is there any way to get the list_plot behaviour from a generator without converting to a list first (To memory-hungry for my purpose)?

If not, I'm planning to request an enhancement to list_plot, if at all possible.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-10-09 01:30:27 +0200

tmonteil gravatar image

How large is n ?

The thing is that the size of the plot will be larger than the size of the list, and the plot also has to fit in memory. So, if the list does not fit into the memory, there is no way to plot all its points.

edit flag offensive delete link more


I was hoping that list_plot's biggest memory component was just an image, not a dynamic object. I'm assuming this is not true?

JoalHeagney gravatar imageJoalHeagney ( 2019-10-09 10:40:30 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-10-09 00:02:55 +0200

Seen: 314 times

Last updated: Oct 09 '19