Label a plot as contour function does
1 view (last 30 days)
I want to label a plot using a label located on the drawed line, just as the countour function does.
I found that I can transform my function plot to a matrix (source) that I can give as input to the contour function
cols = 1:500 ;
rows = 150 + 100*sin(cols/100) ;
M = zeros(300,500) ;
idx = sub2ind(size(M), floor(rows), cols) ;
M(idx) = 1 ;
This produce the following figure
But this plot is not visible in all the domain, has two labels (I would like just one) and the label has not a white background (the number 1 intersect the line). How can I obtain a label like the following?