7

Sending out the bat signal . Could you please help me to get this piece of art? I have no idea about how to obtain it.

enter image description here

In the meantime I’m working on a MWE:

    documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,fit,positioning}

\begin{document}
\begin{tikzpicture}
\matrix (A) [matrix of math nodes, nodes in empty cells,
nodes={draw, minimum width=8mm, minimum height=5mm, outer sep=0pt, 
anchor=center},row sep=-\pgflinewidth, column sep=-\pgflinewidth,
row 3/.style = {nodes={minimum height=8mm}},
row 5/.style = {nodes={minimum height=8mm}},
column 3/.style = {nodes={minimum width=10mm}},
column 4/.style = {nodes={fill=lightgray}},
column 6/.style = {nodes={fill=lightgray}},
column 7/.style = {nodes={minimum width=10mm}},]
{   & & & R & & ? & & &  \\
    & & & |[draw,fill=blue!20]|R & & |[draw,fill=blue!20]|R & & &  \\
    & & & & & & & &  \\
    & & & |[draw,fill=blue!20]|R & & |[draw,fill=blue!20]|R & & &  \\ 
    & & & & & & & &  \\
    & & & ? & & R& & &  \\
    & & & |[draw,fill=blue!20]|R & &|[draw,fill=blue!20]| R& & &  \\};
\foreach \i [count=\xi] in {1,2,\dots,$i$, ,$j$,\dots,$m-1$,$m$}
\node[above, font=\scriptsize] at (A-1-\xi.north) {\i\strut};
\foreach \i [count=\xi] in {1,2,\vdots,$u$,\vdots,$n-1$,$n$}
\node[left, font=\scriptsize] at (A-\xi-1.west) {\i\strut};
\node[right=1cm of A,align=left,text width=4cm,path picture={
\draw ([xshift=1em,yshift=-\pgflinewidth]path picture bounding box.north west) -|
 ([xshift=\pgflinewidth,yshift=\pgflinewidth]path picture bounding box.south west) -- ++ (1em,0);}] (txt){%
 \dots}; 
\foreach \i  in {2,4,7}
{\node[draw,rounded corners,fit=(A-\i-4)(A-\i-6),inner xsep=-1ex,
inner ysep=-0.3ex] (F-\i){};
\draw[-latex] (txt) -- (F-\i.east);
}

\end{tikzpicture}
\end{document}

UPDATE: this is the real combination of colors. I was opening the file from a mobile device and the actual colors were not loading the right way.

enter image description here

LAST UPDATE: When I turn on Night Mode in my laptop, the original picture look like this:

enter image description here

And ours(also in Night Mode) look like this:

enter image description here

There is something fishy going on, they have used a special kind of shadow. I hope we can find it out!

Stefan Pinnow
  • 29,535
NaveganTeX
  • 2,630

2 Answers2

9
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,shadows.blur,positioning,decorations.pathreplacing}

\begin{document}
\begin{tikzpicture}[,decoration={brace,mirror,raise=0.1em}]
\matrix (A) [matrix of math nodes, nodes in empty cells,inner sep=0pt,
nodes={draw, minimum width=12mm, minimum height=12mm, outer sep=0pt, 
anchor=center},row sep=-\pgflinewidth, column sep=-\pgflinewidth,
row 1/.style = {nodes={minimum height=8mm}},
row 3/.style = {nodes={minimum height=8mm,fill=lightgray}},
row 5/.style = {nodes={minimum height=8mm}},
column 1/.style = {nodes={minimum width=8mm}},
column 3/.style = {nodes={minimum width=8mm,fill=lightgray}},
column 5/.style = {nodes={minimum width=8mm}},
fill=white,blur shadow]
{   r_{11} & & r_{1g} & & r_{1n}\\
    & &  & & \\
     r_{i1} & & |[fill=black,text=white]| r_{ig} & & r_{in}\\
    & &  & & \\
     r_{m1} & & r_{mg} & & r_{mn}\\
     };
