Generate a point/marker on a filled contour
Show older comments
Hello,
I want to highlight the maximum value of a filled contour, but with the code that I wrote the marker/point won't come up or it shows up outside of the image when I use OpenGL as renderer.
The data for the code is an array A, with the dimension:[361x181] which represents the radiation of the sun at any given angle and orientation. The code should find the indices of the highest value and then plot that point over the filled contour. But I just can't seem to find the flaw in my code as Matlab doesn't give an error message.
Thanks for your answers,
Roland
B=circshift(A, [0, 1]);
set(gcf,'renderer','zbuffer');
[th,r] = meshgrid((1:361)*pi/180,1:181);
[X,Y] = pol2cart(th,r);
h = polar([0 2*pi], [0 180]);
delete(h);
ph=findall(gca,'type','patch');
set(ph,'facecolor','none','edgecolor', 'none','linewidth',1);
hold on;
contourf(X,Y,B,200),shading flat;
[r,c]=find(B==max(max(A)));
plot(r,c,'.w', 'markersize', 30);
view([90 -270]);
Accepted Answer
More Answers (2)
Walter Roberson
on 26 Mar 2012
0 votes
Plot the point slightly above (Z axis) where you want to show up, using plot3().
When you mix lines and surfaces at the same Z depth, then OpenGL has its own ideas about which should show up on top, and some of the graphics drivers get the order exactly reversed. Easiest way to be sure: tweak the Z depths to get the order you want.
Roland
on 26 Mar 2012
0 votes
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!