Plotting a graph row by row from a table

20 ビュー (過去 30 日間)
Tze Tian
Tze Tian 2014 年 4 月 14 日
編集済み: Adam Danz 2020 年 5 月 29 日
I have a data set that looks like as below and i want to plot them into a graph. I have seen a couple of examples online for graphs , however they are plotting column by column and the data source are from different matrix file.
My final product that i am trying to achieve is the image below. Can someone be kind enough to guide or point me in the right direction ?
The C1990 stands for carbon emission yr 1990.
So far i was able to plot the following but with much changes to the data source, rearranging and performing transpose operation.
  2 件のコメント
William Sharpless
William Sharpless 2020 年 5 月 29 日
+1 I would also like to know if there is a simple way to do this rather than iterate over reach row
Adam Danz
Adam Danz 2020 年 5 月 29 日
To plot row n from a table T,
plot(T{n,:})
To plot column n from table T,
plot(T{:,n})

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

回答 (1 件)

KSSV
KSSV 2020 年 5 月 29 日
Pick the data into a matrix from table. You can either use table2array, table2cell. Let A be your m*n matrix.
plot(A')
legend(str) ; % where str has all names of the rows
  1 件のコメント
Adam Danz
Adam Danz 2020 年 5 月 29 日
編集済み: Adam Danz 2020 年 5 月 29 日
That can be done without copying the data into another variable.
plot(T{:,:}.') % Where T is a table of only numeric values

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

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by