Plot with two different y axis (text-data)

3 visualizaciones (últimos 30 días)
Rachele Franceschini
Rachele Franceschini el 12 de Abr. de 2022
Comentada: Rachele Franceschini el 13 de Abr. de 2022
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

Respuesta aceptada

Chunru
Chunru el 12 de Abr. de 2022
Editada: Chunru el 12 de Abr. de 2022
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')
  1 comentario
Rachele Franceschini
Rachele Franceschini el 13 de Abr. de 2022
It is possible to get for each line, a different color?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by