Hoogle Search
Within LTS Haskell 24.65 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
choroplethLookupToGeo :: VegaLitehvega Graphics.Vega.Tutorials.VegaLite Our first choropleth is based on the Choropleth example from the Vega-Lite Example Gallery. The key elements are:
- Using the TopojsonFeature feature for the data source (thanks to usGeoData).
- Choosing the correct "feature" name in the geographic data, here "counties" in the argument to our usGeoData helper function.
- Performing a Vega-Lite lookup to join the data to be plotted (the unemployment rate) to the geographic data. In this case, the column name in the unemployment data - "id" given as the first argument to lookup - is the same as the column name in the geographic data, the third argument to lookup. Those can be different.
- Specifying a projection, that is a mapping from (longitude, latitude) to (x,y) coordinates. Since we are looking at data for the main-land United States of America we use AlbersUsa (rather than looking at the whole globe, as we did in earlier visualizations), which lets us view the continental USA as well as Alaska and Hawaii.
- Using the Geoshape mark.
let unemploymentData = dataFromUrl "https://raw.githubusercontent.com/vega/vega/master/docs/data/unemployment.tsv" [] in toVegaLite [ usGeoData "counties" , transform . lookup "id" unemploymentData "id" (LuFields ["rate"]) $ [] , projection [PrType AlbersUsa] , encoding . color [ MName "rate", MmType Quantitative, MScale [ SScheme "purpleorange" [] ] ] $ [] , mark Geoshape [] , width 500 , height 300 , background "azure" ]
So, we have seen how to join data between two datasets - thanks to lookup - and display the unemployment rate (from one data source) on a map (defined from another data source). I have chosen a diverging color scheme for the rate, mainly just because I can, but also because I wanted to see how the areas with high rates were clustered. I've also shown how the background function can be used (it is simpler than the configuration approach used earlier in stripPlotWithBackground). Our next choropleth - choroplethLookupFromGeo - will show how we can join multiple fields across data sources, but this requires understanding how Vega-Lite handles multiple views, which is fortunately next in our tutorial.sstLookupRich :: SharedStringTable -> [RichTextRun] -> Intxlsx Codec.Xlsx.Types.Internal.SharedStringTable No documentation available.
sstLookupText :: SharedStringTable -> Text -> Intxlsx Codec.Xlsx.Types.Internal.SharedStringTable No documentation available.
optStanzaLookup :: OptionalStanza -> OptionalStanzaMap a -> acabal-install-solver Distribution.Solver.Types.OptionalStanza No documentation available.
-
curl Network.Curl.Info No documentation available.
AnotherIconLookupFlags :: Int -> IconLookupFlagsgi-gtk3 GI.Gtk.Flags Catch-all for unknown values
-
gi-gtk3 GI.Gtk.Flags Used to specify options for iconThemeLookupIcon
IconLookupFlagsDirLtr :: IconLookupFlagsgi-gtk3 GI.Gtk.Flags Try to load a variant of the icon for left-to-right text direction. Since 3.14.
IconLookupFlagsDirRtl :: IconLookupFlagsgi-gtk3 GI.Gtk.Flags Try to load a variant of the icon for right-to-left text direction. Since 3.14.
IconLookupFlagsForceRegular :: IconLookupFlagsgi-gtk3 GI.Gtk.Flags Try to always load regular icons, even when symbolic icon names are given. Since 3.14.