# imagesc TikZ/pgfplots equivalent, axes problems [closed]

following this link, i tried to reproduce a MATLAB imagesc with tikz. The graph should look like this: However, in constrast to the aforementioned link, my graph should have 19 rows and 192 columns and I have problems defining the matrix row, cols.

Here is my code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\pgfplotsset{
matrix plot/.style={
axis on top,
clip marker paths=true,
scale only axis,
height=\matrixrows/\matrixcols*\pgfkeysvalueof{/pgfplots/width},
enlarge x limits={rel=0.5/\matrixcols},
enlarge y limits={rel=0.5/\matrixrows},
scatter/use mapped color={draw=mapped color, fill=mapped color},
scatter,
point meta=explicit,
mark=square*,
cycle list={
mark size=0.5*\pgfkeysvalueof{/pgfplots/width}/\matrixcols
}
},
matrix rows/.store in=\matrixrows,
matrix rows=19,
matrix cols/.store in=\matrixcols,
matrix cols=192}
\begin{tikzpicture}
\begin{axis}[
% view={0}{180},
width=5cm,
matrix plot,
colormap/hot,
colorbar,
]
\end{axis}
\end{tikzpicture}
\end{document}


1. reproduce the imagesc plot with the correct dimensions as in the Matlab plot (location 1 should start from top)?
2. derive a colormap similar to the one obtained by matlab?

Thank you very much!

## closed as unclear what you're asking by Stefan Pinnow, Troy, TeXnician, CarLaTeX, user36296May 29 '17 at 13:11

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• you could try the viridis colormap. It should be better than the matlab colormap (in my opinion): tex.stackexchange.com/a/254518/44467 – Faekynn Feb 19 '17 at 12:28
• For the location axis starting from top: try the axis option y dir = reverse – Faekynn Feb 19 '17 at 12:29
• Welcome to TeX.SX. I think the main problem is, that you most probably have saved your data in a wrong manner. If you fix that, than you should already have what you want (except the colormap). But please note, that you can achieve this in a much simpler manner using matrix plot. Please have a look at my answer in the link to the question you provided. – Stefan Pinnow Feb 19 '17 at 12:44
• To the colormap: Either you use the viridis colormap as suggested by Faekynn which in the meantime is already incorporated into PGFPlots, so it does not have to be defined any more (as you can also see in "my" answer or you can define the parula (Matlab) colormap which is also explained in Faekynn's link a bit more up by Jake. – Stefan Pinnow Feb 19 '17 at 12:47
• Did the comments help you to solve the problem or do you need further assistance? – Stefan Pinnow Mar 5 '17 at 16:31