How can I plot a matrix of real values with TikZ/PGF such that it looks like plotted with imshow in MATLAB?
\addplot3 does something similar, but I'd like to have that in a color-coded 2D plot.
|
|
|
The following does the job very well:
|
|||
|
|
|
There's a problem with @Christian's first answer: It does not work for data matrices. In that case, the values get mapped at the corners of each squares, and the colors are some interpolation between adjacent data values, not the values themselves. I found the following solution. It's not completely satisfactory since the size of the marks does not adapt to the size of the picture, but it's a start. You can also have empty values, as shown in the example.
|
||||
|
|
|
I hacked a solution by my own, using a scatter plot. The key here is to adjust x and y, and the mark size to the right values.
|
|||||
|