2
$\begingroup$

Considering LocatorPane:

LocatorPane[pts,back,{{xmin,ymin},{xmax,ymax},{dx,dy}}]

Is there any way to specify only the jumps dx and dy in LocatorPane and keep the x any y ranges automatic? If that cannot be then is there any way to specify the x range and dx jump only? I tried something like this but it doesn't work:

LocatorPane[{1, 1}/2, 
 Plot[Sin[x], {x, 0, 10}, 
  ImageSize -> 400], {{0, Automatic}, {10, Automatic}, {1,Automatic}}]
$\endgroup$

2 Answers 2

1
$\begingroup$
DynamicModule[{pt = {1, 1}/2}, 
 LocatorPane[Dynamic[pt, pt = Round[#, 1]; &],
  Plot[Sin[x], {x, 0, 10}, ImageSize -> 400]]]
$\endgroup$
1
  • $\begingroup$ Solves my problem. Thanks $\endgroup$ Nov 26, 2015 at 18:52
2
$\begingroup$
p = Plot[Sin[x], {x, 0, 10}, ImageSize -> 400];
{dx, dy} = {1, 1};
loc = Append[Transpose[PlotRange /. AbsoluteOptions[p, PlotRange]], {dx, dy}]; 
LocatorPane[{1, 1}/2, p, loc]
$\endgroup$
3
  • $\begingroup$ +1, Thanks but the back is little complicated that finding the range using AbsoluteOptions $\endgroup$ Nov 26, 2015 at 18:15
  • $\begingroup$ @Algohi I don't get you ... $\endgroup$ Nov 26, 2015 at 18:19
  • $\begingroup$ I have a complex dynamic interaction code contains several nested DynamicModules and the result is a dynamic interaction Plot. finding range using AbsoluteOptions means running the code (in best cases) twice to get the range which means time consuming. Any way thanks. $\endgroup$ Nov 26, 2015 at 18:25

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.