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 matrix data = np.array([ [34.6, 16.8, 18.4, 14.9, 26.4, 11.9, 25.2, 33.9, 46.0, 56.9, 62.1], [35.3, 29.0, 20.8, 20.3, 21.1, 19.2, 30.9, 42.5, 52.9, 62.6, 61.6], [36.3, 31.6, 26.5, 24.5, 24.0, 25.4, 40.6, 48.0, 56.2, 64.0, 65.3], [37.0, 34.7, 31.2, 27.6, 29.0, 31.8, 45.0, 53.5, 59.6, 64.2, 64.2], [34.2, 35.3, 33.8, 33.3, 31.7, 43.1, 53.2, 59.9, 64.3, 64.0, 64.5], [36.1, 37.0, 35.9, 37.5, 41.6, 56.3, 61.9, 66.1, 64.9, 66.4, 60.2], [36.9, 37.5, 38.9, 44.3, 53.2, 66.1, 67.8, 67.0, 68.0, 67.6, 62.6], [40.6, 37.1, 44.3, 51.3, 61.0, 73.7, 73.9, 70.6, 70.3, 68.3, 63.8], [41.1, 40.6, 48.9, 55.5, 65.8, 80.0, 75.7, 76.6, 73.3, 68.4, 67.1], [38.9, 43.0, 54.7, 66.3, 72.3, 81.5, 78.6, 77.6, 79.6, 71.8, 66.5], [41.0, 46.8, 60.7, 75.2, 82.3, 89.3, 76.8, 80.9, 78.8, 83.7, 68.9] ]) # Meshgrid for 3D plotting x = np.arange(len(x_labels)) y = np.arange(len(y_labels)) x, y = np.meshgrid(x, y) z = data # Plotting fig = plt.figure(figsize=(12, 8)) ax = fig.add_subplot(111, projection='3d') surf = ax.plot_surface(x, y, z, cmap='viridis', edgecolor='k') # Axes settings 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('mid_smooth_deriv2_144_bin') ax.set_zlabel('Probabilité de hausse (%)') ax.set_title('Probabilité de hausse pour futur_percent_3h (%)') # Colorbar fig.colorbar(surf, ax=ax, shrink=0.5, aspect=10) plt.tight_layout() plt.show()