Importing table and making a stacked plot with same x and y axis
显示 更早的评论
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 个评论
Adam Danz
2021-5-19
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
2021-5-19
编辑:Jonas Laursen
2021-5-19
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

