How to show dot graph in specific range
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
How can I show the dot that occour above 1
채택된 답변
Star Strider
2021년 3월 21일
I am not certain what you want.
Adapt this to your data:
x = linspace(0, 7200, 250); % Create ‘x’
y = rand(size(x))*4.5E+4; % Create ‘y’
figure
plot(x, y, 'r.')
hold on
Lv = y>1E+4; % Set Threshold At 1E+4
plot(x(Lv), y(Lv), '.b')
hold off
legend('All Data', 'Data Above Threshold')
.
댓글 수: 9
I want to show the dot that occour above 1
Change the threshold to 1:
Lv = y>1; % Set Threshold At 1E+4
then plot it as:
plot(x(Lv), y(Lv), '.r')
Choose whatever colour you want the dots to be.
Is there any error in my code ?
I do not have your data, and I cannot run images of code in my version of MATLAB.
So, I have no idea if there are any errors in it, other than that the data you are loading is ‘pure_liver’. and you are plotting ‘pure_brain’ that apparently does not exist in your workspace. That would appear to me to be an error.
Oh I already change it and nothing happen
I would need the data and your code (as text, not an image) to see what the problem is.
pure_liver = importdata('Pure Liver Spectra.csv');
[pks,locs] = findpeaks(pure_liver(:,2));
x = 1:size(pure_liver,1);
%Pure brain peak
%figure
%plot(x, pure_brain(:,2))
%hold on
%plot(x(locs), pure_brain(locs,2), '^r')
%hold off
%grid
%Pure Brain Dot
figure
Lv = y>1;
plot(x(Lv), pure_liver(Lv), '.r')
grid
title('Pure Liver peak');
%save files
%dlmwrite('pks_data.csv',pks);
This is my code and my data
All the ‘pks’ values are greater than 1, and range from 102 to 45448:
pure_liver = readmatrix('Pure Liver Spectra.csv');
[pks,locs] = findpeaks(pure_liver(:,2));
x = 1:size(pure_liver,1);
[pks_min,pks_max] = bounds(pks) % Minimum & Maximum Values Of ‘pks’
figure
Lv = pure_liver(locs,2)>1E+4; % Set Threshold = 1E+4
% Lv = pure_liver(locs,2)>1; % Set Threshold = 1
plot(x(locs(Lv)), pure_liver(locs(Lv),2), '.r')
grid
title('Pure Liver peak');
Note that what appears to be ‘1’ on the plot is actually
. Choose the ‘Lv’ assignment that does what you want.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
