question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

wrong Y scale with pairgrid

See original GitHub issue

Following code scales Y axis with small values wrong in half of cases:

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

df = pd.DataFrame(np.random.randn(100,4), columns=list('ABCD'))
df.A = df.A/1e6
df.B = df.B/1e3
df.D = df.D*1e3

sns.pairplot(df, vars=["A", "B", "C", "D"])

image

sns.PairGrid(df).map(plt.scatter) will autoscale both axes wrong in every case for small values: image

Probably this goes to plt.scatter, because plt.scatter([-1e-6, 1e-6], [-1e-6, 1e-6]) won’t autoscale right. image

#862 is about exactly this, however, I’m still puzzled with half-normal pairplot behavior, seems it should return diag-symmetrical plots even with wrong autoscale in scatter function.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
thomascarreaucommented, Apr 16, 2019

You want

sns.PairGrid(df.dropna(), diag_sharey=False)

to solve the issue.

0reactions
naresh-patracommented, Mar 11, 2022

Yes, I don’t understand exactly what the issue with autoscaling is, but this is a problem at the matplotlib layer.

I am facing same problem. Is there any way to control the y-axis of each diagnal plot of seaborn.pairgrid plot?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue with axis limits when using seaborn pairplot with kind='reg'
A regplot extends the limits of the plot by a certain percentage to let the fitting line sit tight against the axis spines....
Read more >
seaborn.PairGrid — seaborn 0.12.1 documentation - PyData |
Subplot grid for plotting pairwise relationships in a dataset. This object maps each variable in a dataset onto a column and row in...
Read more >
seaborn.PairGrid — seaborn 0.9.0 documentation
Subplot grid for plotting pairwise relationships in a dataset. This class maps each variable in a dataset onto a column and row in...
Read more >
Seaborn Tutorial | Kaggle
C1,y=df.C2,data=df , linewidth = 2.5) sns.lineplot(x=df.C1,y=df. ... "axes.grid":False}) # Use "Pallete" to specify the colors to be used for different ...
Read more >
Adjust the grid x-axis scale and y-axis scale in PairGrid ...
I am struggling with getting the right x-axis and y-axis scale for my PairGrid plot of seaborn. Code: x = sns.PairGrid(iris, hue='species') x ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found