7
$\begingroup$

Assume I have the following zip code data:

SCzip = {"01029", "01029", "01029", "01230", "01262", "01453", 
  "01460", "01516", "01545", "01545", "01564", "01583", "01592", 
  "01600", "01720", "01730", "01742", "01748", "01770", "01776", 
  "01776", "01798", "01810", "01810", "01827", "01835", "01845", 
  "01863", "01864", "01887", "01890", "01908", "01929", "01938", 
  "01945", "01945", "01945", "01982", "02043", "02043", "02043", 
  "02043", "02052", "02072", "02109", "02114", "02114", "02116", 
  "02116", "02118", "02144", "02184", "02186", "02186", "02269", 
  "02302", "02455", "02455", "02465", "02474", "02481", "02536", 
  "02557", "02703", "02760", "02806", "02842", "02860", "02871", 
  "02879", "02891", "02911", "02917", "03032", "03053", "03053", 
  "03055", "03063", "03063", "03076", "03264", "03431", "03462", 
  "03748", "03841", "03841", "03841", "03841", "03841", "03842", 
  "03842", "04071", "04401", "04660", "04915", "05450", "05450", 
  "05450", "05450", "05450", "05482", "05482"}

Duplicate values are fine, it is part of what I want to calculate. How many times a zip code appears in the list.

Then I get the counties and create a map of the counties, where the shading indicates how many times a zip code was on the list.

SCcounty = ZIPCodeData[SCzip, "Counties"];
temp = Table[SCcounty[[i]][[1]], {i, 1, 102}]
GeoRegionValuePlot[Counts[temp]]

Which should produce the plot below.

My question is: Is there a way to use the MouseOver (or other function) so that if I hover my mouse over a part of the map, it will show me relevant information, such as County name?

enter image description here

$\endgroup$
9
$\begingroup$

You can do this with GeoLabels:

GeoRegionValuePlot[Counts[temp], GeoLabels -> (Tooltip[#1, #2] &)]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thanks. Works great...such a simple solution. I looked up how Tooltip works, but I'm not sure I understand the meaning of #1, #2 and the & symbol. I guess, that's a more generic Mathematica question. $\endgroup$ – tau1777 Oct 10 '15 at 16:52
  • $\begingroup$ @tau1777 Yes, you can find info on this if you look up Slot and Function. $\endgroup$ – Sjoerd C. de Vries Oct 10 '15 at 16:54
  • $\begingroup$ Cool, Thanks again. $\endgroup$ – tau1777 Oct 10 '15 at 17:07

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.