0

I have the following code in Python (3.4) Jupyter Notebook to plot a histogram:

%matplotlib notebook
import matplotlib.pyplot as plt
import matplotlib
import numpy as np

bins = np.linspace(0, 1.0, 40)
plt.hist(list1, bins, alpha = 0.5, color = 'b')
plt.show()

I am wondering can I rescale it so that the y-axis value has the maximum value of 100? Thanks!

Edamame
  • 23,718
  • 73
  • 186
  • 320

1 Answers1

0

Here is a MWE:

import matplotlib.pyplot as plt
import numpy as np

bins = np.linspace(0, 1.0, 40)
y = np.random.rand(100) 

plt.hist(y, bins)
plt.ylim((None, 100))  # This line sets the y-axis limits

plt.show()
innisfree
  • 2,044
  • 1
  • 14
  • 24