Plot with two different y axis (text-data)

2 次查看(过去 30 天)
I have one table with several regions, and the values distribution for each year (from 2010 to 2019).
I would like to get line plot with to y-axis left regions name, to right values. While x-axis there are years.
t = readtable('Cartel1.xlsx')
It's possible?
for example, creating barth (stacked) but using lines

采纳的回答

Chunru
Chunru 2022-4-12
编辑:Chunru 2022-4-12
t = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/961730/Cartel1.xlsx');
head(t)
ans = 8×11 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 _____________ _______ _______ _______ ______ ______ _______ _______ _______ _______ _______ {'regions_p'} 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 {'A' } 0.62891 1.1046 1.3891 1.864 1.5899 0.70993 0.66656 0.67802 0.74008 0.62891 {'B' } 0.56074 0.53844 0.97474 1.3421 1.0435 1.1377 1.2181 0.83779 1.2789 1.068 {'C' } 0.88687 0.93951 0.98286 1.1213 1.0318 1.177 0.99839 0.73448 1.2059 0.92194 {'D' } 0.93823 0.80934 0.99234 1.2517 1.0988 0.99212 0.95762 0.728 1.1276 1.1043 {'E' } 0.6829 0.80186 0.94871 1.2642 1.4407 0.86883 0.96912 0.79355 0.99117 1.239 {'F' } 0.63041 0.87128 1.0953 1.0785 1.4302 0.73926 0.96106 0.98217 1.0026 1.2092 {'G' } 0.33694 0.89674 1.0714 1.3123 1.3262 0.91323 0.95403 0.79544 1.213 1.1807
plot(t{1, 2:end}', t{2:end, 2:end}' );
legend(t.Var1{2:end}, 'location', 'eastoutside')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by