简体   繁体   中英

Python Matplotlib scatterplot compressing the Y axis

I have some code for a school project I'm working on, and I need to create scatter plots for data on the Median household income by county and each county's investment into sustainable energy practices. For example, the first five lines of my data look like this:

x = [39620, 43170, 76633, 50449, 50777]
y = [49625, 177083, 2026280, 460648, 137874]

The data was gathered fine, however, when I try to create a scatter plot with the data the Y-axis compressed itself to being 1,2,3,4 instead of the actual values which are in the millions.

ply.scatter(x, y, norm=None)

The graph then appears to look like this:

我

I've looked online and can't figure this out, any help would be greatly appreciated thank you so much!

import matplotlib.pyplot as plt

x = [39620, 43170, 76633, 50449, 50777]
y = [49625, 177083, 2026280, 460648, 137874]

plt.figure()
plt.ticklabel_format(style='plain')
plt.scatter(x, y, norm=None)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM