How does one plot a value (column of data) against two other values (2 other columns)?

3 ビュー (過去 30 日間)
I have a text file with many columns and rows, but I am only interested in a few sets of data (for now). How do I go about plotting a column against to two other columns? Columns in question are 14 (current), 10 (latitude), and 11 (longitude). Basically mapping out a location of incidence. Thank you

採用された回答

the cyclist
the cyclist 2017 年 12 月 4 日
編集済み: the cyclist 2017 年 12 月 4 日
% Generate some pretend data. (You should use your actual data.)
M = rand(8,5) + (1:8)';
% Plot the Columns 2 and 5 as a function of Column 1 
figure
plot(M(:,1),M(:,2),'r.-',M(:,1),M(:,5),'g.-')
  2 件のコメント
fernando aguirre
fernando aguirre 2017 年 12 月 4 日
Awesome! Ended up using scatter3 because I realized that the data I had varied in value. Thanks!
Satinath Debnath
Satinath Debnath 2021 年 11 月 4 日
@the cyclist. I have got just an additional doubt with this plot. If I want to plot the other coumn but still in legend I want to mention the reference column. For example in the above example the first column is just constant 1 and other columns 2 and 5 have some random values. So In legend I want to show that 2,3 columns plotted represented 1. Is it possible to show through legend?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by