I have implemented a numeric Laplace Solver in C++ and am trying to graphically represent the validity of my method. I have outputted the grid from C++ and imported it into Mathematica to get the following MatrixPlot:

Matrix Plot

And I wish to compare this directly to:

Density Plot

However; I am not sure how I can rearrange the axes. I wish for the MatrixPlot axes to be {0.0,0.2,0.4,0.8,1.0} like the contour plot (however, I cannot just use FrameTick as I wish to do larger matrices ($20\times 20$, $100\times 100$ and $1000\times 1000$, where it would be impractical to write each tick out by hand), and I also wish for the plot to be reoriented so it has the same orientation as the contour plot. How can I achieve this?

  • $\begingroup$ @Karsten7. But then Mathematica interpolates over the points for me (which I don't want) and it still has axes going up to 7 instead of 1? $\endgroup$ Commented Dec 28, 2014 at 19:15
  • $\begingroup$ @Karsten7. Thank you, that's useful; but how do I rescale the axes now? $\endgroup$ Commented Dec 28, 2014 at 19:21
  • $\begingroup$ @Karsten7. Thank you so much, you've saved me a lot of time!! $\endgroup$ Commented Dec 28, 2014 at 19:23

1 Answer 1


Some data

m = Table[i*j, {i, 7}, {j, 7}];




and a ListDensityPlot of the same data, without interpolation and rescaled axes:

ListDensityPlot[m, DataRange -> {{0, 1}, {0, 1}}, InterpolationOrder -> 0]



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.