How can I use pcolor for rings ?

조회 수: 5 (최근 30일)
JLM
JLM 2015년 4월 24일
댓글: Star Strider 2015년 4월 26일
Hello,
I am trying to highlight a correlation between the position of earthquakes and some parameters such as depth or magnitude... I have already divided the map according to a grid. Then I get this correlation for each small square of the grid. </matlabcentral/answers/uploaded_files/29722/Capture%20d%E2%80%99%C3%A9cran%202015-04-24%20%C3%A0%2023.45.01.png>
Up to now, I succeeded to correlate the positions to the parameters, be it in cartesian or in polar coordinates.
Yet, I would like to correlate the mean depth of earthquakes to their positions according to the RADIUS (and only the radius, NOT the angle).
In other words, I would like to work with rings. (like the following figure)
Thank you very much for your help.

채택된 답변

Star Strider
Star Strider 2015년 4월 25일
This looks more like an archery target than an earth section, but it at least seems to give the appearance you want. Experiment with the colours to get the result you want.
The code uses the cylinder object to create a cone, then uses the colormap to colour it by height. There might be better ways to code it, but no one has come up with one yet, so I offer mine:
c = colormap(jet(4));
[X,Y,Z] = cylinder([1:-0.25:0], 256);
figure(1)
hs = surf(X, Y, Z)
axis square
set(hs, 'EdgeColor','none')
view([0 90])
The plot:
  댓글 수: 5
JLM
JLM 2015년 4월 25일
Yes, sure, there are many ways to highlight this correlation but I was asked to do it on the map, in a visual way. Thank you, Star Strider, for your answer.
Star Strider
Star Strider 2015년 4월 26일
I’ve been giving some thought to this. What sort of profile do you want to plot? If you have that profile function, you can probably plot it using (X,Y) matrices created by meshgrid, then depending on how you want to plot it, use cart2pol or pol2cart. Since I still don’t understand how you want to map a 2D relation to a 3D relation, I can’t be more specific.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ahmet Cecen
Ahmet Cecen 2015년 4월 25일
I am not sure what the question here is. If all you need to check is whether there is a correlation between mean depth and radius, just convert your Cartesian coordinates to polar using:
[THETA,RHO] = cart2pol(X,Y)
then just do not use theta ... which is effectively
[~,RHO] = cart2pol(X,Y)
So then you would just plot RHO vs Mean Depth for a scatter plot, and do any sort of correlation analysis you want with RHO as your x and Mean Depth as your y.
If then you want to plot it, you will plot using:
polar(theta,rho)
but instead use:
polar(1:2*pi,rho)
so you will plot rings instead of points.
  댓글 수: 1
JLM
JLM 2015년 4월 25일
편집: JLM 2015년 4월 25일
Ahmet, Thank you very much for your help. I am afraid it does not work properly. I may be mistaken but it writes "Error using polar THETA and RHO must be the same size."
I have already calculated the radius and the angle corresponding to the longitudes and latitudes of my earthquakes , by myself because I had an issue with the origin of my system. I finally get the figure above (kind of wheel).
Yet, what I would like to have is the average of the depth for example, of all the earthquakes located between radius1 and radius2 and to make it appear with colors depending on the average obtained.
If you need more info about my code or what I am trying to do, please, let me know. I appreciate what you do.
Thank you everybody for helping me.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by