Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Map an expression to a color based on a hash
| ResourceFunction["HashHue"][expr] gives a Hue based on the expression expr. | |
| ResourceFunction["HashHue"][expr,type] uses the specified hash type. | 
Get a color for an expression:
| In[1]:= | ![ResourceFunction["HashHue"]["Hello World"]](https://www.wolframcloud.com/obj/resourcesystem/images/954/9546ae91-2b23-4e84-8d3a-5e74a925ee04/1f664a50e8c31002.png) | 
| Out[1]= |  | 
Sometime differences in values are hard to see visually:
| In[2]:= | ![values = RandomReal[10^7, WorkingPrecision -> 20] + {0, 0, 0, 10^3, 0,
    0, 0, 0}](https://www.wolframcloud.com/obj/resourcesystem/images/954/9546ae91-2b23-4e84-8d3a-5e74a925ee04/628d82a339cb631c.png) | 
| Out[2]= |  | 
Make different values standout visually:
| In[3]:= | ![Style[#, ResourceFunction["HashHue"][#]] & /@ values](https://www.wolframcloud.com/obj/resourcesystem/images/954/9546ae91-2b23-4e84-8d3a-5e74a925ee04/1120f5953499571b.png) | 
| Out[3]= |  | 
Data with text fields can take up space:
| In[4]:= | ![policeData = ResourceData["Urbana Police Incidents"][
  1 ;; 50, {"TimeOccurred", "AddressStreet", "CrimeDescription"}]](https://www.wolframcloud.com/obj/resourcesystem/images/954/9546ae91-2b23-4e84-8d3a-5e74a925ee04/4daa9d35acbfb663.png) | 
| Out[4]= |  | 
Instead, visualize the data with colors where identical values always match:
| In[5]:= | ![policeData[All, {"CrimeDescription" -> ResourceFunction["HashHue"]}]](https://www.wolframcloud.com/obj/resourcesystem/images/954/9546ae91-2b23-4e84-8d3a-5e74a925ee04/4db63ac09d2b86f6.png) | 
| Out[5]= |  | 
Create an index for interpreting the color:
| In[6]:= | ![AssociationMap[ResourceFunction["HashHue"], DeleteDuplicates[policeData[All, "CrimeDescription"]]]](https://www.wolframcloud.com/obj/resourcesystem/images/954/9546ae91-2b23-4e84-8d3a-5e74a925ee04/7855705a42b1c0f8.png) | 
| Out[6]= |  | 
Create a docked cell that shows your current Wolfram Language status:
| In[7]:= | ![statusCell[] := Cell[BoxData[
   ToBoxes[Grid[{Style[#, ResourceFunction[
          "HashHue"][#]] & /@ {$VersionNumber, $CloudConnected, $WolframID}}, Spacings -> 5]]], "Output"]](https://www.wolframcloud.com/obj/resourcesystem/images/954/9546ae91-2b23-4e84-8d3a-5e74a925ee04/4c3688279213fb10.png) | 
| In[8]:= | ![SetOptions[
 CreateDocument[{TextCell["Live Notebook Status", "Section"]}], DockedCells -> {statusCell[]}]](https://www.wolframcloud.com/obj/resourcesystem/images/954/9546ae91-2b23-4e84-8d3a-5e74a925ee04/76199194b7aa0bd7.png) | 

This work is licensed under a Creative Commons Attribution 4.0 International License