I have a small piece of code that displays some data with Python and matplotlib
in a graph using scatter()
and errorbar()
, but I want the numbers to be more specific on points with dots on them using floats. I don't want overlapping and I want to be able to see the entire graph without having to move so that when I save it to a file it's all visible
Here's the code:
import matplotlib.pyplot as plt
y = [88, 137, 134, 78, 107, 154, 108, 123, 118, 133, 125, 140, 66, 82, 28, 45, 102, 68, 4, 1, 155, 5, 124, 95, 107, 36, 127, 63, 90, 32, 64, 148, 130, 141, 73, 99, 149, 18, 3, 30, 16, 85, 149, 67, 29, 18, 153, 79, 69, 9, 124, 119, 22, 9, 10, 122, 144, 36, 5, 128, 126, 155, 34, 133, 49, 36, 60, 83, 152, 135, 40, 28, 150, 80, 150, 127, 13, 85, 56, 61, 37, 152, 25, 7, 125, 45, 59, 41, 13, 17, 56, 44, 155, 40, 14, 69, 96, 114, 128, 51, 135, 87, 132, 132, 132, 38, 83, 21, 93, 111, 43, 84, 148, 22, 24, 99, 23, 95, 72, 102, 135, 8, 27, 49, 105, 111, 43, 50, 31, 155, 28, 8, 151, 99, 28, 14, 122, 9, 147, 91, 81, 147, 28, 125]
x = [-69, -118, -115, -59, -88, -135, -89, -104, -99, -114, -106, -121, -47, -63, -9, -26, -83, -49, 15, 18, -136, 14, -105, -76, -88, -17, -108, -44, -71, -13, -45, -129, -111, -122, -54, -80, -130, 1, 16, -11, 3, -66, -130, -48, -10, 1, -134, -60, -50, 10, -105, -100, -3, 10, 9, -103, -125, -17, 14, -109, -107, -136, -15, -114, -30, -17, -41, -64, -133, -116, -21, -9, -131, -61, -131, -108, 6, -66, -37, -42, -18, -133, -6, 12, -106, -26, -40, -22, 6, 2, -37, -25, -136, -21, 5, -50, -77, -95, -109, -32, -116, -68, -113, -113, -113, -19, -64, -2, -74, -92, -24, -65, -129, -3, -5, -80, -4, -76, -53, -83, -116, 11, -8, -30, -86, -92, -24, -31, -12, -136, -9, 11, -132, -80, -9, 5, -103, 10, -128, -72, -62, -128, -9, -106]
plt.scatter(x, y, c = 'red')
plt.errorbar(x, y, c = 'red')
plt.title("EL")
plt.xlabel("X")
plt.ylabel("Y")
plt.savefig("tst.png")
plt.show()