\foreach \X/\Y in {1/1,3/g,5/n}
 {\node[above=0.2em of A-1-\X] (T-\X) {$\Y$};}
\foreach \X/\Y in {1/1,3/i,5/m}
 {\node[left=0.2em of A-\X-1] (L-\X) {$\Y$};}
\draw[decorate] (T-3.south-|A.east) -- (T-3.north-|A.east)
 node[midway,right=0.1em] {$G$};
\draw[decorate] (A-3-5.south-|A.east) -- (A-3-5.north-|A.east)
 node[midway,right=0.1em] {$R_i$};
\draw[decorate] (L-5.west|-A.south) --
 (L-5.east|-A.south) node[midway,below=0.1em] {$I$};
\draw[decorate] (A-5-3.west|-A.south) --
 (A-5-3.east|-A.south) node[midway,below=0.1em] {$R_g$};
\node[above=0.2em of T-3] {items};
\node[left=0.2em of L-3] {users};
\end{tikzpicture}
\end{document}

enter image description here

Blue shadow a la percusse's deleted answer.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,shadows.blur,positioning,decorations.pathreplacing}
\makeatletter
\tikzset{render blur shadow/.code={\pgfbs@savebb%
\pgfsyssoftpath@getcurrentpath{\pgfbs@input@path}%
\pgfbs@compute@shadow@bbox%
\pgfbs@process@rounding{\pgfbs@input@path}{\pgfbs@fadepath}%
\pgfbs@apply@canvas@transform%
\colorlet{pstb@shadow@color}{white!\pgfbs@opacity!#1}%
\pgfdeclarefading{shadowfading}{\pgfbs@paint@fading}%
\pgfsetfillcolor{#1}%
\pgfsetfading{shadowfading}{\pgftransformshift{\pgfpoint{\pgfbs@midx}{\pgfbs@midy}}}%
\pgfbs@usebbox{fill}%
\pgfbs@restorebb%
},render blur shadow/.default=shadowcolor}
\colorlet{shadowcolor}{black}
\makeatother
\begin{document}
\begin{tikzpicture}[,decoration={brace,mirror,raise=0.3em}]
\colorlet{shadowcolor}{blue}
\matrix (A) [matrix of math nodes, nodes in empty cells,inner sep=0pt,
nodes={draw, minimum width=12mm, minimum height=12mm, outer sep=0pt, 
anchor=center},row sep=-\pgflinewidth, column sep=-\pgflinewidth,
row 1/.style = {nodes={minimum height=8mm}},
row 3/.style = {nodes={minimum height=8mm,fill=lightgray}},
row 5/.style = {nodes={minimum height=8mm}},
column 1/.style = {nodes={minimum width=8mm}},
column 3/.style = {nodes={minimum width=8mm,fill=lightgray}},
column 5/.style = {nodes={minimum width=8mm}},
fill=white,blur shadow={shadow blur steps=10,shadow xshift=0.3em,shadow
yshift=-0.3em,shadow blur radius=1.5ex}]
{   r_{11} & & r_{1g} & & r_{1n}\\
    & &  & & \\
     r_{i1} & & |[fill=black,text=white]| r_{ig} & & r_{in}\\
    & &  & & \\
     r_{m1} & & r_{mg} & & r_{mn}\\
     };
\foreach \X/\Y in {1/1,3/g,5/n}
 {\node[above=0.2em of A-1-\X] (T-\X) {$\Y$};}
\foreach \X/\Y in {1/1,3/i,5/m}
 {\node[left=0.2em of A-\X-1] (L-\X) {$\Y$};}
\draw[decorate] (T-3.south-|A.east) -- (T-3.north-|A.east)
 node[midway,right=0.3em] {$G$};
\draw[decorate] (A-3-5.south-|A.east) -- (A-3-5.north-|A.east)
 node[midway,right=0.3em] {$R_i$};
\draw[decorate] (L-5.west|-A.south) --
 (L-5.east|-A.south) node[midway,below=0.3em] {$I$};
\draw[decorate] (A-5-3.west|-A.south) --
 (A-5-3.east|-A.south) node[midway,below=0.3em] {$R_g$};
\node[above=0.2em of T-3] {items};
\node[left=0.2em of L-3] {users};
\end{tikzpicture}
\end{document}

enter image description here

  • Marmot, it looks great! Though I'd like to give it that blue shadow (which appears in east, north, south and west) which makes it a beauty. How can i do that? – NaveganTeX Jun 17 '19 at 04:41
  • 1
    @naveganTeX I added a blue shadow. See also https://tex.stackexchange.com/a/493406/121799. –  Jun 17 '19 at 04:50
  • I am checking it! Thank you!!! – NaveganTeX Jun 17 '19 at 04:52
  • I've updated the OP. Now the color combination makes sense. – NaveganTeX Jun 17 '19 at 05:01
  • 1
    @naveganTeX I agree. –  Jun 17 '19 at 05:04
  • Did you update the code with the new colors combination? Is it blue!20? – NaveganTeX Jun 17 '19 at 05:08
  • 1
    @naveganTeX I used blue!20 because that is also in your above code. –  Jun 17 '19 at 05:11
  • 1
    FYI the blue shading is just a rectangle, not a shadow. Trying replacing the last lines of Marmot's first code with: \begin{scope}[on background layer] \fill[fill=backgroundblue] (-2.6,2.5) rectangle (2.7,-2.8); \end{scope} \end{tikzpicture} \end{document} and add \definecolor{backgroundblue}{RGB}{235,255,255} and \usetikzlibrary{backgrounds} at the beginning – Robin Georg Jun 17 '19 at 05:18
  • Check my last update to the OP – NaveganTeX Jun 17 '19 at 05:24
  • @RobinGeorg Thanks! I do not know what the goal is but maybe shadow scale=1.1 could be simpler. Or blur shadow={shadow blur steps=10,shadow xshift=0.15em,shadow yshift=-0.15em,shadow blur radius=1.5ex,shadow scale=1.05}. –  Jun 17 '19 at 05:24
  • 2
    @marmot It is a medal answer :-) +1 to arrive at 10. – Sebastiano Jun 17 '19 at 21:16
  • @marmot We keep scoring with our post, mainly done by you, but some credit for me for the OP :) – NaveganTeX Jun 18 '19 at 20:37
  • 1
    @naveganTeX Well, I did upvote the question right away... (Voting behavior is hard to understand.) –  Jun 18 '19 at 20:39
