plot title formatting with table
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a figure with many subplots, and each subplot has an associated "metric." Normally, you'd put the metric in the title of the figure ... but suppose I am trying to compare 5 different metrics for each subplot. Is there a nice way to display all 5 of them in the title without it looking too crowded?
I suppose one approach is something like this ...

but even this looks cumbersome, and I don't know if it is possible to put tables in titles in Matlab?
Any suggestions are greatly appreciated!
Cheers,
0 Commenti
Risposte (2)
Walter Roberson
il 23 Ago 2016
title() does permit 'Interpreter', 'latex' so you might be able to use the File Exchange contribution https://www.mathworks.com/matlabcentral/fileexchange/44274-latextable
However, I would not be surprised if it assumes does not get the spacing right between the title and the graph.
0 Commenti
Tillmann
il 26 Set 2018
I was just looking for the same and tried out the latextable option. For me it didn't work, because of the table environment. However if you directly use the tabular environment, it does work.
MWE:
tbl_header = "\begin{tabular}{ccccc} \textbf{DoE ID} & \multicolumn{2}{c}{\textbf{Toolposition} (in mm)} & \multicolumn{2}{c}{\textbf{Material}} \\ & x & y & name & thickness (in mm) \\ \hline";
tbl_footer = "\end{tabular}";
for ii = 1:5
plot((1:256)', rand(256,1)); hold on;
tbl_body(ii) = sprintf("%d & %.2f & %.2f & %s & %.2f", randi(10,1), rand, rand, 'random string', randi(10,1));
end
tbl_str = sprintf("%s %s %s", tbl_header, strjoin(tbl_body, ' \\\\ '), tbl_footer);
title(...
{...
sprintf("\\textbf{Machine:} %s", 'Random machine name'), ...
"", ...
tbl_str ...
}, ...
'Interpreter','latex' ...
);
0 Commenti
Vedere anche
Categorie
Scopri di più su Title in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!