Circle-Generator | generate circles for block building games like Minecraft | Video Game library
kandi X-RAY | Circle-Generator Summary
kandi X-RAY | Circle-Generator Summary
Web frontend here:
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Circle-Generator
Circle-Generator Key Features
Circle-Generator Examples and Code Snippets
Community Discussions
Trending Discussions on Circle-Generator
QUESTION
Long time lurker, first time poster, hope someone can help!
I am an artist trying to wrap my head around generative/procedural design using numpy and various assorted tools in jupyter notebook.
I have some code https://github.com/GreySoulX/Circle-generator/blob/main/BrokenCircles.ipynb (see below) that will generate a number of concentric circles of random radius and output them as SVG code. I can get it to display, and I can even get the SVG output with the basic code, but when put it all in a functions and call it with interactive() my saved files come out empty rather that what is shown in my notebook with widgets.VBox() .
Any idea where I can fix this? Am I just missing this by a million miles?
...ANSWER
Answered 2021-May-12 at 03:24This is an issue with how the inline backend handles closing figures and what plt.savefig
does internally. The way static figures are displayed in notebooks (i.e. when not using ipympl) is that at the end of cell execution (or in this case at the end of the callback from the slider) the current figure is closed and displayed.
However plt.savefig
expects there to be a currently open figure as it calls plt.gcf
(get current figure) internally which either grabs the most recently active figure or creates a new empty figure if no figures are active.
So when you did this not in functions the figure wasn't closed until the cell was finished executing and so plt.savefig
was able to find the figure. However when you moved to functions it was no longer able to find the current figure.
There are two basic solutions to this.
Solutions 1. Globalfig
You can lift figure to the global scope and use fig.savefig
- this makes sure that both the plot updating method and the saving method are refering to the same fig
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Circle-Generator
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page