1
$\begingroup$

I am trying to use VectorPlot to produce a 1 dimensional vector plot. I Have tried using VectorPoints->{10,1} but it produces an error as it wants at least 2 in each direction. Is there a way to make such a plot? For example:

d = 3;
n = 3;
k = 1;
c = Sqrt[(d-2)/(k(n-2))];
Show[
  VectorPlot[{-(d-2)+(n-2) k x^2, 0}, {x,0,3}, {y,-0.1,0.1}, VectorPoints -> {20, 3}, AspectRatio -> 1/5, ImageSize -> Large, StreamPoints -> 20], 
  Graphics[{Red, Line[{{c,-1}, {c, 1}}]}]
]

But I only want a single line of vectors, and I'd like to clear up the StreamPoints to look nicer somehow. Perhaps it would be nice if the vectors were on one line and the stream lines below or something like that. I'm open to suggestions.

enter image description here

$\endgroup$
  • 2
    $\begingroup$ What is a 1D vector plot? Can you point to one on the web? $\endgroup$ – David G. Stork Mar 15 at 21:47
  • $\begingroup$ @DavidG.Stork I added an example $\endgroup$ – Kai Mar 15 at 21:56
2
$\begingroup$

Specify the actual points instead of how many:

Block[{d = 3, n = 3, k = 1, c},
 c = Sqrt[(d - 2)/(k (n - 2))];

 Show[
  VectorPlot[{-(d - 2) + (n - 2) k x^2, 0}, {x, 0, 3}, {y, -0.1, 
    0.1},
   VectorPoints -> Table[{x, 0}, {x, 0, 3, 3./12}], 
   AspectRatio -> 1/5, ImageSize -> Large], 
  Graphics[{Red, Line[{{c, -1}, {c, 1}}]}]]
 ]

enter image description here

$\endgroup$
  • $\begingroup$ Perfect! Thanks a bunch $\endgroup$ – Kai Mar 15 at 22:31
0
$\begingroup$
    Graphics[Table[
      Arrow[{{i, 0}, {i, 0} + {RandomReal[], 0}}], 
    {i, 1, 10, .5}]]

or for greater visibility:

Graphics[Table[{Hue[RandomReal[]], 
   Arrow[{{i, 0}, {i, 0} + {3 RandomReal[], 0}}]}, 
{i, 1, 20, 2}]]
$\endgroup$

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.