0
$\begingroup$

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?

$\endgroup$
1
  • 1
    $\begingroup$ 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? $\endgroup$
    – Kuba
    Apr 26, 2014 at 13:38

1 Answer 1

4
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ 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 $\endgroup$
    – arax
    Apr 27, 2014 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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