Using AstronomicalData I could easily do something like:

superGiantMass = 
  Tooltip[{AstronomicalData[#, "BVColorIndex"], 
      AstronomicalData[#, "Mass"]/AstronomicalData["Sun", "Mass"]},
     {AstronomicalData[#, "SpectralClass"], 
      AstronomicalData[#, "Name"]}] & /@

and plot it:

ListPlot[superGiantMass, PlotRange -> All, ImageSize -> Large, 
 AxesLabel -> {"BVColorIndex", "Mass"}, PlotLabel -> "Supergiant"]

Adding multiple additional tooltip labels, of elemental values not directly in the plot, like DistanceLightYears, Luminosity, etc, and normalized units like mass/massOfSun were great.

Multiple category classes plot were easy:

(* Plot Abosolute Magnitude *)

ListPlot[{classAStarMag, classBStarMag,
   classFStarMag, classGStarMag, classKStarMag, classMStarMag, 
  classOStarMag}, PlotRange -> All, ImageSize -> Large, 
 AxesLabel -> {"BVColorIndex", "AbsoluteMagnitude"}, 
 PlotLabel -> "Absolute Magnitude", 
 PlotLegends -> {"Class A", "Class B", "Class F", "Class G", 
   "Class K", "Class M", "Class O"}]

My question is how to do similar things using the newer StarData class.

This sort of works, but nothing like the above examples:

(* Plot luminosity versus mass for nearby stars: *)

 Tooltip[{##2}, {#1, #2, #3}] & @@@ 
  StarData[EntityClass["Star", "ClassOStar"],
   {"SpectralClass", "Mass", "Luminosity"}],
 PlotRange -> Automatic, ImageSize -> Large, 
 AxesLabel -> {"Mass", "Luminosity"}]

I can't seem to add different tooltip labels like DistanceLightYears when using StarData or normalize elements like mass/sunMass.

And while I use ##2 on tooltip, I really don't understand its usage versus the set of tooltip displays when using {#1, #2, #3}.

Any help would be greatly appreciated.


  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 Jun 13 '16 at 16:34

Got a partial workaround using Show to graph categories of StarData together:

markerRed = Graphics[{Red, Disk[]}];

(* Plot luminosity versus mass for ClassOStar": *)

classOStarMassLuminosity = ListLogLogPlot[
   Tooltip[{##2}, {#1, #2, #3}] & @@@ 
     Take[StarData[EntityClass["Star", "ClassOStar"], {"Name", "Mass", 
          "Luminosity"}], 200], PlotRange -> All, ImageSize -> Large, 
  AxesLabel -> {"Mass", "Luminosity"}, PlotLegends -> {"Class O"}, 
  PlotStyle -> Blue]

(* Plot luminosity versus mass for ClassMStar": *)

classMStarMassLuminosity = ListLogLogPlot[
   Tooltip[{##2}, {#1, #2, #3}] & @@@ 
     StarData[EntityClass["Star", "ClassMStar"], {"Name", "Mass", 
         "Luminosity"}], PlotRange -> All, ImageSize -> Large, 
  AxesLabel -> {"Mass", "Luminosity"}, PlotLegends -> {"Class M"}, 
  PlotMarkers -> {markerRed, .02}]

Show[classOStarMassLuminosity, classMStarMassLuminosity]

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.