packages feed

hvega 0.4.0.0 → 0.4.1.0

raw patch · 6 files changed

+70/−13 lines, 6 filesbinary-addedPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Graphics.Vega.Tutorials.VegaLite: parallaxBreakdown :: VegaLite

Files

CHANGELOG.md view
@@ -1,6 +1,11 @@ For the latest version of this document, please see [https://github.com/DougBurke/hvega/blob/master/hvega/CHANGELOG.md](https://github.com/DougBurke/hvega/blob/master/hvega/CHANGELOG.md). +## 0.4.1.0++Updated the tutorial, adding in a new plot to introduce the addition+of a second axis to the visualization (`parallaxBreakdown`).+ ## 0.4.0.0  Thanks to (in no order): Matthew Pickering (mpickering),
hvega.cabal view
@@ -1,5 +1,5 @@ name:                hvega-version:             0.4.0.0+version:             0.4.1.0 synopsis:            Create Vega-Lite visualizations (version 3) in Haskell. description:         This is based on the elm-vegalite package                      (<http://package.elm-lang.org/packages/gicentre/elm-vegalite/latest>)@@ -66,6 +66,7 @@                      images/vl/stripploty.png                      images/vl/stripplotwithcolor.png                      images/vl/stripplotwithcolorordinal.png+                     images/vl/parallaxbreakdown.png                      images/vl/parallaxhistogram.png                      images/vl/gmaghistogram.png                      images/vl/yloghistogram.png
+ images/vl/parallaxbreakdown.png view

binary file changed (absent → 10325 bytes)

src/Graphics/Vega/Tutorials/VegaLite.hs view
@@ -78,15 +78,18 @@   -- $stripplot-mmtype    , stripPlotWithColorOrdinal-  -  -- * Adding an axis and summing up data++  -- * Adding an axis   ---  -- $singleview-histogram-  -  , simpleHistogram+  -- $add-axis -  -- ** Histograms+  , parallaxBreakdown++  -- ** Creating a value to plot: aggregating data+  --+  -- $histogram   +  , simpleHistogram   , parallaxHistogram   , gmagHistogram   @@ -651,15 +654,62 @@      , enc []      ] --- $singleview-histogram+-- $add-axis -- While the strip plot shows the range of parallaxes, it is hard to -- make out the distribution of values, since the ticks overlap. Even -- changing the opacity of the ticks - by adding an encoding channel -- like @'opacity' [ 'MNumber' 0.6 ]@, or by setting the 'MOpacity'--- property of the 'mark' - only helps so much. So, we--- would like to bin up the parallax values, and report the number--- of stars in each bin (i.e. aggregate the data). That is, create--- a histogram of the data.+-- property of the 'mark' - only helps so much. Adding a second+-- axis is easy to do, so let's see how the parallax distribution+-- varies with cluster membership.+++{-|++The 'stripPlotWithColor' visualization can be changed to show two+variables just by adding a second position declaration:++<<images/vl/parallaxbreakdown.png>>++<https://vega.github.io/editor/#/url/vega-lite/N4KABGBEC2CGBOBrSAuKAXAlgY2QGnCgBNZ1ZUxQIJIBXeAGwsgAt10AHAZxQHpf4sAO4A6AOaZ0LWgCNaXAKbxsAewB26BRpGrovACIraYgEL1EC3iwBuCsbF5wum+Fdv3eJMr3uZYAWlgAgDYARmDA0IAGfzIZBgVQ2BE1FX8WBVgiJRF0LmtIAmooADMVeDh0CmBIDgRFasgAcTgxZjVaaBklQqgOBgAPds7u+F7IBQB9fqG0SA6unoBfJcIloqgAEi5sDLhmNk4efndkiSlZEUwVXh29h1P-BklLawBmEQArLnVCwgm1KoiJg1G00FRqJBVAxyo0SpgFAwiMwAMIMeQucboACeHAU7RU0BBsCY60INFmlHJkPhiORcxmf2KNBxeOYAEdaLANJJSJhbEzmZBYANMFxGlh0AlmAAFBAkhgisAACicAEpIKtimTipBsXCEUjUejnD08Bhcfi5qkiWoSZq1hsoep4WDKKslkA Open this visualization in the Vega Editor>++@+let enc = encoding+            . position X [ PName \"plx\", PmType Quantitative, PAxis [ AxTitle \"Parallax (mas)\" ] ]+            . position Y [ PName \"Cluster\", PmType Nominal ]+            . color [ MName \"Cluster\", MmType Nominal ]++in toVegaLite+    [ gaiaData+    , mark Tick []+    , enc []+    ]+@++I have left the color-encoding in, as it makes it easier to compare to+'stripPlotWithColor', even though it replicates the information provided+by the position of the mark on the Y axis.++-}++parallaxBreakdown :: VegaLite+parallaxBreakdown =+  let enc = encoding+            . position X [ PName "plx", PmType Quantitative, PAxis [ AxTitle "Parallax (mas)" ] ]+            . position Y [ PName "Cluster", PmType Nominal ]+            . color [ MName "Cluster", MmType Nominal ]++  in toVegaLite+     [ gaiaData+     , mark Tick []+     , enc []+     ]+++-- $histogram+-- We can also \"create\" data to be plotted, by aggregating data. In this+-- case we can create a histogram showing the number of stars with the+-- same parallax value (well, a range of parallaxes).  {-| 
stack.yaml view
@@ -5,4 +5,4 @@  extra-deps: [] -resolver: lts-14.1+resolver: lts-14.4
tools/PlayTutorial.hs view
@@ -90,6 +90,7 @@      , ("stripploty", VL.stripPlotY)      , ("stripplotwithcolor", VL.stripPlotWithColor)      , ("stripplotwithcolorordinal", VL.stripPlotWithColorOrdinal)+     , ("parallaxbreakdown", VL.parallaxBreakdown)      , ("parallaxhistogram", VL.parallaxHistogram)      , ("gmaghistogram", VL.gmagHistogram)      , ("yloghistogram", VL.ylogHistogram)