How to eliminate transition section in contourf function;
Afficher commentaires plus anciens

The value in yellew is 4, and the value in blue is 1, there are not value between 4 and 1, but the figure by contourf has transition section.
Réponse acceptée
Plus de réponses (1)
% Sample data
[X, Y, Z] = peaks(100);
% Create a figure
figure;
% Create a filled contour plot
contourf(X, Y, Z);
% Use a default colormap and display a colorbar
colormap(parula);
colorbar;
% Title
title('Without Modifications');
% Sample data
[X, Y, Z] = peaks(100);
% Define contour levels explicitly
contourLevels = [-7:1:7];
% Create a new figure
figure;
% Create a filled contour plot with specified contour levels and no line style
contourf(X, Y, Z, contourLevels, 'LineStyle', 'none');
% Use a colormap that emphasizes discrete levels and display a colorbar
colormap(jet(length(contourLevels)-1));
colorbar;
% Title
title('With Modifications');
1 commentaire
广凯 魏
le 20 Août 2023
Catégories
En savoir plus sur Contour Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

