2

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

ColoredMatrix

Thank you all

6
  • probably, you can use some pieces from here tex.stackexchange.com/questions/274219/…
    – novice
    Jun 22 '16 at 15:17
  • 1
    what kind of data do you want to generate it from ? 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 Jun 22 '16 at 15:41
  • See this question. Shouldn't be hard to adapt to your situation. Jun 22 '16 at 16:23
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

1
  • 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
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.