I am trying to create a line graph plot showing the residual error for 18 of my iterations of a program:
As you can see, the xaxis is using decimals.
Code:
fig, ax = plt.subplots()
ax.plot(cscResidualError,linestyle='--', marker='o', color='b')
ax.set_yscale('log')
plt.title("CSC Residual Error")
plt.xlabel("Iteration #")
plt.ylabel("Residual Error")
plt.figure(2)
plt.savefig("CSC Graph")
When I use xsticks:
It all shifts up and does not align with points.
Code:
fig, ax = plt.subplots()
ax.plot(cscResidualError,linestyle='--', marker='o', color='b')
ax.set_yscale('log')
plt.title("CSC Residual Error")
plt.xlabel("Iteration #")
plt.ylabel("Residual Error")
plt.xticks(range(1,len(cscResidualError)+1))
plt.figure(2)
plt.savefig("CSC Graph")
Data:
cscResidualError = [
0.38915721867614916,
0.14078627143431255,
0.0601407351727453,
0.026160551464395596,
0.010909825159991874,
0.0037606157046234353,
0.0014798491987814617,
0.0005147342493009802,
0.00022841941948465328,
0.00009143826264755746,
0.000037994973446398104,
0.000015510527981215652,
0.000006235837935018515,
0.000002454482759005122,
0.0000009932668806359943,
0.000000404640351575657,
0.00000016779591717735326,
0.00000006865543708870457
]
Any help appreciated.