-
Notifications
You must be signed in to change notification settings - Fork 11
Exporting an image #21
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
Comments
Hi, this is a good question. I don't think there is a simple way to do this right now. I should check how to implement this, but it could take some time. |
Thank you for giving this thought! Any efforts would be greatly appreciated as it's a significant blocker to adopting this package in my workflows more generally |
Hi, and sorry for taking this long for looking into this issue. I added a from pyobsplot import Obsplot, Plot
oj = Obsplot(renderer="jsdom", theme="light")
oj(Plot.rectY(range(3), Plot.binX({"y": "count"})), path="out.html") This is still experimental and only available in the github version. Implementing this for the widget renderer doesn't work for the moment. But I believe that even if it works one day, it will only be able to generate a non-easily embeddable HTML file. But I'll continue to take a look into it. |
No stress at all. Things take time and when I briefly searched online this looked like it would be a tough nut to crack! Thanks so much for knocking something up. I'll give it a go. |
In fact I just published pyobsplot 0.4.0 which allows to output plots generated by the There is a bit of documentation about it here: https://juba.github.io/pyobsplot/usage.html#saving-plots-to-file Any feedback appreciated ! Output to file doesn't work for the |
Hi thanks for publishing! Using the latest version with python 3.9 gives the following error.
The | operator was added in Python 3.10. Given 3.12 was released this week it might be reasonable to set the minimum Python version as 3.10 but your call! Not a blocker for me as I'm happy to update my Python version :) |
Ah, you're right, thanks for pointing this out. I found this bug earlier but only put a workaround for CI tests. The development version should be compatible with Python 3.9 again, sorry ! |
Thanks to the solution in manzt/anywidget#339, saving widget output to an HTML file should now be possible. I'll try to publish a new package version shortly. |
v0.4.1 just released: https://github.com/juba/pyobsplot/releases/tag/v0.4.1 |
Amazing! Thank you so much for looking into this. I will give it a go tomorrow and let you know how it goes |
PR to address a bug with saving SVGs #22 |
Another update that I hope is helpful. When exporting HTML the title font from my notebook is not preserved. Perhaps this is an observable plot question and not a pyobsplot question!
Do you know if this is fixable? Including font-family changes the font for the axis elements but not the title or caption. I noticed Plotly preserves the title element when saving to SVG with Kaleido |
When you display the plot without exporting it to a file, your title is in a serif font ? As far as I can see the |
Sorry for the delay. Yep that's correct the style option is applied to the svg element so my title remains unchanged. Just noticed there is an issue open on observable plot to be able to style the figure element. What's the implications of adding a font family here? Perhaps borrowing the font family of h2, h3 and figcaption here? This would allow one to share html exports over email for example and have them open with titles etc. styled properly. |
The styles in So for the moment I think I'll wait for the upstream issue to be resolved. |
That makes sense thanks. What are your thoughts on this #24? Apologies if I've not fully absorbed your point above! |
How would I export a plot to html/png/svg?
Ideally I would like to be able to do something similar to Plotly i.e.
fig.write_html("path/to/file.html")
/fig.write_image("images/fig1.png")
/fig.write_image("images/fig1.svg")
The text was updated successfully, but these errors were encountered: