Reputation: 20382
My question is how to adjust a Seaborn log-log scatterplot to fit text labels? MWE:
mport seaborn as sns
mport seaborn.objects as so
f = sns.load_dataset("penguins").sample(frac = 0.1)
f['island'] = 'long names here'
Arbitrary tweak distributions
f['bill_length_mm'] = df['bill_length_mm'].apply(lambda x: 2.0**(x / 5))
f['bill_depth_mm'] = df['bill_depth_mm'].apply(lambda x: 2.0**((x - 10) / 2))
(
so.Plot(df, x='bill_length_mm', y='bill_depth_mm', text = 'island')
.add(so.Dot()).add(so.Text(valign='bottom'))
.scale(x = 'log', y = 'log')
.save('test.png')
)
As you can see on the resulting image, the labels get cropped by the edges. This would be relatively easy to fix if I were using linear axes. But how to do it when drawing logarithmic scatter plots?
Upvotes: 0
Views: 39