2
$\begingroup$

In a previous version of Mathematica (maybe version 7), it was possible to use GeometricTransformation on an ArrayPlot. That doesn't seem to work anymore.

Rotate[ArrayPlot[img], Pi/4] works, but I want to be able to apply a more general transformation to the image. And, also I need to be able to combine that transformed image with other things that I want to draw on the plane. Right now, Rotate[ArrayPlot won't combine with other things like Plot[Sin[x],{x,0,2}] via Show.

What I'd like to do is to display a rasterized image (say a PNG) on a coordinate grid and to be able to apply various transformations on that image in the style of GeometricTransformation. I'm not wedded to using ArrayPlot--that was just what I used in my notebook from 11 years ago!

Any suggestions for accomplishing this in a more recent version of Mathematica?

$\endgroup$
2
  • 1
    $\begingroup$ Internally, ArrayPlot[] produces a Raster[] object, so you could extract that and apply your transformations to it: With[{ras = Cases[ArrayPlot[RandomReal[1, {5, 5}], ColorFunction -> Hue], _Raster, Infinity]}, Graphics[{Directive[FaceForm[], EdgeForm[Thick]], Rotate[{ras, Rectangle[{0, 0}, {5, 5}]}, Pi/3]}]]. If this does not suit your needs, edit your question to explain why. $\endgroup$ – J. M.'s torpor Mar 1 at 5:25
  • $\begingroup$ That's perfect. Thank you! That tip that Raster was the graphics primitive that would work with GeometricTransformation was perfect. $\endgroup$ – D Yong Mar 1 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.