Specify value on a contour with a value that is not in the matrix, it is possible ?
1 view (last 30 days)
Show older comments
Gaétan Andriano
on 8 Jul 2021
Commented: Gaétan Andriano
on 8 Jul 2021
Hello !
I have an interrogation. I have a matrix with m rows and n columns and I plot this matrix with the contour function. In this matrix, there are some values positive and negative. To distinguish negative and positive part I would like to plot a line at 0 but in my matrix, I don't have exactly the value 0. There is a method or a function to help me ?
Thanks in advance
0 Comments
Accepted Answer
Star Strider
on 8 Jul 2021
Yes.
M = (-1:0.11:1).'*(-1:0.9:1);
figure
contour(M, 'ShowText','on')
hold on
contour(M, [0 0], 'ShowText','on', 'LineStyle','--','Color','k') % Specific Contour At 0
hold off
This plot already plots the 0 contour, however the second contour call specifically plots the 0 contour with a black dashed line.
.
0 Comments
More Answers (1)
See Also
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!