I have a list contour plot overlay by a 15x15 mesh grid. And I want to label the axes with numbers positioned at the center of the cells instead of the grid lines.
data = {
{1, 0, 2, 3, 4, 5, 6, 6, 7, 8, 8, 8, 8, 8, 8},
{0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 9, 9, 9, 9, 8},
{0, 1, 2, 3, 4, 4, 5, 6, 6, 8, 9, 9, 9, 8, 9},
{0, 2, 3, 4, 5, 6, 6, 6, 7, 8, 8, 9, 9, 8, 8},
{0, 2, 3, 4, 5, 6, 7, 7, 8, 8, 9, 9, 9, 8, 7},
{1, 2, 2, 4, 5, 6, 6, 7, 8, 8, 8, 8, 9, 8, 8},
{1, 2, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 8, 8},
{1, 2, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 8, 8, 8},
{2, 2, 3, 3, 4, 5, 6, 7, 9, 8, 8, 8, 8, 8, 7},
{2, 2, 3, 3, 4, 5, 6, 7, 8, 8, 7, 7, 8, 7, 7},
{1, 1, 1, 2, 4, 4, 6, 7, 8, 7, 7, 6, 6, 6, 7},
{0, 1, 1, 2, 3, 4, 5, 7, 7, 7, 7, 6, 5, 5, 6},
{0, 1, 2, 3, 4, 5, 6, 7, 5, 5, 6, 6, 5, 5, 5},
{1, 2, 2, 2, 4, 4, 5, 6, 6, 4, 5, 6, 5, 5, 4},
{3, 3, 3, 3, 3, 4, 6, 6, 7, 4, 4, 5, 5, 4, 2}};
ListContourPlot[
data, ColorFunction -> ColorData[{"Warm", "Reverse"}],
ContourLabels -> None, ContourStyle -> None, InterpolationOrder -> 4,
Contours -> 10, Mesh -> 14, MeshFunctions -> {#1 &, #2 &},
MeshStyle -> Black, ScalingFunctions -> {Identity, "Reverse"},
FrameTicks -> {{Table[{-i - 0.5, i}, {i, 0, 14, 1}], None}, {None, Table[{i + 0.5, i}, {i, 0, 14, 1}]}}]
However, the frame ticks doesn't fit to the grids completely. Is there any way to fix it?
Mesh->{Range[14]-0.5,-(Range[14]+0.5)}
will line put mesh exactly on your ticks. Drop the0.5
if you want the mesh shifted a half cell relative to the ticks. $\endgroup$data
. $\endgroup$Mesh -> {Range[15] - 0.5, -(Range[15] + 0.5)}
orMesh -> {Range[15], -Range[15]}
. Are they what you're looking for? $\endgroup$Mesh->{Range[14]-0.5,-(Range[14]+0.5)}
,Mesh->{Range[14],-(Range[14])}
,Mesh->{Range[15]-0.5,-(Range[15]+0.5)}
orMesh->{Range[15],-(Range[15])}
doesn't give 15x15 equal sized cells and the ticks labeled from 1 to 15. $\endgroup$