0

I would like to make a matrix plot with the following script, where all 0 values are displayed in white all other values according to the colormap. Is there a masking feature in pgf plot? Could it be done with a feature which assigns a certain color to all values below a certain value? All values I want to display according to the colorplot are larger than 0.

\documentclass[]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\begin{document}

\begin{tikzpicture}
\begin{axis}[view={0}{90},
enlargelimits=false,
xtick=data, ytick=data,
colorbar,
colormap/viridis
]
\addplot3[matrix plot]
table[] {
1 1 1
2 1 2
3 1 0

1 2 0
2 2 3
3 2 1 
};
\end{axis}
\end{tikzpicture}

\end{document}

I have this code at the moment which outputs a result like this: enter image description here

Your Answer

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

Browse other questions tagged or ask your own question.