When I hover over my graph, the x and y graph coordinates in the lower left corner(below my graph, not the labels) are displaying in scientific notation. How would I disable this to display the numbers in standard form? I don't think this is a duplicate question (as someone marked it).
Here is my code and I'll leave the coordinates as well.
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
from scipy.interpolate import *
import MySQLdb
# connect to MySQL database
def mysql_select_all():
conn = MySQLdb.connect(host='localhost',
user='root',
passwd='####',
db='world')
cursor = conn.cursor()
sql = """
SELECT
GNP, Population
FROM
country
WHERE
Name LIKE 'United States'
OR Name LIKE 'Canada'
OR Name LIKE 'United Kingdom'
OR Name LIKE 'Russian Federation'
OR Name LIKE 'Germany'
OR Name LIKE 'Poland'
OR Name LIKE 'Italy'
OR Name LIKE 'China'
OR Name LIKE 'India'
OR Name LIKE 'Japan'
OR Name LIKE 'Brazil';
"""
cursor.execute(sql)
result = cursor.fetchall()
list_x = []
list_y = []
for row in result:
list_x.append(row[0])
for row in result:
list_y.append(row[1])
list_x = list(map(float, list_x)) # before this statment each item in list_x was a string. This converts those string items into floats
list_y = list(map(float, list_y))
print(list_x)
print(list_y)
fig = plt.figure()
ax1 = plt.subplot2grid((1,1), (0,0))
p1 = np.polyfit(list_x, list_y, 1) #p1 has my slope @ index 0 and my intercept @ index 1
ax1.xaxis.labelpad = 50
ax1.yaxis.labelpad = 50
plt.xlim(15000, 10510700)
plt.plot(list_x, np.polyval(p1,list_x),'r-') # using p1 to plot line of best fit
plt.scatter(list_x, list_y, color = 'darkgreen', s = 100)
plt.xlabel("GNP (US dollars)", fontsize=30)
plt.ylabel("Population(in billions)", fontsize=30)
plt.xticks([1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000], rotation=45, fontsize=14)
plt.yticks(fontsize=14)
plt.show()
cursor.close()
mysql_select_all()
Here are the coordinates
x = [776739.0, 598862.0, 982268.0, 2133367.0, 1378330.0, 447114.0, 1161755.0, 3787042.0, 151697.0, 276608.0, 8510700.0]
y = [170115000.0, 31147000.0, 1277558000.0, 82164700.0, 59623400.0, 1013662000.0, 57680000.0, 126714000.0, 38653600.0, 146934000.0, 278357000.0]