4

If I ArrayPlot an {1200,1600} matrix, the result is a plot with ImageDimensions of {360,273} pixels:

ArrayPlot[RandomReal[{0, 1}, {1200, 1600}]];
ImageDimensions[%]

{360, 273}

I can't find an scaling option. How can I get a plot with a resolution of {1200,1600}?

sebhofer
  • 2,741
  • 18
  • 25
ErikP
  • 411
  • 3
  • 6
  • ImageDimensions returns the number of displayed pixels not the number of blocks used by ArrayPlot – sebhofer Jul 19 '13 at 09:07
  • But I would like to get an image of the same dimensions as the original matrix. How can I get that? – ErikP Jul 19 '13 at 09:16
  • 1
    This should work ArrayPlot[RandomReal[1,{100,100}],PixelConstrained->True,ImageSize->{100,100}] – sebhofer Jul 19 '13 at 09:25

1 Answers1

5

You're looking for PixelConstrained -> 1:

ArrayPlot[RandomReal[{0, 1}, {500, 500}],
 Frame -> False, PixelConstrained -> 1]

You should know that when it says it's pixel-constrained, it really means it. You can't resize the output pattern because it's being matched pixel-by-pixel to the physical pixels of your monitor. This may sound like a good thing but some patterns can appear too "harsh" because of this.

And remember that you always have the option of using Image:

Image[RandomReal[{0, 1}, {500, 500}]]
amr
  • 5,487
  • 1
  • 22
  • 32