Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

please help regarding plot

조회 수: 1 (최근 30일)
mridula
mridula 2013년 9월 3일
마감: MATLAB Answer Bot 2021년 8월 20일
how can i plot or draw the following graph/plot. scatter is not working at all as it is adding lot of space between bubbles. http://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Dotplot_of_random_values_2.png/220px-Dotplot_of_random_values_2.png
i have some values instead of random valuesand i want to plot exactly what is given in the link.
thanks
  댓글 수: 1
Walter Roberson
Walter Roberson 2013년 9월 3일

답변 (1개)

Jacob Ward
Jacob Ward 2017년 9월 6일
Doubt you'll get much use out of this, but here's how I recreated the plot in the link you gave!
numbers = round(9*rand(50,1)); % Generates random numbers between 0 and 9.
hold on;
max = 0;
for j = 0:9 % Plots each number 1 at a time, moving up one unit each time one is found
count = 1;
for i = 1:50
if numbers(i) == j
plot(numbers(i),count,'ko','MarkerFaceColor','k');
count=count+1;
end
if count > max
max = count;
end
end
end
axis([-.5 9.5 0 max])
set(gca,'YTickLabel','')
title('Dotplot of Random Values')
xlabel('Random Values')

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by