Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. begin{figure}[htbp]
  2.  
  3.  
  4. centering
  5. begin{tikzpicture}
  6.  
  7. matrix (A) [matrix of math nodes, nodes in empty cells,
  8. nodes={draw, minimum width=8mm, minimum height=5mm, outer sep=0pt, anchor=center},
  9. row sep=-pgflinewidth, column sep=-pgflinewidth,
  10. row 3/.style = {nodes={minimum height=8mm}},
  11. row 5/.style = {nodes={minimum height=8mm}},
  12. column 3/.style = {nodes={minimum width=10mm}},
  13. column 4/.style = {nodes={fill=lightgray}},
  14. column 6/.style = {nodes={fill=lightgray}},
  15. column 7/.style = {nodes={minimum width=10mm}},]
  16. { & & & c & & ? & & & \
  17. & & & |[draw,fill=blue!20]|c & & |[draw,fill=blue!20]|c & & & \
  18. & & & & & & & & \
  19. & & & |[draw,fill=blue!20]|c & & |[draw,fill=blue!20]|c & & & \
  20. & & & & & & & & \
  21. & & & ? & & c& & & \
  22. & & & |[draw,fill=blue!20]|c & &|[draw,fill=blue!20]| c& & & \};
  23.  
  24. % draw the box on the right
  25. node [draw,font = footnotesize,
  26. text width=3cm,
  27. right=of A,
  28. name=textbox
  29. ] {Similarity $d_{ij}$ between items.};
  30.  
  31.  
  32. foreach i [count=xi] in {1,2,dots,$i$, ,$j$,dots,$m-1$,$m$}
  33. % added name=t-xi to the following
  34. node[above, font=scriptsize, name=t-xi] at (A-1-xi.north) {istrut};
  35. foreach i [count=xi] in {1,2,vdots,$u$,vdots,$n-1$,$n$}
  36. node[left, font=scriptsize] at (A-xi-1.west) {istrut};
  37. foreach i in {2,4,7}
  38. {
  39. % use the fit library instead of drawing box manually, then you get a node you can refer to
  40. node [fit=(A-i-4)(A-i-6), inner sep=-0.5mm, draw, rounded corners, name=Ri] {};
  41. % draw arrow from textbox node
  42. draw [latex-] (Ri.east) -- (textbox);
  43. }
  44.  
  45.  
  46. % draw arrows from the nodes using the names defined with the modification of the loop above
  47. % and relative coordinates. Add helper coordinate on the first arrow
  48. draw [latex-] (t-4) -- coordinate[pos=0.6] (s1) ++(0,15mm);
  49. draw [latex-] (t-6) -- ++(0,15mm);
  50. % draw arrow between the helper coordinate s1 and the point that has the x-coordinate of t-6 and the y-coordinate of s1
  51. draw [<->] (s1) -- node[fill=white,font=scriptsize,inner sep=1pt] {$d_{ij}=?$} (t-6 |- s1);
  52.  
  53. end{tikzpicture}
  54.  
  55.  
  56.  
  57. end{figure}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement