CyberPrizrak
CyberPrizrak

Reputation: 13

How do you change the spread of the Y axis of pandas box plot?

I am plotting 100 data points for 9 different groups. One group's data points are much larger than all the other groups so when I make a box graph using pandas only that group is shown, while all other groups are smashed to the bottom. Here is what it looks like now: smushed box plot

I would like the Y axis to be more spaced out so that I can see the other groups' box graphs. Here is similar data in a scatter plot that has the spacing I am looking for: well spaced scatter plot

now need this
What I have What is need

Here is my code at the moment:

# use ``` to designate a code block in markdown
import pandas as pd 
import matplotlib.pyplot as plt 

df = pd.read_csv("residues.csv")
df.plot.box()
plt.show()

Upvotes: 1

Views: 337

Answers (2)

tdy
tdy

Reputation: 41327

It looks like you want y to be log-scaled:

df.plot.box(logy=True)

with/without logy

Upvotes: 2

CypherX
CypherX

Reputation: 7353

Try this:

boxplot = df.boxplot(column=df.columns)
plt.show()

Reference

enter image description here

Upvotes: 0

Related Questions