Create color scatter plot

조회 수: 5 (최근 30일)
monnq
monnq 2012년 10월 11일
I have a set of (x,y) points, in which several (x,y) points occur multiple times. When I make a normal scatter plot of these points, I cannot see the amount of times each point is occuring the dataset. Therefore I want to use colors in the scatter plot to show how many times the points are occuring.
I know how to count the occurrence in each cell using hist3(x,y), but how can I eventually create the plot that I want? To use scatter I need end up with:
  • x & y containing the unique points in the dataset
  • z containing the number of times each points occurs
  댓글 수: 1
monnq
monnq 2012년 10월 11일
About 4000. I know how to eventually create the scatter plot and adjust the colors. I am now looking for an easy way to create the inputs for the scatter plot, i.e. x,y points occuring together with the number of times z they occur.

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

답변 (1개)

Image Analyst
Image Analyst 2012년 10월 11일
편집: Image Analyst 2012년 10월 11일
You can pass in a list of colors into scatter that says the color of each marker. Just make up your colors and pass it in.
Use the histogram count as an index into a standard colormap like winter, summer, autumn, hot, cool, etc.
myColors = winter(256); theIndex = 256 * histogramCounts(thePointsIndex) / max(histogramCounts) myColors(thePoint, :) = winter(theIndex, :);
Do the above for every point in your data set, then pass in to scatter() or scatter3().
  댓글 수: 1
monnq
monnq 2012년 10월 11일
Thanks, now the only thing remain how can I easily link the indices of the datapoints to the indices of the matrix resulting from hist3

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by