Generate a point/marker on a filled contour
Mostra commenti meno recenti
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]);
Risposta accettata
Più risposte (2)
Walter Roberson
il 26 Mar 2012
0 voti
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.
1 Commento
Roland
il 26 Mar 2012
Roland
il 26 Mar 2012
0 voti
Categorie
Scopri di più su Contour Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!