0
$\begingroup$

I am having some difficulty in resizing a Stream Plot when using locators: Whenever I try to resize the Stream Plot, one of the locators instead moves to the cursor.

Manipulate[{StreamPlot[{(
 q1 (x - p[[1]]))/((x - p[[1]])^2 + (y - p[[2]])^2)^(3/2) + (
 q2 (x - q[[1]]))/((x - q[[1]])^2 + (y - q[[2]])^2)^(3/2), (
 q1 (y - p[[2]]))/((x - p[[1]])^2 + (y - p[[2]])^2)^(3/2) + (
 q2 (y - q[[2]]))/((x - q[[1]])^2 + (y - q[[2]])^2)^(3/2)}, {x, 0,
 10}, {y, 0, 10}, PlotRange -> {0, 10}]},
 {{p, {1, 1}}, Locator}, {{q, {1, 1}}, Locator}, {q1, -4, 4}, {q2, -4,4}]

How can I rectify this behaviour?

$\endgroup$
2
  • $\begingroup$ resize? why not add an manipulator about ImageSize $\endgroup$ May 30, 2013 at 13:54
  • $\begingroup$ that's what locators do -- they go to the cursor. Just add ImageSize->500 (or whatever size you want) or control the size with a slider if you want it dynamic. I would also remove the brackets around the StreamPlot -- no need for them in the plot. $\endgroup$
    – bill s
    May 30, 2013 at 14:25

1 Answer 1

1
$\begingroup$

Here's one way:

Manipulate[
   StreamPlot[{(q1 (x - p[[1]]))/((x - p[[1]])^2 + 
     (y - p[[2]])^2)^(3/2) + (q2 (x - q[[1]]))/((x - q[[1]])^2 + 
     (y - q[[2]])^2)^(3/2), (q1 (y - p[[2]]))/((x - p[[1]])^2 + 
     (y - p[[2]])^2)^(3/2) + (q2 (y - q[[2]]))/((x - q[[1]])^2 + 
     (y - q[[2]])^2)^(3/2)}, {x, 0, 10}, {y, 0, 10}, PlotRange -> {0, 10}, 
     ImageSize -> siz], {{p, {1, 1}}, Locator}, {{q, {1, 1}}, Locator}, 
          {q1, -4, 4}, {q2, -4, 4}, {siz, 100, 600}]
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.