Comments (11)
PNG export would indeed be really useful, but it is much harder to implement than SVG export, because you need a complete HTML renderer (such as a browser) to convert to a bitmap image file.
Maybe I'll try to see how other libraries implement this.
from pyobsplot.
Observable use this. Happy to try adding a function to pyobsplot-js if you think that would make sense
from pyobsplot.
Oh I didn't know about this, it seems really promising ! Where did you see that Observable uses it ?
If you want to try to integrate it in pyobsplot, of course don't hesitate. Maybe the difficulty will be to make it work in both the jsdom
and widget
renderers, but it is definitely worth a try.
from pyobsplot.
Great - I'll give that a go. It was mentioned in a discussion here.
from pyobsplot.
This was unfortunately the case for html-to-image "but it is much harder to implement than SVG export, because you need a complete HTML renderer (such as a browser) to convert to a bitmap image file.". In Observable notebooks the figure has already been rendered in the browser so export to png via html-to-image is possible.
I've had a look at what other visualisation libraries do and they all appear to take a similar approach as described here. A simple approach that worked but proved limited was using the python package html2image. The issue I had was getting the correct width and height. If the html just contains an SVG tag then there's no issue we can grab the width and height attributes. However, if there is a title/legend/caption etc. then the height will be too small.
Bokeh has an implementation to dynamically get the width and height which we could try and borrow when the figure is a HTML object (export_to_png and dynamically estimate width & height )?
Not ideal, there would also need to be an additional docs section similar to this.
Let me know what you think
from pyobsplot.
Related Issues (20)
- Syntax error in documentation HOT 1
- Widget JS error troubleshooting
- Use type declarations to improve IDE support
- Integrating Observable Inputs HOT 2
- Implement "dark mode"
- Interactions and static tips not possible with `jsdom` renderer HOT 2
- 'charmap' codec can't decode byte 0x90 in position 780112: character maps to <undefined> HOT 7
- Make shorthand definition possible HOT 1
- Unexpected scale for pandas datetime column HOT 4
- question about ObservableHQ HOT 2
- Exporting an image HOT 17
- Simplify dataframe serializations HOT 1
- Plot.rectY not plotting bars HOT 2
- Widget renderer output lost when notebook is closed in JupyterLab HOT 1
- Add padding for `jsdom` renderer output
- Mixing renderers in Jupyter lab moves all outputs to widgets HOT 1
- Add "Open in colab" button HOT 2
- Investigate topojson "frame" issue HOT 1
- Plots with legends don't work in Quarto in formats other than HTML HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyobsplot.