How can one adjust the format of the numbers displayed on a contour plot using clabel and a vector specifying the levels of the contours?
Show older comments
I have Reduced my code to this simple form. My code actually calculates the vector V that sets the contours in an evenly spaced way no matter what. Well equal area way to be exact. How can I control the format of the numbers displayed in the labels? IE e,g,f, precision of 3 etc.... The code below provides the form XXXXX.XXXXXX but I want say x.xxe^x in the labels on the contour plot for example. I have tried to find a tick or label but didn't see them available in the get / set command for contour / clabel which is how I would have approached this for other axis objects like colorbar.
clear all, clc, format short eng, format compact,
a=linspace(0,100,100);
[X,Y] = meshgrid(a,a);
Z = X.^2 .*Y.^2;
V =[60.6005e+003 405.3483e+003 1.2596e+006 2.9207e+006 5.7763e+006,...
10.6068e+006 18.7857e+006 34.3230e+006];
figure(1)
clf
grid on, hold on,
[C,h] = contour(X,Y,Z,V,'-k');
clabel(C,h,V,'LabelSpacing',1000),
hold off,
Accepted Answer
More Answers (0)
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!