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!