I'd like to create a blank Graphics object of a certain size with a certain coordinate system (PlotRange) and subsequently draw stuff to it with respect to the already-established coordinate system. However, I'm finding out that subsequent objects ignore the existing coordinate system. FOr instance:

g = Graphics[PlotRange -> {{0, 4.6}, {0, 2}}, ImageSize -> {460, 200},
Background -> LightGray];
g = Show[g, Graphics[{Thickness[0.01], Line[{{0, 0}, {1, 1}}]}]]

I would expect the line from the second line to start at the bottom left. Instead, the entire Graphics object is centered.


This works. Just add {} to the first g



Mathematica graphics

  • $\begingroup$ Super! Can you give us some insight into what makes it work? $\endgroup$ – Wynne Feb 18 '18 at 3:53
  • $\begingroup$ @Wynne it was just a guess, that it the first g needed "something" in there to set. Even if that something was just the empty list. Show also takes options from the first argument. So I just tried {} to make it happy and it worked. This might be documented somewhere, I have no idea. $\endgroup$ – Nasser Feb 18 '18 at 3:59

Your Answer

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

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