import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.mplot3d import Axes3D # Labels x_labels = ['B5', 'B4', 'B3', 'B2', 'B1', 'N0', 'H1', 'H2', 'H3', 'H4', 'H5'] y_labels = ['B5', 'B4', 'B3', 'B2', 'B1', 'N0', 'H1', 'H2', 'H3', 'H4', 'H5'] # Data data = np.array([ [8.2, 4.1, 3.1, 3.4, 3.5, 3.0, 2.9, 2.8, 2.5, 3.0, 4.1], [24.9, 13.5, 11.8, 11.0, 9.0, 9.3, 9.1, 8.9, 8.1, 7.8, 11.4], [39.8, 24.7, 20.4, 18.8, 17.4, 16.0, 16.2, 14.7, 15.4, 15.5, 15.9], [54.8, 40.6, 32.7, 28.3, 25.9, 24.3, 23.1, 24.0, 23.4, 24.2, 21.1], [65.1, 52.9, 46.6, 44.7, 38.8, 37.7, 35.4, 33.6, 32.2, 33.1, 27.4], [73.1, 62.9, 61.1, 59.0, 56.1, 52.4, 49.5, 48.5, 42.7, 39.9, 35.3], [79.7, 72.5, 73.1, 72.6, 71.6, 69.8, 66.9, 63.8, 58.0, 53.2, 41.9], [81.7, 79.8, 79.6, 80.8, 79.3, 80.1, 78.1, 76.7, 72.5, 65.7, 52.8], [86.1, 87.7, 87.4, 87.8, 87.2, 86.5, 84.5, 84.4, 82.7, 78.8, 65.4], [92.6, 93.4, 94.0, 93.4, 94.3, 94.0, 93.8, 93.7, 92.7, 89.6, 79.9], [97.1, 97.5, 97.9, 98.2, 97.5, 98.2, 98.1, 98.2, 97.7, 97.4, 93.5] ]) # Meshgrid for 3D plotting x = np.arange(len(x_labels)) y = np.arange(len(y_labels)) x, y = np.meshgrid(x, y) # Plot fig = plt.figure(figsize=(12, 8)) ax = fig.add_subplot(111, projection='3d') surf = ax.plot_surface(x, y, data, cmap='viridis', edgecolor='k') # Axis formatting ax.set_xticks(np.arange(len(x_labels))) ax.set_yticks(np.arange(len(y_labels))) ax.set_xticklabels(x_labels) ax.set_yticklabels(y_labels) ax.set_xlabel("mid_smooth_deriv1_144_bin") ax.set_ylabel("sma144_diff_bin") ax.set_zlabel("Probabilité de hausse (%)") ax.set_title("Probabilité de hausse pour futur_percent_3h en 3D") fig.colorbar(surf, shrink=0.5, aspect=10) plt.tight_layout() plt.show()