필터 지우기
필터 지우기

How to make scatter points into squares of a given size?

조회 수: 39 (최근 30일)
Robert Wu
Robert Wu 2017년 12월 15일
댓글: Walter Roberson 2017년 12월 15일
I would like to make a figure where my data points 'c' are squares of a given size instead of points.
The problem with the scatter function is that the points are too small. Making them larger will result in the data points overlaping.
x = (1:121);
y = zeros(1,121);
c = rand(1,121);
scatter(x,y,20,c)
Any help would be appreciated.
Many thanks,
Rob.

답변 (1개)

Walter Roberson
Walter Roberson 2017년 12월 15일
편집: Walter Roberson 2017년 12월 15일
scatter(x, y, c, 'Marker', 's')
Note: Many readers would tend to associate the variable name 'c' with "color", but you are using it in a position associated with marker size.
  댓글 수: 2
Robert Wu
Robert Wu 2017년 12월 15일
편집: Robert Wu 2017년 12월 15일
Hi Walter,
Thanks for the reply. The 'c' variable is color. I want to represent the value of my data with color. I used rand in this case for the sake of the question.
Walter Roberson
Walter Roberson 2017년 12월 15일
scatter(x, y, [], c, 'Marker', 's')
The order is x, y, size, color, then property/value pairs.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by