How to make sparsity pattern graph with grouping
Mostra commenti meno recenti
Hi. I would like to create a graph looking like the following:

The rows correspond to periods (months), and the columns to a set of features/predictors/X's. The features have been assigned to a category, which corresponds to the different colors.
The data that I would like to plot something similar for, are in the following form (-assuming we have 30 periods, and 15 perdictors):
%Create a Sparse Matrix M:
T=30; N=15;
M=zeros(T,N);
for i=1:T
M(i,randsample(1:N, 6, false))=1;
end
TT = array2timetable(M,'RowTimes',dateshift(datetime('today'),'end','month',-T+1:0),'VariableNames',"x"+string(1:N))
c = [repmat("Financial",[1,5]) repmat("Econ",[1,8]) repmat("Survey",[1,2])]';
c = c(randsample(1:N,N,false));
categoriez = array2table(c,'RowNames',"x"+string(1:N),"VariableNames","categ")
I would like to create a graph like the one on the top, using the data in timetable TT and table categoriez. Any help would be appreciated!
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Discrete Data Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


