-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add SVG output option #10
Labels
Comments
SVG version:
PNG version:
|
PNG performed a little better. But this is odd:
I don't think I believe that. Should dig further. |
simonw
changed the title
Try using SVG instead of PNG for the output
Add SVG output option
Oct 12, 2020
I'm going to add a |
Here's my prototype: +++ b/datasette_seaborn/__init__.py
@@ -35,15 +35,15 @@ def render_seaborn(columns, rows, request):
method_fn = getattr(sns, method)
figure = method_fn(data=df, **kwargs)
- png = io.BytesIO()
+ image_bytes = io.BytesIO()
if not hasattr(figure, "savefig"):
figure = figure.get_figure()
- figure.savefig(png, format="png")
+ figure.savefig(image_bytes, format="svg")
if hasattr(figure, "clf"):
figure.clf()
else:
figure.fig.clf()
- return {"body": png.getvalue(), "content_type": "image/png"}
+ return {"body": image_bytes.getvalue(), "content_type": "image/svg+xml"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a hunch that this might perform better. Need to try it out to see.
The text was updated successfully, but these errors were encountered: