weird latex-interpreter problem in annotation when adding one line to table
古いコメントを表示
dear experts,
trying to plot the data of a confusion matrix via annotations, i stumbled upon a weird effect and i really haven't any clue what could be the cause for this effect.
a string, containing a latex formated table, is shown via an annotation textbox. in my example code, the upper table works fine. but, when just adding another row of data (e.g. duplicate the 'GHI' row), results in an Warning: Error updating TextBox.
what am is missing???
%% example
clear all; close all;
%% this works fine
figure()
subplot(2,1,1); axis off;
strA = ['\begin{tabular}{lrllllllllll} \hline '...
' & & \multicolumn{10}{c}{\textbf{response}} \\ \cline{3-12} '...
' & & \multicolumn{2}{c}{\textbf{ABC}} & \multicolumn{2}{c}{\textbf{DEF}} & \multicolumn{2}{c}{\textbf{GHI}} & \multicolumn{2}{c}{\textbf{KLM}} & \multicolumn{2}{c}{\textbf{total}} \\ '...
' & & \multicolumn{1}{c}{No.} & \multicolumn{1}{c}{\%} & \multicolumn{1}{c}{No.} & \multicolumn{1}{c}{\%} & \multicolumn{1}{c}{No.} & \multicolumn{1}{c}{\%} & \multicolumn{1}{c}{No.} & \multicolumn{1}{c}{\%} & \multicolumn{1}{c}{No.} & \multicolumn{1}{c}{\%} \\ \hline '...
'\multicolumn{1}{c}{\textbf{target}} & \textbf{ABC} & 205 & 89.9 & 6 & 2.6 & 1 & 0.4 & 16 & 7.0 & 228 & 25 \\ '...
'\textbf{} & \textbf{DEF} & 40 & 17.5 & 175 & 76.8 & 11 & 4.8 & 2 & 0.9 & 228 & 25 \\ '...
'\textbf{} & \textbf{GHI} & 9 & 3.9 & 4 & 1.8 & 202 & 88.6 & 13 & 5.7 & 228 & 25 \\ '...
'\textbf{} & \textbf{KLM} & 10 & 4.4 & 0 & 0 & 11 & 4.8 & 207 & 90.8 & 228 & 25 \\ '...
'\end{tabular}'];
ha = annotation('textbox',[0 0.5 1 0.5],...
'EdgeColor', 'none',...
'HorizontalAlignment','center',...
'VerticalAlignment','middle',...
'Interpreter', 'latex');
set(ha, 'String', strA);
%% NOW: just add copy one of the last four data-lines!!!
subplot(2,1,2); axis off;
strB = ['\begin{tabular}{lrllllllllll} \hline '...
' & & \multicolumn{10}{c}{\textbf{response}} \\ \cline{3-12} '...
' & & \multicolumn{2}{c}{\textbf{ABC}} & \multicolumn{2}{c}{\textbf{DEF}} & \multicolumn{2}{c}{\textbf{GHI}} & \multicolumn{2}{c}{\textbf{KLM}} & \multicolumn{2}{c}{\textbf{total}} \\ '...
' & & \multicolumn{1}{c}{No.} & \multicolumn{1}{c}{\%} & \multicolumn{1}{c}{No.} & \multicolumn{1}{c}{\%} & \multicolumn{1}{c}{No.} & \multicolumn{1}{c}{\%} & \multicolumn{1}{c}{No.} & \multicolumn{1}{c}{\%} & \multicolumn{1}{c}{No.} & \multicolumn{1}{c}{\%} \\ \hline '...
'\multicolumn{1}{c}{\textbf{target}} & \textbf{ABC} & 205 & 89.9 & 6 & 2.6 & 1 & 0.4 & 16 & 7.0 & 228 & 25 \\ '...
'\textbf{} & \textbf{DEF} & 40 & 17.5 & 175 & 76.8 & 11 & 4.8 & 2 & 0.9 & 228 & 25 \\ '...
'\textbf{} & \textbf{GHI} & 9 & 3.9 & 4 & 1.8 & 202 & 88.6 & 13 & 5.7 & 228 & 25 \\ '...
'\textbf{} & \textbf{GHI} & 9 & 3.9 & 4 & 1.8 & 202 & 88.6 & 13 & 5.7 & 228 & 25 \\ '...
'\textbf{} & \textbf{KLM} & 10 & 4.4 & 0 & 0 & 11 & 4.8 & 207 & 90.8 & 228 & 25 \\ '...
'\end{tabular}'];
ha = annotation('textbox',[0 0 1 0.5],...
'EdgeColor', 'none',...
'HorizontalAlignment','center',...
'VerticalAlignment','middle',...
'Interpreter', 'latex');
set(ha, 'String', strB);
thanks in advance,
adam
1 件のコメント
Ameer Hamza
2020 年 9 月 30 日
This seems to be a bug in the implementation of latex interpreter. Maybe consider filing a bug report: https://www.mathworks.com/support/bugreports/report_bug
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!