MATLAB Answers

How the property 'textstep' modify my contour graph?

15 views (last 30 days)
Jose Aguilar Muñiz
Jose Aguilar Muñiz on 1 May 2020
Edited: Adam Danz on 4 May 2020
I would like to know how change my contour graph if I modify de property 'textstep'. I don't understand the description "interval between labeled contour lines, specified as a scalar numeric value¨".

Answers (1)

Adam Danz
Adam Danz on 1 May 2020
Edited: Adam Danz on 4 May 2020
TextStep controls which contours are labeled.
Consider this example.
% produce contour plot example.
x = -2:0.2:2;
y = -2:0.2:3;
[X,Y] = meshgrid(x,y);
Z = X.*exp(-X.^2-Y.^2);
[~, C] = contour(X,Y,Z,'ShowText','on');
Note that the contour labels are [.1, .2, .3, ...] (image below, left)
Look at the current TextStep value.
>> C.TextStep
ans =
Double the value
C.TextStep = 0.2
Note the change in text labels. (image below, right)
A common approach is to set TextStep as a factor of LevelStep.
C.TextStep = C.LevelStep*2;


Sign in to comment.

Translated by