Importing table and making a stacked plot with same x and y axis
Mostrar comentarios más antiguos
Hello.
I am quite new to MatLab and the functionality compared to excel, but I wanted to do a stacked plot, where my graphs are placed above eachother.
For reference I want something where the 3 different file's graphs I've got is stacked so they look like a PXRD specta (see attached). Peaks (those 1 0 0, 1 0 2, 2 0 0 etc is not needed, just a simple way of stacking them and I suspect you can just use legends for the names?
Problem is I'm nowhere good at using MatLab and I've tried some things and I've managed to get the data inside MatLab and delete columns I don't want.
tbl1 = readtable('SrFe12O19_xy.csv');
tbl1.Properties.VariableNames = ["Degs", "Counts"]
tbl2 = readtable('Fe2O3_hematite_xy.csv');
tbl2.Properties.VariableNames = ["Degs", "Counts"]
tbl3 = readtable('SrFe12O19_Jonas_maj2021.csv');
tbl3(:, 3) = []; % Deletes column 3
tbl3.Properties.VariableNames = ["Degs", "Counts"]
Where the tbl1 and tbl2 are 660x2 table but tbl3 is 6976x2 table.

2 comentarios
Adam Danz
el 19 de Mayo de 2021
A bit more info is needed about your tables.
Assuming "Degs" contains the x-coordinates, are they all unique values within each table? Are they sorted in any way?
Since some tables are longer than others, the longer tables either have duplicate x-values or the shorter tables are missing x-values that are in the longer tables. Stackedplot is designed to visualize data along the same range of x-values so what's supposed to happen in the case of missing or duplicate x-coordinates?
Jonas Laursen
el 19 de Mayo de 2021
Editada: Jonas Laursen
el 19 de Mayo de 2021
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

