Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. documentclass{article}
  2. usepackage{tikz}
  3. usetikzlibrary{matrix,
  4. positioning}
  5. tikzset{
  6. mymatrix/.style = {matrix of nodes,
  7. nodes in empty cells,
  8. nodes={minimum height=3ex, minimum width=1em,
  9. inner sep=0pt, outer sep=0pt, anchor=center,
  10. draw, very thin, fill=yellow},
  11. column sep=0pt,
  12. row sep=0pt,
  13. inner sep=0.5pgflinewidth, outer sep=1pt,
  14. draw, thick},
  15. empty node/.style = {draw,fill=none},
  16. every label/.append style = {font=large, text=teal}
  17. }
  18. makeatletter
  19. deftikz@lib@matrix@empty@cell{%
  20. iftikz@lib@matrix@empty%
  21. node[name=tikzmatrixname-thepgfmatrixcurrentrow-thepgfmatrixcurrentcolumn,empty node]{};fi}
  22. makeatother
  23.  
  24. begin{document}
  25. [
  26. begin{tikzpicture}[node distance=0pt]
  27. matrix (m1) [mymatrix,
  28. label={[rotate=90, anchor=south]left: items},
  29. label=below:$R$,
  30. label=above:users]
  31. {
  32. 1 & & 3 & & & 5 & & & 5 & & 4 & \
  33. & & 5 & 4 & & & 4 & & & 2 & 1 & 3 \
  34. 2 & 4 & & 1 & 2 & & 3 & & 4 & 3 & 5 & \
  35. & 2 & 4 & & 5 & & & 4 & & & 2 & \
  36. & & 4 & 3 & 4 & 2 & & & & & 2 & 5 \
  37. 1 & & 3 & & 3 & & & 2 & & & 4 & \
  38. };
  39. node (approx) [right=of m1] {$approx$};
  40. matrix (m2) [mymatrix=none, right=1em of approx,
  41. label={[rotate=90, anchor=south]left: items},
  42. label=below:$Q$,
  43. label=above:factors]
  44. {
  45. 0.1& -0.4 & -0.2 \
  46. -0.5& 0.6 & 0.5 \
  47. -0.2& 0.3 &0.5 \
  48. 1.1& 2.1 & 0.3 \
  49. -0.7&2.1 & -2 \
  50. -1& 0.7 & 0.3 \
  51. };
  52. node (times) [right=of m2] {$times$};
  53. matrix (m3) [mymatrix=none, right=of times,
  54. label={[rotate=90, anchor=north]right: factors},
  55. label=below:$P^T$,
  56. label=above:users]
  57. {
  58. & & & & & & & & & & & \
  59. & & & & & & & & & & & \
  60. & & & & & & & & & & & \
  61. };
  62. end{tikzpicture}
  63. ]
  64. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement