Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

how to increase png resolution with altair.renderers.enable("png") #75

Closed
zyxue opened this issue Aug 27, 2020 · 5 comments
Closed

how to increase png resolution with altair.renderers.enable("png") #75

zyxue opened this issue Aug 27, 2020 · 5 comments

Comments

@zyxue
Copy link

zyxue commented Aug 27, 2020

I'm using altair in a notebook, I tried

altair.renderers.enable("png", scale_factor=3.0)

it doesn't seem to have any effect on the resolution of the generated png. What's the right way to do so, please?

@ausiddiqui
Copy link

ausiddiqui commented Mar 18, 2021

Facing the same. Installed using the conda method on macOS 11.2.3 running python 3.7 and altair 4.10 and vega-lite-cli 5.17.0. I also tried passing webdriver='firefox' and webdriver='chrome' and it made no impact. Additionally the axis tick labels are a much lighter style than the level visible on my browser (Safari using Jupyter Lab).

@pfei-sa
Copy link

pfei-sa commented Aug 6, 2021

Try altair_saver.save(plot, "plot.png", vega_cli_options=["-s 4"]) where 4 is the scaling factor

@JavierMedel
Copy link

specify the width and height using the properties I hope it helps.

altair_saver.save(bars.properties(width=800, height=400), "plot.png", vega_cli_options=["-s 4"])

@aecio
Copy link

aecio commented Feb 7, 2022

This seems to work when using notebooks without having to use the save() function:

alt.renderers.enable('altair_saver', fmts=['png'], embed_options={'scaleFactor': '4'})

@joelostblom
Copy link
Member

Since Altair 5.2, the functionality of Altair Saver is now available in Altair via the vl-convert package. Most of the functionality has been available since 5.0, and the main addition in 5.2 was PDF export. See the docs on how to save charts for more details. This includes how to set the resolution https://altair-viz.github.io/user_guide/saving_charts.html#png-figure-size-resolution

We are going to archive this repo, so I'm closing all the open issues and PRs before doing so. Try out the new options for saving charts mentioned above and if you run into issues, please open an issue directly in the altair or vl-convert repo.

@joelostblom joelostblom closed this as not planned Won't fix, can't repro, duplicate, stale Mar 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants