The solutions shown in How to change the figure size of a seaborn axes or figure level plot do not work for seaborn.objects
. This question is about the new interface added in seaborn v0.12
.
Tried different ways to set the plotted image size but no one worked, below is the code, how to set the below image height and width by pixel or inch?
About seaborn.objects.Plot.add
:
import pandas as pd
from seaborn import objects as so
df = sns.load_dataset('planets')
p = so.Plot(data=df, x='orbital_period', y='mass').add(so.Dot())
p.save('output.png')
p.show()
With Plot.layout
:
(
so.Plot(data=d, x="point_x", y="point_y")
.add(so.Dot())
.layout(size=(w, h)) # in inches * (dpi / 100)
.save("output.png", dpi=dpi) # e.g. dpi=100
.show()
)