How to show dot graph in specific range
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
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 件のコメント
Phudit Kanittasut
2021 年 3 月 21 日
I want to show the dot that occour above 1
Star Strider
2021 年 3 月 21 日
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.
Phudit Kanittasut
2021 年 3 月 21 日
Is there any error in my code ?
Star Strider
2021 年 3 月 21 日
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.
Phudit Kanittasut
2021 年 3 月 21 日
Oh I already change it and nothing happen
Star Strider
2021 年 3 月 21 日
I would need the data and your code (as text, not an image) to see what the problem is.
Phudit Kanittasut
2021 年 3 月 21 日
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);
Phudit Kanittasut
2021 年 3 月 21 日
This is my code and my data
Star Strider
2021 年 3 月 21 日
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!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)
