Possible Duplicate:
Using pgfplots, how do I arrange my data matrix for a surface plot so that each cell in the matrix is plotted as a square?

I'm trying to use pgfplots to visualise a matrix using \addplot3[surf] and view={0}{90}. However, pgfplots colours each segment based on the value at the vertices, so that input coordinates in a 3x3-matrix result in only 2*2=4 coloured segments:

    colorbar right]
\addplot3[surf] coordinates {
    (0,0,0) (0,1,1) (0,2,2)

    (1,0,1) (1,1,2) (1,2,4)

    (2,0,2) (2,1,4) (2,2,8)

This results in:

Illustration of unwanted behaviour

Is there a way to specify the colours of the segments directly for an image-view of a matrix?

  • I already wrote the question, then discovered it's a duplicate, however, having a duplicate question may make it easier for others to find it.
    – gerrit
    Oct 22, 2012 at 13:52


Browse other questions tagged .