seaborn icon indicating copy to clipboard operation
seaborn copied to clipboard

PairGrid custom extent limits?

Open shoyer opened this issue 9 years ago • 5 comments

It would be nice if PairGrid had some mechanism for specifying custom extent limits when the defaults aren't quite right, similar to the {x,y}lim arguments for FacetGrid.

I would normally do this after making a plot with matplotlib, but this is particularly awkward for PairGrid.

I imagine the API docs should look something this:

limits : dict of the form {variable: limits}, optional
    Axis limits of the form (vmin, vmax) for each named variable.

shoyer avatar Jan 26 '15 21:01 shoyer

This sounds like a good idea, I'm assuming you think it should be a parameter passed when instantiating a PairGrid?

mwaskom avatar Jan 27 '15 05:01 mwaskom

This would be particularly helpful, as there are problems in this context when using seaborn from python3. Or fixing might be possible in the same go.

Anyways, the following code will work in python2, but produce wrong axis with python3:

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


df = pd.DataFrame(np.random.rand(100,4))

g = sns.PairGrid(df)
# g.map(plt.scatter) # works in python3 too
g.map_diag(plt.hist)
g.map_offdiag(plt.scatter)

plt.show()

germannp avatar Feb 04 '15 15:02 germannp

Can you be more specific about what doesn't work and also check that you have the same seaborn and matplotlib versions in both environments? It's hard to understand what could differ between the python versions.

mwaskom avatar Feb 04 '15 16:02 mwaskom

I am sorry, my matplotlib for python3 was outdated ... Cheers & thanks for the good work!

germannp avatar Feb 04 '15 16:02 germannp

@mwaskom , @shoyer Is this issue still open and unsolved? It seems germannp's comments were unrelated. I know you can adjust axes limits after creation and plotting pairgrids, but it'd be nice to initialize limits for each variable included. Or can this information be passed somehow for each variable in **kwargs if I want to use hist2d on map_upper() for example

hectormz avatar Jul 14 '18 18:07 hectormz