Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
resize? why not add an manipulator about ImageSize –  HyperGroups May 30 '13 at 13:54
    
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. –  bill s May 30 '13 at 14:25
add comment

1 Answer

up vote 1 down vote accepted

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}]
share|improve this answer
    
Thanks, that solved it. –  Ambar May 31 '13 at 5:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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