11
$\begingroup$

This really should not be hard:

StreamPlot[{1, 1}, {x, 0, 1}, {y, 0, 1}, StreamStyle -> {Arrowheads[.02], Darker[Pink]}] 

But this is the mess Mathematica turns this into:

enter image description here

The distribution is quasi-random, and there seem to be a number of wrong arrowheads thrown in randomly, too. I would classify this as a bug (or several of them). Are there decent work-arounds? I found that providing sets of StreamPoints also does not work as expected:

StreamPlot[{1, 1}, {x, 0, 1}, {y, 0, 1}, StreamStyle -> {Arrowheads[.02], Darker[Pink]}, StreamPoints -> {{{0.01, 0}, {0.01, 0.1}, {0.01, 0.2}, {0.01, 0.3}, {0.01, 0.4}}}] 

enter image description here

We still get incorrect arrows, and the streamlines inexplicably stop after a short distance.

$\endgroup$
15
  • 1
    $\begingroup$ I would expect to see some nice equidistant lines at a 45-degree angle. For the second example, I would expect to see those streamlines continue to the bounds of the plot area. This is how it worked in version 12 and earlier. $\endgroup$ Commented Jan 19, 2022 at 22:51
  • 1
    $\begingroup$ Version 12 undoubtedly handled this much more elegantly, along the lines of what @Pirx mentioned. Not to mention the fact that the color in the style directive seems to be ignored altogether in the later version, whereas it worked in v 12. $\endgroup$ Commented Jan 19, 2022 at 22:57
  • 1
    $\begingroup$ StreamColorFunction -> None, StreamStyle -> {Automatic, Darker[Pink]} $\endgroup$ Commented Jan 19, 2022 at 23:05
  • 2
    $\begingroup$ The problem is absent in version 8.0.4 (screenshot). So it is a regression bug. $\endgroup$ Commented Jan 20, 2022 at 13:53
  • 2
    $\begingroup$ On V13.0: Seems to have to do with a constant vector field. Adding some not-too-small noise helps: {1 + 0.005 Cos[100 x y], 1 + 0.005 Sin[100 x y]}. Adding lots of points helps a bit, too: StreamPlot[{1, 1}, {x, 0, 1}, {y, 0, 1}, StreamPoints -> {MeshCoordinates@DiscretizeRegion[Rectangle[], MaxCellMeasure -> 0.001]}, StreamColorFunction -> None, StreamStyle -> {Arrowheads[.02], Darker[Pink]}] $\endgroup$ Commented Jan 20, 2022 at 23:47

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.