3

I think this should get you going:

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{tikzpicture}
\draw[fill=gray!40, opacity=0.8] (-4,1) rectangle (-1.5,0);
\draw[fill=gray!40, opacity=0.8] (-0.5,1) rectangle (2.5,0);
\draw[fill=gray!40, opacity=0.8] (-1.5,0) rectangle (-0.5,-3);
\draw[fill=gray!40, opacity=0.8] (-1.5,4) rectangle (-0.5,1);
\draw (-4,4) rectangle (-3,-3);
\draw (-3,4) rectangle (-1.5,-3);
\draw (-0.5,4) rectangle (1.5,-3);
\draw (1.5,4) rectangle (2.5,-3);
\draw (-4,4) rectangle (2.5,3);
\draw (-4,-3) rectangle (2.5,-2);
\draw[fill=black]  (-1.5,1) rectangle (-0.5,0);
\node at (-1,0.5) {\textcolor{white}{$r_{ig}$}};
\node at (-3.5,3.5) {$r_{11}$};
\node at (-3.5,0.5) {$r_{i1}$};
\node at (-1,3.5) {$r_{1g}$};
\node at (-3.5,-2.5) {$r_{m1}$};
\draw[decorate, decoration={brace, amplitude=3pt}] (2.6,1.0) -- (2.6,0);
\node at (3,0.5) {$R_i$}
\end{tikzpicture}
\end{document}

result

geguze
  • 470
  • 2
  • 11