Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to draw a graphic $20\times20$ grid, rotate it by $\theta$ around $(0,0)$, and trim off the part on the right of the y-axis, so I came up with

ImageTrim[Rotate[GraphicsGrid[Table["", {20}, {20}], Frame -> All], Dynamic[\[Theta]], {0, 0}], {-1000, -1000}, {0, 1000}];

But it gives no output, but an error message instead

ImageTrim::imginv: Expecting an image or graphics instead of [an oblique orange square wich usually indicates something's wrong]

What should I do?

share|improve this question
May I ask what is the goal at the end, I feel like your approach is not an effective one. p.s. What is that you don't understand from the error message? –  Kuba Apr 26 '14 at 13:38

1 Answer 1

Maybe you will find this useful:

grid = Translate[ First@ArrayPlot[SparseArray[{}, {20, 20}], Mesh -> All],
                  {-10, -10}];

Slider[Dynamic@θ, {0, 2 Pi}]
Graphics[ Dynamic@Rotate[grid, θ, {0, 0}], PlotRange -> {{0, Automatic}, All}]

enter image description here

share|improve this answer
Thanks! But PlotRange isn't quite what I'm looking for, because I need to juxtapose two such grids in one Graphics, one on the right of the y-axis, and one on the left. Besides, I don't know why Mathematica says the return of Rotate is not Graphics –  Alex Su Apr 27 '14 at 4:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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