-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add a visualization with NumPy and canvas #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- /palettes.py | ||
- /fractals.py | ||
</py-env> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could support <py-script src="./palettes.py"
>` as well (or alternatively).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nested module structure would be nice to have as well. Currently any attempts failed with various errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattpap it does support src
. Check out the todo example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that part. However, I wanted to achieve was to include a script and then import from it. I ended up using <py-env>
.
import numpy as np | ||
|
||
from palettes import Magma256 | ||
from fractals import mandelbrot, julia |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better if those were relative imports, assuming it's possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, not sure. I'll merge and we can try it and change later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. Will hold to merge a little in case you have a feedback or want to move the code to a source file, per comments.
- /palettes.py | ||
- /fractals.py | ||
</py-env> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattpap it does support src
. Check out the todo example.
I think I'm good with the current state of this PR. I will submit a follow-up to address Peter's suggestions. |
A combination of NumPy ndarray manipulation and HTML5 canvas (intentionally not using mpl, ...) to produce fractal images:
Could be made into an interactive visualization by allowing setting initial conditions, palette, etc.