Custom contour level labeling not working
Show older comments
I am trying to match my papers resutls with another and the way they label their contours is with a bit of an offset (screenshot of table). I m trying to find a way to be able to sort of overide the clabel so for a value of 0.5 for example it displays 1 as per the table in the paper. levels1 are my plotting lines and levels2 is what i want to use for labeling the lines. Doing it this way it just puts the labels at the "correct value levels"

levels1 = [-3 -2 -1 -0.5 0 0.5 1 2 3 4 5];
levels2 = [-4 -3 -2 -1 0 1 2 3 4 5 6];
% 1) Plot background (if you have one)
if Re == 400
bg = imread('comp.png');
else
bg = imread('Re_1000wcont.png');
end
bg = flipud(bg);
figure
imagesc([0 1],[0 1], bg);
set(gca,'YDir','normal');
hold on;
[C, hLine] = contour( ...
X, Y, -flipud(omega), ...
levels1, ...
'LineColor','b', 'LineStyle','--', 'LineWidth',1 );
axis equal; box on; xlim([0 1]); ylim([0 1]);
hold on;
clabel(C, hLine, levels2, ...
'FontSize', 13, ...
'LabelSpacing',300, ...
'Color', 'r');
xlabel('$x$', 'Interpreter','latex');
ylabel('$y$', 'Interpreter','latex');
ax = gca;
ax.TickLabelInterpreter = 'latex';
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!