1

I was trying to create a bivariate scatterplot of each variable against every other that are in a dataframe, and I found sns.pairplot() was exactly what I needed.

However, no matter what I do (and I have tried all of the advice found in this question), the plots keep coming out too spread out, as well as in general too big. In the picture below, only the first two rows and four columns out of 12 variables display on my entire screen.

enter image description here

I have found out that my use of

%config InlineBackend.figure_format = 'svg'

to create non-blurry graphs on my high-ppi screen is partially at blame, as without it, I instead get this graph, which fits perfectly on my screen, but is now too small and I would prefer to scroll slightly around while having a bigger pic.

(note: the additional options below have no effect)

enter image description here

How can I make the grid of plots customizable in its overall size as well as spacing? As it stands, no options work, and one graphics backend (the default one) produces too small graphs, while the 'svg' backend produces too large ones.

EDIT: Editing sns.set(rc={'figure.figsize':(x,y)}) or the height/ aspect options improve nothing: the former produces no change, while the latter two change how big the individual plots are (with height=1 making them indecipherable), but the overall "grid" is still as bulky and overly large as before.

Coolio2654
  • 1,589
  • 3
  • 21
  • 46
  • using `sns.set(rc={'figure.figsize':(x,y)})` has no effect on the output? – brokenfoot Dec 09 '18 at 02:31
  • 1
    Have you tried changing the `height` argument in `pairplot`? Altering this in combination with `aspect` should change the size of the individual plots. [Documentation](https://seaborn.pydata.org/generated/seaborn.pairplot.html) – willk Dec 09 '18 at 02:33
  • I replied to both of your comments in an edit at the end of my question. – Coolio2654 Dec 09 '18 at 03:57

1 Answers1

2

Essentially you are asking how to display the figure in its original size in a jupyter notebook.
That translates into how to add scrollbars if it exceeds the room it's given by the layout of the output cell.

I think for the horizontal direction this can be done as follows. However for the vertical direction this does not seem to work.

%matplotlib inline

# Cell2
from IPython.display import display, HTML
CSS = """div.output_area img {max-width:None !important;max-height: None !important";}"""
display(HTML('<style>{}</style>'.format(CSS)))

# Cell3
import matplotlib.pyplot as plt
fig, ax = plt.subplots(ncols=8, figsize=(20,10))

enter image description here

ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712