I'm trying to build a 3d scatter plot using matplotlib and python. The problem looks like the following: The offset for the points on a 3d plot is making it impossible to understand where exactly these belong.
Here is the graph that was built:
In this graph, observe that these points don't exactly coincide with the vertices. That is, according to the graph it shows that there exists a point somewhere between 0B and 1B and 4S, which is not contained in the dataset (see code MWE below). Is there something that needs to be done to set the offset?
#!/usr/bin/env python
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
from mpl_toolkits.mplot3d import Axes3D
import string
from matplotlib import cm
import matplotlib
def plot_state_transition():
xTickMarks = ["-1B","0B", "1B", "2B", "3B"]#, "4B"]#, "1B3S", "2B2S"]
yTickMarks = ["-1S","0S", "1S", "2S", "3S", "4S"]
zTickMarks = ["0", "0.6", "0.65", "0.9", "1.15"]
matplotlib.rc('font', serif='Helvetica Neue')
matplotlib.rc('text', usetex='false')
matplotlib.rcParams.update({'font.size': 10})
fig = plt.figure(figsize=(11.69,4.88)) # for landscape
axes1 = fig.add_subplot(111, projection='3d')
savename = "state-transition.png"
tup = []
plt.grid(True,linestyle='-',color='0.75')
X_AXIS = ['2B', '2B', '1B', '2B', '2B', '2B', '1B', '2B']
Y_AXIS = ['0S', '2S', '3S', '2S', '2S', '2S', '3S', '2S']
Z_AXIS = ['0.6', '0.6', '0.6', '0.6', '0.6', '0.9', '0.9', '0.9']
s = [12.900648500000001, 12.705360163934426, 13.021028032786887, 13.258014354838707, 14.418979838709676, 17.092295806451613, 15.625246451612906, 17.484319354838711]
x = [xTickMarks.index(i) for i in X_AXIS]
y = [yTickMarks.index(i) for i in Y_AXIS]
z = [zTickMarks.index(i) for i in Z_AXIS]
s = s
axes1.scatter(x, y, z, c='r', marker='o')
axes1.set_xlim((0, len(xTickMarks)-1))
axes1.set_ylim((0, len(yTickMarks)-1))
axes1.set_zlim((0, len(zTickMarks)-1))
axes1.set_xticks(xrange(len(xTickMarks)))
axes1.set_yticks(xrange(len(yTickMarks)))
axes1.set_zticks(xrange(len(zTickMarks)))
axes1.set_xticklabels(xTickMarks)
axes1.set_yticklabels(yTickMarks)
axes1.set_zticklabels(zTickMarks)
axes1.set_ylabel('Small cores')
axes1.set_zlabel('Frequency')
axes1.set_xlabel('Big cores')
axes1.xaxis.grid(True)
figsize=(11.69,8.27) # for landscape
fig.savefig(savepath + savename, bbox_inches='tight', dpi=300, pad_inches=0.1)
plt.clf()
def main():
plot_state_transition()
if __name__ == "__main__":
main()