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([ [42.5, 47.8, 52.7, 48.5, 54.2, 64.6, 70.8, 69.2, 72.3, 71.2, 79.9], [34.1, 43.5, 45.7, 53.7, 52.6, 67.3, 63.9, 70.8, 73.5, 67.9, 82.9], [33.7, 42.7, 45.8, 49.6, 49.0, 57.8, 64.7, 68.7, 70.7, 72.6, 87.1], [30.0, 36.6, 40.5, 42.3, 51.2, 62.0, 64.4, 65.2, 69.8, 74.3, 84.9], [21.4, 29.8, 33.6, 39.9, 49.4, 56.1, 59.9, 63.9, 71.0, 72.8, 79.6], [19.8, 30.4, 34.5, 41.5, 42.2, 48.1, 61.7, 64.5, 73.7, 69.3, 79.4], [22.7, 27.0, 36.9, 34.8, 46.3, 50.2, 58.9, 63.1, 65.8, 66.5, 80.0], [23.1, 34.3, 32.2, 31.0, 38.8, 54.3, 53.6, 55.1, 60.3, 63.3, 77.4], [17.0, 32.6, 37.4, 31.0, 35.1, 36.7, 45.2, 53.0, 55.4, 58.6, 71.8], [22.7, 31.9, 28.0, 35.8, 36.3, 46.9, 53.9, 53.8, 58.8, 58.0, 67.6], [18.8, 27.0, 32.1, 36.0, 41.9, 48.1, 49.8, 53.6, 57.2, 62.2, 65.2] ]) # 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_1d_bin') ax.set_ylabel('sma24_diff_1h_bin') ax.set_zlabel('Probabilité de hausse (%)') ax.set_title('Probabilité de hausse pour futur_percent_12h (%)') # Colorbar fig.colorbar(surf, ax=ax, shrink=0.5, aspect=10) plt.tight_layout() plt.show()