简体   繁体   中英

How to change size of axis labels and values in seaborn pairsplot

I've created a pairplot in seaborn using the following code:

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

mtcars = pd.read_csv("https://raw.githubusercontent.com/focods/WonderfulML/master/data/mtcars.csv")
sns.pairplot(mtcars, kind='reg', diag_kind='hist')

and get this plot:

在此处输入图片说明

The font is tiny and I'm trying to figure out how to increase the size. I see in the documentation a parameter that might be what I'm looking for: plot_kws which is a dictionary, but how do I figure out the available keys and what they do?

So I have two questions. First, is how to read the documentation so that I can figure out what the keys are for this dictionary. Second, is how to increase the font size of the y-axis labels for this plot.

Turns out that to change the size of x and y axis labels, I needed to call set_context and pass a dictionary to the rc parameter. When I added this line just above the call to pairplot :

sns.set_context("paper", rc={"axes.labelsize":36})

I get this plot:

在此处输入图片说明

which is an improvement (if you look closely), but am now trying to figure out how to increase the size of the tick labels.

Resize the graph with all the parameters.

seabornInstance.set_context("paper", rc={"axes.labelsize":20})
seabornInstance.set_context("talk", font_scale=1.4)
xpl=seabornInstance.pairplot(mtcars, kind='reg', diag_kind='hist',height=7, aspect=1)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM