2
$\begingroup$

This application works great.

The thing is, the associations:

{{xAxis, 6}, {4, 5, 6, 7, 8}}, {{yAxis, 7}, {5, 6, 7, 8}},

while functional, are not very intuitive.

How can I replace xAxis and yAxis number values with their associated names,

{4 -> "BVColorIndex", 5 -> "Temperature", 6 -> "Mass", 7 -> "Luminosity", 8 -> "AbsoluteMagnitude"}

and still have numerical values on their assignments

With[{c1 = xAxis, c2 = yAxis, tooltip1 = tooltip},

Thanks!

Manipulate[
 plotType[
  With[{c1 = xAxis, c2 = yAxis, tooltip1 = tooltip},
    Tooltip[{Slot[c1], Slot[c2]}, {Slot[tooltip1], Slot[c1], 
       Slot[c2]}] &] @@@ category,
  PlotRange -> Automatic, ImageSize -> 800, 
  AxesLabel -> {xLabel, yLabel},
  PlotStyle -> Red],
 {{xAxis, 6}, {4, 5, 6, 7, 8}}, {{yAxis, 7}, {5, 6, 7, 8}},
 {{tooltip, 3}, {1, 3}},
 {{xLabel, "Mass"}, {"BVColorIndex", "Temperature", "Mass", "Luminosity",
    "AbsoluteMagnitude"}},
 {{yLabel, "Luminosity"}, {"BVColorIndex", "Temperature", "Mass", 
   "Luminosity", "AbsoluteMagnitude"}},
 {{plotType, ListLogLogPlot }, {ListPlot, ListLogPlot, 
   ListLogLogPlot}},
 {{category, importSubgiant }, {
   importClassAStar -> "ClassA",
   importClassBStar -> "ClassB",
   importClassFStar -> "ClassF",
   importClassGStar -> "ClassG",
   importClassMStar -> "ClassM",
   importClassOStar -> "ClassO",
   importSubgiant -> "Subgiant",
   importNormalGiant -> "NormalGiant",
   importSupergiant -> "Supergiant",
   importVariableStar -> "VariableStar",
   importTableStar -> "TableStar",
   unionByClass -> "UnionByClass",
   unionGiants -> "UnionGiants",
   unionAll -> "UnionAll"
   }}]
ListPicker[Dynamic[a],
  {
   importClassAStar -> "ClassA",
   importClassBStar -> "ClassB",
   importClassFStar -> "ClassF",
   importClassGStar -> "ClassG",
   importClassMStar -> "ClassM",
   importClassOStar -> "ClassO",
   importSubgiant -> "Subgiant",
   importNormalGiant -> "NormalGiant",
   importSupergiant -> "Supergiant",
   importVariableStar -> "VariableStar",
   importTableStar -> "TableStar",
   unionByClass -> "UnionByClass",
   unionGiants -> "UnionGiants",
   unionAll -> "UnionAll"
   }
  ] ;

(* 
Association[{4\[Rule]"BVColorIndex",5\[Rule]"Temperature",6\[Rule]\
"Mass",7\[Rule]"Luminosity",8\[Rule]"AbsoluteMagnitude"}]
*)
$\endgroup$
  • 1
    $\begingroup$ Great way to use the AstronomicalData! But I don't think it really belongs here - this is specifically for questions and answers. You should definitely post this over on community.wolfram.com though $\endgroup$ – Jason B. Jul 8 '16 at 19:48
  • $\begingroup$ As JasonB said, this website is for questions and answers only. As written, this post won't be accepted. However (personally) I do wish that you keep it: just put it in a Q/A format. Ask an appropriate question, and post the code as the answer to it (answer your own question). $\endgroup$ – Szabolcs Jul 8 '16 at 19:53
  • $\begingroup$ New to this forum. Wasn't sure. Trying to reach others with similar questions on using Mathematica curated Astronomy data. Could always delete it, if not appropriate. $\endgroup$ – Joseph Karpinski Jul 8 '16 at 19:54
  • $\begingroup$ Submit it to the Wolfram Demonstrations Project, would be a nice addition there. $\endgroup$ – ciao Jul 8 '16 at 19:58
  • 2
    $\begingroup$ This is not a forum. It is a questions/answers site. Unlike on forums, discussions are not appropriate here. That doesn't mean that the people who come here don't like to look at cool stuff, it's just that not everything fits this format. I would recommend converting your post to a Q/A format instead of deleting it: ask about how to plot a certain thing and post your own answer to your own question. $\endgroup$ – Szabolcs Jul 8 '16 at 19:59
2
$\begingroup$

Wow was that simple.

{{xAxis, 6}, {4 -> "BVColorIndex", 5 -> "Temperature", 6 -> "Mass", 
  7 -> "Luminosity", 8 -> "AbsoluteMagnitude"}}, 

{{yAxis, 7}, {5 -> "Temperature", 6 -> "Mass", 7 -> "Luminosity", 
  8 -> "AbsoluteMagnitude"}},

{{tooltip, 3}, {1 -> "Name", 3 -> "SpectralClass"}},
$\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.