Message Boards Message Boards

0
|
1158 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Adding arrowheads at both ends of the axes in a 2D plot

Posted 10 months ago

Is there a way in Mathematica to add arrowheads at both ends of the axes in a 2D plot? In the following code snippet I have customized the appearance of arrowheads (function k) but can't work out how to get the arrowheads at both ends of each axis.

k = Graphics[Line[{{-1/4, 1/4}, {0, 0}, {-1/4, -1/4}}]];
Plot[Sin[x], {x, -10, 10},
 AxesLabel -> {x, y},
 PlotRange -> {-11, 11},
 LabelStyle -> 
  Directive[Black, 14, Italic, FontFamily -> "Times New Roman"],
 TicksStyle -> Directive[Black, Plain, 10],
 AxesStyle -> Arrowheads[{{Automatic, Automatic, k}}],
 ]

Any help would be much appreciated. Geoffrey

POSTED BY: Geoffrey Marnell
2 Replies

You can try something like this:

k = Graphics[Line[{{-1/4, 1/4}, {0, 0}, {-1/4, -1/4}}]];
Plot[Sin[x], {x, -10, 10},
 AxesLabel -> {x, y}, PlotRange -> {-11, 11},
 LabelStyle -> Directive[Black, 14, Italic,
   FontFamily -> "Times New Roman"],
 TicksStyle -> Directive[Black, Plain, 10],
 AxesStyle -> Arrowheads[{{Automatic, 0,
     Graphics[Line[-{{-1/4, 1/4}, {0, 0}, {-1/4, -1/4}}]]},
    {Automatic, Automatic, k}}]]
POSTED BY: Gianluca Gorni

Thank you. That's perfect.

POSTED BY: Geoffrey Marnell
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract