Reputation: 33
I entered this code with the x
, y
, and size
defined by variables I created earlier. The problem is that the points are too bunched up and I want to stretch out my y-axis.
plt.scatter(rets.mean(),rets.std(),s = area)
plt.xlabel('Expected Return')
plt.ylabel('Risk')
For example, right now my y-axis goes from -0.005
to 0.04
in increments of 0.005
, how would I adjust it to count in increments of 0.0025
?
Upvotes: 2
Views: 1974
Reputation: 87376
import matplotlib.pyplot as plt
import matplotlib.ticker as mticks
fig, ax = plt.subplots()
ax.set_ylim((-.005, .04))
ax.yaxis.set_major_locator(mticks.MultipleLocator(.0025))
Upvotes: 4