6
$\begingroup$

I am trying to plot a vector field using the function StreamPlot:

StreamPlot[{0, rho (1 - rho) - j}, {j, 0, 1/3}, {rho, 0, 1},
 Frame -> None, StreamPoints -> 100, StreamScale -> {0.3},
 StreamStyle -> Green, StreamMarkers -> "PinDart"]

Mathematica graphics

This vector field is essentially made of vertical lines. My problem is that Mathematica only seems to draw parts of these lines, while I would like them to be continuous and span the entire range on the vertical axis.

I have tried to use several graphical options for this command, but nothing seems to work. Any idea?

$\endgroup$
6
  • $\begingroup$ Are you certain they are straight vertical lines? Some of the vectors are {0,0} so they will not be drawn. Have a look at ContourPlot[rho (1 - rho) - j, {j, 0, 1/3}, {rho, 0, 1}] to see that the varying values in the vertical plane. $\endgroup$
    – Edmund
    Mar 23, 2020 at 11:11
  • $\begingroup$ I'm voting to close this question as off-topic because zero length vectors are not drawn on StreamPlot. $\endgroup$
    – Edmund
    Mar 23, 2020 at 11:13
  • $\begingroup$ tried StreamScale -> Full? $\endgroup$
    – kglr
    Mar 23, 2020 at 11:14
  • $\begingroup$ I am aware that there are points where the flow is (0,0), and I do not expect Mathematica to produce a plot for them (I apologize if this was not clear before). What I would expect is for the lines to be defined above/below these points, instead of on one side only. I have tried StreamScale->Full, but it does not work :/ $\endgroup$
    – annuk89
    Mar 23, 2020 at 11:20
  • $\begingroup$ Show an image of what you get. I get stream lines throughout the plotting domain: i.stack.imgur.com/wJWnQ.png $\endgroup$
    – Michael E2
    Mar 23, 2020 at 11:40

1 Answer 1

5
$\begingroup$

Define explicit starting points for streamlines.

pts = Flatten[Table[{{j, 1/2}, {j, 0}, {j, 1}}, {j, 0, 1/3, 1/30}], 1];

sp = StreamPlot[{0, rho (1 - rho) - j}, {j, 0, 1/3}, {rho, 0, 1}, 
       StreamPoints -> pts, StreamScale -> {0.3}, StreamStyle -> Green];

cp = ContourPlot[0 == rho (1 - rho) - j, {j, 0, 1/3}, {rho, 0, 1}];

Show[cp, sp]

enter image description here

$\endgroup$
1
  • $\begingroup$ This is exactly what I meant, thank you! :) $\endgroup$
    – annuk89
    Mar 23, 2020 at 13:08

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.