2
$\begingroup$

I'm trying to create a manipulate controller to set four value. High and low temperature for both test and use conditions. The four values then go into a calculation.

I can set these as four individual sliders - which takes quite a bit of room.

I did find this code


    Manipulate[
Column[{Dynamic@
Grid@Map[Pane[#, {60, 12}] &, 
  Transpose@points, {2}]}], {{points, ({#, 0} &) /@ 
Round[RandomReal[{-2, 2}, {4}], .001]}, 
LocatorPane[Dynamic[points, (points = {#, 0} & /@ First /@ #) &], 
Graphics[{}, PlotRange -> {{-2, 2}, {-.1, .1}}, Axes -> True, 
 ImageSize -> 300, Ticks -> {Automatic, None}], 
Appearance -> 
 Graphics[{EdgeForm[Gray], LightGray, Disk[]}, 
  ImageSize -> 10]] &}]

at

Manipulating several values from the same interval

So, my question is on labeling each of the points so they are unique to each of the four temperature values?

I'd also like to pre assign values and keep the values created for use in calculations later in the manipulate.... is this possible?

I think I need to get rid of the Random assignment of the five point, change it to four specific points, and that is where I get los on how to assign the results of someone moving the points to a variable.

Guess two or three questions here.

$\endgroup$
3
  • $\begingroup$ Like this one? reference.wolfram.com/language/ref/IntervalSlider.html If you look at Custom Control Appearances on this page it'll help you implement new controls. $\endgroup$
    – Szabolcs
    Feb 23, 2014 at 4:59
  • $\begingroup$ @Fred You've been a member of this site for a year now, and posted 8 questions. But you accepted only one answer and also voted only once. That perhaps shows that your experience hasn't been good so far. Care to comment why? $\endgroup$ Feb 23, 2014 at 18:06
  • 1
    $\begingroup$ Hi Belisarius,Mostly just struggling to learn MMA - and get a few projects accomplished. I should pay more attention to the procedures here as the site has been very helpful and supportive. For example, not even sure how to add a line break to a comment here --- I do appreciate your support and if voting or accepting answers helps others know they are on the right track - I'll pay more attention in the future. First though I need to learn more about this valuable forum. Cheers, Fred $\endgroup$ Feb 25, 2014 at 8:09

1 Answer 1

3
$\begingroup$

You could label the points:

Manipulate[
 Column[{Dynamic@
    Grid@Map[Pane[#, {60, 20}] &, 
      Transpose@points, {2}]}], {{points, ({#, 0.1} &) /@ {-1, -1.5, 1.5, 1}},
  LocatorPane[
    Dynamic[points, (points = {#, 0.1} & /@ First /@ #) &], 
    Graphics[{}, PlotRange -> {{-2, 2}, {-.5, .5}}, 
     AxesOrigin -> {0, 0}, Axes -> True, ImageSize -> 300, Ticks -> {Automatic, None}], 
    Appearance -> (Labeled[
         Graphics[{EdgeForm[Gray], LightGray, Disk[]}, 
          ImageSize -> 10], #, Top] & /@ {uh, ul, th, tl})] &}]

Mathematica graphics

$\endgroup$
5
  • $\begingroup$ Nice implementation +1. I was wondering if it is possible to restrict the high bound not to be left of the lower bound (maybe carrying them as they move ...) and the reverse (lower to upper) $\endgroup$
    – tchronis
    Feb 23, 2014 at 8:19
  • $\begingroup$ That's a great idea - in my application that should be the case anyway - it would provide an error proof in the document. I would also like to use the point to do a calculation. So would I replace the -1, -1.5, 1.5, 1 in the Grid@Map[... with variables that I then can use later in a calculation? $\endgroup$ Feb 23, 2014 at 17:19
  • $\begingroup$ @tchronis 1) Its nice, but not mine. I borrowed most of the code from the docs :) 2) To impose individual restrictions on the bounds it's better to define four independent locators instead of an array $\endgroup$ Feb 23, 2014 at 18:00
  • $\begingroup$ @FredSchenkelberg You asked "I'd also like to pre assign values and keep the values created for use in calculations later in the manipulate.... is this possible?" Your above comment requires now a different thing, and I think it has been asked before. Search the site $\endgroup$ Feb 23, 2014 at 18:03
  • $\begingroup$ @belisarius - thanks, I've been looking and it's the code within the Grid and LocatorPane lines that I'm not at all familiar with thus not sure how to edit. I have found ways to define variable with preset values within the controller or slider - not within the above array -- that part has me stumped. $\endgroup$ Feb 23, 2014 at 18:44

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.