Legend for Contour Plots
                    Version 1.1.0 (4.96 KB) by  
                  Patrik Forssén
                
                
                  Adds a curve description legend to a contour plot
                
                  
              Adds a curve description legend to a contour plot, this is preferable when putting labels on the contour curves clutter up the plot. The default description is the level, but you may optionally supply custom descriptions. You might also include descriptions of other plotted objects in the legend.
Example,
[X, Y, Z]  = peaks(512);
figure
[~, hCont] = contour(X, Y, Z, 'LineWidth', 1.5);
contourLegend(hCont)
figure
[~, hCont] = contourf(X, Y, Z);
contourLegend(hCont)
Cite As
Patrik Forssén (2025). Legend for Contour Plots (https://nl.mathworks.com/matlabcentral/fileexchange/115120-legend-for-contour-plots), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
              Created with
              R2020a
            
            
              Compatible with any release
            
          Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
