Generate figures on clicking a button with code hidden. #1772
Unanswered
atharvaaalok
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am writing a scientific article about my research.
I give a first code block to explain the method.
This generates a figure.
I then want to run the same code again in a different cell to generate figures many times.
Basically, some parameter is randomly initialized and a figure is generated.
This should help my reader get an idea of the types of outputs that can be generated for different parameter values.
Here is what I want to achieve.
I want my second code block to be hidden. Since I have already explained the working of the code in the first block I don't need to show it again in a loop. This just adds to clutter.
Then I want there to be a button (say an ipywidget) that when clicked generates a new figure.
So basically I want to hide my code to run behind a button that my reader can click to generate figures.
Example code:
I want only the "Generate Plot" button to be visible. The code should somehow be hidden in the background.
For example hidden in a dropdown which the reader can click to see the code if they want to.
How can I achieve functionality like this?
Beta Was this translation helpful? Give feedback.
All reactions