Ask Your Question
1

The size of the plot returned by df.hist() is not the desired one.

asked 2022-11-18 11:00:00 +0000

djk gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-08-20 14:00:00 +0000

lalupa gravatar image

To change the size of the plot returned by df.hist(), you can pass in the figsize parameter with a tuple of width and height values.

For example:

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

# create a dataframe with random values
df = pd.DataFrame(np.random.randn(100, 4), columns=['A', 'B', 'C', 'D'])

# plot a histogram with a custom size
df.hist(figsize=(10, 8))

plt.show()

In this example, the figsize parameter is set to (10, 8), which will create a plot with a width of 10 inches and a height of 8 inches. You can adjust these values to your desired size.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-11-18 11:00:00 +0000

Seen: 10 times

Last updated: Aug 20 '22