12
$\begingroup$

In version 9 I could do the following with the output as shown.

ListPlot[Table[{x, x^2}, {x, 0, 1, 0.1}], PlotRange -> All, 
Filling -> Axis, FillingStyle -> (Arrow[#] &)]

Mathematica graphics

Now in version 10.0.2 with the same input I get the following.

Mathematica graphics

How do I get my arrows back? PlotTheme Classic does not help. Thanks

$\endgroup$
  • 5
    $\begingroup$ plot /. Line -> Arrow can be a quick fix. $\endgroup$ – Kuba Jan 18 '15 at 17:58
  • 2
    $\begingroup$ Another quick fix is PlotMarkers -> "\[FilledUpTriangle]" $\endgroup$ – ybeltukov Jan 18 '15 at 18:04
  • 1
    $\begingroup$ @ybeltukov Not exactly the same but very clever! $\endgroup$ – Mr.Wizard Jan 18 '15 at 18:06
10
$\begingroup$

It seems this form still works:

ListPlot[
  Table[{x, x^2}, {x, 0, 1, 0.1}],
  PlotRange -> All, 
  Filling -> {1 -> {Axis, Arrow[#] &}}
]

enter image description here


Caveat

The use of a Function as a filling style seemed undocumented, therefore one cannot expect the feature to remain or remain unchanged in new versions of Mathematica. ybeltukov notes in a comment that the form above does not work with multiple plot sets. In light of this I suppose that it would be better to write our own plotting function using Graphics primitives if this kind of customization is needed, since that functionality is documented and hopefully will not incompatibly change in future releases. (This is often faster as well as it avoids a lot of overhead associated with generalized plotting.) Post-processing is quick but also easily breaks between versions as the plotting output format often changes.

$\endgroup$
  • 1
    $\begingroup$ How to do the same thing for several lists of points? Even {1 -> {Axis, Arrow[#] &}, 2 -> {Axis, Arrow[#] &}} produces a strange error Filling::invfillentry: "{2->{Axis,Arrow[#1]&},2->{Axis,Arrow[#1]&}} is not a valid Filling specification. " $\endgroup$ – ybeltukov Jan 18 '15 at 18:35
  • $\begingroup$ @ybeltukov Problem noted in the answer, along with my thoughts. $\endgroup$ – Mr.Wizard Jan 18 '15 at 18:44
  • $\begingroup$ @Mr.Wizard Many thanks for your answer which I have now accepted. Also your comment. Probably a Graphics construct is best as you suggest. $\endgroup$ – Hugh Jan 19 '15 at 22:01

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.