2

I am trying to plot results I received from an optimization model I created. The results are different for several input parameters. As seen in the plot, points which should be in the front lay behind the points which should lay behind it. I found a similar question on stack overflow but this was never fully answered with a solution that fits my case.

My code is pretty straight forward.

fig = plt.figure(figsize=(12, 10))
plt.subplots_adjust(hspace=0.1)
plt.suptitle('Policy selection part features for D=%d' %d)

for n, data in enumerate(plotlist):
    ax = plt.subplot(2, 3, n+1, projection='3d')
    ax.scatter(data[data[:, -1] == '1-bin', 0], data[data[:, -1] == '1-bin', 1], data[data[:, -1] == '1-bin', 2],
               s=40, color='blue', label="1-bin", alpha=0.9, edgecolors='black')
    ax.scatter(data[data[:, -1] == '2-bin', 0], data[data[:, -1] == '2-bin', 1], data[data[:, -1] == '2-bin', 2],
               s=40, color='purple', label="2-bin", alpha=0.9, edgecolors='black')
    ax.scatter(data[data[:, -1] == 'Order picking', 0], data[data[:, -1] == 'Order picking', 1],
               data[data[:, -1] == 'Order picking', 2], s=40,
               color='red', label="Order picking", alpha=0.9, edgecolors='black')
    ax.scatter(data[data[:, -1] == 'Order kitting', 0], data[data[:, -1] == 'Order kitting', 1],
               data[data[:, -1] == 'Order kitting', 2], s=40,
               color='green', label="Order kitting", alpha=0.9, edgecolors='black')
    ax.scatter(data[data[:, -1] == 'Kit to stock', 0], data[data[:, -1] == 'Kit to stock', 1],
               data[data[:, -1] == 'Kit to stock', 2], s=40,
               color='yellow', label="Kit to stock", alpha=0.9, edgecolors='black')
    ax.set_xlabel('Volume part [L]')
    ax.set_ylabel('Price part')
    ax.set_zlabel('Cycle time')
    ax.set_xlim(-1, 12)
    ax.set_ylim(-1, 500)
    ax.set_zlim(-0.1, 1.05)
# ax.legend(loc='upper right', bbox_to_anchor=(1.05, 1.05))
handles, labels = ax.get_legend_handles_labels()
plt.legend(handles, labels, loc='upper right', bbox_to_anchor=(1.3, 1.4))
plt.show() 

Here is an image of issue. I was wondering if someone found the solution for this problem?

Strangely in another plot the first 5 plots do have the issue, but the last one does not: image. Can anyone clarify this?

Sjalom123
  • 21
  • 2

0 Answers0