2

How can we generate this type of image using tikz package?

ColoredMatrix

Thank you all

  • probably, you can use some pieces from here http://tex.stackexchange.com/questions/274219/drawing-a-multicolored-grid-using-tikz – novice Jun 22 '16 at 15:17
  • 1
    what kind of data do you want to generate it from ? – Christoph Frings Jun 22 '16 at 15:26
  • As there seems to be no colour pattern, you can do that with a simple tabular environment and the \cellcolor command from colortbl. Needless to summon TikZ for that. – Bernard Jun 22 '16 at 15:26
  • @ Amit : in that codes, there is a black borders and I want to fill all the squares with the same color as in the image posted here.

    @ Christoph: There is not a data, just I want to find a code that gives me the image

    – mathdatastatsml Jun 22 '16 at 15:41
  • See this question. Shouldn't be hard to adapt to your situation. – Christoph Frings Jun 22 '16 at 16:23
  • See also http://tex.stackexchange.com/questions/264182/drawing-a-really-large-binary-matrix-as-colored-grid/264223?s=1|0.4400#264223 – John Kormylo Jun 22 '16 at 17:33

2 Answers2

4

An example with TiKZ and a colorseries from xcolor.

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\pgfmathsetseed{1}
\begin{tikzpicture}
\definecolorseries{test}{rgb}{step}[rgb]{.95,.85,.55}{.17,.47,.37}
\resetcolorseries[35]{test}
\foreach \x in {0,1,...,4}{
    \foreach \y in {0,1,...,7}
        \fill[test!!+] (\x,\y) rectangle ++(1,1);
    }
    \end{tikzpicture}
\end{document}

enter image description here

Ignasi
  • 136,588
3

If the color pattern is given by a mathematical function, you might want to plot it using the pgfplots colormap.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[view={0}{90}]
    \addplot3[surf] {exp(-((x)^2+(y)^2))};
  \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

Henri Menke
  • 109,596
  • 1
    There's also the matrix plot style in PGFPlots, which makes the squares centered on the coordinates (in your examples, the colour values of the squares represent the average of the four corner values) – Jake Jun 22 '16 at 19:13