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.

pairplot: all samples plotted as being 0 on y-axis

See original GitHub issue

Hi, I’ve just run into a situation where pairplot yields this:

pairplot while a corresponding pandas.scatter_matrix yields this: scatter_matrix The reproducible example below which produces the figures above uses custom data (csv attached: bug.txt) because I guess this behavior somehow has to do with the small values in the example:

import pandas as pd
import seaborn as sns; sns.set(style="ticks", color_codes=True)
data = pd.read_csv('bug.txt') # is csv but needs .txt extension for github
pd.plotting.scatter_matrix(data) # seems to be OK
sns.pairplot(data) # all samples shown as 0 on y-axis

Used versions:

sns.__version__
'0.8.1'
pd.__version__
'0.22.0'
matplotlib.__version__
'2.1.2'

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jbae11commented, Nov 13, 2019

@MainzerKaiser I came up with this sort of hacky way of doing it, hopefully it helps.

def better_scatter(x, y, **kwargs):
    plt.scatter(x, y, **kwargs)
    margin = (max(y) - min(y)) * 0.1
    plt.ylim(min(y) - margin, max(y) + margin)

g = sns.PairGrid(pp_data)
g = g.map_diag(plt.hist)
g = g.map_offdiag(better_scatter)
1reaction
geekoverdosecommented, Feb 5, 2018

Ack. Should anyone else run into this: a quick-fix until the issue is fixed in matplotlib is to just set seaborn’s ylim by hand , e.g. as:

g = sns.pairplot(data)
g.set(ylim=(data.min().min(),data.max().max()))
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add an axis to pairplot for another plot in the same figure
I want to add another plot next to pairplot result in the same figure. For example, this code: import pandas as pd import...
Read more >
seaborn.pairplot — seaborn 0.12.1 documentation - PyData |
seaborn.pairplot# ... Plot pairwise relationships in a dataset. By default, this function will create a grid of Axes such that each numeric variable...
Read more >
Visualizing Data with Pair-Plot Using Matplotlib - End Point Dev
Plotting a single pair in a grid needs to get the current axis for the current grid cell and identify the current feature...
Read more >
Control Axis Limits of Plot - Python Graph Gallery
You can control the limits of X and Y axis of your plots using matplotlib function plt.xlim() and plt.ylim() . In this example,...
Read more >
How to make a pairplot in Python and the Seaborn ... - YouTube
This Seaborn paiplot video covers how to make a pairplot with Seaborn Python as well as the Seaborn pairplot interpretation.
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