0

enter image description here

fig, axes = plt.subplots(1, len(num_col), figsize=(100, 30))
for j,k in enumerate(num_col):
    sb.boxplot(y = k, data=data,ax = axes[j],)

I made this subplot using above codes, but I want to make it more clear
I wanna see y label clearly and make more rows for subplot.

1 Answer 1

3

I want to make it more clear. I wanna see y label clearly

For this problem you need to use subplots.adjust and ylabels fontsize

Make more rows for subplot.

Check the modified code below

import numpy as np
import matplotlib.pylab as plt
import seaborn as sb

data = sb.load_dataset("tips")
num_col = data.select_dtypes(include=[np.number]).columns.tolist()
rows = 2
if((((len(num_col) + 1)/rows)%rows) ==0): #when num of cols are divisable by rows
    cols = (len(num_col)+1)/rows
else:
    cols = ((len(num_col)+1)/rows) + ((len(num_col)/rows)%rows)

fig, axs = plt.subplots(rows,cols, figsize=(10,10))
fig.subplots_adjust(hspace = 0.1, wspace=0.5)
axs = axs.ravel()
for j,k in enumerate(num_col):
    b = sb.boxplot(y = k, data=data,ax = axs[j],)
    b.set_ylabel(k,fontsize=20)

gives

enter image description here

P.S. : It is always a good practice to give a small sample of your data and full code with imports to make it reproducible.

Sign up to request clarification or add additional context in comments.

2 Comments

@KenKim If you think the answer was helpful, you can officially mark it as an answer to your query.
DONE, Thanks again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.