1
$\begingroup$

I would like to create a Graphics similar to the top one here: enter image description here

, but I can obtain only the bottom one.

I use this:

Graphics[{
      {Arrow[{{0,-4},{0,5}}]},
      {Red,Thickness[0.03],Arrow[{{0,1},{0,4}}]},
      {Blue,Thickness[0.03],Arrow[{{0,0},{0,-3.5}}]},
      {EdgeForm[Directive[Thick]],White,Rectangle[{-1,-1},{1,1}]}
      }]

How can I show the blue line inside the rectangle?

How can I make bigger the top of the arrow?

$\endgroup$

2 Answers 2

3
$\begingroup$

Change White to:

   FaceForm[None]
$\endgroup$
2
  • $\begingroup$ That works. Can I do something for the thickness of the extreme of the arrow? $\endgroup$
    – Ale1794
    Commented Jun 8, 2017 at 16:36
  • $\begingroup$ Use: Arrowheads[.1] $\endgroup$ Commented Jun 8, 2017 at 16:44
4
$\begingroup$

Since the graphics primitives are layered in the order they appear, an alternative approach is to have the Rectangle before the Arrow primitives. This can be done by using RotateRight on the list of graphics primitives:

graphics = Graphics[{{Arrow[{{0, -4}, {0, 5}}]}, 
    {Red, Thickness[0.03], Arrow[{{0, 1}, {0, 4}}]},
    {Blue, Thickness[0.03], Arrow[{{0, 0}, {0, -3.5}}]}, 
    {EdgeForm[Directive[Thick]], White, Rectangle[{-1, -1}, {1, 1}]}}];

MapAt[{Arrowheads[.2], RotateRight@#} &, graphics, {1}]

Mathematica graphics

$\endgroup$

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