Skip to content

p.show() should take in a dpi argument #932

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

Open
anishazaveri opened this issue Apr 10, 2025 · 2 comments
Open

p.show() should take in a dpi argument #932

anishazaveri opened this issue Apr 10, 2025 · 2 comments

Comments

@anishazaveri
Copy link

This is what I'm doing currently to get high-res plots displayed in Jupyter-VSCode

import plotnine as p9
import matplotlib.pyplot as plt
p = (p9.ggplot....)

fig = p.draw()
fig.set_dpi(300)
display(fig)
plt.close(fig)   

It would be great if I could instead put the dpi as an argument to p.show()

@has2k1
Copy link
Owner

has2k1 commented Apr 10, 2025

You still have two other options.

  1. Set the dpi in the theme
... + theme(dpi=300)
  1. Use set_option set the default dpi and the themes will use it.
from plotnine.options import set_option

old_dpi = set_option("dpi", 300)

@anishazaveri
Copy link
Author

anishazaveri commented Apr 23, 2025

Didn't know theme had a dpi argument. That works perfectly. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@has2k1 @anishazaveri and others