I'm trying to use plotnine to save a high-resolution png image.
With a test dataset, this looks like:
from plotnine import *
import pandas as pd
import numpy as np
df = pd.DataFrame()
df['x'] = np.arange(0,10,0.01)
df['y'] = np.sin(df['x'])
p = ggplot(df, aes(x='x',y='y')) + labs(x='x', y='y') + geom_point(size=0.1)
p.save(filename = 'test3.png', height=5, width=5, units = 'in', dpi=1000)
This produces a low-resolution .png file containing my plot, which is not improved when I increase the specified dpi.
I've also tried saving with:
ggsave(plot=p, filename='test.png', dpi=1000)
and replacing dpi=1000
with res=1000
. This produces identical low-resolution png files.
How can I save my plot at the resolution I want?
Edit: This bug is resolved in plotnine version 0.3.0. and the above code works correctly.