I think what you are looking for is the PixelConstrained
option of ArrayPlot
, or understanding of its mechanism using Raster
and Offset
. With the default settings you will need Frame -> False
to show all values (the frame overlaps the outer pixels).
data = CellularAutomaton[{1635, {3, 1}}, {{1}, 0}, 80];
ArrayPlot[data,
ColorRules -> {0 -> Black, 1 -> Yellow, 2 -> Orange},
PixelConstrained -> 2,
Frame -> False
]

This makes every point on the plot a 2px by 2px square.
For full control this can be done manually with Raster
and Offset
:
data /. {0 -> {0, 0, 0}, 1 -> {1, 1, 0}, 2 -> {1, 0.5, 0}};
Graphics[Raster[Reverse @ %, {{0, 0}, Offset[{322, 162}, {0, 0}]}],
ImageSize -> {322, 162}, PlotRange -> {{0, 322}, {0, 162}}, Frame -> False,
FrameTicks -> None]
With either method you will find that adding frame ticks causes clipping as the ImageSize
does not account for the label area. A solution is to specify the ImagePadding
manually and include it in the ImageSize
.
myPlot[data_, scale_Integer, pad_Integer:0, opts : OptionsPattern[]] :=
With[{size = scale {#2, #} & @@ Dimensions@data},
Graphics[Raster[Reverse @ data, {{0, 0}, Offset[size, {0, 0}]}],
ImageSize -> 2 + pad + size,
PlotRange -> {{0, size[[1]]}, {0, size[[2]]}}, opts,
ImagePadding -> {{pad, 1}, {pad, 1}},
PlotRangeClipping -> True, Frame -> True,
FrameTicks -> None
]
]
data /. {0 -> {0, 0, 0}, 1 -> {1, 1, 0}, 2 -> {1, 0.5, 0}};
myPlot[%, 2, 25, FrameTicks -> True]

...
does not) ... $\endgroup$ – Yves Klett Jul 8 '13 at 6:22Image
from the data and export that instead.Image
exports at 1-to-1 pixel size. $\endgroup$ – Szabolcs Jul 8 '13 at 6:29PixelConstrained -> {1, 1}
. $\endgroup$ – Oleksandr R. Jul 8 '13 at 10:18