0

I have been shifting to tikz to do my plots recently (from matplotlib), and I have to say I kind of like it a lot. It's very nice to have everything coherent, in font, code, colors and so on!

Unfortunately, I have not been able to reproduce yet the heatmap kind of plot. I have seen examples of course, but nothing that reached the quality of those made with the seaborn library in Python:

enter image description here

I would like to ask if someone would know how to approach this?

Best, Pierre

1

pgfplots can do matrix plots.

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{colorbrewer}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[enlargelimits=false,colorbar,colormap/Purples]
    \addplot [matrix plot,point meta=explicit]
      coordinates {
        (0,0) [0] (1,0) [1] (2,0) [2]

        (0,1) [3] (1,1) [4] (2,1) [5]

        (0,2) [6] (1,2) [7] (2,2) [8]
      };
  \end{axis}
\end{tikzpicture}

\end{document}

enter image description here

  • very nice +1 for your answer. – Sebastiano Dec 12 '17 at 10:17
  • @Sebastiano Pff, I just copied the manual. – Henri Menke Dec 12 '17 at 10:47
  • Hello Henri, and thank you for your answer! I must apologize as I badly formulated the question... I had stopped working on it for some time, sorry. I've found an answer for the loading of the dataframe-like data here: tex.stackexchange.com/questions/42444/… Thank you again, Pierre. – Pierre Dec 13 '17 at 12:52

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.