diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,97 @@
 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.12.0.7
+
+Bump to support containers version 0.7.
+
+## 0.12.0.6
+
+Bump to support text version 2.1. This appears to have been un-released,
+so is a secret just between you and I.
+
+## 0.12.0.5
+
+Bump to support bytestring version 0.12.0.0 (only needed if building
+the tests).
+
+## 0.12.0.4
+
+Bump to support aeson version 2.2 (tests may require building with
+the --allower-newer=aeson option).
+
+## 0.12.0.3
+
+Bump to support aeson version 2.1.
+
+## 0.12.0.2
+
+Bump to support text version 2.0. All hail our new UTF-8 rulers.
+
+## 0.12.0.1
+
+Bump to support bytestring version 0.11 for testing `hvega`. There
+are no changes to the code.
+
+## 0.12.0.0
+
+Support aeson version 2.0. There is currently no significant change to
+the API but it is expected that in a future release there will be when
+we wil require a minimum version of 2.0 for aeson.
+
+At the time of release of 0.12.0.0 the tests will fail when using
+aeson >= 2.0 because `aeson-pretty` has not yet been updated (see
+https://github.com/informatikr/aeson-pretty/issues/36).
+
+## 0.11.0.1
+
+There is no change in the code, only the tests, which should now
+pass when using hashable 0.3.1.0.
+
+## 0.11.0.0
+
+The Vega-Lite tests are now validated against version 4.15 of the
+Vega-Lite schema.
+
+Note that `hvega` does __not__ provide any information to help users
+take advantage of the (new to 4.14) ability to omit the type of a
+field when [it can be inferred](https://vega.github.io/vega-lite/docs/type.html).
+As the type is currently optional in `hvega` users can just not give a type.
+The example [IHaskell notebooks](https://github.com/DougBurke/hvega/tree/master/notebooks)
+have been updated to show off the optional support.
+
+Similarly, Vega-Lite 4.14 allows you to share the type, scale, axis,
+and legend in a shared encoding. There is no explicit support added in
+0.11.0.0 because `hvega` already allowed you to create the specification.
+
+### New Constructors
+
+The `OrderChannel` type has gained `OBand`, `OTitle`/`ONoTitle`,
+and conditional-predicate support with `ODataCondition`,
+`OSelectionCondition`, and `ONumber` constructors.
+
+The `MarkChannel` type has gained the `MNullValue` constructor.
+
+The `ScaleRange` type has gained `RField`, `RMax`, and `RMin`
+constructors.
+
+### Breaking Changes
+
+Domain settings in `ScaleProperty` and associated types have been
+changed to better match the Vega-Lite schema: `SDomain` now takes
+a new type (`DomainLimits`) which actually contains many of the
+orignal symbols (so hopefully will require no changes), and a new
+constructor has been added (`SDomainOpt`) which takes the
+`ScaleDomain` type, which has seen new constructors - `DMax`,
+`DMaxTime`, `DMid`, `DMin`, and `DMinTime` - as well as
+some constructors moving to `DomainLimits`.
+
+### Deprecated symbols
+
+The `SDomainMid` constructor of `ScaleProperty` will be removed in a
+future release as it has been replaced by the `DMid` constructor
+in `ScaleDomain`.
+
 ## 0.10.0.0
 
 The Vega-Lite tests are now validated against version 4.13 of the
@@ -21,7 +112,7 @@
 Month` has been changed to `PTimeUnit (TU Month)` and `SNice NMinute`
 has changed to `SNice (NTU NMinute)`.
 
-The `BaseTimeUnit' type has seen a number of additions: the `Week` and
+The `BaseTimeUnit` type has seen a number of additions: the `Week` and
 `DayOfYear` time units added in Vega-Lite 4.13.0, along with the
 associated composite units (such as `YearWeek`), and a number of
 composite types that were missing (such as `MonthDateHours`).  The
@@ -62,7 +153,7 @@
 The `angle` encoding channel has been added for text and point marks.
 
 The `Channel` type has gained `ChAngle`, `ChTheta`, `ChTheta2`,
-`ChRadius`, `ChRadius`', 'ChDescription', and `ChURL`.
+`ChRadius`, `ChRadius`, `ChDescription`, and `ChURL`.
 
 Layers have been added to `Arrangement` (`Layer`) and to `RepeatFields`
 (`LayerFields`).
@@ -830,7 +921,7 @@
 optional field name, to allow them to be used as part of an encoding
 aggregation (e.g. with `PAggregate`).
 
-The "z index" value has changed from an 'Int' to the 'ZIndex' type.
+The "z index" value has changed from an `Int` to the `ZIndex` type.
 
 The constructors for the `Symbol` type now all start with `Sym`, so
 `Cross`, `Diamond`, `TriangleUp`, `TriangleDown`, and `Path` have been
@@ -838,7 +929,7 @@
 `SymTriangleDown`, and `SymPath`, respectively.
 
 The `Legend` type has been renamed `LegendType` and its constructors
-have been renamed 'GradientLegend' and 'SymbolLegend'.
+have been renamed `GradientLegend` and `SymbolLegend`.
 
 ### Improved testing
 
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -1,9 +1,13 @@
+
 # hvega
 
-[![vega-lite version](https://img.shields.io/badge/Vega--Lite-v4.13-purple.svg)](https://vega.github.io/vega-lite/)
+[![Hackage](https://img.shields.io/hackage/v/hvega.svg)](https://hackage.haskell.org/package/hvega)
+[![vega-lite version](https://img.shields.io/badge/Vega--Lite-v4.15-purple.svg)](https://vega.github.io/vega-lite/)
+[![GitHub CI](https://github.com/DougBurke/hvega/workflows/hvega-CI/badge.svg)](https://github.com/DougBurke/hvega/actions)
+[![Dependencies status](https://img.shields.io/hackage-deps/v/hvega.svg)](http://packdeps.haskellers.com/feed?needle=hvega)
 
 Create [Vega-Lite](https://vega.github.io/vega-lite/) visualizations in
-Haskell. It targets version 4.13 of the Vega-Lite specification. Note that
+Haskell. It targets version 4.15 of the Vega-Lite specification. Note that
 the module does not include a viewer for these visualizations (which are
 JSON files), but does provide several helper functions, such as
 [toHtmlFile](https://hackage.haskell.org/package/hvega/docs/Graphics-Vega-VegaLite.html#v:toHtmlFile),
@@ -39,7 +43,7 @@
     enc = encoding
             . position X [ PName "Horsepower", PmType Quantitative ]
             . position Y [ PName "Miles_per_Gallon", PmType Quantitative, PTitle "Miles per Gallon" ]
-            . color [ MName "Origin", MmType Nominal ]
+            . color [ MName "Origin" ]
 
     bkg = background "rgba(0, 0, 0, 0.05)"
 
@@ -48,7 +52,7 @@
 
 When the JSON is viewed with a Vega-Lite aware viewer, the resultant plot
 can be interacted with (e.g. to use the tooltip support) using the
-[interactive version](https://vega.github.io/editor/#/url/vega-lite/N4IgtghgTg1iBcoAuB7FAbJBLADg0AxigHZICmpCIFRAJlsQOYgC+ANCEgJ45lUFYoBdH3YhaEJBHwgArlHRUAFkiQ4AzvAD0WgG5lGEAHSMsSJbIBGRrCj0GIAWglT1ZJOq0uIWgtHVGAFbqJKwcACTqBEpkkMqqGtr2hiZmFta2WlExkMlO6GZkegAsQSHEIBw0KPRMMkToKFAyAGZYZOi0VADyUFimFRzcvFTEKGAMEIpiAB6t7Z1UABJNbjgoAO5kzUM8fPAgAI6yEKRmklj6YSBc8x1dBwCyWCLqAPq8UG8A4lONg5wzCIqM9XgACT5g37of6VTh7KjHU7YKTYK4sMSWCAEGCMKAoWTEB4gKCMLEACgADGxqbSjJSAKwASlYQA).
+[interactive version](https://vega.github.io/editor/#/url/vega-lite/N4IgtghgTg1iBcoAuB7FAbJBLADg0AxigHZICmpCIFRAJlsQOYgC+ANCEgJ45lUFYoBdH3YhaEJBHwgArlHRUAFkiQ4AzvAD0WgG5lGEAHSMsSJbIBGRrCj0GIAWglT1ZJOq0uIWgtHVGAFbqJKwcACTqBEpkkMqqGtr2hiZmFta2WlExkMlO6GZkegAsQSHEIBw0KPRMMkToKFAyAGZYZOi0VADyUFimFWIAHq3tnVQAEk1uOCgA7mTNHNy8VACOshCkZpJY+mEgXKMdXfAgALJYIuoA+rxQNwDiEOiNFctmIlSX1wAE979nq9QsseHwzhsttgpNh9iwxJYIAQYIwoChZMRTiAoIxEQAKAAMbF+RJJxIJRgJAFYAJSsIA).
 It can also be viewed as a PNG:
 
 ![Simple scatterplot](https://raw.githubusercontent.com/DougBurke/hvega/master/hvega/images/example-car.png "Simple scatterplot")
@@ -63,7 +67,8 @@
 at some point, and so there was
 [some speculation](https://en.wikipedia.org/wiki/Betelgeuse#2019%E2%80%932020_fading)
 that we could see a "naked-eye" supernova (even though the current models
-suggest that Betelgeuse has about 100,000 more years to go before this happens).
+suggest that Betelgeuse has about 100,000 more years to go before this happens,
+and the rapid brightening in mid 2023 has also got some people's hopes up).
 This interest lead to a lot of observations added to the
 [American Association of Variable Star Observers](https://www.aavso.org/)
 database, which we are going to look at below. This example is rather-more
@@ -76,12 +81,12 @@
     w = width 600
     h = height 150
 
-    pos1Opts fld ttl = [PName fld, PmType Quantitative, PAxis [AxTitle ttl]]
+    pos1Opts fld ttl = [PName fld, PmType Quantitative, PTitle ttl]
     x1Opts = pos1Opts "days" "Days since January 1, 2020"
     y1Opts = pos1Opts "magnitude" "Magnitude" ++ [PSort [Descending], yRange]
     yRange = PScale [SDomain (DNumbers [-1, 3])]
 
-    filtOpts = [MName "filterName", MmType Nominal]
+    filtOpts = [MName "filterName"]
     filtEnc = color (MLegend [ LTitle "Filter", LTitleFontSize 16, LLabelFontSize 14 ] : filtOpts)
               . shape filtOpts
 
@@ -93,8 +98,8 @@
                   . filtEnc
 
     selName = "brush"
-    pos2Opts fld = [PName fld, PmType Quantitative, PAxis [AxNoTitle],
-                   PScale [SDomain (DSelectionField selName fld)]]
+    pos2Opts fld = [PName fld, PmType Quantitative, PNoTitle,
+                   PScale [SDomainOpt (DSelectionField selName fld)]]
     x2Opts = pos2Opts "days"
     y2Opts = pos2Opts "magnitude" ++ [PSort [Descending]]
 
@@ -132,7 +137,6 @@
 
     details = asSpec [ columns 1
                      , facetFlow [ FName "filterName"
-                                 , FmType Nominal
                                  , FHeader headerOpts
                                  ]
                      , spacing 10
@@ -155,7 +159,7 @@
 
 This can be viewed as
 
- - an [interactive version](https://vega.github.io/editor/#/url/vega-lite/N4KABGBEAuBOCGA7AzgMwPawLaQFxgG1wIxhJUBLAG2gFNY8oATeaAVywDpKb6A5eFloEADAF0wAXmlgA5ADVZkAL4AaYhDI86DfJBbsuWeAHNEFdk1pgAPGAAsK9SVKR4yRvvgBPD6qgAxvBUAWxUrLSeBhycAFZMYAC0YABM9gCsAByZ9gCcnCIqxGLOgeiIlCaMoC5uAB4UHvg1LlDQFlS0AGLl0ADqtBQmABbQnoiYxlSQpbXhAEa0VD2I0ADKFABekfgAjPazJDAd3b0b24y7AGwaYMrEasRe0PDVt5BssNN6o9AADshcAB6IEIADunBMFmGbHmbGQ9ACvVoq04SKwQIAIug2CYAEKfADWtCBwwAbrQTPAgcZkDpSRSqUCDNTFnQqCZaPDaIkUiI+YkRABmRK7fKxZDlSAPUqQMlIxBBMb4IguFq1YaDEbKsC7dIiQ4QSDGWCE6qQdB-eABCzeRgiTjpfwwbx-HZQP7oCirGZQHidJiMVDBBGPVpQMEUJjQYaMK4iA23I0IzoBdpS5pJo7zWDw2OZ8O1b0Wc11RgEXl8-y7BMlKB2lWCx3+FKOsRhwtGlFIpjekxNQiQMvOu0lLO1aCu92Qb06MnBaWd+7hju1bvoXuIKoFwuQJFUTBvTtGyhLQN6bT8QSRQ2tF1u8boLDehe3uaUlHn0jju8LJYrdYtndfY3zvdpoE6TwumoHQZh-CcTgA85gJuY87h-Vc72QYZ4AfZpyAoM9PEvWABCEX172nCZn0QBdMNqMsd07AiiL0FhfDgtDKM8ABHNgkHA1gKApTjj3qRpzXAyC9ExHxkDAZBvQCawACkkH42BvF1Ft+UKZdC3oo4G2-LjTyoL9jVMcxLBveCoGQIJpNcJgn3gb1y1FfwhXbUDk0wHV9FoBzPz7UTmMnPCoD4gSLCEkTfKgeAGgHMgpOnABZKyLDYKwiiXLN9IgTD1SOZA3QCI9d01IZRkufVQMs01zUta1bXtZs2inTxPVnCj-VoL9gyoUMGsjaN8zAeNE2Y9dN23EyxP3Q8mLEsyLJIsjbLQo0Iqop8X2mBKjU6TlEC-EquL-ZYziAy4DjshCIOnaDeAYI6jjSpDbr2VDtsKgyEsgbDcPdLRCPM4iYKvcjnV2x8aLowHGIW0zwYs9i-Ae+zHNB-RXPc-C1qiOSKJTWg0woDMoBzPMVEM8NuL0aLVli9p4qx8SUuOJ7GEQMIqH+ldAeMi7dyJvRjDMbLcveoGcfNFzjAJ1xxagSXrJym97KWcn00QTwaewunZclWAAqsYKztC2W4aZ-iWZeNmtu2znJJOXn+cF1ovaKgrbz3dAqA4FBLn94NlJ1UWTzRyHXs2sK701eArF0FHdyugBBRVhmWqBPwThmroAUTqP5U8gWQXp0fBZDAABqMBoi4K6C9-eBFioAAFZO5sYXl7su9v-xui4fsBtKPaoKhAczqghn1vRYBqsYMIa22oGog7F29-2ytardLhEW59LHI0ABIHM1YxPF+AFgSBRl4EhaFYU4SmgUv2hjAfyl4ESOe6AP3sHESU+tZQTxWjAWgdQAp4loOyD83JZDyXVtLawQh3CfC-iiaAyB-D7nCHQBI8wtIZwzvINYAB5BO5AR7AUyDKJ4FsAhLz+HrTwAAJdAYIwA4XknA9knIkHyRzMvRAQV5LziXgNfw8x3ADTAOURurB4BgAIREYhpDyFULAAAClvoCEEYJjGcHgPAMkkpOCYBMECAAlJwMAABNHECkc5hASCGdAYADzoEJGAVgvDoD-EMUCaAkYgn0DRE+IEbIljzHQNAfxZ1AnBPvlCGMr90SkgoH8P4xIYnwLiQkhxABJRJYJ3D+KnmAGM1gECckUYgBS6AbTBDAEIXsqiAm1IUi8M2ijUCpF0pwaUyggA)
+ - an [interactive version](https://vega.github.io/editor/#/url/vega-lite/N4IgLgTghgdgzgMwPYQLYgFwG1QIJYA2YAphJiACZRgCuqAdPkaQHJSrFYAMAugAQBeIXwDkANREgAvgBpchEmQyVqdeqigBzGHloVifADx8ALNLkgocclQCe1mSADGUAk5oFqxG6oYArCj4AWj4AJhMAVgAOKJMATnouaR5HJyQYfE1MUCgADzxrDFAwXQJiADF0sAB1YjxNAAswchgUDQIQR08AI2ICSpgwAGU8AC9vDABGE0cSsDKB4bGJyYA2KVkVMChskBoIDuUmsAAHOAwAegvoAHd6TV0Gmm6aOFI0weJB+jTUC4ARJA0TQAIX2AGtiBcGgA3YiaKAXDRwRTQuEIi5UbYXXokAiaYivYhBUJcUlBLgAZiCkwSfjg6XMIBhHxczWwoAadUa7MmES4jg0EHBuyQJygTl0tkwXHoEVmthOExAJyQeEGnRATDKFEwCFcb02NzwFDADUwqy4ApAbzKThKjKKIG6EFe5qd6t0u1ymCwJNJMkmVpSIGl2ApcpkoTlPE2XzSFHVmkKWBAPsc0pDYEVyvVihhrmkcZgCaTuzSBBQu3wfV1yiYijYHE1ZQJMDroB6fUWI3GmGms1KyvKClImrmCyqvZW602cAaUCV1bwtfIDdY7G8mx9TprBDrKns46H5H+UHsfDg6qcBgAUrAaFAILY+JMZGEyUkFUvlABHR+DLo1B4HCTJhvIq7KBo2i6DQ+ianALhlLsFBIBo6q+jSMiUrGjgMhA7KUMQiFfImMBZIO8zKgAsloOh6N437Kv+sBzMBoEbLIoBwEqTi7Fy9RNP2-KCk+IpOmKEpSjKkbgDm5CqnmmrasQdb6gQhqOMaprupa1rxkgZFZE6FZVruK77muo4QE2jEgK2pG7F2-RTss-YzOAJ7KCOzBkJRk6DNO-aznhC4-hBln1tZtlMjuEUHnYDg2khEygKh6EwMukGHkltrEPaeCOs6rrzkW-kTDAHgEEx5AsYB2wlBxGZZZFIDQfRcF2YhripZQaFQBh5nZe1sHwXhfT5Q6mXKC6bplTaKCEfoJHtmW5WYJVBDVXJP4gHVbGNVuGypEgBB0PA-aOPqN7svFVm+TFjhclA+hKJ2UC9AQACCJYNGZICOV0H19AAorkJxKCAIg+YoGCiHwADUfBYmozktsDBAAAovUZmAkh5zk9m5UyrOtGCbdtzlfQQ9TTSAECCc0x02uKkrkf2XBSCGAAkiFcho5DHGclwXOiUD3I8zz0IVFx88QGii-CUBBDTJCiyY9D0oyZPFMQuSESCxB4vChJvCIcB8CNDGW8QVj7PLXxgHA74Vp4JCBN0L5fV9YhDAA8sprl9lMUSbMtTgMycU3kAAEkgNx8AuFuG3iBJEubfAuozMDERbBYM6p77dFYql8OkyPUFAfCu14Htez7-t8AAFEL5xXDcHf0FAUAwgy9AoJoFwAJT0HwACaQKXn9HiBAaSB8JWSDgnw1CJ2ApxtxcYDGuvpA-GhOJG303RIGAK-tmvG8iw8ZpS780J4CcJyQofeIn2Ao8AJJnzcVgr1tfAzQGGgASMuMBLxIElK4G2iYq6ryAZebYBEy4IA-KSeg0ggA)
 
  - as a PNG:
 
diff --git a/default.nix b/default.nix
--- a/default.nix
+++ b/default.nix
@@ -1,2 +1,50 @@
-{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc883" }:
-nixpkgs.pkgs.haskell.packages.${compiler}.callPackage ./hvega.nix { }
+{ sources ? import ../nix/sources.nix
+, pkgs ? import sources.nixpkgs {}
+, compiler ? "ghc928"
+}:
+
+let
+  # There must be a better way than this! I just want to avoid
+  # excessive compilation when using a non-standard compiler.
+  #
+  isDefaultCompiler = compiler == "ghc8107";  # drop HLS for now
+
+  # since we are in a sub-directory
+  # gitignore = pkgs.nix-gitignore.gitignoreSourcePure [ ./.gitignore ];
+  gitignore = pkgs.nix-gitignore.gitignoreSourcePure [ ../.gitignore ];
+
+  myHaskellPackages = pkgs.haskell.packages.${compiler}.override {
+    overrides = hself: hsuper: {
+      "hvega" =
+        hself.callCabal2nix "hvega" (gitignore ./.) {};
+    };
+  };
+
+  shell = myHaskellPackages.shellFor {
+    packages = p: [
+      p."hvega"
+    ];
+    buildInputs = [
+      pkgs.haskellPackages.cabal-install
+      pkgs.haskellPackages.hlint
+      pkgs.niv
+    ] ++ pkgs.lib.optionals isDefaultCompiler [
+      pkgs.haskellPackages.haskell-language-server
+    ];
+    withHoogle = isDefaultCompiler;
+  };
+
+  # exe = pkgs.haskell.lib.justStaticExecutables (myHaskellPackages."hvega");
+
+  # docker = pkgs.dockerTools.buildImage {
+  #   name = "{{cookiecutter.project_name}}";
+  #   config.Cmd = [ "${exe}/bin/{{cookiecutter.project_name}}" ];
+  # };
+in
+{
+  inherit shell;
+  # inherit exe;
+  # inherit docker;
+  inherit myHaskellPackages;
+  "hvega" = myHaskellPackages."hvega";
+}
diff --git a/hvega.cabal b/hvega.cabal
--- a/hvega.cabal
+++ b/hvega.cabal
@@ -1,5 +1,5 @@
 name:                hvega
-version:             0.10.0.0
+version:             0.12.0.7
 synopsis:            Create Vega-Lite visualizations (version 4) in Haskell.
 description:         This is based on the elm-vegalite package
                      (<http://package.elm-lang.org/packages/gicentre/elm-vegalite/latest>)
@@ -10,7 +10,7 @@
 license-file:        LICENSE
 author:              Douglas Burke
 maintainer:          dburke.gw@gmail.com
-copyright:           2018-2020 Douglas Burke
+copyright:           2018-2023 Douglas Burke
 category:            Graphics
 build-type:          Simple
 extra-source-files:  README.md
@@ -18,7 +18,6 @@
                      stack.yaml
                      default.nix
                      shell.nix
-                     hvega.nix
                      tests/specs/axis/*.vl
                      tests/specs/color/*.vl
                      tests/specs/composite/*.vl
@@ -160,8 +159,8 @@
                        Graphics.Vega.VegaLite.Time
                        Graphics.Vega.VegaLite.Transform
   build-depends:       base >= 4.9 && < 5
-                     , aeson >= 0.11 && < 1.6
-                     , text == 1.2.*
+                     , aeson >= 0.11 && < 2.3
+                     , text >= 1.2 && < 2.2
                      , unordered-containers == 0.2.*
 
   default-language:    Haskell2010
@@ -216,16 +215,18 @@
                        Gallery.Scatter
                        Gallery.Table
 
-  build-depends:       aeson >= 1.4.2 && < 1.6
+  build-depends:       aeson >= 1.4.2
                      , aeson-pretty == 0.8.*
-                     , base >= 4 && < 5
-                     , bytestring == 0.10.*
-                     , containers >= 0.5.7 && < 0.7
+                     , base
+                     , bytestring >= 0.10 && < 0.13
+                     , containers >= 0.5.7 && < 0.8
                      , filepath
                      , tasty
                      , tasty-golden >= 2.2 && < 2.4
-                     , text == 1.2.*
-                     , unordered-containers >= 0.2 && < 0.3
+                     , text
+                     , unordered-containers
+                     -- hvega is not needed with recent cabal's, but it's
+                     -- not obvious if this is true with older versions
                      , hvega
 
   default-language:    Haskell2010
@@ -243,6 +244,8 @@
                      , bytestring
                      , directory
                      , filepath
+                     -- hvega is not needed with recent cabal's, but it's
+                     -- not obvious if this is true with older versions
                      , hvega
                      , text
   else
diff --git a/hvega.nix b/hvega.nix
deleted file mode 100644
--- a/hvega.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-{ mkDerivation, aeson, aeson-pretty, base, bytestring, containers
-, directory, filepath, http-conduit, stdenv, tagsoup, tasty
-, tasty-golden, text, unordered-containers
-}:
-mkDerivation {
-  pname = "hvega";
-  version = "0.10.0.0";
-  src = ./.;
-  configureFlags = [ "-ftools" ];
-  isLibrary = true;
-  isExecutable = true;
-  libraryHaskellDepends = [ aeson base text unordered-containers ];
-  executableHaskellDepends = [
-    aeson aeson-pretty base bytestring directory filepath http-conduit
-    tagsoup text
-  ];
-  testHaskellDepends = [
-    aeson aeson-pretty base bytestring containers filepath tasty
-    tasty-golden text unordered-containers
-  ];
-  homepage = "https://github.com/DougBurke/hvega";
-  description = "Create Vega-Lite visualizations (version 4) in Haskell";
-  license = stdenv.lib.licenses.bsd3;
-}
diff --git a/shell.nix b/shell.nix
--- a/shell.nix
+++ b/shell.nix
@@ -1,2 +1,3 @@
-{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc883" }:
-(import ./default.nix { inherit nixpkgs compiler; }).env
+{ compiler ? "ghc928"
+}:
+(import ./default.nix { compiler = compiler; }).shell
diff --git a/src/Graphics/Vega/Tutorials/VegaLite.hs b/src/Graphics/Vega/Tutorials/VegaLite.hs
--- a/src/Graphics/Vega/Tutorials/VegaLite.hs
+++ b/src/Graphics/Vega/Tutorials/VegaLite.hs
@@ -3,7 +3,7 @@
 
 {-|
 Module      : Graphics.Vega.Tutorials.VegaLite
-Copyright   : (c) Douglas Burke, 2019-2020
+Copyright   : (c) Douglas Burke, 2019-2021
 License     : BSD3
 
 Maintainer  : dburke.gw@gmail.com
@@ -19,7 +19,9 @@
 <https://youtu.be/9uaHRWj04D4 Wongsuphasawat et al at the 2017 Open Vis Conf>.
 
 The tutorial targets version 4 of the Vega-Lite specification and
-the functionality provided in version @0.9.0.0@ of hvega.
+the functionality provided in version @0.12.0.0@ of hvega (although
+a number of examples could be simplified by removing the
+now-optional type information as of Vega-Lite 4.14).
 
 -}
 
@@ -75,6 +77,7 @@
   -- ** Adding color as an encoding
 
   , stripPlotWithColor
+  , stripPlotWithColor2
 
   -- ** Comparing Ordinal with Nominal data types
   --
@@ -358,7 +361,8 @@
 -- example, @elm-vegalite@ provides @pQuant n@ which in @hvega@ is the
 -- combination of @'PName' n@ and @'PmType' 'Quantitative'@ in @hvega@.
 -- The top-level functions - such as 'dataFromUrl', 'encoding', and
--- 'filter' - are generally the same.
+-- 'filter' - are generally the same. As the VegaLite schema has expanded
+-- over time the differences between the two approaches has also grown.
 --
 -- Version @0.5.0.0@ does introduce more-significant changes, in that
 -- there are now separate types for a number of functions - such as
@@ -469,7 +473,7 @@
 
 <<images/vl/stripplot.png>>
 
-<https://vega.github.io/editor/#/url/vega-lite/N4KABGBEC2CGBOBrSAuKAXAlgY2QGnCgBNZ1ZUxQIJIBXeAGwsgAt10AHAZxQHpf4sAO4A6AOaZ0LWgCNaXAKbxsAewB26BRpGrovACIraYgEL1EC3iwBuCsbF5wum+Fdv3eJMr3uZYAWlgAgDYARmDA0IAGfzIZBgVQ2BE1FX8WBVgiJRF0LmtIAmooADMVeDh0CmBIdABPDgVmPIKAX0JWoqgAEi5sDLhmNk4efndkiSlZEUwVXj6Bh3H-BklLawBmEQArLnVCwkgtVSJMNTFqyAAPS5LMBQYiZg4GG7wMBqa0SABHWlgNJJSJhbJBWp1Dqo1HcLmhgO1WkA Open this visualization in the Vega Editor>
+<https://vega.github.io/editor/#/url/vega-lite/N4IgtghgTg1iBcIAuBLAxnANCAJhJECoArlADYIgAWSSADgM7wD0zUEA7gHQDmKSVYgCNiDAKZQ0AewB2SMXK7SwzACJTiPAEKkYY5lQBuYnhGaQG8qAeOnmeAs1MoIAWghuAbAEZP77wAMrgRCZGLeEFwyUq5UYhA4ElxIDIYg2ABmUlCQSETIAJ50YpQpaQC+5dgAJAxocZCUNPRMrLaRfALCXChSzHUNZu2uZPz6hgAsXABWDLLpIArSOCgyPPkAHvkZKGJkOJR0ZFvYSEUliACOxBBy-PgoxiCV5UA Open this visualization in the Vega Editor>
 
 @
 'toVegaLite'
@@ -492,7 +496,7 @@
 this case we use the function 'position' to provide an encoding of the
 @\"plx\"@ field as the x-position in our plot. The precise way in which
 the data value (parallax) is mapped to the x-position will depend on the type of
-data we are encoding. We can provide a hint by delcaring the
+data we are encoding. We can provide a hint by declaring the
 measurement type of the data field, here 'Quantitative' indicating a
 numeric measurement type. The final parameter of position is a list of
 any additional encodings in our specification. Here, with only one
@@ -543,7 +547,7 @@
 
 <<images/vl/stripplotwithbackground.png>>
 
-<https://vega.github.io/editor/#/url/vega-lite/N4KABGBEDGD2B2AzAlgc0gLjMSAjAhtANaoBOsArvACaZSmoEAUADADRjuccsB0AjAEpIAXzbgoAW3ykidSABdkxSOIiRq+BfjqgI6iqQA28gBYKFABwDOGAPR3S+AO69UyBaYq4K1gKakcPAKfsG8cJJ2ACKUqABChkR+dqYAbn6o+HbS1iGkKemZdpradpnI+AC0+FUAbPy11fwsldq4Rn78+LzwsJWmfvjUAbwK1qmqEuqIsKTSCrqKAJ6WfvJjEyISYhKQACTW0APSZhY29naF3e6e3rzIsHaHx1lXlUYeyakAzLwAVtYEJN1KE4NRkPB0FgcAAPRYoPxGWhYSCWIxwjjLVbyACOFHwwQ8WmQ6VEWxEQA Open this visualization in the Vega Editor>
+<https://vega.github.io/editor/#/url/vega-lite/N4Igxg9gdgZglgcxALlAIwIZgNYIE4QCuUAJiiHgpgBQAMANAAQPNO0B0AjAJQgC+9EAFsMebOQAucHCEEkMEjClCE8AG3IALCRIAOAZ2QB6I3gwB3dgjgTNhNIX0BTPJCgSn79pCFGAIkQIAEKq2E5GmgBuTggYRiL6HngR0bFG8opGsXAYALQYeQBsnIX5nLS5imhqTpwY7FAQuZpOGCQu7BL6kbIgMBB4IhLKIBIAnrpOkt38AiAAJPpgLSJaOgbGRqn11rb27HAQRksrcdu5ajbhkQAs7ABW+tC9npAkcFBIqCAAHiPwTjUZGQIF0aj+gnGk3IAEdCBh3DYFHBorM+EA Open this visualization in the Vega Editor>
 
 @
 let enc = encoding
@@ -586,7 +590,7 @@
 
 <<images/vl/stripploty.png>>
 
-<https://vega.github.io/editor/#/url/vega-lite/N4KABGBEC2CGBOBrSAuKAXAlgY2QGnCgBNZ1ZUxQIJIBXeAGwsgAt10AHAZxQHpf4sAO4A6AOaZ0LWgCNaXAKbxsAewB26BRpGrovACIraYgEL1EC3iwBuCsbF5wum+Fdv3eJMr3uZYAWlgAgDYARmDA0IAGfzIZBgVQ2BE1FX8WBVgiJRF0LmtIAmooADMVeDh0CmBIdABPDgVmPIKAX0JWoqgAEi5sDLhmNk4efndkiSlZEUwVXj6Bh3H-BklLawBmEQArLnVCwkgtVSJMNTFqyDrLkswFBiJmDgYAD0KMBqa0SABHWlgNJJSJhbJBWp1Dqo1LcLmhgO1WkA Open this visualization in the Vega Editor>
+<https://vega.github.io/editor/#/url/vega-lite/N4IgtghgTg1iBcIAuBLAxnANCAJhJECoArlADYIgAWSSADgM7wD0zUEA7gHQDmKSVYgCNiDAKZQ0AewB2SMXK7SwzACJTiPAEKkYY5lQBuYnhGaQG8qAeOnmeAs1MoIAWghuAbAEZP77wAMrgRCZGLeEFwyUq5UYhA4ElxIDIYg2ABmUlCQSETIAJ50YpQpaQC+5dgAJAxocZCUNPRMrLaRfALCXChSzHUNZu2uZPz6hgAsXABWDLLpIArSOCgyPPkF+RkoYmQ4lHRkAB4LSEUliACOxBBy-PgoxiCV5UA Open this visualization in the Vega Editor>
 
 @
 let enc = encoding
@@ -639,7 +643,7 @@
 'dataFromRows' - or directly from JSON (as a 'Data.Aeson.Value') using
 'dataFromJson'.
 
-Examples showing 'dataFromColumns' are the 'pieChart' and'skyPlotWithGraticules' plots,
+Examples showing 'dataFromColumns' are the 'pieChart' and 'skyPlotWithGraticules' plots,
 but let's not peak ahead!
 
 -}
@@ -661,7 +665,7 @@
 
 <<images/vl/stripplotwithcolor.png>>
 
-<https://vega.github.io/editor/#/url/vega-lite/N4KABGBEC2CGBOBrSAuKAXAlgY2QGnCgBNZ1ZUxQIJIBXeAGwsgAt10AHAZxQHpf4sAO4A6AOaZ0LWgCNaXAKbxsAewB26BRpGrovACIraYgEL1EC3iwBuCsbF5wum+Fdv3eJMr3uZYAWlgAgDYARmDA0IAGfzIZBgVQ2BE1FX8WBVgiJRF0LmtIAmooADMVeDh0CipiqA4ERWrCWqgAcTgxZjVaaBklQubayAAlAEEAfQBJAGFhgGUunr74AZaaDgYAD0Xe-qK1yH0AUSnZhbRIbt2V-ZbIBXGN7Yur5chBiABfQe+v-cgACRcbAZODMNicHj8dzJCRSWQiTAqXjA0EOGH+BiSSzWAAsIgAVlx1KsoFpVERMGpOmgajRVAxytVICVMAoGERmNMGPIXIUMABPDgKLoqaBU2BMT63KDPSgfUpsjnMJ6k4qQdBCkUXACOtFgGkkpEwtjV1EgsE2mC4zKw6ASzAACghJQxLWAABROACUkF+1H90sIkFUalZNMo30+QA Open this visualization in the Vega Editor>
+<https://vega.github.io/editor/#/url/vega-lite/N4IgtghgTg1iBcIAuBLAxnANCAJhJECoArlADYIgAWSSADgM7wD0zUEA7gHQDmKSVYgCNiDAKZQ0AewB2SMXK7SwzACJTiPAEKkYY5lQBuYnhGaQG8qAeOnmeAs1MoIAWghuAbAEZP77wAMrgRCZGLeEFwyUq5UYhA4ElxIDIYg2ABmUlCQSEQgdNDi+QDikDyUMsRgQhLpIABKAIIA+gCSAMINAMqV1bVQ9XRkAB59NXXYqgCi7V29iFUTg9hiLcNji-11AL572AAkDGhxkJQ09EystpF8AsJcKFLMx6dmN65k-PqGACxcACsGLJ6gppDgUDIKvBQNIyNl8hkUGIyDhKB0yKIrPUkABPOhiSpSMCQiAUHbYTagJEotGIDY4-GExAAR2IEDk-HwKGM9QgIxQDHyqCQYUoAAVoGSyPyAAQACgsAEoQHs9kA Open this visualization in the Vega Editor>
 
 @
 let enc = encoding
@@ -706,7 +710,47 @@
      , enc []
      ]
 
+{-|
 
+As of Vega-Lite version 4.14 we can now drop the type information when
+it can be inferred. I am a little hazy of the rules, so I am going to
+include the information (as it also means I don't have to change
+the existing code!). However, as an example, we don't need to
+add the @MmType Nominal@ setting to the 'color' channel, since the
+following creates the same visualization as 'stripPlotWithColor':
+
+<https://vega.github.io/editor/#/url/vega-lite/N4IgtghgTg1iBcIAuBLAxnANCAJhJECoArlADYIgAWSSADgM7wD0zUEA7gHQDmKSVYgCNiDAKZQ0AewB2SMXK7SwzACJTiPAEKkYY5lQBuYnhGaQG8qAeOnmeAs1MoIAWghuAbAEZP77wAMrgRCZGLeEFwyUq5UYhA4ElxIDIYg2ABmUlCQSEQgdNDi+QDikDyUMsRgQhLpIABKAIIA+gCSAMINAMqV1bVQ9XRkAB59NXXYqgCi7V29iFUTg9hiLcNji-11AL572AAkDGhxkJQ09EystpF8AsJcKFLMx6dmN65k-PqGACxcACsGLJ6gppDgUDIKvBQNIyNl8hkUGIyDhKB0yKIrCAdthNqAkSi0YgNvVUEgwpQAArQCBkMgQEYAAgAFBYAJRkgCedDElAAjsQIHJ+PgUMYcXsgA Open this visualization in the Vega Editor>
+
+@
+let enc = encoding
+            . position X [ PName \"plx\", PmType Quantitative, 'PTitle' \"Parallax (mas)\" ]
+            . 'color' [ 'MName' \"Cluster\" ]
+
+in toVegaLite
+    [ gaiaData
+    , mark Tick []
+    , enc []
+    ]
+@
+
+Note that as well as removing @MmType Nominal@ from the 'color' encoding, I have
+switched to the 'PTitle' option (which is the same as @PAxis [AxTitle ...]@.
+
+-}
+
+stripPlotWithColor2 :: VegaLite
+stripPlotWithColor2 =
+  let enc = encoding
+            . position X [ PName "plx", PmType Quantitative, PTitle "Parallax (mas)" ]
+            . color [ MName "Cluster" ]
+
+  in toVegaLite
+     [ gaiaData
+     , mark Tick []
+     , enc []
+     ]
+
+
 -- $stripplot-mmtype
 -- It is instructive to see what happens if we change the mark type for
 -- the color encoding from 'Nominal' to 'Ordinal'.
@@ -715,7 +759,7 @@
 
 <<images/vl/stripplotwithcolorordinal.png>>
 
-<https://vega.github.io/editor/#/url/vega-lite/N4KABGBEC2CGBOBrSAuKAXAlgY2QGnCgBNZ1ZUxQIJIBXeAGwsgAt10AHAZxQHpf4sAO4A6AOaZ0LWgCNaXAKbxsAewB26BRpGrovACIraYgEL1EC3iwBuCsbF5wum+Fdv3eJMr3uZYAWlgAgDYARmDA0IAGfzIZBgVQ2BE1FX8WBVgiJRF0LmtIAmooADMVeDh0CipiqA4ERWrCWqgAcTgxZjVaaBklQubayAAlAEEAfQBJAGFhgGUunr74AZaaDgYAD0Xe-qK1yH0AUSnZhbRIbt2V-ZbIBXGN7Yur5chBiABfQe+v-cgACRcbAZODMNicHj8dzJCRSWQiTAqXjA0EOGH+BiSSzWAAsIgAVlx1KsoFpVERMGpOmgajRVAxytVICVMAoGERmNMGPIXIUMABPDgKZjlSlqWBMT63KDPSgfUpsjnMJ6k4qQdBCkUXACOtFgGkkpEwtjV1EgsE2mC4zKw6ASzAACghJQxLWAABROACUkF+1H90sIkFUalZNMo30+QA Open this visualization in the Vega Editor>
+<https://vega.github.io/editor/#/url/vega-lite/N4IgtghgTg1iBcIAuBLAxnANCAJhJECoArlADYIgAWSSADgM7wD0zUEA7gHQDmKSVYgCNiDAKZQ0AewB2SMXK7SwzACJTiPAEKkYY5lQBuYnhGaQG8qAeOnmeAs1MoIAWghuAbAEZP77wAMrgRCZGLeEFwyUq5UYhA4ElxIDIYg2ABmUlCQSEQgdNDi+QDikDyUMsRgQhLpIABKAIIA+gCSAMINAMqV1bVQ9XRkAB59NXXYqgCi7V29iFUTg9hiLcNji-11AL572AAkDGhxkJQ09EystpF8AsJcKFLMx6dmN65k-PqGACxcACsGLJ6gppDgUDIKvBQNIyNl8hkUGIyDhKB0yKIrPUkABPOhiSjZCEyCAUHbYTagJEotGIDY4-GExAAR2IEDk-HwKGM9QgIxQDHyqCQYUoAAVoGSyPyAAQACgsAEoQHs9kA  Open this visualization in the Vega Editor>
 
 @
 let enc = encoding
@@ -747,7 +791,7 @@
 
 -- $pie-chart
 -- Before adding a second axis, let's temporarily look at another
--- \"one dimensiona" chart, namel the humble pie chart.
+-- \"one dimensiona" chart, namely the humble pie chart.
 -- The 'Arc' mark type allows you to create pie charts, as well as more
 -- complex visualizations which we won't discuss further in this
 -- tutorial.
@@ -3972,7 +4016,7 @@
 
 <<images/vl/coordinatedviews2.png>>
 
-<https://vega.github.io/editor/#/url/vega-lite/N4KABGBEBOCmAOsCGAXSAuMwYHsDuGYA2pAMY4DOASgIKQA0UAIgKID6AkgMJUDKkAXUZkcAGwCuAWwB2hEvFEAPBlADikpAHNBAX3rgoFRKUKgIESCmhJpFAGY5okuQfNZISCoRHU6w0kiipOKiqLDe5BQAFAAmqFIAdLScPLxgAFRgAAocYAD0YACMABwADACUkDquYEI1kBrQANYRAJbQpKLh+m6QcShIpjUW4tCi3gAWKCjwFOh5edZ4CZqtKBPiAEbiFLAdONIosIcJ5JJ5TDjimgBCo02weRMAbrCaSHkaFEfQT6-veX6H3erSQAFokOCAGyFKEQwqlMEDTZdQpIBLSHBgibIGJ7BIoCjPBjDKAOJyoIZuXrwJDQXamSDqLTeaRSTZ7FSQBTKTCQNmSDnQLmwNg81nsznValgaXmPT1XZdUgoVoHRnwVqkB4xRkoACeiG8rUOe2egSqCt6x3IMRN2kwZmpIlEjipMqg5ok4T5mjg+pJHqg5GkdtV6sdpN6dlasFEur5XAk305PSDhjjsBVatkfM12tgurTQcshp9UExkhNFqjstJVudvPcMbjCfccEQlL55AkMiqwgNRr5AEdxDZVQNVa9+6TIAHHZAW-HGR3kGg+dB8P2oIPy5BR+O1qhWtO5RA5Q3IAASCikHEaSbTWbzPL-dGrdZbBJqvK3+8fN8wVENZHmeABmBIACsKHVNMRGkGMHSwaodCAA Open this visualization in the Vega Editor>
+<https://vega.github.io/editor/#/url/vega-lite/N4IgTgpgDhCGAuIBcowHsDuyDaIBKAggPoCSAwngMogA0IAIgKKkXUC6dAxmgDYCuAWwB2OEFB4APWiADiA2AHMQbAL50AzjE7JQ8sAGtkITgEswnHhGkATBLB0g+YHkYAW8eFHVIA9D7CwGAB0CibwrnwARnzqEOZoQvAQiUHcAj70aHwKAEJO+hA+rgBuEAqwPvLqSWBFpeU+tvAV5SawALSwHQBsAIzdnb0ADO3NkZa9sEFCaO2ucNZxQfDqxdIAZmhg8ogoYrBgsQ5yikZCgpFx0oQsVGcXV3TiUkgg5wKXYNJMt9Sv759pBAiM97h8ripIRoIJZOPATAkHFATJwCtYHJETEJ0a91JxYJZ1NJ4ABPGBGLE1YoEkBQkDJbjWLFKPbcHhbBzrEwwnEgMj8aqPECk8n-NACLE0tQgF6gLk8hyQGAIIxswQiaUiqyvACOfFgiTCCBMpVpdBJnO5PBxqGgcF24EwZuFZO1ID1BvhzXhpsh0oAJHj5vI3B4vL4fPUpqFwlEggifEGIPJI2UOjwwoVigAWIIAK3UiJUQA Open this visualization in the Vega Editor>
 
 The image was captured after panning and zooming in the
 \"parallax-RA_ICRS\" plot.
@@ -4069,7 +4113,8 @@
                                ]
                   . position Y [ PName \"plx\"
                                , PmType Quantitative
-                               , PScale [ SDomain ('DSelection' \"brush\") ]
+                                 -- prior to 0.11.0.0 this was 'SDomain'
+                               , PScale [ 'SDomainOpt' ('DSelection' \"brush\") ]
                                ]
                   . color [ MName \"Cluster\", MmType Nominal ]
 
@@ -4115,7 +4160,7 @@
                 ]
             . position Y [ PName "plx"
                          , PmType Quantitative
-                         , PScale [ SDomain (DSelection "brush") ]
+                         , PScale [ SDomainOpt (DSelection "brush") ]
                          ]
                   . color [ MName "Cluster", MmType Nominal ]
 
@@ -4236,42 +4281,34 @@
 
 <<images/vl/loessexample.png>>
 
-<https://vega.github.io/editor/#/url/vega-lite/N4KABGBEAuBOCGA7AzgMwPawLaQFxgG1hJUBLAG2gFNY8oAKAE3mgFcsA6AEQFEB9AJIBhAEoBlMAD4AvGAAMASjAAyMExbtu-YeLAAeWQBZFkAL4BdADTgozaPDqgIESK1jk6kABbRoAB2RcAHoghAB3DgBzUmgvVgAjVmQaAGN0RGoMjjSsIK50VkiAITcAayogrwA3Kkj4IKx4ZGpYSpq6oLt6utJ4AFp4foA2AEYhgZG5Pvt48ioR+A5EdD6vKnhGGg5oZCrIa2coDGwWRxtDyD94WGSzw4uAcUbIz0R2eJp98-vIEQBBQSiMSvd6fA73Fx+cgADxBWA+tHBEMgvEB4jhCK+EJcVD4UNh+Egb3hn2+EFM3wp5PBkGQfioKTuzm8VFIkR8dAATABWORIqBhUiMWJc3n8yDkeAAT0++AIZLATmxkEasFKnj86FIGSxyqoiDSjG1L3wSuxUDS5EwjhIpCo5EYniE5CSLX2UGgUvpr3QWG18A8ligc0i+sd+De5HIpn5yIJioVyLI9vDUCe8BeseVyBSAaoNoAXjR0HRUAHkjHEz9Pd7CQBHVhIaAxFikGqQKvUztQKVM80uZMOjUw3X9qA5vOF4ul8tUStjlw1-P1xsZFvN9vdqnY7eHef3M3VhAoY44OXdw-myCRWAFPzxXtyyDO12fKzdlxNOgESCwoOQXt3wXYN0CoZBkGHP8PygdJPHTF4tyrIDlVVdVTVpOB0HKAB1IURXwTl-2aW9yk8WZ4BSdV-yXTxyG1fN92RfVDWNPtlXjYhB1TX93RgL1lygBsm3XNt83-eBoVICCI1YKNGOVR9FVtFNPF7aj+M8IS13sDcxKgCSpLoSNoyrXdnDM8wbH3SAABIczWRpPB8fxAhCdpFmiWIEg4Uh0CCeyqEaIJ3L6OjqGCwwOAAK2QWCaUtdgUC5GkyxSKhoBtLinRdZowQ9DTCWWP1EADMx4vSMgTUVClTCAA Open this visualization in the Vega Editor>
+<https://vega.github.io/editor/#/url/vega-lite/N4IgLgTghgdgzgMwPYQLYgFwG1QIJYA2YAphJiABQAmUYArqgHQAiAogPoCSAwgEoDKAAgB8AXkEAGAJSCAZIOq0GLDjwGCAPOIAs0kAF8AugBoQNMFEyg6EAuQAWYMAAc4GAPTvoAd0YBzPDB7OgAjOjhSAGMkGBJYxmjUd2YkOj8AIRsAa2J3ewA3Yj8od1QoOBIIPMLi93MS4rwoAFooFoA2AEZ21s6JZosQgmJOqEYYJGb7YigqUkYwOHyQU2Q0WisQZygICM2AcTK-chgGENIVkF4AQS4+fhOzi9NnAgAPR9RzslM2O4FPt9LsR2K8PhgQKcvhd9LDTHBnMRIptpng-I5MAAmACsElM3jwVCCWNxpgIUAAnhdsKAyhAsuRnEg8LFgTBolQWccMKBogQUJt8MQCFRyNwCOFKpdhn5iDBRRhTgQCPpTODcHhhQqQIcoMd4ZEoMNNgAvUhITAII0RVXgCmI8gARzosDAgVoeEKBlMFMFmpFjPelzghuNPJAZogFowVoINtMYHtxCdLti7rdXthqtAkFgiBQ6BpID8UbozhCvuwIHFkouJhA-OIcDggY+phi5F1xyMpjpDPDFSjOQA6oTiRhMfDIEgcuQhlBIgyE0nyAQWcnbXKOVzNuqQEKAxCu8HQ8nw5Ho7H43aHRDna7056Nz6-VrWyejWfQBfLdbiLbE1vEB7zTCwMw3WFDFtAASENpjKBwnFcDx3BqMYAiCUJGDwJB3Dg4gylQooWjXEhUO0RgACs4A7Uw+QYeAsVWBdiDAV9D2rCUKmeG8z0hJBUBZI0DH0IA Open this visualization in the Vega Editor>
 
 @
 let simplify = transform
                . filter (FExpr \"(datum.DE_ICRS >= 0) & (datum.DE_ICRS <= 40)\")
 
-    rawEnc = encoding
-            . position X [ PName \"Gmag\"
-                         , PmType Quantitative
-                         , PScale [ SZero False ]
-                         ]
-            . position Y [ PName \"plx\"
-                         , PmType Quantitative
-                         , PScale [ SZero False ]
-                         ]
+    baseEnc = encoding
+             . position X [ PName \"Gmag\"
+                          , PmType Quantitative
+                          , PScale [ SZero False ]
+                          ]
+             . position Y [ PName \"plx\"
+                          , PmType Quantitative
+                          , PScale [ SZero False ]
+                          ]
+
+    rawEnc = baseEnc
             . color [ MName \"Cluster\"
-                    , MmType Nominal
                     , MLegend []
                     ]
 
     rawLayer = asSpec [ rawEnc [], mark Point [] ]
 
     trans = transform
-            . 'loess' \"plx\" \"Gmag\" [ 'LsAs' \"x\" \"y\"
-                                 , 'LsGroupBy' [ \"Cluster\" ] ]
-
-    trendAx pos lbl = position pos [ PName lbl
-                                   , PmType Quantitative
-                                   , PAxis []
-                                   ]
-    trendEnc = encoding
-               . trendAx X \"x\"
-               . trendAx Y \"y\"
+            . 'loess' \"plx\" \"Gmag\" [ 'LsGroupBy' [ \"Cluster\" ] ]
 
     trendLayer = asSpec [ trans []
-                        , trendEnc []
+                        , baseEnc []
                         , mark Line [ MStroke \"black\"
                                     , MStrokeWidth 2
                                     ]
@@ -4306,36 +4343,28 @@
   let simplify = transform
                  . filter (FExpr "(datum.DE_ICRS >= 0) & (datum.DE_ICRS <= 40)")
 
-      rawEnc = encoding
-              . position X [ PName "Gmag"
-                           , PmType Quantitative
-                           , PScale [ SZero False ]
-                           ]
-              . position Y [ PName "plx"
-                           , PmType Quantitative
-                           , PScale [ SZero False ]
-                           ]
-              . color [ MName "Cluster"
-                      , MmType Nominal
-                      , MLegend []
-                      ]
+      baseEnc = encoding
+                . position X [ PName "Gmag"
+                             , PmType Quantitative
+                             , PScale [ SZero False ]
+                             ]
+                . position Y [ PName "plx"
+                             , PmType Quantitative
+                             , PScale [ SZero False ]
+                             ]
 
+      rawEnc = baseEnc
+               . color [ MName "Cluster"
+                       , MLegend []
+                       ]
+
       rawLayer = asSpec [ rawEnc [], mark Point [] ]
 
       trans = transform
-              . loess "plx" "Gmag" [ LsAs "x" "y"
-                                   , LsGroupBy [ "Cluster" ] ]
-
-      trendAx pos lbl = position pos [ PName lbl
-                                     , PmType Quantitative
-                                     , PAxis []
-                                     ]
-      trendEnc = encoding
-                 . trendAx X "x"
-                 . trendAx Y "y"
+              . loess "plx" "Gmag" [ LsGroupBy [ "Cluster" ] ]
 
       trendLayer = asSpec [ trans []
-                          , trendEnc []
+                          , baseEnc []
                           , mark Line [ MStroke "black"
                                       , MStrokeWidth 2
                                       ]
@@ -4364,42 +4393,28 @@
 
 <<images/vl/regressionexample.png>>
 
-<https://vega.github.io/editor/#/url/vega-lite/N4KABGBEAuBOCGA7AzgMwPawLaQFxgG1hJUBLAG2gFNY8oAKAE3mgFcsA6AEQFEB9AJIBhAEoBlMAD4AvGAAMASjAAyMExbtu-YeLAAeWQBZFkAL4BdADTgoACyqkA5reh0AzHLnWIkZtHh0oBA+rLDkdJAu0AAOyLgA9PEIAO4cjqTQtqwARqzINADG6IjUJRxFWPFc6KyOAEKhANZU8bYAblSO8PFY8MjUsK0dXfF+3V2k8AC08NMAbACMczMLclP+2eRUC-AciOhT9vCMNBzQyG2Q3sEkmL2u+EHBPtHwsPmBNs8+AOK9jhFEOxsjQrl9vpARABBQSiMSA4Gg67fKDRcgADwRWBBtGREN4sPEWJxYJRPiofDRmPwkCB2NB4IgpnBzKZ10gyVIjEy7k87IAJMgCvZehEorEEvFhrt0pkchxSOh4kKRd1pVNyBkWm1DBwAFbIYqkqDkeAAT1B+AI4Kez0gvVgjQi0XQpBKxrtVEQRUYboBj0ZNyK5EwgRIpCo5EYESE5DyAyuUGgZuiVEB6Cwbvg4VMeLt1LAtrJ4cj0Zpf3gALzEKF2bTj0gAC8aOg6Khs-lc4G7cnUxEAI6sJDQDIsUgdSDdsBdslQM1hsil50YxOQWtbMPN2Ct-Dt8idyxJlP1qCD4ejkcT1nfa9sm2BmAIFAYbB0a2zosoyCObesaLZecrUgWN41BKwpx8Po30gTFD0gedwNnHxYE6FDkGQRVEGXWCIKgI1y3+SdZ1vYJEIhB0nQbfpt2aAB1LkeXwAAmODqPQZoIk2eACidODexPSBNUQNMZwhL0fT9T5Z0gYNQwbRcoxjON+iRI8+xpfZM0QbMzGrHwC2IBSyygWC1IEs8Sgvcc0zg+B0VIZA6CBchyFEr9AMLEtFJpec+OPAch0s-xLxsqA7IcpzWBckimRZGwyJk4oyH9QtmVMIA Open this visualization in the Vega Editor>
+<https://vega.github.io/editor/#/url/vega-lite/N4IgLgTghgdgzgMwPYQLYgFwG1QIJYA2YAphJiABQAmUYArqgHQAiAogPoCSAwgEoDKAAgB8AXkEAGAJSCAZIOq0GLDjwGCAPOIAs0kAF8AugBoQAC2J4A5mbCYAzBImmaYKJlB0IBcrbAAHOAwAemDoAHdGKzwwMzoAIzo4UgBjJBgSDMY01GDmJDorACEvAGtiYLMAN2IrKGDUKDgSCEqauuDXerq8KABaKH6ANgBGIYGRiT63eIJiEahGGCQ+iygqUkYwOCqQU2Q0Wg8QfygIZOOAcUarchgGeNI9kF4AQS4+fjuHp9N-AgAHt9UI8yKY2B8BMDQc9iOx-kCMCB7iCnvp0aZwngqLEHE5TAASOApCyNXxgAJBULtRbRWIJRh4JDBYmk+o0voEGIVKraRgAKzg6WeBCgAE8nthQI0IKVyP4kHgMrCYGkqErbhhQGkCChjvhiAQqORuAQki0DKZEbg8IbjUjrlBbqZiVA5scAF6kJCYBBu5L6UxgMX+YjkACOdFgYBitDwNUtIDF+ttRvlgOervdWpAXogPowfoIAaDIbDSMj0djMYT6MDoEgsEQKHQUpAVnzdH88WT2BApvNTxMIAgtVHcDgTJg6aBpmFDpuBmHMrlOea+fKAHVsbiMAAmF2QJDlcizKApOWl0PkLkwMOBkDEVVIdUwTXapC6sg5g1ppED5o0StFM7XIR1nRALNy1APMCyLEtwDLCMowyat43vUxextUCkQRTMUjdaDc29X1-WIB9g2vCsUJjNwa3vdFDH0IA Open this visualization in the Vega Editor>
 
 @
 let simplify = transform
                . filter (FExpr \"(datum.DE_ICRS >= 0) & (datum.DE_ICRS <= 40)\")
 
-    rawAx pos lbl = position pos [ PName lbl
-                                 , PmType Quantitative
-                                 , PScale [ SZero False ]
-                                 ]
-    cluster = color [ MName \"Cluster\"
-                    , MmType Nominal
-                    ]
-
-    rawEnc = encoding
-             . rawAx X \"Gmag\"
-             . rawAx Y \"plx\"
-             . cluster
+    axis pos lbl = position pos [ PName lbl
+                                , PmType Quantitative
+                                , PScale [ SZero False ]
+                                ]
+    enc = encoding
+          . axis X \"Gmag\"
+          . axis Y \"plx\"
+          . color [ MName \"Cluster\" ]
 
-    rawLayer = asSpec [ rawEnc [], mark Point [] ]
+    rawLayer = asSpec [ enc [], mark Point [] ]
 
     trans = transform
-            . 'regression' \"plx\" \"Gmag\" [ 'RgAs' \"x\" \"y\"
-                                      , 'RgGroupBy' [ \"Cluster\" ] ]
-
-    trendAx pos lbl = position pos [ PName lbl
-                                   , PmType Quantitative
-                                   , PAxis []
-                                   ]
-    trendEnc = encoding
-               . trendAx X \"x\"
-               . trendAx Y \"y\"
-               . cluster
+            . 'regression' \"plx\" \"Gmag\" [ 'RgGroupBy' [ \"Cluster\" ] ]
 
     trendLayer = asSpec [ trans []
-                        , trendEnc []
+                        , enc []
                         , mark Line [ MStroke \"black\"
                                     , MStrokeWidth 2
                                     ]
@@ -4424,36 +4439,22 @@
   let simplify = transform
                  . filter (FExpr "(datum.DE_ICRS >= 0) & (datum.DE_ICRS <= 40)")
 
-      rawAx pos lbl = position pos [ PName lbl
-                                   , PmType Quantitative
-                                   , PScale [ SZero False ]
-                                   ]
-      cluster = color [ MName "Cluster"
-                      , MmType Nominal
-                      ]
-
-      rawEnc = encoding
-               . rawAx X "Gmag"
-               . rawAx Y "plx"
-               . cluster
+      axis pos lbl = position pos [ PName lbl
+                                  , PmType Quantitative
+                                  , PScale [ SZero False ]
+                                  ]
+      enc = encoding
+            . axis X "Gmag"
+            . axis Y "plx"
+            . color [ MName "Cluster" ]
 
-      rawLayer = asSpec [ rawEnc [], mark Point [] ]
+      rawLayer = asSpec [ enc [], mark Point [] ]
 
       trans = transform
-              . regression "plx" "Gmag" [ RgAs "x" "y"
-                                        , RgGroupBy [ "Cluster" ] ]
-
-      trendAx pos lbl = position pos [ PName lbl
-                                     , PmType Quantitative
-                                     , PAxis []
-                                     ]
-      trendEnc = encoding
-                 . trendAx X "x"
-                 . trendAx Y "y"
-                 . cluster
+              . regression "plx" "Gmag" [ RgGroupBy [ "Cluster" ] ]
 
       trendLayer = asSpec [ trans []
-                          , trendEnc []
+                          , enc []
                           , mark Line [ MStroke "black"
                                       , MStrokeWidth 2
                                       ]
diff --git a/src/Graphics/Vega/VegaLite.hs b/src/Graphics/Vega/VegaLite.hs
--- a/src/Graphics/Vega/VegaLite.hs
+++ b/src/Graphics/Vega/VegaLite.hs
@@ -1,6 +1,6 @@
 {-|
 Module      : Graphics.Vega.VegaLite
-Copyright   : (c) Douglas Burke, 2018-2020
+Copyright   : (c) Douglas Burke, 2018-2021
 License     : BSD3
 
 Maintainer  : dburke.gw@gmail.com
@@ -14,14 +14,10 @@
 it has been updated to match later versions.  This module allows users
 to create a Vega-Lite specification, targeting __version 4__ of the
 <https://vega.github.io/schema/vega-lite/v4.json JSON schema>.
-Version 0.10 of @hvega@ supports version 4.13 of the Vega-Lite specification.
+Version 0.12 of @hvega@ supports version 4.15 of the Vega-Lite specification.
 
-Although this is based on the Elm module, there are differences, such
-as using type constructors rather than functions for many properties -
-such as @'VL.PName' \"HorsePower\"@ rather than @pName \"HorsePower\"@ -
-and the return value of 'VL.toVegaLite'. The intention is to keep close
-to the Elm module, but it is more a guide than an absolute
-requirement!
+Although this was based on the Elm module, there have been a number of
+changes - on both sides.
 
 Please see "Graphics.Vega.Tutorials.VegaLite" for an introduction
 to using @hvega@ to create visualizations. The
@@ -65,7 +61,7 @@
     enc = 'VL.encoding'
             . 'VL.position' 'VL.X' [ 'VL.PName' \"Horsepower\", 'VL.PmType' 'VL.Quantitative' ]
             . 'VL.position' 'VL.Y' [ 'VL.PName' \"Miles_per_Gallon\", 'VL.PmType' 'VL.Quantitative', 'VL.PTitle' \"Miles per Gallon\" ]
-            . 'VL.color' [ 'VL.MName' \"Origin\", 'VL.MmType' 'VL.Nominal' ]
+            . 'VL.color' [ 'VL.MName' \"Origin\" ]
 
     bkg = 'VL.background' \"rgba(0, 0, 0, 0.05)\"
 
@@ -92,7 +88,7 @@
 
 The visualization can be viewed in the Vega Editor, which lets you
 interact with the plot and modify its contents, as shown for
-<https://vega.github.io/editor/#/url/vega-lite/N4IgtghgTg1iBcoAuB7FAbJBLADg0AxigHZICmpCIFRAJlsQOYgC+ANCEgJ45lUFYoBdH3YhaEJBHwgArlHRUAFkiQ4AzvAD0WgG5lGEAHSMsSJbIBGRrCj0GIAWglT1ZJOq0uIWgtHVGAFbqJKwcACTqBEpkkMqqGtr2hiZmFta2WlExkMlO6GZkegAsQSHEIBw0KPRMMkToKFAyAGZYZOi0VADyUFimFRzcvFTEKGAMEIpiAB6t7Z1UABJNbjgoAO5kzUM8fPAgAI6yEKRmklj6YSBc8x1dBwCyWCLqAPq8UG8A4lONg5wzCIqM9XgACT5g37of6VTh7KjHU7YKTYK4sMSWCAEGCMKAoWTEB4gKCMLEACgADGxqbSjJSAKwASlYQA this example>.
+<https://vega.github.io/editor/#/url/vega-lite/N4IgtghgTg1iBcoAuB7FAbJBLADg0AxigHZICmpCIFRAJlsQOYgC+ANCEgJ45lUFYoBdH3YhaEJBHwgArlHRUAFkiQ4AzvAD0WgG5lGEAHSMsSJbIBGRrCj0GIAWglT1ZJOq0uIWgtHVGAFbqJKwcACTqBEpkkMqqGtr2hiZmFta2WlExkMlO6GZkegAsQSHEIBw0KPRMMkToKFAyAGZYZOi0VADyUFimFWIAHq3tnVQAEk1uOCgA7mTNHNy8VACOshCkZpJY+mEgXKMdXfAgALJYIuoA+rxQNwDiEOiNFctmIlSX1wAE979nq9QsseHwzhsttgpNh9iwxJYIAQYIwoChZMRTiAoIxEQAKAAMbF+RJJxIJRgJAFYAJSsIA this example>.
 
 It can also be viewed as a PNG version:
 
@@ -156,7 +152,7 @@
       -- Define the properties used for the "position" channels. For this example
       -- it makes sense to define as functions since they are used several times.
       --
-      pos1Opts fld ttl = ['VL.PName' fld, 'VL.PmType' 'VL.Quantitative', 'VL.PAxis' ['VL.AxTitle' ttl]]
+      pos1Opts fld ttl = ['VL.PName' fld, 'VL.PmType' 'VL.Quantitative', 'VL.PTitle' ttl]
       x1Opts = pos1Opts \"days\" \"Days since January 1, 2020\"
       y1Opts = pos1Opts \"magnitude\" \"Magnitude\" ++ ['VL.PSort' ['VL.Descending'], y1Range]
       y1Range = 'VL.PScale' ['VL.SDomain' ('VL.DNumbers' [-1, 3])]
@@ -164,7 +160,7 @@
       -- The filter name is used as a facet, but also to define the
       -- color and shape of the points.
       --
-      filtOpts = ['VL.MName' \"filterName\", 'VL.MmType' 'VL.Nominal']
+      filtOpts = ['VL.MName' \"filterName\"]
       filtEnc = 'VL.color' ('VL.MLegend' ['VL.LTitle' \"Filter\", 'VL.LTitleFontSize' 16, 'VL.LLabelFontSize' 14] : filtOpts)
                 . 'VL.shape' filtOpts
 
@@ -199,8 +195,8 @@
       -- What is plotted in the "detail" plot?
       --
       selName = \"brush\"
-      pos2Opts fld = [ 'VL.PName' fld, 'VL.PmType' 'VL.Quantitative', 'VL.PAxis' ['VL.AxNoTitle']
-                     , 'VL.PScale' ['VL.SDomain' ('VL.DSelectionField' selName fld)] ]
+      pos2Opts fld = [ 'VL.PName' fld, 'VL.PmType' 'VL.Quantitative', 'VL.PNoTitle'
+                     , 'VL.PScale' ['VL.SDomainOpt' ('VL.DSelectionField' selName fld)] ]
       x2Opts = pos2Opts \"days\"
       y2Opts = pos2Opts \"magnitude\" ++ ['VL.PSort' ['VL.Descending']]
 
@@ -231,7 +227,6 @@
       --
       details = 'VL.asSpec' [ 'VL.columns' 1
                        , 'VL.facetFlow' [ 'VL.FName' \"filterName\"
-                                   , 'VL.FmType' 'VL.Nominal'
                                    , 'VL.FHeader' headerOpts
                                    ]
                        , 'VL.spacing' 10
@@ -266,7 +261,7 @@
 However this is missing the interactive elements of the visualization, primarily
 selection and zooming in the top plot changes the axis ranges of the bottom two
 plots. This interactivity requires a Vega-Lite viewer such as
-<https://vega.github.io/editor/#/url/vega-lite/N4KABGBEAuBOCGA7AzgMwPawLaQFxgG1wIxhJUBLAG2gFNY8oATeaAVywDpKb6A5eFloEADAF0wAXmlgA5ADVZkAL4AaYhDI86DfJBbsuWeAHNEFdk1pgAPGAAsK9SVKR4yRvvgBPD6qgAxvBUAWxUrLSeBhycAFZMYAC0YABM9gCsAByZ9gCcnCIqxGLOgeiIlCaMoC5uAB4UHvg1LlDQFlS0AGLl0ADqtBQmABbQnoiYxlSQpbXhAEa0VD2I0ADKFABekfgAjPazJDAd3b0b24y7AGwaYMrEasRe0PDVt5BssNN6o9AADshcAB6IEIADunBMFmGbHmbGQ9ACvVoq04SKwQIAIug2CYAEKfADWtCBwwAbrQTPAgcZkDpSRSqUCDNTFnQqCZaPDaIkUiI+YkRABmRK7fKxZDlSAPUqQMlIxBBMb4IguFq1YaDEbKsC7dIiQ4QSDGWCE6qQdB-eABCzeRgiTjpfwwbx-HZQP7oCirGZQHidJiMVDBBGPVpQMEUJjQYaMK4iA23I0IzoBdpS5pJo7zWDw2OZ8O1b0Wc11RgEXl8-y7BMlKB2lWCx3+FKOsRhwtGlFIpjekxNQiQMvOu0lLO1aCu92Qb06MnBaWd+7hju1bvoXuIKoFwuQJFUTBvTtGyhLQN6bT8QSRQ2tF1u8boLDehe3uaUlHn0jju8LJYrdYtndfY3zvdpoE6TwumoHQZh-CcTgA85gJuY87h-Vc72QYZ4AfZpyAoM9PEvWABCEX172nCZn0QBdMNqMsd07AiiL0FhfDgtDKM8ABHNgkHA1gKApTjj3qRpzXAyC9ExHxkDAZBvQCawACkkH42BvF1Ft+UKZdC3oo4G2-LjTyoL9jVMcxLBveCoGQIJpNcJgn3gb1y1FfwhXbUDk0wHV9FoBzPz7UTmMnPCoD4gSLCEkTfKgeAGgHMgpOnABZKyLDYKwiiXLN9IgTD1SOZA3QCI9d01IZRkufVQMs01zUta1bXtZs2inTxPVnCj-VoL9gyoUMGsjaN8zAeNE2Y9dN23EyxP3Q8mLEsyLJIsjbLQo0Iqop8X2mBKjU6TlEC-EquL-ZYziAy4DjshCIOnaDeAYI6jjSpDbr2VDtsKgyEsgbDcPdLRCPM4iYKvcjnV2x8aLowHGIW0zwYs9i-Ae+zHNB-RXPc-C1qiOSKJTWg0woDMoBzPMVEM8NuL0aLVli9p4qx8SUuOJ7GEQMIqH+ldAeMi7dyJvRjDMbLcveoGcfNFzjAJ1xxagSXrJym97KWcn00QTwaewunZclWAAqsYKztC2W4aZ-iWZeNmtu2znJJOXn+cF1ovaKgrbz3dAqA4FBLn94NlJ1UWTzRyHXs2sK701eArF0FHdyugBBRVhmWqBPwThmroAUTqP5U8gWQXp0fBZDAABqMBoi4K6C9-eBFioAAFZO5sYXl7su9v-xui4fsBtKPaoKhAczqghn1vRYBqsYMIa22oGog7F29-2ytardLhEW59LHI0ABIHM1YxPF+AFgSBRl4EhaFYU4SmgUv2hjAfyl4ESOe6AP3sHESU+tZQTxWjAWgdQAp4loOyD83JZDyXVtLawQh3CfC-iiaAyB-D7nCHQBI8wtIZwzvINYAB5BO5AR7AUyDKJ4FsAhLz+HrTwAAJdAYIwA4XknA9knIkHyRzMvRAQV5LziXgNfw8x3ADTAOURurB4BgAIREYhpDyFULAAAClvoCEEYJjGcHgPAMkkpOCYBMECAAlJwMAABNHECkc5hASCGdAYADzoEJGAVgvDoD-EMUCaAkYgn0DRE+IEbIljzHQNAfxZ1AnBPvlCGMr90SkgoH8P4xIYnwLiQkhxABJRJYJ3D+KnmAGM1gECckUYgBS6AbTBDAEIXsqiAm1IUi8M2ijUCpF0pwaUyggA the Vega Editor>.
+<https://vega.github.io/editor/#/url/vega-lite/N4IgLgTghgdgzgMwPYQLYgFwG1QIJYA2YAphJiACZRgCuqAdPkaQHJSrFYAMAugAQBeIXwDkANREgAvgBpchEmQyVqdeqigBzGHloVifADx8ALNLkgocclQCe1mSADGUAk5oFqxG6oYArCj4AWj4AJhMAVgAOKJMATnouaR5HJyQYfE1MUCgADzxrDFAwXQJiADF0sAB1YjxNAAswchgUDQIQR08AI2ICSpgwAGU8AC9vDABGE0cSsDKB4bGJyYA2KVkVMChskBoIDuUmsAAHOAwAegvoAHd6TV0Gmm6aOFI0weJB+jTUC4ARJA0TQAIX2AGtiBcGgA3YiaKAXDRwRTQuEIi5UbYXXokAiaYivYhBUJcUlBLgAZiCkwSfjg6XMIBhHxczWwoAadUa7MmES4jg0EHBuyQJygTl0tkwXHoEVmthOExAJyQeEGnRATDKFEwCFcb02NzwFDADUwqy4ApAbzKThKjKKIG6EFe5qd6t0u1ymCwJNJMkmVpSIGl2ApcpkoTlPE2XzSFHVmkKWBAPsc0pDYEVyvVihhrmkcZgCaTuzSBBQu3wfV1yiYijYHE1ZQJMDroB6fUWI3GmGms1KyvKClImrmCyqvZW602cAaUCV1bwtfIDdY7G8mx9TprBDrKns46H5H+UHsfDg6qcBgAUrAaFAILY+JMZGEyUkFUvlABHR+DLo1B4HCTJhvIq7KBo2i6DQ+ianALhlLsFBIBo6q+jSMiUrGjgMhA7KUMQiFfImMBZIO8zKgAsloOh6N437Kv+sBzMBoEbLIoBwEqTi7Fy9RNP2-KCk+IpOmKEpSjKkbgDm5CqnmmrasQdb6gQhqOMaprupa1rxkgZFZE6FZVruK77muo4QE2jEgK2pG7F2-RTss-YzOAJ7KCOzBkJRk6DNO-aznhC4-hBln1tZtlMjuEUHnYDg2khEygKh6EwMukGHkltrEPaeCOs6rrzkW-kTDAHgEEx5AsYB2wlBxGZZZFIDQfRcF2YhripZQaFQBh5nZe1sHwXhfT5Q6mXKC6bplTaKCEfoJHtmW5WYJVBDVXJP4gHVbGNVuGypEgBB0PA-aOPqN7svFVm+TFjhclA+hKJ2UC9AQACCJYNGZICOV0H19AAorkJxKCAIg+YoGCiHwADUfBYmozktsDBAAAovUZmAkh5zk9m5UyrOtGCbdtzlfQQ9TTSAECCc0x02uKkrkf2XBSCGAAkiFcho5DHGclwXOiUD3I8zz0IVFx88QGii-CUBBDTJCiyY9D0oyZPFMQuSESCxB4vChJvCIcB8CNDGW8QVj7PLXxgHA74Vp4JCBN0L5fV9YhDAA8sprl9lMUSbMtTgMycU3kAAEkgNx8AuFuG3iBJEubfAuozMDERbBYM6p77dFYql8OkyPUFAfCu14Htez7-t8AAFEL5xXDcHf0FAUAwgy9AoJoFwAJT0HwACaQKXn9HiBAaSB8JWSDgnw1CJ2ApxtxcYDGuvpA-GhOJG303RIGAK-tmvG8iw8ZpS780J4CcJyQofeIn2Ao8AJJnzcVgr1tfAzQGGgASMuMBLxIElK4G2iYq6ryAZebYBEy4IA-KSeg0ggA the Vega Editor>.
 
 -}
 
@@ -664,6 +659,7 @@
        , VL.categoricalDomainMap
        , VL.domainRangeMap
        , VL.ScaleDomain(..)
+       , VL.DomainLimits(..)
        , VL.ScaleRange(..)
        , VL.ScaleNice(..)
        , VL.NTimeUnit(..)
@@ -857,6 +853,17 @@
          --
          -- $update
 
+         -- ** Version 0.12
+         --
+         -- $update01202
+         -- $update01201
+         -- $update01200
+         
+         -- ** Version 0.11
+         --
+         -- $update01101
+         -- $update01100
+
          -- ** Version 0.10
          --
          -- $update01000
@@ -1263,6 +1270,75 @@
 -- The following section describes how to update code that used
 -- an older version of @hvega@.
 
+-- $update01202
+-- The @0.12.0.2@ release adds support for version 2.0 of the text package.
+-- There are no changes to the code.
+
+-- $update01201
+-- The @0.12.0.1@ release is purely to support bytestring 0.11 when
+-- running the tests. There are no changes to the code.
+
+-- $update01200
+-- The @0.12.0.0@ release allows @hvega@ to be built with version 2.0 of the
+-- [aeson package](https://hackage.haskell.org/package/aeson). There are
+-- no changes to the API of @hvega@, but it does mean that you may need
+-- to update code that directly creates JSON, such as 'VL.dataFromJson'.
+-- It is likely that 'VL.LabelledSpec' type and the related
+-- @toXXXSpec/fromXXXSpec@ functions, such as 'VL.fromSelectSpec' and
+-- 'VL.toSelectSpec', will be updated once we can drop
+-- support for versions of @aeson@ prior to 2.0.
+--
+
+-- $update01101
+-- The @0.11.0.1@ release is purely to support testing with @hashable@ 0.3.1.0.
+-- There are no changes to the module.
+--
+
+-- $update01100
+-- The @0.11.0.0@ release updates @hvega@ to support version 4.15 of
+-- the Vega-Lite schema.
+--
+-- Note that @hvega@ does __not__ provide any information to help users
+-- take advantage of the (new to 4.14) ability to
+-- omit the type of a field when
+-- [it can be inferred](https://vega.github.io/vega-lite/docs/type.html).
+-- As the type is currently optional in @hvega@ users can just
+-- not give a type. The example [IHaskell notebooks](https://github.com/DougBurke/hvega/tree/master/notebooks)
+-- have been updated to show off the optional support.
+--
+-- Similarly, Vega-Lite 4.14 allows you to share the type, scale, axis,
+-- and legend in a shared encoding. There is no explicit support added in
+-- @0.11.0.0@ because @hvega@ already allowed you to create the specification.
+--
+-- __New constructors__
+--
+-- The 'VL.OrderChannel' type has gained 'VL.OBand', 'VL.OTitle'/'VL.ONoTitle',
+-- and conditional-predicate support with 'VL.ODataCondition',
+-- 'VL.OSelectionCondition', and 'VL.ONumber' constructors.
+--
+-- The 'VL.MarkChannel' type has gained the 'VL.MNullValue' constructor.
+--
+-- 
+-- The 'VL.ScaleRange' type has gained 'VL.RField', 'VL.RMax', and 'VL.RMin'
+-- constructors.
+--
+-- __Breaking Changes__
+--
+-- Domain settings in 'VL.ScaleProperty' and associated types have been
+-- changed to better match the Vega-Lite schema: 'VL.SDomain' now takes
+-- a new type ('VL.DomainLimits') which actually contains many of the
+-- orignal symbols (so hopefully will require no changes), and a new
+-- constructor has been added ('VL.SDomainOpt') which takes the
+-- 'VL.ScaleDomain' type, which has seen new constructors - 'VL.DMax',
+-- 'VL.DMaxTime', 'VL.DMid', 'VL.DMin', and 'VL.DMinTime' - as well as
+-- some constructors moving to 'VL.DomainLimits'.
+--
+-- __Deprecated symbols__:
+--
+-- The 'VL.SDomainMid' constructor of 'VL.ScaleProperty' will be removed in a
+-- future release as it has been replaced by the 'VL.DMid' constructor
+-- in 'VL.ScaleDomain'.  
+  
 -- $update01000
 -- The @0.10.0.0@ release updates @hvega@ to support version 4.13 of
 -- the Vega-Lite schema.
diff --git a/src/Graphics/Vega/VegaLite/Configuration.hs b/src/Graphics/Vega/VegaLite/Configuration.hs
--- a/src/Graphics/Vega/VegaLite/Configuration.hs
+++ b/src/Graphics/Vega/VegaLite/Configuration.hs
@@ -3,12 +3,12 @@
 
 {-|
 Module      : Graphics.Vega.VegaLite.Configuration
-Copyright   : (c) Douglas Burke, 2018-2020
+Copyright   : (c) Douglas Burke, 2018-2021
 License     : BSD3
 
 Maintainer  : dburke.gw@gmail.com
 Stability   : unstable
-Portability : OverloadedStrings
+Portability : CPP, OverloadedStrings
 
 Top-level configuration options. As this can configure most
 of a visualization, it needs to import most of the other
@@ -38,9 +38,11 @@
 
 
 import qualified Data.Aeson as A
+
 import qualified Data.Text as T
 
 import Data.Aeson ((.=), object)
+import Data.Aeson.Types (Pair)
 
 #if !(MIN_VERSION_base(4, 12, 0))
 import Data.Monoid ((<>))
@@ -97,6 +99,7 @@
   , autosizeProperty
   , viewBackgroundSpec
   , cursorLabel
+  , (.=~), toObject
   )
 import Graphics.Vega.VegaLite.Geometry
   ( ProjectionProperty
@@ -110,7 +113,7 @@
   )
 import Graphics.Vega.VegaLite.Mark
   ( MarkProperty
-  , mprops_
+  , oldMprops_
   )
 import Graphics.Vega.VegaLite.Scale
   ( ScaleNice
@@ -530,7 +533,7 @@
 
 
 toAxis :: T.Text -> [AxisConfig] -> LabelledSpec
-toAxis lbl acs = ("axis" <> lbl) .= object (map axisConfigProperty acs)
+toAxis lbl acs = ("axis" <> lbl) .=~ object (map axisConfigProperty acs)
 
 toAxisChoice :: AxisChoice -> T.Text -> [AxisConfig] -> LabelledSpec
 toAxisChoice AxXY lbl = toAxis lbl
@@ -538,14 +541,14 @@
 toAxisChoice AxY lbl = toAxis ("Y" <> lbl)
 
 aprops_ :: T.Text -> [AxisProperty] -> LabelledSpec
-aprops_ f mps = f .= object (map axisProperty mps)
+aprops_ f mps = f .=~ object (map axisProperty mps)
 
 -- easier to turn into a ConfigSpec in config than here
 configProperty :: ConfigurationProperty -> LabelledSpec
-configProperty (ArcStyle mps) = mprops_ "arc" mps
-configProperty (AreaStyle mps) = mprops_ "area" mps
-configProperty (AriaStyle b) = "aria" .= b
-configProperty (AutosizeStyle aus) = "autosize" .= object (map autosizeProperty aus)
+configProperty (ArcStyle mps) = oldMprops_ "arc" mps
+configProperty (AreaStyle mps) = oldMprops_ "area" mps
+configProperty (AriaStyle b) = "aria" .=~ b
+configProperty (AutosizeStyle aus) = "autosize" .=~ object (map autosizeProperty aus)
 configProperty (Axis acs) = toAxis "" acs
 configProperty (AxisBand c acs) = toAxisChoice c "Band" acs
 configProperty (AxisBottom acs) = toAxis "Bottom" acs
@@ -559,78 +562,78 @@
 configProperty (AxisX acs) = toAxis "X" acs
 configProperty (AxisY acs) = toAxis "Y" acs
 
--- configProperty (AxisNamedStyles [(nme, mps)]) = "style" .= object [aprops_ nme mps]
+-- configProperty (AxisNamedStyles [(nme, mps)]) = "style" .=~ object [aprops_ nme mps]
 configProperty (AxisNamedStyles styles) =
   let toStyle = uncurry aprops_
-  in "style" .= object (map toStyle styles)
+  in "style" .=~ toObject (map toStyle styles)
 
-configProperty (BackgroundStyle bg) = "background" .= bg
-configProperty (BarStyle mps) = mprops_ "bar" mps
-configProperty (BoxplotStyle mps) = mprops_ "boxplot" mps
-configProperty (CircleStyle mps) = mprops_ "circle" mps
-configProperty (ConcatStyle cps) = "concat" .= object (map compConfigProperty cps)
-configProperty (CountTitleStyle ttl) = "countTitle" .= ttl
-configProperty (CustomFormatStyle b) = "customFormatTypes" .= b
-configProperty (ErrorBandStyle mps) = mprops_ "errorband" mps
-configProperty (ErrorBarStyle mps) = mprops_ "errorbar" mps
-configProperty (FacetStyle cps) = "facet" .= object (map compConfigProperty cps)
-configProperty (FieldTitleStyle ftp) = "fieldTitle" .= fieldTitleLabel ftp
-configProperty (FontStyle font) = "font" .= font
-configProperty (GeoshapeStyle mps) = mprops_ "geoshape" mps
+configProperty (BackgroundStyle bg) = "background" .=~ bg
+configProperty (BarStyle mps) = oldMprops_ "bar" mps
+configProperty (BoxplotStyle mps) = oldMprops_ "boxplot" mps
+configProperty (CircleStyle mps) = oldMprops_ "circle" mps
+configProperty (ConcatStyle cps) = "concat" .=~ object (map compConfigProperty cps)
+configProperty (CountTitleStyle ttl) = "countTitle" .=~ ttl
+configProperty (CustomFormatStyle b) = "customFormatTypes" .=~ b
+configProperty (ErrorBandStyle mps) = oldMprops_ "errorband" mps
+configProperty (ErrorBarStyle mps) = oldMprops_ "errorbar" mps
+configProperty (FacetStyle cps) = "facet" .=~ object (map compConfigProperty cps)
+configProperty (FieldTitleStyle ftp) = "fieldTitle" .=~ fieldTitleLabel ftp
+configProperty (FontStyle font) = "font" .=~ font
+configProperty (GeoshapeStyle mps) = oldMprops_ "geoshape" mps
 configProperty (HeaderStyle hps) = header_ "" hps
 configProperty (HeaderColumnStyle hps) = header_ "Column" hps
 configProperty (HeaderFacetStyle hps) = header_ "Facet" hps
 configProperty (HeaderRowStyle hps) = header_ "Row" hps
-configProperty (ImageStyle mps) = mprops_ "image" mps
-configProperty (LegendStyle lcs) = "legend" .= object (map legendConfigProperty lcs)
-configProperty (LineStyle mps) = mprops_ "line" mps
+configProperty (ImageStyle mps) = oldMprops_ "image" mps
+configProperty (LegendStyle lcs) = "legend" .=~ object (map legendConfigProperty lcs)
+configProperty (LineStyle mps) = oldMprops_ "line" mps
 
-configProperty (LineBreakStyle s) = "lineBreak" .= s
+configProperty (LineBreakStyle s) = "lineBreak" .=~ s
 
-configProperty (MarkStyle mps) = mprops_ "mark" mps
--- configProperty (MarkNamedStyles [(nme, mps)]) = "style" .= object [mprops_ nme mps]
+configProperty (MarkStyle mps) = oldMprops_ "mark" mps
+-- configProperty (MarkNamedStyles [(nme, mps)]) = "style" .=~ object [mprops_ nme mps]
 configProperty (MarkNamedStyles styles) =
-  let toStyle = uncurry mprops_
-  in "style" .= object (map toStyle styles)
+  let toStyle = uncurry oldMprops_
+  in "style" .=~ toObject (map toStyle styles)
 
-configProperty (NumberFormatStyle fmt) = "numberFormat" .= fmt
-configProperty (PaddingStyle pad) = "padding" .= paddingSpec pad
-configProperty (PointStyle mps) = mprops_ "point" mps
-configProperty (ProjectionStyle pps) = "projection" .= object (map projectionProperty pps)
-configProperty (RangeStyle rcs) = "range" .= object (map rangeConfigProperty rcs)
-configProperty (RectStyle mps) = mprops_ "rect" mps
-configProperty (RepeatStyle cps) = "repeat" .= object (map compConfigProperty cps)
-configProperty (RuleStyle mps) = mprops_ "rule" mps
+configProperty (NumberFormatStyle fmt) = "numberFormat" .=~ fmt
+configProperty (PaddingStyle pad) = "padding" .=~ paddingSpec pad
+configProperty (PointStyle mps) = oldMprops_ "point" mps
+configProperty (ProjectionStyle pps) = "projection" .=~ object (map projectionProperty pps)
+configProperty (RangeStyle rcs) = "range" .=~ object (map rangeConfigProperty rcs)
+configProperty (RectStyle mps) = oldMprops_ "rect" mps
+configProperty (RepeatStyle cps) = "repeat" .=~ object (map compConfigProperty cps)
+configProperty (RuleStyle mps) = oldMprops_ "rule" mps
 configProperty (ScaleStyle scs) = scaleConfig_ scs
 configProperty (SelectionStyle selConfig) =
-  let selProp (sel, sps) = selectionLabel sel .= object (concatMap selectionProperties sps)
-  in "selection" .= object (map selProp selConfig)
-configProperty (SquareStyle mps) = mprops_ "square" mps
-configProperty (TextStyle mps) = mprops_ "text" mps
-configProperty (TickStyle mps) = mprops_ "tick" mps
-configProperty (TimeFormatStyle fmt) = "timeFormat" .= fmt
-configProperty (TitleStyle tcs) = "title" .= object (map titleConfigSpec tcs)
-configProperty (TrailStyle mps) = mprops_ "trail" mps
-configProperty (ViewStyle vcs) = "view" .= object (concatMap viewConfigProperties vcs)
+  let selProp (sel, sps) = selectionLabel sel .=~ object (concatMap selectionProperties sps)
+  in "selection" .=~ toObject (map selProp selConfig)
+configProperty (SquareStyle mps) = oldMprops_ "square" mps
+configProperty (TextStyle mps) = oldMprops_ "text" mps
+configProperty (TickStyle mps) = oldMprops_ "tick" mps
+configProperty (TimeFormatStyle fmt) = "timeFormat" .=~ fmt
+configProperty (TitleStyle tcs) = "title" .=~ object (map titleConfigSpec tcs)
+configProperty (TrailStyle mps) = oldMprops_ "trail" mps
+configProperty (ViewStyle vcs) = "view" .=~ object (concatMap viewConfigProperties vcs)
 
 -- deprecated aliases
-configProperty (Autosize aus) = "autosize" .= object (map autosizeProperty aus)
-configProperty (Background bg) = "background" .= bg
-configProperty (CountTitle ttl) = "countTitle" .= ttl
-configProperty (FieldTitle ftp) = "fieldTitle" .= fieldTitleLabel ftp
-configProperty (Legend lcs) = "legend" .= object (map legendConfigProperty lcs)
-configProperty (NumberFormat fmt) = "numberFormat" .= fmt
-configProperty (Padding pad) = "padding" .= paddingSpec pad
-configProperty (Projection pps) = "projection" .= object (map projectionProperty pps)
-configProperty (Range rcs) = "range" .= object (map rangeConfigProperty rcs)
+configProperty (Autosize aus) = "autosize" .=~ object (map autosizeProperty aus)
+configProperty (Background bg) = "background" .=~ bg
+configProperty (CountTitle ttl) = "countTitle" .=~ ttl
+configProperty (FieldTitle ftp) = "fieldTitle" .=~ fieldTitleLabel ftp
+configProperty (Legend lcs) = "legend" .=~ object (map legendConfigProperty lcs)
+configProperty (NumberFormat fmt) = "numberFormat" .=~ fmt
+configProperty (Padding pad) = "padding" .=~ paddingSpec pad
+configProperty (Projection pps) = "projection" .=~ object (map projectionProperty pps)
+configProperty (Range rcs) = "range" .=~ object (map rangeConfigProperty rcs)
 configProperty (Scale scs) = scaleConfig_ scs
-configProperty (TimeFormat fmt) = "timeFormat" .= fmt
-configProperty (View vcs) = "view" .= object (concatMap viewConfigProperties vcs)
+configProperty (TimeFormat fmt) = "timeFormat" .=~ fmt
+configProperty (View vcs) = "view" .=~ object (concatMap viewConfigProperties vcs)
 
-configProperty (NamedStyle nme mps) = "style" .= object [mprops_ nme mps]
+configProperty (NamedStyle nme mps) = "style" .=~ toObject [oldMprops_ nme mps]
 configProperty (NamedStyles styles) =
-  let toStyle = uncurry mprops_
-  in "style" .= object (map toStyle styles)
+  let toStyle = uncurry oldMprops_
+  in "style" .=~ toObject (map toStyle styles)
 
 {-|
 
@@ -705,7 +708,7 @@
 
 scaleConfig_ :: [ScaleConfig] -> LabelledSpec
 -- scaleConfig_ [] = "scale" .= A.Null  -- not sure here
-scaleConfig_ scs = "scale" .= object (map scaleConfigProperty scs)
+scaleConfig_ scs = "scale" .=~ object (map scaleConfigProperty scs)
 
 
 -- | Indicates the style in which field names are displayed.
@@ -1043,7 +1046,7 @@
       --
       --   @since 0.9.0.0
 
-legendConfigProperty :: LegendConfig -> LabelledSpec
+legendConfigProperty :: LegendConfig -> Pair
 legendConfigProperty (LeAria b) = "bool" .= b
 legendConfigProperty (LeAriaDescription t) = "description" .= t
 legendConfigProperty (LeClipHeight x) = "clipHeight" .= x
@@ -1140,7 +1143,7 @@
     | RSymbol T.Text
 
 
-rangeConfigProperty :: RangeConfig -> LabelledSpec
+rangeConfigProperty :: RangeConfig -> Pair
 rangeConfigProperty rangeCfg =
   let (l, n) = case rangeCfg of
         RCategory nme -> ("category", nme)
@@ -1153,7 +1156,7 @@
   in l .= object [schemeProperty n []]
 
 
-scaleConfigProperty :: ScaleConfig -> LabelledSpec
+scaleConfigProperty :: ScaleConfig -> Pair
 scaleConfigProperty (SCBandPaddingInner x) = "bandPaddingInner" .= x
 scaleConfigProperty (SCBandPaddingOuter x) = "bandPaddingOuter" .= x
 scaleConfigProperty (SCBarBandPaddingInner x) = "barBandPaddingInner" .= x
@@ -1306,7 +1309,7 @@
       --   be used instead.
 
 
-viewConfigProperties :: ViewConfig -> [LabelledSpec]
+viewConfigProperties :: ViewConfig -> [Pair]
 viewConfigProperties (ViewBackgroundStyle bs) = map viewBackgroundSpec bs
 viewConfigProperties (ViewClip b) = ["clip" .= b]
 viewConfigProperties (ViewWidth x) = ["continuousWidth" .= x]
@@ -1674,7 +1677,7 @@
       --   @since 0.5.0.0
 
 
-axisConfigProperty :: AxisConfig -> LabelledSpec
+axisConfigProperty :: AxisConfig -> Pair
 axisConfigProperty (AStyle [s]) = "style" .= s
 axisConfigProperty (AStyle s) = "style" .= s
 
@@ -1899,7 +1902,7 @@
       --   @since 0.4.0.0
 
 
-titleConfigSpec :: TitleConfig -> LabelledSpec
+titleConfigSpec :: TitleConfig -> Pair
 titleConfigSpec (TAlign ha) = "align" .= hAlignLabel ha
 titleConfigSpec (TAnchor an) = "anchor" .= anchorLabel an
 titleConfigSpec (TAngle x) = "angle" .= x
@@ -1954,7 +1957,7 @@
       --   Prior to @0.6.0.0@ this was either @ConcatSpacing@ or @FSpacing@.
 
 
-compConfigProperty :: CompositionConfig -> LabelledSpec
+compConfigProperty :: CompositionConfig -> Pair
 compConfigProperty (CompColumns n) = "columns" .= n
 compConfigProperty (CompSpacing x) = "spacing" .= x
 
diff --git a/src/Graphics/Vega/VegaLite/Core.hs b/src/Graphics/Vega/VegaLite/Core.hs
--- a/src/Graphics/Vega/VegaLite/Core.hs
+++ b/src/Graphics/Vega/VegaLite/Core.hs
@@ -4,7 +4,7 @@
 
 {-|
 Module      : Graphics.Vega.VegaLite.Core
-Copyright   : (c) Douglas Burke, 2018-2020
+Copyright   : (c) Douglas Burke, 2018-2021
 License     : BSD3
 
 Maintainer  : dburke.gw@gmail.com
@@ -174,9 +174,15 @@
 import Prelude hiding (filter, lookup, repeat)
 
 import qualified Data.Aeson as A
+
+#if MIN_VERSION_aeson(2, 0, 0)
+import qualified Data.Aeson.Key as Key
+#endif
+
 import qualified Data.Text as T
 
 import Data.Aeson (object, toJSON, (.=))
+import Data.Aeson.Types (Pair)
 import Data.Maybe (mapMaybe)
 
 #if !(MIN_VERSION_base(4, 12, 0))
@@ -259,6 +265,7 @@
   , cInterpolateSpec
   , viewBackgroundSpec
   , symbolLabel
+  , (.=~), toObject, toKey
   )
 import Graphics.Vega.VegaLite.Input
   ( Data
@@ -275,16 +282,17 @@
   )
 import Graphics.Vega.VegaLite.Scale
   ( ScaleDomain(..)
+  , DomainLimits(..)
   , ScaleRange(..)
   , ScaleNice
-  , scaleDomainSpec
+  , scaleDomainProperty
+  , domainLimitsSpec
   , scaleNiceSpec
   )
 import Graphics.Vega.VegaLite.Specification
   ( VLProperty(..)
   , VLSpec
   , PropertySpec
-  , LabelledSpec
   , EncodingSpec(..)
   , BuildEncodingSpecs
   , TransformSpec(..)
@@ -297,7 +305,7 @@
 import Graphics.Vega.VegaLite.Time
   ( DateTime
   , TimeUnit
-  , dateTimeProperty
+  , dateTimeSpec
   , timeUnitSpec
   )
 import Graphics.Vega.VegaLite.Transform
@@ -318,6 +326,7 @@
   , imputeTS
   )
 
+
 --- helpers
 
 -- This could be extended to any Ord type but specialize for now to Double
@@ -332,40 +341,40 @@
 clamped xmin xmax x = max xmin (min xmax x)
 
 
-repeat_ :: Arrangement -> LabelledSpec
+repeat_ :: Arrangement -> Pair
 repeat_ arr = "repeat" .= arrangementLabel arr
 
-sort_ :: [SortProperty] -> LabelledSpec
+sort_ :: [SortProperty] -> Pair
 sort_ ops = "sort" .= sortPropertySpec ops
 
 mchan_ :: T.Text -> [MarkChannel] -> EncodingSpec
-mchan_ f ms = ES (f .= object (concatMap markChannelProperty ms))
+mchan_ f ms = ES (f .=~ object (concatMap markChannelProperty ms))
 
-mtype_ :: Measurement -> LabelledSpec
+mtype_ :: Measurement -> Pair
 mtype_ m = "type" .= measurementLabel m
 
-timeUnit_ :: TimeUnit -> LabelledSpec
+timeUnit_ :: TimeUnit -> Pair
 timeUnit_ tu = "timeUnit" .= timeUnitSpec tu
 
 -- The assumption at the moment is that it's always correct to
 -- replace the empty list by null.
 --
-scaleProp_ :: [ScaleProperty] -> LabelledSpec
+scaleProp_ :: [ScaleProperty] -> Pair
 scaleProp_ [] = "scale" .= A.Null
 scaleProp_ sps = "scale" .= object (map scaleProperty sps)
 
 
-value_ :: T.Text -> LabelledSpec
+value_ :: T.Text -> Pair
 value_ v = "value" .= v
 
 
-selCond_ :: (a -> [LabelledSpec]) -> BooleanOp -> [a] -> [a] -> [LabelledSpec]
+selCond_ :: (a -> [Pair]) -> BooleanOp -> [a] -> [a] -> [Pair]
 selCond_ getProps selName ifClause elseClause =
   let h = ("condition", hkey)
       toProps = concatMap getProps
-      hkey = object (("selection", booleanOpSpec selName) : toProps ifClause)
+      hkey = object (toKey ("selection", booleanOpSpec selName) : toProps ifClause)
       hs = toProps elseClause
-  in h : hs
+  in (h : hs)
 
 -- Special case the single-condition check, so that I don't get false
 -- positives when comparing against the Vega-Lite specification. There
@@ -378,7 +387,7 @@
 --      selection: xxx
 -- which happens for the Selection operator.
 --
-dataCond_ :: (a -> [LabelledSpec]) -> [(BooleanOp, [a])] -> [a] -> [LabelledSpec]
+dataCond_ :: (a -> [Pair]) -> [(BooleanOp, [a])] -> [a] -> [Pair]
 dataCond_ getProps tests elseClause =
   let h = ("condition", condClause)
       condClause = case conds of
@@ -388,10 +397,10 @@
       testClause (Selection sel, ifClause) =
         object (("selection" .= sel) : toProps ifClause)
       testClause (predicate, ifClause) =
-        object (("test", booleanOpSpec predicate) : toProps ifClause)
+        object (toKey ("test", booleanOpSpec predicate) : toProps ifClause)
       toProps = concatMap getProps
       hs = toProps elseClause
-  in h : hs
+  in (h : hs)
 
 
 
@@ -555,6 +564,10 @@
       -- ^ Literal string value when encoding with a mark property channel.
     | MBoolean Bool
       -- ^ Boolean value when encoding with a mark property channel.
+    | MNullValue
+      -- ^ A null value.
+      --
+      --   @since 0.11.0.0
     | MSymbol Symbol
       -- ^ A symbol literal. This can be useful when making a symbol dependent on some data or
       --   selection condition (e.g. 'MDataCondition' or 'MSelectionCondition').
@@ -571,8 +584,8 @@
       --
       --   @since 0.6.0.0
 
-markChannelProperty :: MarkChannel -> [LabelledSpec]
-markChannelProperty (MName s) = [field_ s]
+markChannelProperty :: MarkChannel -> [Pair]
+markChannelProperty (MName s) = ["field" .= s]
 markChannelProperty (MRepeat arr) = ["field" .= object [repeat_ arr]]
 markChannelProperty (MRepeatDatum arr) = ["datum" .= object [repeat_ arr]]
 markChannelProperty (MmType t) = [mtype_ t]
@@ -593,6 +606,7 @@
 markChannelProperty (MString s) = ["value" .= s]
 markChannelProperty (MBoolean b) = ["value" .= b]
 markChannelProperty (MSymbol s) = ["value" .= symbolLabel s]
+markChannelProperty MNullValue = ["value" .= A.Null]
 markChannelProperty (MTitle s) = ["title" .= splitOnNewline s]
 markChannelProperty MNoTitle = ["title" .= A.Null]
 
@@ -629,7 +643,7 @@
   --
   --   Prior to @0.5.0.0@ this argument was @['LabelledSpec']@.
   -> PropertySpec
-encoding channels = (VLEncoding, object (map unES channels))
+encoding channels = (VLEncoding, toObject (map unES channels))
 
 
 {-|
@@ -755,12 +769,21 @@
       --   The default is @1@.
       --
       --   @since 0.4.0.0
-    | SDomain ScaleDomain
-      -- ^ Custom scaling domain.
+    | SDomain DomainLimits
+      -- ^ Custom scaling domain. See also 'SDomainOpt'.
+      --
+      --   In verson @0.11.0.0@ some functionality was moved to 'SDomainOpt'.
     | SDomainMid Double
       -- ^ Set the mid-point of a continuous diverging domain.
       --
+      --   This is deprecated as of 0.11.0.0 and @'SDomainOpt' ('DMid' x)@ should be used
+      --   instead.
+      --
       --   @since 0.6.0.0
+    | SDomainOpt ScaleDomain
+      -- ^ Custom scaling domain. See also 'SDomain'.
+      --
+      --   @since 0.11.0.0
     | SExponent Double
       -- ^ The exponent to use for power scaling ('Graphics.Vega.VegaLite.ScPow').
       --
@@ -807,21 +830,25 @@
       --   channel.
 
 
-scaleProperty :: ScaleProperty -> LabelledSpec
+scaleProperty :: ScaleProperty -> Pair
 scaleProperty (SType sType) = "type" .= scaleLabel sType
 scaleProperty (SAlign c) = "align" .= clamped 0 1 c
 scaleProperty (SBase x) = "base" .= x
 scaleProperty (SBins xs) = "bins" .= xs
 scaleProperty (SClamp b) = "clamp" .= b
 scaleProperty (SConstant x) = "constant" .= x
-scaleProperty (SDomain sdType) = "domain" .= scaleDomainSpec sdType
+scaleProperty (SDomain dl) = "domain" .= domainLimitsSpec dl
 scaleProperty (SDomainMid x) = "domainMid" .= x
+scaleProperty (SDomainOpt sd) = scaleDomainProperty sd
 scaleProperty (SExponent x) = "exponent" .= x
 scaleProperty (SInterpolate interp) = "interpolate" .= cInterpolateSpec interp
 scaleProperty (SNice ni) = "nice" .= scaleNiceSpec ni
 scaleProperty (SPadding x) = "padding" .= x
 scaleProperty (SPaddingInner x) = "paddingInner" .= x
 scaleProperty (SPaddingOuter x) = "paddingOuter" .= x
+scaleProperty (SRange (RField f)) = "range" .= object ["field" .= f]
+scaleProperty (SRange (RMax x)) = "rangeMax" .= x
+scaleProperty (SRange (RMin x)) = "rangeMin" .= x
 scaleProperty (SRange (RPair lo hi)) = "range" .= [lo, hi]
 scaleProperty (SRange (RHeight w)) = "range" .= [fromT "height", toJSON w]
 scaleProperty (SRange (RWidth h)) = "range" .= [toJSON h, fromT "width"]
@@ -839,7 +866,7 @@
 --
 -- based on schema 3.3.0 #/definitions/SchemeParams
 
-schemeProperty :: T.Text -> [Double] -> LabelledSpec
+schemeProperty :: T.Text -> [Double] -> Pair
 schemeProperty nme [n] = "scheme" .= object ["name" .= nme, "count" .= n]
 schemeProperty nme [mn, mx] = "scheme" .= object ["name" .= nme, "extent" .= [mn, mx]]
 schemeProperty nme [n, mn, mx] = "scheme" .= object ["name" .= nme, "count" .= n, "extent" .= [mn, mx]]
@@ -899,11 +926,11 @@
       --   @since 0.4.0.0
 
 
-sortProperty :: SortProperty -> [LabelledSpec]
+sortProperty :: SortProperty -> [Pair]
 sortProperty Ascending = [order_ "ascending"]
 sortProperty Descending = [order_ "descending"]
 sortProperty (ByChannel ch) = ["encoding" .= channelLabel ch]
-sortProperty (ByFieldOp field op) = [field_ field, op_ op]
+sortProperty (ByFieldOp field op) = ["field" .= field, op_ op]
 sortProperty (ByRepeatOp arr op) = ["field" .= object [repeat_ arr], op_ op]
 sortProperty (CustomSort _) = []
 
@@ -1083,8 +1110,8 @@
       --
       --   @since 0.5.0.0
 
-positionChannelProperty :: PositionChannel -> LabelledSpec
-positionChannelProperty (PName s) = field_ s
+positionChannelProperty :: PositionChannel -> Pair
+positionChannelProperty (PName s) = "field" .= s
 positionChannelProperty (PmType m) = mtype_ m
 positionChannelProperty (PBin b) = bin b
 positionChannelProperty PBinned = binned_
@@ -1616,7 +1643,7 @@
       -- ^ The z-index of the axis, relative to the chart marks.
 
 
-axisProperty :: AxisProperty -> LabelledSpec
+axisProperty :: AxisProperty -> Pair
 axisProperty (AxStyle [s]) = "style" .= s
 axisProperty (AxStyle s) = "style" .= s
 
@@ -1713,7 +1740,7 @@
 axisProperty (AxTitleY x) = "titleY" .= x
 axisProperty (AxTranslateOffset x) = "translate" .= x
 axisProperty (AxValues vals) = "values" .= dataValuesSpecs vals
-axisProperty (AxDates dtss) = "values" .= map (object . map dateTimeProperty) dtss
+axisProperty (AxDates dtss) = "values" .= map dateTimeSpec dtss
 axisProperty (AxZIndex z) = "zindex" .= z
 
 
@@ -2016,10 +2043,15 @@
       --   @since 0.4.0.0
 
 
-fop_ :: FieldName -> T.Text -> DataValue -> [LabelledSpec]
-fop_ field label val = [field_ field, label .= dataValueSpec val]
+#if MIN_VERSION_aeson(2, 0, 0)
+fop_ :: FieldName -> Key.Key -> DataValue -> [Pair]
+#else
+fop_ :: FieldName -> T.Text -> DataValue -> [Pair]
+#endif
+fop_ field label val = ["field" .= field,
+                        label .= dataValueSpec val]
 
-filterProperty :: Filter -> [LabelledSpec]
+filterProperty :: Filter -> [Pair]
 
 filterProperty (FEqual field val) = fop_ field "equal" val
 filterProperty (FLessThan field val) = fop_ field "lt" val
@@ -2037,20 +2069,20 @@
               DateRange dMin dMax -> [process dMin, process dMax]
 
       process [] = A.Null
-      process dts = object (map dateTimeProperty dts)
+      process dts = dateTimeSpec dts
 
-  in [field_ field, "range" .= ans]
+  in ["field" .= field, "range" .= ans]
 
 filterProperty (FOneOf field vals) =
   let ans = case vals of
               Numbers xs -> map toJSON xs
-              DateTimes dts -> map (object . map dateTimeProperty) dts
+              DateTimes dts -> map dateTimeSpec dts
               Strings ss -> map toJSON ss
               Booleans bs -> map toJSON bs
 
-  in [field_ field, "oneOf" .= ans]
+  in ["field" .= field, "oneOf" .= ans]
 
-filterProperty (FValid field) = [field_ field, "valid" .= True]
+filterProperty (FValid field) = ["field" .= field, "valid" .= True]
 filterProperty _ = []  -- ignore FExpr and FCompose
 
 
@@ -2169,8 +2201,8 @@
       --
       --   @since 0.9.0.0
 
-hyperlinkChannelProperty :: HyperlinkChannel -> [LabelledSpec]
-hyperlinkChannelProperty (HName s) = [field_ s]
+hyperlinkChannelProperty :: HyperlinkChannel -> [Pair]
+hyperlinkChannelProperty (HName s) = ["field" .= s]
 hyperlinkChannelProperty (HRepeat arr) = ["field" .= object [repeat_ arr]]
 hyperlinkChannelProperty (HmType t) = [mtype_ t]
 hyperlinkChannelProperty (HAggregate op) = [aggregate_ op]
@@ -2251,8 +2283,8 @@
       -- ^ Display no title.
 
 
-ariaDescriptionChannelProperty :: AriaDescriptionChannel -> [LabelledSpec]
-ariaDescriptionChannelProperty (ADName s) = [field_ s]
+ariaDescriptionChannelProperty :: AriaDescriptionChannel -> [Pair]
+ariaDescriptionChannelProperty (ADName s) = ["field" .= s]
 ariaDescriptionChannelProperty (ADRepeat arr) = ["field" .= object [repeat_ arr]]
 ariaDescriptionChannelProperty (ADmType t) = [mtype_ t]
 ariaDescriptionChannelProperty (ADAggregate op) = [aggregate_ op]
@@ -2386,14 +2418,14 @@
       --
       -- @since 0.4.0.0
 
-facetChannelProperty :: FacetChannel -> LabelledSpec
-facetChannelProperty (FName s) = field_ s
+facetChannelProperty :: FacetChannel -> Pair
+facetChannelProperty (FName s) = "field" .= s
 facetChannelProperty (FmType measure) = mtype_ measure
 facetChannelProperty (FAlign algn) = "align" .= compositionAlignmentSpec algn
 facetChannelProperty (FAggregate op) = aggregate_ op
 facetChannelProperty (FBin bps) = bin bps
 facetChannelProperty (FCenter b) = "center" .= b
-facetChannelProperty (FHeader hps) = header_ "" hps
+facetChannelProperty (FHeader hps) = toKey (header_ "" hps)
 facetChannelProperty (FSort sps) = sort_ sps
 facetChannelProperty (FSpacing x) = "spacing" .= x
 facetChannelProperty (FTitle s) = "title" .= s
@@ -2507,8 +2539,8 @@
       --
       --   @since 0.4.0.0
 
-textChannelProperty :: TextChannel -> [LabelledSpec]
-textChannelProperty (TName s) = [field_  s]
+textChannelProperty :: TextChannel -> [Pair]
+textChannelProperty (TName s) = ["field" .= s]
 textChannelProperty (TRepeat arr) = ["field" .= object [repeat_ arr]]
 textChannelProperty (TRepeatDatum arr) = ["datum" .= object [repeat_ arr]]
 textChannelProperty (TmType measure) = [mtype_ measure]
@@ -2535,6 +2567,8 @@
 
 -- | Properties of an ordering channel used for sorting data fields.
 
+-- maps to OrderFieldDef
+
 data OrderChannel
     = OName FieldName
       -- ^ The name of the field used for encoding with an order channel.
@@ -2542,30 +2576,83 @@
       -- ^ Reference in an order channel to a field name generated by 'repeatFlow'
       -- or 'repeat'. The parameter identifies whether reference is being made to
       -- fields that are to be arranged in columns, in rows, or a with a flow layout.
-    | OmType Measurement
-      -- ^ The level of measurement when encoding with an order channel.
-    | OBin [BinProperty]
-      -- ^ Discretize numeric values into bins when encoding with an
-      --   order channel.
     | OAggregate Operation
       -- ^ Compute some aggregate summary statistics for a field to be encoded
       --   with an order channel.
+    | OBand Double
+      -- ^ For rect-based marks, define the mark size relative to the bandwidth of
+      --   band scales, bins, or time units: a value of 1 uses the range and 0.5
+      --   half the range. For other marks it defines the relative position in a
+      --   band of a stacked, binned, time unit, or band scale: if 0 the marks
+      --   will be positioned at the beginning of the band and 0.5 gives the
+      --   middle of the band.
+      --
+      --   The argument must be in the range 0 to 1, inclusive, but there is no
+      --   check on this.
+      --
+      --   @since 0.11.0.0
+    | OBin [BinProperty]
+      -- ^ Discretize numeric values into bins when encoding with an
+      --   order channel.
+    | OSort [SortProperty]
+      -- ^ Sort order for field when encoding with an order channel.
     | OTimeUnit TimeUnit
       -- ^ Form of time unit aggregation of field values when encoding with
       --   an order channel.
-    | OSort [SortProperty]
-      -- ^ Sort order for field when encoding with an order channel.
-
-
-orderChannelProperty :: OrderChannel -> LabelledSpec
-orderChannelProperty (OName s) = field_ s
-orderChannelProperty (ORepeat arr) = "field" .= object [repeat_ arr]
-orderChannelProperty (OmType measure) = mtype_ measure
-orderChannelProperty (OBin bps) = bin bps
-orderChannelProperty (OAggregate op) = aggregate_ op
-orderChannelProperty (OTimeUnit tu) = timeUnit_ tu
-orderChannelProperty (OSort ops) = sort_ ops
+    | OTitle T.Text
+      -- ^ The title for the field.
+      --
+      --   Note that if both the field and axis, header, or legend titles are
+      --   defined than the latter (axis, header, or legend) will be used.
+      --
+      --   @since 0.11.0.0
+    | ONoTitle
+      -- ^ Remove the title.
+      --
+      --   @since 0.11.0.0
+    | OmType Measurement
+      -- ^ The level of measurement when encoding with an order channel.
+    | ODataCondition [(BooleanOp, [OrderChannel])] [OrderChannel]
+      -- ^ Make an order channel conditional on one or more predicate expressions. The first
+      --   parameter is a list of tuples each pairing an expression to evaluate with the encoding
+      --   if that expression is @True@. The second is the encoding if none of the expressions
+      --   evaluate as @True@.
+      --
+      --   @since 0.11.0.0
+    | OSelectionCondition BooleanOp [OrderChannel] [OrderChannel]
+      -- ^ Make an order channel conditional on interactive selection. The first parameter
+      --   is a selection condition to evaluate; the second the encoding to apply if that
+      --   selection is true; the third parameter is the encoding if the selection is false.
+      --
+      --   An example:
+      --
+      --   @'order' ['OSelectionCondition' ('SelectionName' "highlight")
+      --           ['ONumber' 1] ['ONumber' 0]]
+      --   @
+      --
+      --   @since 0.11.0.0
+    | ONumber Double
+      -- ^ Create a value with this number. For use with 'OSelectionCondition'
+      --   and 'ODataCondition'.
+      --
+      --   @since 0.11.0.0
 
+orderChannelProperty :: OrderChannel -> [Pair]
+orderChannelProperty (OAggregate op) = [aggregate_ op]
+orderChannelProperty (OBand x) = ["band" .= x]
+orderChannelProperty (OBin bps) = [bin bps]
+orderChannelProperty (OName s) = ["field" .= s]
+orderChannelProperty (ORepeat arr) = ["field" .= object [repeat_ arr]]
+orderChannelProperty (OSort ops) = [sort_ ops]
+orderChannelProperty (OTimeUnit tu) = [timeUnit_ tu]
+orderChannelProperty (OTitle s) = ["title" .= s]
+orderChannelProperty ONoTitle = ["title" .= A.Null]
+orderChannelProperty (OmType measure) = [mtype_ measure]
+orderChannelProperty (ODataCondition tests elseClause) =
+  dataCond_ orderChannelProperty tests elseClause
+orderChannelProperty (OSelectionCondition selName ifClause elseClause) =
+  selCond_ orderChannelProperty selName ifClause elseClause
+orderChannelProperty (ONumber n) = ["value" .= n]
 
 -- | Level of detail channel properties used for creating a grouped channel
 --   encoding.
@@ -2583,8 +2670,8 @@
       -- ^ How should the detail field be aggregated?
 
 
-detailChannelProperty :: DetailChannel -> LabelledSpec
-detailChannelProperty (DName s) = field_ s
+detailChannelProperty :: DetailChannel -> Pair
+detailChannelProperty (DName s) = "field" .= s  -- field_ s
 detailChannelProperty (DmType t) = mtype_ t
 detailChannelProperty (DBin bps) = bin bps
 detailChannelProperty (DTimeUnit tu) = timeUnit_ tu
@@ -2602,7 +2689,7 @@
     | RowBy [FacetChannel]
 
 
-facetMappingProperty :: FacetMapping -> LabelledSpec
+facetMappingProperty :: FacetMapping -> Pair
 facetMappingProperty (RowBy fFields) =
   "row" .= object (map facetChannelProperty fFields)
 facetMappingProperty (ColumnBy fFields) =
@@ -2633,9 +2720,9 @@
   [ConfigureSpec]
   -- ^ The configuration options, created with 'Graphics.Vega.VegaLite.configuration'.
   --
-  --    Prior to version @0.5.0.0@ this was @[LabelledSpec]@.
+  --    Prior to version @0.5.0.0@ this was @['LabelledSpec']@.
   -> PropertySpec
-configure configs = (VLConfig, object (map unCS configs))
+configure configs = (VLConfig, toObject (map unCS configs))
 
 
 -- | Alignment to apply to grid rows and columns generated by a composition
@@ -3074,7 +3161,7 @@
   --
   --   Prior to @0.5.0.0@ this argument was @['LabelledSpec']@.
   -> PropertySpec
-resolve res = (VLResolve, object (map unRS res))
+resolve res = (VLResolve, toObject (map unRS res))
 
 
 {-|
@@ -4661,19 +4748,27 @@
 Encode an order channel.
 
 @
-enc =
-    'encoding'
-        . 'position' 'Graphics.Vega.VegaLite.X' [ 'PName' "miles", 'PmType' 'Graphics.Vega.VegaLite.Quantitative' ]
-        . 'position' 'Graphics.Vega.VegaLite.Y' [ 'PName' "gas", 'PmType' 'Graphics.Vega.VegaLite.Quantitative' ]
-        . 'order' [ 'OName' "year", 'OmType' 'Graphics.Vega.VegaLite.Temporal', 'OSort' ['Descending'] ]
+'encoding'
+    . 'position' 'Graphics.Vega.VegaLite.X' [ 'PName' "miles", 'PmType' 'Graphics.Vega.VegaLite.Quantitative' ]
+    . 'position' 'Graphics.Vega.VegaLite.Y' [ 'PName' "gas", 'PmType' 'Graphics.Vega.VegaLite.Quantitative' ]
+    . 'order' [ 'OName' "year", 'OmType' 'Graphics.Vega.VegaLite.Temporal', 'OSort' ['Descending'] ]
 @
+
+<https://vega.github.io/vega-lite/docs/condition.html Conditional values>
+can be set with 'OSelectionCondition', such as
+
+@
+'order' [ 'OSelectionCondition' ('SelectionName "highlight")
+          ['ONumber' 1] ['ONumber' 0]
+@
 -}
+
 order ::
   [OrderChannel]
   -- ^ The order-encoding options.
   -> BuildEncodingSpecs
 order oDefs ols =
-  ES ("order", object (map orderChannelProperty oDefs)) : ols
+  ES ("order", object (concatMap orderChannelProperty oDefs)) : ols
 
 
 {-|
@@ -5005,4 +5100,4 @@
   -- ^ A separate list of properties for each channel.
   -> BuildEncodingSpecs
 tooltips tDefs ols =
-  ES ("tooltip" .= map (object . concatMap textChannelProperty) tDefs) : ols
+  ES ("tooltip" .=~ map (object . concatMap textChannelProperty) tDefs) : ols
diff --git a/src/Graphics/Vega/VegaLite/Data.hs b/src/Graphics/Vega/VegaLite/Data.hs
--- a/src/Graphics/Vega/VegaLite/Data.hs
+++ b/src/Graphics/Vega/VegaLite/Data.hs
@@ -24,13 +24,13 @@
 import qualified Data.Aeson as A
 import qualified Data.Text as T
 
-import Data.Aeson (object, toJSON)
+import Data.Aeson (toJSON)
 
 
 import Graphics.Vega.VegaLite.Specification (VLSpec)
 import Graphics.Vega.VegaLite.Time
   ( DateTime
-  , dateTimeProperty
+  , dateTimeSpec
   )
 
 
@@ -68,7 +68,7 @@
 
 dataValueSpec :: DataValue -> VLSpec
 dataValueSpec (Boolean b) = toJSON b
-dataValueSpec (DateTime dt) = object (map dateTimeProperty dt)
+dataValueSpec (DateTime dt) = dateTimeSpec dt
 dataValueSpec (Number x) = toJSON x
 dataValueSpec (Str t) = toJSON t
 dataValueSpec NullValue = A.Null
@@ -94,7 +94,7 @@
 
 dataValuesSpecs :: DataValues -> [VLSpec]
 dataValuesSpecs (Booleans bs) = map toJSON bs
-dataValuesSpecs (DateTimes dtss) = map (object . map dateTimeProperty) dtss
+dataValuesSpecs (DateTimes dtss) = map dateTimeSpec dtss
 dataValuesSpecs (Numbers xs) = map toJSON xs
 dataValuesSpecs (Strings ss) = map toJSON ss
 
diff --git a/src/Graphics/Vega/VegaLite/Foundation.hs b/src/Graphics/Vega/VegaLite/Foundation.hs
--- a/src/Graphics/Vega/VegaLite/Foundation.hs
+++ b/src/Graphics/Vega/VegaLite/Foundation.hs
@@ -3,7 +3,7 @@
 
 {-|
 Module      : Graphics.Vega.VegaLite.Foundation
-Copyright   : (c) Douglas Burke, 2018-2020
+Copyright   : (c) Douglas Burke, 2018-2021
 License     : BSD3
 
 Maintainer  : dburke.gw@gmail.com
@@ -112,13 +112,29 @@
        , header_
        , order_
        , allowNull
+
+       -- aeson 2.0 support
+       , (.=~)
+       , toKey
+       , toKeys
+       , toObject
        )
     where
 
 import qualified Data.Aeson as A
+
+#if MIN_VERSION_aeson(2, 0, 0)
+import qualified Data.Aeson.Key as Key
+#endif
+
 import qualified Data.Text as T
 
+#if MIN_VERSION_aeson(2, 0, 0)
+import Control.Arrow (first)
+#endif
+
 import Data.Aeson ((.=), object, toJSON)
+import Data.Aeson.Types (Pair, ToJSON)
 
 #if !(MIN_VERSION_base(4, 12, 0))
 import Data.Monoid ((<>))
@@ -135,14 +151,45 @@
   )
 
 
-field_ :: FieldName -> LabelledSpec
+{-
+Similar to the Aeson .= version, but retains the Text,Value pairing as
+this matches LabelledSpec. Ideally we'd change LabelledSpec to match
+Pair (aka Key,Value) but then we'd have different types depending on
+the version of aeson in use, which is less-than-ideal. The current
+thinking is that we can bump the minimum aeson value to 2.0 at some
+point and make the change then.
+
+It does leave a number of "internal" routines in place that return
+LabelledSpec rather than Pair, since they have been made available for
+use, which means a confusing set of "this function can use .= and this
+one has to use .=~".
+-}
+
+(.=~) :: ToJSON a => T.Text -> a -> (T.Text, A.Value)
+a .=~ b = (a, toJSON b)
+
+toKey :: LabelledSpec -> Pair
+#if MIN_VERSION_aeson(2, 0, 0)
+toKey = first Key.fromText
+#else
+toKey = id
+#endif
+
+toKeys :: [LabelledSpec] -> [Pair]
+toKeys = map toKey
+
+toObject :: [LabelledSpec] -> VLSpec
+toObject = object . toKeys
+
+
+field_ :: FieldName -> Pair
 field_ f = "field" .= f
 
 header_ :: T.Text -> [HeaderProperty] -> LabelledSpec
-header_ extra hps = ("header" <> extra) .= object (map headerProperty hps)
+header_ extra hps = ("header" <> extra, object (map headerProperty hps))
 
 -- could restrict to ascending/descending
-order_ :: T.Text -> LabelledSpec
+order_ :: T.Text -> Pair
 order_ o = "order" .= o
 
 
@@ -1066,10 +1113,9 @@
 stackOffsetSpec StCenter = "center"
 stackOffsetSpec NoStack = A.Null
 
-stackOffset :: StackOffset -> LabelledSpec
+stackOffset :: StackOffset -> Pair
 stackOffset so = "stack" .= stackOffsetSpec so
 
-
 stackPropertySpecOffset , stackPropertySpecSort:: StackProperty -> Maybe VLSpec
 stackPropertySpecOffset (StOffset op) = Just (stackOffsetSpec op)
 stackPropertySpecOffset _ = Nothing
@@ -1247,8 +1293,8 @@
         RLegend chRules -> ("legend", chRules)
         RScale chRules -> ("scale", chRules)
 
-      ans = map (\(ch, rule) -> channelLabel ch .= resolutionLabel rule) rls
-  in RS (nme, object ans)
+      ans = map (\(ch, rule) -> channelLabel ch .=~ resolutionLabel rule) rls
+  in RS (nme, toObject ans)
 
 
 -- | This is used with 'Graphics.Vega.VegaLite.bounds' to define the extent of a sub plot.
@@ -1350,7 +1396,7 @@
       -- ^ Recalculate autosizing on every view update.
 
 
-autosizeProperty :: Autosize -> LabelledSpec
+autosizeProperty :: Autosize -> Pair
 autosizeProperty APad = "type" .= fromT "pad"
 autosizeProperty AFit = "type" .= fromT "fit"
 autosizeProperty AFitX = "type" .= fromT "fit-x"
@@ -1374,12 +1420,11 @@
     | LayerFields [FieldName]
       -- ^ @since 0.9.0.0
 
-repeatFieldsProperty :: RepeatFields -> LabelledSpec
+repeatFieldsProperty :: RepeatFields -> Pair
 repeatFieldsProperty (RowFields fs) = "row" .= fs
 repeatFieldsProperty (ColumnFields fs) = "column" .= fs
 repeatFieldsProperty (LayerFields fs) = "layer" .= fs
 
-
 {-|
 
 Indicates the type of color interpolation to apply, when mapping a data field
@@ -1414,8 +1459,13 @@
 -- Need to tie down some types as things are too polymorphic,
 -- particularly in the presence of OverloadedStrings.
 --
-pairT :: T.Text -> T.Text -> (T.Text, A.Value)
+#if MIN_VERSION_aeson(2, 0, 0)
+pairT :: Key.Key -> T.Text -> Pair
 pairT a b = a .= b
+#else
+pairT :: T.Text -> T.Text -> Pair
+pairT a b = a .= b
+#endif
 
 
 cInterpolateSpec :: CInterpolate -> VLSpec
@@ -1489,7 +1539,7 @@
     -- ^ The mitre limit at which to bevel the line around the background, if drawn.
 
 
-viewBackgroundSpec :: ViewBackground -> LabelledSpec
+viewBackgroundSpec :: ViewBackground -> Pair
 viewBackgroundSpec (VBStyle [style]) = "style" .= style  -- special case singleton
 viewBackgroundSpec (VBStyle styles) = "style" .= styles
 viewBackgroundSpec (VBCornerRadius r) = "cornerRadius" .= r
@@ -1693,7 +1743,7 @@
       -- @since 0.4.0.0
 
 
-headerProperty :: HeaderProperty -> LabelledSpec
+headerProperty :: HeaderProperty -> Pair
 headerProperty (HFormat fmt) = "format" .= fmt
 headerProperty HFormatAsNum = "formatType" .= fromT "number"
 headerProperty HFormatAsTemporal = "formatType" .= fromT "time"
diff --git a/src/Graphics/Vega/VegaLite/Geometry.hs b/src/Graphics/Vega/VegaLite/Geometry.hs
--- a/src/Graphics/Vega/VegaLite/Geometry.hs
+++ b/src/Graphics/Vega/VegaLite/Geometry.hs
@@ -3,7 +3,7 @@
 
 {-|
 Module      : Graphics.Vega.VegaLite.Geometry
-Copyright   : (c) Douglas Burke, 2018-2020
+Copyright   : (c) Douglas Burke, 2018-2021
 License     : BSD3
 
 Maintainer  : dburke.gw@gmail.com
@@ -35,10 +35,13 @@
        ) where
 
 import qualified Data.Aeson as A
+
 import qualified Data.Text as T
 
 import Control.Arrow (second)
+
 import Data.Aeson ((.=), object, toJSON)
+import Data.Aeson.Types (Pair)
 
 #if !(MIN_VERSION_base(4, 12, 0))
 import Data.Monoid ((<>))
@@ -49,11 +52,13 @@
   ( DataValue
   , dataValueSpec
   )
-import Graphics.Vega.VegaLite.Foundation (fromT)
+import Graphics.Vega.VegaLite.Foundation
+  ( fromT
+  , toObject
+  )
 import Graphics.Vega.VegaLite.Specification
   ( VLProperty(VLData, VLProjection)
   , VLSpec
-  , LabelledSpec
   , PropertySpec
   )
 import Graphics.Vega.VegaLite.Input
@@ -61,7 +66,7 @@
   )
 
 
-type_ :: T.Text -> LabelledSpec
+type_ :: T.Text -> Pair
 type_ t = "type" .= t
 
 
@@ -285,7 +290,7 @@
       -- ^ @Satellite@ map projection tilt.
 
 
-projectionProperty :: ProjectionProperty -> LabelledSpec
+projectionProperty :: ProjectionProperty -> Pair
 projectionProperty (PrType proj) = "type" .= projectionLabel proj
 projectionProperty (PrClipAngle numOrNull) = "clipAngle" .= maybe A.Null toJSON numOrNull
 projectionProperty (PrClipExtent rClip) =
@@ -366,7 +371,7 @@
           <> if null properties
              then []
              else [("properties",
-                    object (map (second dataValueSpec) properties))]
+                    toObject (map (second dataValueSpec) properties))]
          )
 
 
@@ -477,7 +482,7 @@
     --   The default is @2.5@.
 
 
-graticuleProperty :: GraticuleProperty -> LabelledSpec
+graticuleProperty :: GraticuleProperty -> Pair
 graticuleProperty (GrExtent (lng1, lat1) (lng2, lat2)) =
   "extent" .= [[lng1, lat1], [lng2, lat2]]
 graticuleProperty (GrExtentMajor (lng1, lat1) (lng2, lat2)) =
diff --git a/src/Graphics/Vega/VegaLite/Input.hs b/src/Graphics/Vega/VegaLite/Input.hs
--- a/src/Graphics/Vega/VegaLite/Input.hs
+++ b/src/Graphics/Vega/VegaLite/Input.hs
@@ -4,7 +4,7 @@
 
 {-|
 Module      : Graphics.Vega.VegaLite.Input
-Copyright   : (c) Douglas Burke, 2018-2020
+Copyright   : (c) Douglas Burke, 2018-2021
 License     : BSD3
 
 Maintainer  : dburke.gw@gmail.com
@@ -40,12 +40,14 @@
        ) where
 
 import qualified Data.Aeson as A
+
 import qualified Data.HashMap.Strict as HM
 import qualified Data.Text as T
 
 import Control.Arrow (second)
 
 import Data.Aeson ((.=), Value, decode, encode, object, toJSON)
+import Data.Aeson.Types (Pair)
 import Data.Maybe (fromMaybe, mapMaybe)
 
 #if !(MIN_VERSION_base(4, 12, 0))
@@ -59,13 +61,14 @@
   )
 import Graphics.Vega.VegaLite.Foundation
   ( FieldName
+  , toObject
   )
 import Graphics.Vega.VegaLite.Specification
   ( VLProperty(VLData, VLDatasets)
   , VLSpec
   , LabelledSpec
   )
-import Graphics.Vega.VegaLite.Time (dateTimeProperty)
+import Graphics.Vega.VegaLite.Time (dateTimeSpec)
 
 
 {-|
@@ -177,7 +180,7 @@
 type Data = (VLProperty, VLSpec)
 
 
-formatProperty :: Format -> [LabelledSpec]
+formatProperty :: Format -> [Pair]
 formatProperty (JSON js) =
   let ps = [("type", "json")]
            <> if T.null (T.strip js) then [] else [("property", js)]
@@ -194,7 +197,7 @@
                                    , "mesh" .= os
                                    ]
 formatProperty (Parse fmts) =
-  let pObj = object (map (second dataTypeSpec) fmts)
+  let pObj = toObject (map (second dataTypeSpec) fmts)
   in [("parse", pObj)]
 
 
@@ -222,7 +225,7 @@
 @
 -}
 dataRow :: [(FieldName, DataValue)] -> [DataRow] -> [DataRow]
-dataRow rw = (object (map (second dataValueSpec) rw) :)
+dataRow rw = (toObject (map (second dataValueSpec) rw) :)
 
 
 {-|
@@ -271,7 +274,7 @@
 
         in fromMaybe din (convert din >>= extract')
 
-  in (VLDatasets, object specs)
+  in (VLDatasets, toObject specs)
 
 
 -- | This is for composed specifications, and it tells the visualization to
@@ -317,7 +320,7 @@
       -- a relatively easy conversion. The type annotation isn't needed
       -- but left in for reference.
       --
-      convert :: Maybe [(T.Text, Value)]
+      convert :: Maybe [Pair]
       convert = HM.toList <$> decode (encode dataSpec)
 
       extract [v] = Just v
@@ -359,7 +362,7 @@
   --   calls to 'dataColumn'.
   -> Data
 dataFromColumns fmts cols =
-  let dataArray = map object (transpose cols)
+  let dataArray = map toObject (transpose cols)
 
       vals = [("values", toJSON dataArray)]
              <> if null fmts
@@ -433,11 +436,10 @@
 dataColumn colName dVals xs =
   let col = case dVals of
         Booleans cs -> map toJSON cs
-        DateTimes cs -> map dtToJSON cs
+        DateTimes cs -> map dateTimeSpec cs
         Numbers cs -> map toJSON cs
         Strings cs -> map toJSON cs
 
-      dtToJSON = object . map dateTimeProperty
       x = map (colName,) col
 
   in x : xs
diff --git a/src/Graphics/Vega/VegaLite/Legend.hs b/src/Graphics/Vega/VegaLite/Legend.hs
--- a/src/Graphics/Vega/VegaLite/Legend.hs
+++ b/src/Graphics/Vega/VegaLite/Legend.hs
@@ -32,7 +32,9 @@
 import qualified Data.Text as T
 
 import Data.Aeson ((.=), object, toJSON)
+import Data.Aeson.Types (Pair)
 
+
 import Graphics.Vega.VegaLite.Foundation
   ( APosition
   , Bounds
@@ -70,10 +72,10 @@
   ( ScaleNice
   , scaleNiceSpec
   )
-import Graphics.Vega.VegaLite.Specification (VLSpec, LabelledSpec)
+import Graphics.Vega.VegaLite.Specification (VLSpec)
 import Graphics.Vega.VegaLite.Time
   ( DateTime
-  , dateTimeProperty
+  , dateTimeSpec
   )
 
 
@@ -165,7 +167,7 @@
   | LeLTopRight [BaseLegendLayout]
 
 
-legendLayoutSpec :: LegendLayout -> LabelledSpec
+legendLayoutSpec :: LegendLayout -> Pair
 legendLayoutSpec (LeLAnchor anc) = "anchor" .= anchorLabel anc
 legendLayoutSpec (LeLBottom bl) = "bottom" .= toBLSpec bl
 legendLayoutSpec (LeLBottomLeft bl) = "bottom-left" .= toBLSpec bl
@@ -210,7 +212,7 @@
 toBLSpec :: [BaseLegendLayout] -> VLSpec
 toBLSpec = object . map baseLegendLayoutSpec
 
-baseLegendLayoutSpec :: BaseLegendLayout -> LabelledSpec
+baseLegendLayoutSpec :: BaseLegendLayout -> Pair
 baseLegendLayoutSpec (BLeLAnchor anc) = "anchor" .= anchorLabel anc
 baseLegendLayoutSpec (BLeLBounds bnds) = "bounds" .= boundsSpec bnds
 baseLegendLayoutSpec (BLeLCenter b) = "center" .= b
@@ -490,7 +492,7 @@
     | LZIndex ZIndex
       -- ^ The z-index at which to draw the legend.
 
-legendProperty :: LegendProperty -> LabelledSpec
+legendProperty :: LegendProperty -> Pair
 legendProperty (LAria b) = "aria" .= b
 legendProperty (LAriaDescription t) = "description" .= t
 legendProperty (LClipHeight x) = "clipHeight" .= x
@@ -561,7 +563,7 @@
 legendProperty (LValues vals) =
   let ls = case vals of
         LNumbers xs    -> map toJSON xs
-        LDateTimes dts -> map (object . map dateTimeProperty) dts
+        LDateTimes dts -> map dateTimeSpec dts
         LStrings ss    -> map toJSON ss
   in "values" .= ls
 legendProperty (LeX x) = "legendX" .= x
@@ -569,7 +571,7 @@
 legendProperty (LZIndex z) = "zindex" .= z
 
 
-legendProp_ :: [LegendProperty] -> LabelledSpec
+legendProp_ :: [LegendProperty] -> Pair
 legendProp_ [] = "legend" .= A.Null
 legendProp_ lps = "legend" .= object (map legendProperty lps)
 
diff --git a/src/Graphics/Vega/VegaLite/Mark.hs b/src/Graphics/Vega/VegaLite/Mark.hs
--- a/src/Graphics/Vega/VegaLite/Mark.hs
+++ b/src/Graphics/Vega/VegaLite/Mark.hs
@@ -1,13 +1,14 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE OverloadedStrings #-}
 
 {-|
 Module      : Graphics.Vega.VegaLite.Mark
-Copyright   : (c) Douglas Burke, 2018-2020
+Copyright   : (c) Douglas Burke, 2018-2021
 License     : BSD3
 
 Maintainer  : dburke.gw@gmail.com
 Stability   : unstable
-Portability : OverloadedStrings
+Portability : CPP, OverloadedStrings
 
 This provides the functionality of the VegaLite module but is
 not directly exported to the user.
@@ -29,7 +30,7 @@
        , BlendMode(..)
 
          -- not for external export
-       , mprops_
+       , oldMprops_
 
        , markLabel
        , markProperty
@@ -37,9 +38,15 @@
        ) where
 
 import qualified Data.Aeson as A
+
+#if MIN_VERSION_aeson(2, 0, 0)
+import qualified Data.Aeson.Key as Key
+#endif
+
 import qualified Data.Text as T
 
 import Data.Aeson ((.=), object, toJSON)
+import Data.Aeson.Types (Pair)
 import Data.List (sortOn)
 
 
@@ -71,6 +78,7 @@
   , ttContentLabel
   , hAlignLabel
   , vAlignLabel
+  , (.=~)
   )
 import Graphics.Vega.VegaLite.Specification
   ( VLSpec
@@ -79,11 +87,20 @@
 
 
 -- As of version 0.6.0.0, an empty list is mapped to True
-mprops_ :: T.Text -> [MarkProperty] -> LabelledSpec
+#if MIN_VERSION_aeson(2, 0, 0)
+mprops_ :: Key.Key -> [MarkProperty] -> Pair
+#else
+mprops_ :: T.Text -> [MarkProperty] -> Pair
+#endif
 mprops_ f [] = f .= True
 mprops_ f mps = f .= object (map markProperty mps)
 
+-- Used by Configuration to create top-level data
+oldMprops_ :: T.Text -> [MarkProperty] -> LabelledSpec
+oldMprops_ f [] = f .=~ True
+oldMprops_ f mps = f .=~ object (map markProperty mps)
 
+
 -- | Type of visual mark used to represent data in the visualization.
 --
 --   The properties of the mark can be changed with the 'MarkProperty'
@@ -713,7 +730,7 @@
       --   @since 0.9.0.0
 
 
-markProperty :: MarkProperty -> LabelledSpec
+markProperty :: MarkProperty -> Pair
 
 -- special case the gradients
 markProperty (MColorGradient dir stops opts) =
@@ -868,7 +885,7 @@
   let sortedStops = sortOn fst stops
   in object ([ "gradient" .= colorGradientLabel dir
              , "stops" .= map stopSpec sortedStops ]
-             ++ map gradientProperty props)
+              ++ map gradientProperty props)
 
 
 {-|
@@ -1024,10 +1041,10 @@
 -- This is a little different from the other calls since I wanted to
 -- make sure the scale factor was encoded as a number not a string.
 --
-extent_ :: T.Text -> LabelledSpec
+extent_ :: T.Text -> Pair
 extent_ v = "extent" .= v
 
-markErrorExtentLSpec :: MarkErrorExtent -> LabelledSpec
+markErrorExtentLSpec :: MarkErrorExtent -> Pair
 markErrorExtentLSpec ConfidenceInterval = extent_ "ci"
 markErrorExtentLSpec StdErr             = extent_ "stderr"
 markErrorExtentLSpec StdDev             = extent_ "stdev"
@@ -1129,7 +1146,7 @@
     --   only). The default is 0.5.
 
 
-gradientProperty :: GradientProperty -> LabelledSpec
+gradientProperty :: GradientProperty -> Pair
 gradientProperty (GrX1 x) = "x1" .= x
 gradientProperty (GrX2 x) = "x2" .= x
 gradientProperty (GrY1 x) = "y1" .= x
diff --git a/src/Graphics/Vega/VegaLite/Scale.hs b/src/Graphics/Vega/VegaLite/Scale.hs
--- a/src/Graphics/Vega/VegaLite/Scale.hs
+++ b/src/Graphics/Vega/VegaLite/Scale.hs
@@ -2,7 +2,7 @@
 
 {-|
 Module      : Graphics.Vega.VegaLite.Scale
-Copyright   : (c) Douglas Burke, 2018-2020
+Copyright   : (c) Douglas Burke, 2018-2021
 License     : BSD3
 
 Maintainer  : dburke.gw@gmail.com
@@ -15,18 +15,21 @@
 
 module Graphics.Vega.VegaLite.Scale
        ( ScaleDomain(..)
+       , DomainLimits(..)
        , ScaleRange(..)
        , ScaleNice(..)
        , NTimeUnit(..)
 
          -- not for external export
-       , scaleDomainSpec
+       , scaleDomainProperty
+       , domainLimitsSpec
        , scaleNiceSpec
        ) where
 
 import qualified Data.Text as T
 
 import Data.Aeson ((.=), object, toJSON)
+import Data.Aeson.Types (Pair)
 
 
 import Graphics.Vega.VegaLite.Foundation
@@ -41,7 +44,7 @@
   )
 import Graphics.Vega.VegaLite.Time
   ( DateTime
-  , dateTimeProperty
+  , dateTimeSpec
   )
 
 
@@ -49,15 +52,44 @@
 
 Describes the scale domain (type of data in scale). For full details see the
 <https://vega.github.io/vega-lite/docs/scale.html#domain Vega-Lite documentation>.
+
+In @0.11.0.0@ the functionality has been split into 'ScaleDomain' and
+'DomainLimits'.
 -}
 
 data ScaleDomain
-    = DNumbers [Double]
-      -- ^ Numeric values that define a scale domain.
-    | DStrings [T.Text]
-      -- ^ String values that define a scale domain.
-    | DDateTimes [[DateTime]]
-      -- ^ Date-time values that define a scale domain.
+    = DMax Double
+      -- ^ Sets the maximum value in the scale domain.
+      --   It is only intended for scales with a continuous domain.
+      --
+      --   It is supported in Vega-Lite 4.14 and later.
+      --
+      --   @since 0.11.0.0
+    | DMaxTime [DateTime]
+      -- ^ 'DMax' for dates.
+      --
+      --   It is supported in Vega-Lite 4.14 and later.
+      --
+      --   @since 0.11.0.0
+    | DMid Double
+      -- ^ Sets the mid-point of a continuous diverging domain.
+      --
+      --   It replaces 'Graphics.Vega.VegaLite.SDomainMid'.
+      --
+      --   @since 0.11.0.0
+    | DMin Double
+      -- ^ Sets the minimum value in the scale domain.
+      --   It is only intended for scales with a continuous domain.
+      --
+      --   It is supported in Vega-Lite 4.14 and later.
+      --
+      --   @since 0.11.0.0
+    | DMinTime [DateTime]
+      -- ^ 'DMin' for dates.
+      --
+      --   It is supported in Vega-Lite 4.14 and later.
+      --
+      --   @since 0.11.0.0
     | DSelection SelectionLabel
       -- ^ Scale domain based on a named interactive selection.
       --   See also 'DSelectionField' and 'DSelectionChannel', which should
@@ -77,38 +109,74 @@
       --   is projected over multiple fields or encodings.
       --
       --   @since 0.7.0.0
-    | DUnionWith ScaleDomain
+    | DUnionWith DomainLimits
       -- ^ Combine the domain of the data with the provided domain.
       --
       --   The following example will use a range of at least 0 to 100,
       --   but this will be increased if the data (either initially or
       --   via any updates to the Vege-Lite visualization) exceeds this:
       --
-      --   @'Graphics.Vega.VegaLite.PScale' ['Graphics.Vega.VegaLite.SDomain' (DUnionWith ('DNumbers' [0, 100]))]@
-      --
-      --   Note that 'DUnionWith' should not be nested, but this
-      --   is not enforced by @hvega@.
+      --   @'Graphics.Vega.VegaLite.PScale' ['Graphics.Vega.VegaLite.SDomainOpt' (DUnionWith ('DNumbers' [0, 100]))]@
       --
       --   @since 0.6.0.0
     | Unaggregated
-    -- ^ Indicate that a domain of aggregated data should be scaled to
-    --   the domain of the data prior to aggregation.
+      -- ^ Indicate that a domain of aggregated data should be scaled to
+      --   the domain of the data prior to aggregation.
 
-scaleDomainSpec :: ScaleDomain -> VLSpec
-scaleDomainSpec (DNumbers nums) = toJSON (map toJSON nums)
-scaleDomainSpec (DDateTimes dts) = toJSON (map (object . map dateTimeProperty) dts)
-scaleDomainSpec (DStrings cats) = toJSON (map toJSON cats)
-scaleDomainSpec (DSelection selName) = object ["selection" .= selName]
-scaleDomainSpec (DSelectionField selName field) = object [ "selection" .= selName
-                                                         , "field" .= field ]
-scaleDomainSpec (DSelectionChannel selName ch) = object [ "selection" .= selName
-                                                        , "encoding" .= channelLabel ch ]
-scaleDomainSpec (DUnionWith sd) = object ["unionWith" .= scaleDomainSpec sd]
-scaleDomainSpec Unaggregated = "unaggregated"
 
+-- For now we do not include Unaggregated in DomainLimits as the
+-- documentaiton suggests we should ubt the schema does not: see
+-- https://github.com/vega/vega-lite/issues/7022
+--
 
 {-|
 
+Represent the range of the domain, which is used by 'VL.SDomain'
+and 'DUnionWith'.
+
+Prior to @0.11.0.0@ this was part of 'ScaleDomain'.
+
+@since 0.11.0.0
+-}
+data DomainLimits
+  = DNumbers [Double]
+    -- ^ Numeric values that define a scale domain.
+    --
+    --   It is expected that this contains two values (minimum and
+    --   maximum), but more can be given for
+    --   [piecewise  quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise).
+  | DStrings [T.Text]
+    -- ^ String values that define a scale domain
+  | DDateTimes [[DateTime]]
+    -- ^ Date-time values that define a scale domain.
+
+
+scaleDomainProperty :: ScaleDomain -> Pair
+
+scaleDomainProperty (DMax x) = "domainMax" .= x
+scaleDomainProperty (DMaxTime dts) = "domainMax" .= dateTimeSpec dts
+scaleDomainProperty (DMid x) = "domainMid" .= x
+scaleDomainProperty (DMin x) = "domainMin" .= x
+scaleDomainProperty (DMinTime dts) = "domainMin" .= dateTimeSpec dts
+
+
+scaleDomainProperty (DSelection selName) = "domain" .= object ["selection" .= selName]
+scaleDomainProperty (DSelectionField selName field) = "domain" .= object [ "selection" .= selName
+                                                                         , "field" .= field ]
+scaleDomainProperty (DSelectionChannel selName ch) = "domain" .= object [ "selection" .= selName
+                                                                        , "encoding" .= channelLabel ch ]
+scaleDomainProperty (DUnionWith sd) = "domain" .= object ["unionWith" .= domainLimitsSpec sd]
+scaleDomainProperty Unaggregated = "domain" .= fromT "unaggregated"
+
+
+domainLimitsSpec :: DomainLimits -> VLSpec
+domainLimitsSpec (DNumbers nums) = toJSON (map toJSON nums)
+domainLimitsSpec (DDateTimes dts) = toJSON (map dateTimeSpec dts)
+domainLimitsSpec (DStrings cats) = toJSON (map toJSON cats)
+
+
+{-|
+
 Describes the way a scale can be rounded to \"nice\" numbers. For full details see the
 <https://vega.github.io/vega-lite/docs/scale.html#continuous Vega-Lite documentation>.
 
@@ -188,7 +256,32 @@
 -}
 
 data ScaleRange
-    = RPair Double Double
+    = RField FieldName
+      -- ^ For [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete)
+      --   and [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing)
+      --   scales, the name if the field to use.
+      --
+      --   For example. if the field \"color\" contains CSS color names, we can say
+      --   @RField \"color\"@.
+      --
+      --   It is supported in Vega-Lite 4.14 and later.
+      --
+      --   @since 0.11.0.0
+    | RMax Double
+      -- ^ Sets the maximum value in the scale range.
+      --   It is only intended for scales with a continuous range.
+      --
+      --   It is supported in Vega-Lite 4.14 and later.
+      --
+      --   @since 0.11.0.0
+    | RMin Double
+      -- ^ Sets the minimum value in the scale range.
+      --   It is only intended for scales with a continuous range.
+      --
+      --   It is supported in Vega-Lite 4.14 and later.
+      --
+      --   @since 0.11.0.0
+    | RPair Double Double
       -- ^ The minimum and maximum values.
       --
       --   @since 0.9.0.0
diff --git a/src/Graphics/Vega/VegaLite/Selection.hs b/src/Graphics/Vega/VegaLite/Selection.hs
--- a/src/Graphics/Vega/VegaLite/Selection.hs
+++ b/src/Graphics/Vega/VegaLite/Selection.hs
@@ -35,6 +35,7 @@
 import Control.Arrow (second)
 
 import Data.Aeson ((.=), object, toJSON)
+import Data.Aeson.Types (Pair)
 import Data.Maybe (mapMaybe)
 
 
@@ -55,11 +56,11 @@
   , fromColor
   , fromDS
   , cursorLabel
+  , (.=~), toKey, toObject
   )
 import Graphics.Vega.VegaLite.Specification
   ( VLProperty(VLSelection)
   , PropertySpec
-  , LabelledSpec
   , SelectSpec(..)
   , BuildSelectSpecs
   , SelectionLabel
@@ -238,10 +239,10 @@
       --   [Vega-Lite toggle documentation](https://vega.github.io/vega-lite/docs/toggle.html).
 
 
-selectionProperties :: SelectionProperty -> [LabelledSpec]
+selectionProperties :: SelectionProperty -> [Pair]
 selectionProperties (Fields fNames) = ["fields" .= fNames]
 selectionProperties (Encodings channels) = ["encodings" .= map channelLabel channels]
-selectionProperties (SInit iVals) = ["init" .= object (map (second dataValueSpec) iVals)]
+selectionProperties (SInit iVals) = ["init" .= toObject (map (second dataValueSpec) iVals)]
 selectionProperties (SInitInterval Nothing Nothing) = []
 selectionProperties (SInitInterval mx my) =
   let conv (_, Nothing) = Nothing
@@ -321,7 +322,7 @@
       -- ^ The offset at which to start the dash pattern.
 
 
-selectionMarkProperty :: SelectionMarkProperty -> LabelledSpec
+selectionMarkProperty :: SelectionMarkProperty -> Pair
 selectionMarkProperty (SMCursor c) = "cursor" .= cursorLabel c
 selectionMarkProperty (SMFill colour) = "fill" .= fromColor colour
 selectionMarkProperty (SMFillOpacity x) = "fillOpacity" .= x
@@ -373,10 +374,10 @@
       -- ^ The initial text for input elements such as text fields.
 
 
-inputProperty :: InputProperty -> LabelledSpec
+inputProperty :: InputProperty -> Pair
 inputProperty (Debounce x) = "debounce" .= x
 inputProperty (Element el) = "element" .= el -- #/definitions/Element
-inputProperty (InOptions opts) = "options" .= map toJSON opts
+inputProperty (InOptions opts) = "options" .= map toJSON opts  -- don't need the map
 inputProperty (InMin x) = "min" .= x
 inputProperty (InMax x) = "max" .= x
 inputProperty (InName s) = "name" .= s
@@ -421,7 +422,7 @@
       -- ^ Color input element that can bound to a named field value.
 
 
-bindingSpec :: Binding -> LabelledSpec
+bindingSpec :: Binding -> Pair
 bindingSpec bnd =
   let (lbl, input, ps) = case bnd of
         IRange label props -> (label, fromT "range", props)
@@ -438,7 +439,7 @@
         ITel label props -> (label, "tel", props)
         IColor label props -> (label, "color", props)
 
-  in (lbl, object (("input" .= input) : map inputProperty ps))
+  in toKey (lbl, object (("input" .= input) : map inputProperty ps))
 
 
 {-|
@@ -465,7 +466,7 @@
     --   that should trigger the selection.
 
 
-bindLegendProperty :: BindLegendProperty -> [LabelledSpec]
+bindLegendProperty :: BindLegendProperty -> [Pair]
 bindLegendProperty (BLField f) = [ toLBind Nothing
                                  , "fields" .= [f]
                                  ]
@@ -479,7 +480,7 @@
                                             , "encodings" .= [channelLabel ch]
                                             ]
 
-toLBind :: Maybe T.Text -> LabelledSpec
+toLBind :: Maybe T.Text -> Pair
 toLBind Nothing = "bind" .= fromT "legend"
 toLBind (Just es) = "bind" .= object ["legend" .= es]
 
@@ -506,7 +507,7 @@
   --
   --   Prior to @0.5.0.0@ this argument was @['LabelledSpec']@.
   -> PropertySpec
-selection sels = (VLSelection, object (map unS sels))
+selection sels = (VLSelection, toObject (map unS sels))
 
 
 {-|
@@ -535,4 +536,4 @@
 select nme sType options ols =
   -- TODO: elm filters out those properties that are set to A.Null
   let selProps = ("type" .= selectionLabel sType) : concatMap selectionProperties options
-  in S (nme .= object selProps) : ols
+  in S (nme .=~ object selProps) : ols
diff --git a/src/Graphics/Vega/VegaLite/Specification.hs b/src/Graphics/Vega/VegaLite/Specification.hs
--- a/src/Graphics/Vega/VegaLite/Specification.hs
+++ b/src/Graphics/Vega/VegaLite/Specification.hs
@@ -3,7 +3,7 @@
 
 {-|
 Module      : Graphics.Vega.VegaLite.Specification
-Copyright   : (c) Douglas Burke, 2018-2020
+Copyright   : (c) Douglas Burke, 2018-2021
 License     : BSD3
 
 Maintainer  : dburke.gw@gmail.com
@@ -50,6 +50,10 @@
        )
     where
 
+#if MIN_VERSION_aeson(2, 0, 0)
+import qualified Data.Aeson.Key as Key
+#endif
+
 -- VegaLite uses these symbols.
 import Prelude hiding (filter, lookup, repeat)
 
@@ -58,7 +62,12 @@
 import Control.Arrow (first)
 
 -- Aeson's Value type conflicts with the Number type
+#if MIN_VERSION_aeson(2, 0, 0)
+import Data.Aeson (Value, object, toJSON)
+#else
 import Data.Aeson (Value, object, (.=))
+#endif
+
 import Data.Maybe (catMaybes, fromMaybe)
 
 #if !(MIN_VERSION_base(4, 12, 0))
@@ -232,7 +241,11 @@
   --   JSON representation of the visualization (noting that @VLSpec@ is
   --   an alias for @Value@).
 fromVL (VL (schema, specs)) =
+#if MIN_VERSION_aeson(2, 0, 0)
+  let kvals = map (first Key.fromText) (("$schema", toJSON schema) : specs)
+#else
   let kvals = ("$schema" .= schema) : specs
+#endif
   in object kvals
 
 
@@ -249,8 +262,11 @@
 @
 -}
 asSpec :: [PropertySpec] -> VLSpec
+#if MIN_VERSION_aeson(2, 0, 0)
+asSpec = object . map (first Key.fromText) . unProperty
+#else
 asSpec = object . unProperty
-
+#endif
 
 {-|
 
diff --git a/src/Graphics/Vega/VegaLite/Time.hs b/src/Graphics/Vega/VegaLite/Time.hs
--- a/src/Graphics/Vega/VegaLite/Time.hs
+++ b/src/Graphics/Vega/VegaLite/Time.hs
@@ -3,7 +3,7 @@
 
 {-|
 Module      : Graphics.Vega.VegaLite.Time
-Copyright   : (c) Douglas Burke, 2018-2020
+Copyright   : (c) Douglas Burke, 2018-2021
 License     : BSD3
 
 Maintainer  : dburke.gw@gmail.com
@@ -22,7 +22,7 @@
        , BaseTimeUnit(..)
 
        -- not for external export
-       , dateTimeProperty
+       , dateTimeSpec
        , timeUnitSpec
        
        ) where
@@ -30,6 +30,7 @@
 import qualified Data.Text as T
 
 import Data.Aeson ((.=), object, toJSON)
+import Data.Aeson.Types (Pair)
 
 #if !(MIN_VERSION_base(4, 12, 0))
 import Data.Monoid ((<>))
@@ -38,7 +39,7 @@
 -- added in base 4.8.0.0 / ghc 7.10.1
 import Numeric.Natural (Natural)
 
-import Graphics.Vega.VegaLite.Specification (LabelledSpec, VLSpec)
+import Graphics.Vega.VegaLite.Specification (VLSpec)
 
 
 {-|
@@ -364,7 +365,7 @@
 baseTimeUnitLabel SecondsMilliseconds = "secondsmilliseconds"
 
 
-dateTimeProperty :: DateTime -> LabelledSpec
+dateTimeProperty :: DateTime -> Pair
 dateTimeProperty (DTYear y) = "year" .= y
 dateTimeProperty (DTQuarter q) = "quarter" .= q
 dateTimeProperty (DTMonth mon) = "month" .= monthNameLabel mon
@@ -379,6 +380,9 @@
 dateTimeProperty (DTSeconds s) = "seconds" .= s
 dateTimeProperty (DTMilliseconds ms) = "milliseconds" .= ms
 
+
+dateTimeSpec :: [DateTime] -> VLSpec
+dateTimeSpec = object . map dateTimeProperty
 
 dayLabel :: DayName -> T.Text
 dayLabel Mon = "Mon"
diff --git a/src/Graphics/Vega/VegaLite/Transform.hs b/src/Graphics/Vega/VegaLite/Transform.hs
--- a/src/Graphics/Vega/VegaLite/Transform.hs
+++ b/src/Graphics/Vega/VegaLite/Transform.hs
@@ -3,7 +3,7 @@
 
 {-|
 Module      : Graphics.Vega.VegaLite.Transform
-Copyright   : (c) Douglas Burke, 2018-2020
+Copyright   : (c) Douglas Burke, 2018-2021
 License     : BSD3
 
 Maintainer  : dburke.gw@gmail.com
@@ -46,6 +46,7 @@
 import qualified Data.Text as T
 
 import Data.Aeson ((.=), object, toJSON)
+import Data.Aeson.Types (Pair)
 import Data.Maybe (mapMaybe)
 
 #if !(MIN_VERSION_base(4, 12, 0))
@@ -62,13 +63,12 @@
   ( FieldName
   , SortField
   , sortFieldSpec
-  , field_
+  -- , field_
   , fromT
   , allowNull
   )
 import Graphics.Vega.VegaLite.Specification
   ( VLSpec
-  , LabelledSpec
   , TransformSpec(..)
   , SelectionLabel
   )
@@ -195,10 +195,10 @@
 operationSpec VarianceP = "variancep"
 
 
-aggregate_ :: Operation -> LabelledSpec
+aggregate_ :: Operation -> Pair
 aggregate_ op = "aggregate" .= operationSpec op
 
-op_ :: Operation -> LabelledSpec
+op_ :: Operation -> Pair
 op_ op = "op" .= operationSpec op
 
 
@@ -219,11 +219,11 @@
       --   that do not apply to fields such as 'Count', 'Rank', and 'DenseRank'.
 
 
-windowFieldProperty :: Window -> LabelledSpec
+windowFieldProperty :: Window -> Pair
 windowFieldProperty (WAggregateOp op) = "op" .= operationSpec op
 windowFieldProperty (WOp op) = "op" .= wOperationLabel op
 windowFieldProperty (WParam n) = "param" .= n
-windowFieldProperty (WField f) = field_ f
+windowFieldProperty (WField f) = "field" .= f  -- was "field_ f"
 
 
 -- | Window-specific operation for transformations (for use with 'WOp').
@@ -340,7 +340,7 @@
       -- ^ Pick the step size from this list.
 
 
-binProperty :: BinProperty -> LabelledSpec
+binProperty :: BinProperty -> Pair
 binProperty (AlreadyBinned b) = "binned" .= b
 binProperty (BinAnchor x) = "anchor" .= x
 binProperty (Base x) = "base" .= x
@@ -354,11 +354,11 @@
 binProperty (Steps xs) = "steps" .= xs
 
 
-bin :: [BinProperty] -> LabelledSpec
+bin :: [BinProperty] -> Pair
 bin [] = "bin" .= True
 bin xs = "bin" .= object (map binProperty xs)
 
-binned_ :: LabelledSpec
+binned_ :: Pair
 binned_ = "bin" .= fromT "binned"
 
 
@@ -462,7 +462,7 @@
       -- ^ The replacement value (when using @ImMethod 'ImValue'@).
 
 
-imputeProperty :: ImputeProperty -> LabelledSpec
+imputeProperty :: ImputeProperty -> Pair
 imputeProperty (ImFrame m1 m2) = "frame" .= map allowNull [m1, m2]
 imputeProperty (ImKeyVals dVals) = "keyvals" .= dataValuesSpecs dVals
 imputeProperty (ImKeyValSequence start stop step) =
@@ -497,7 +497,7 @@
 imputePropertySpecValue _ = Nothing
 
 
-impute_ :: [ImputeProperty] -> LabelledSpec
+impute_ :: [ImputeProperty] -> Pair
 impute_ ips = "impute" .= object (map imputeProperty ips)
 
 
diff --git a/stack.yaml b/stack.yaml
--- a/stack.yaml
+++ b/stack.yaml
@@ -5,4 +5,4 @@
 
 extra-deps: []
 
-resolver: lts-15.5
+resolver: lts-21.2
diff --git a/tests/CompositeTests.hs b/tests/CompositeTests.hs
--- a/tests/CompositeTests.hs
+++ b/tests/CompositeTests.hs
@@ -174,13 +174,13 @@
 errorband2No = eBand "stdev" False
 
 
+barley :: Data
+barley = dataFromUrl "https://vega.github.io/vega-lite/data/barley.json" []
+
+
 eBar :: MarkErrorExtent -> VegaLite
 eBar ext =
-    let
-        barley =
-            dataFromUrl "https://vega.github.io/vega-lite/data/barley.json" []
-
-        enc =
+    let enc =
             encoding
                 . position X [ PName "yield", PmType Quantitative
                              , PScale [ SZero False ] ]
@@ -235,7 +235,7 @@
     in
     toVegaLite
         [ des
-        , dataFromUrl "https://vega.github.io/vega-lite/data/barley.json" []
+        , barley
         , layer [ specErrorBars, specPoints ]
         ]
 
diff --git a/tests/ConditionalTests.hs b/tests/ConditionalTests.hs
--- a/tests/ConditionalTests.hs
+++ b/tests/ConditionalTests.hs
@@ -25,6 +25,7 @@
             , ("selectionCondition5", selectionCondition5)
             , ("bindScales1", bindScales1)
             , ("bindScales2", bindScales2)
+            , ("selectionHeatMap", selectionHeatMap)
             ]
 
 
@@ -325,3 +326,51 @@
     in
     toVegaLite
         [ width 300, height 300, carData, sel [], mark Circle [], encHorses [] ]
+
+
+-- https://github.com/vega/vega-lite/blob/master/examples/specs/selection_heatmap.vl.json
+--
+selectionHeatMap :: VegaLite
+selectionHeatMap =
+  let dvals = dataFromColumns []
+              . dataColumn "count" (Numbers [13, 0, 0, 0, 10, 6, 0, 0, 9])
+              . dataColumn "actual" (Strings ["A", "A", "A", "B", "B", "B", "C", "C", "C"])
+              . dataColumn "predicted" (Strings ["A", "B", "C", "A", "B", "C", "A", "B", "C"])
+
+      enc = encoding
+            . position X [PName "predicted", PmType Nominal]
+            . position Y [PName "actual", PmType Nominal]
+            . fill [MName "count", MmType Quantitative]
+            . stroke [ MDataCondition
+                       [(And
+                         (Selection "highlight")
+                         (Expr "length(data(\"highlight_store\"))")
+                        , [MString "black"])]
+                       [MNullValue]
+                     ]
+            . opacity [ MSelectionCondition
+                        (SelectionName "highlight")
+                        [MNumber 1]
+                        [MNumber 0.5]
+                      ]
+            . order [ OSelectionCondition
+                      (SelectionName "highlight")
+                      [ONumber 1]
+                      [ONumber 0]
+                    ]
+
+      sel = selection
+            . select "highlight" Single []
+
+      conf = configure
+             . configuration (ScaleStyle [SCBandPaddingInner 0, SCBandPaddingOuter 0])
+             . configuration (ViewStyle [ViewStep 40])
+             . configuration (RangeStyle [RRamp "yellowgreenblue"])
+             . configuration (Axis [Domain False])
+
+  in toVegaLite [ dvals []
+                , sel []
+                , enc []
+                , mark Rect [MStrokeWidth 2]
+                , conf []
+                ]
diff --git a/tests/DataTests.hs b/tests/DataTests.hs
--- a/tests/DataTests.hs
+++ b/tests/DataTests.hs
@@ -694,7 +694,7 @@
 domain1, domain2, domain3 :: VegaLite
 domain1 = domain []
 domain2 = domain [SDomain (DNumbers [90, 100])]
-domain3 = domain [SDomain (DUnionWith (DNumbers [90, 100]))]
+domain3 = domain [SDomainOpt (DUnionWith (DNumbers [90, 100]))]
 
 
 {-
diff --git a/tests/EncodingTests.hs b/tests/EncodingTests.hs
--- a/tests/EncodingTests.hs
+++ b/tests/EncodingTests.hs
@@ -13,6 +13,7 @@
 testSpecs :: [(String, VegaLite)]
 testSpecs = [ ("strokedashgroup", strokeDashGroup)
             , ("strokedashline", strokeDashLine)
+            , ("nullencoding", nullEncoding)
             ]
             
 
@@ -41,3 +42,26 @@
                . strokeDash [ MName "predicted", MmType Nominal ]
                $ []
              ]
+
+-- See https://github.com/vega/vega-lite/issues/6762
+--
+-- Note: a "null" encoding here is with no arguments, which creates {}.
+-- We don't support creating null instead of {}.
+--
+nullEncoding :: VegaLite
+nullEncoding =
+  let dvals = dataFromColumns []
+              . dataColumn "a" (Strings ["A", "B", "D", "E", "E", "G", "H", "I"])
+              . dataColumn "b" (Numbers [28, 55, 91, 81, 81, 19, 87, 52])
+
+      lyr1 = [mark Bar []]
+      lyr2 = [mark Rule [], encoding (position X [] [])]
+      
+  in toVegaLite [ description "Can we null the encoding"
+                , dvals []
+                , encoding
+                  . position X [PName "a", PmType Nominal, PAxis [AxLabelAngle 0]]
+                  . position Y [PName "b", PmType Quantitative]
+                  $ []
+                , layer (map asSpec [lyr1, lyr2])
+                ]
diff --git a/tests/Gallery/Bar.hs b/tests/Gallery/Bar.hs
--- a/tests/Gallery/Bar.hs
+++ b/tests/Gallery/Bar.hs
@@ -21,6 +21,8 @@
             , ("bar4", bar4)
             , ("bar5", bar5)
             , ("bar6", bar6)
+            , ("bar6order", bar6order)
+            , ("bar6sort", bar6sort)
             , ("bar7", bar7)
             , ("bar8", bar8)
             , ("bar9", bar9)
@@ -208,25 +210,58 @@
         ]
 
 
--- bar9 in GalleryBar.elm
+barley :: Data
+barley = dataFromUrl "https://vega.github.io/vega-lite/data/barley.json" []
+
+
+barleyEnc :: [EncodingSpec] -> PropertySpec
+barleyEnc = encoding
+            . position X [ PName "yield", PmType Quantitative, PAggregate Sum ]
+            . position Y [ PName "variety", PmType Nominal ]
+            . color [ MName "site", MmType Nominal ]
+
+
+-- bar9 in GalleryBar.elm, also first version of
+-- https://vega.github.io/vega-lite/docs/stack.html#sorting-stack-order
 bar6 :: VegaLite
 bar6 =
-    let
-        des =
-            description "Barley crop yields as a horizontal stacked bar chart"
+  let des = description "Barley crop yields as a horizontal stacked bar chart"
 
-        enc =
-            encoding
-                . position X [ PName "yield", PmType Quantitative, PAggregate Sum ]
-                . position Y [ PName "variety", PmType Nominal ]
-                . color [ MName "site", MmType Nominal ]
-    in
-    toVegaLite
-        [ des
-        , dataFromUrl "https://vega.github.io/vega-lite/data/barley.json" []
-        , mark Bar []
-        , enc []
-        ]
+  in toVegaLite [ des
+                , barley
+                , mark Bar []
+                , barleyEnc []
+                ]
+
+
+-- tweaks to bar6 from https://vega.github.io/vega-lite/docs/stack.html#sorting-stack-order
+--
+bar6order :: VegaLite
+bar6order =
+  let enc = barleyEnc
+            . order [ OName "yield", OmType Quantitative, OAggregate Sum ]
+
+  in toVegaLite [ barley
+                , mark Bar []
+                , enc []
+                ]
+
+
+-- tweaks to bar6 from https://vega.github.io/vega-lite/docs/stack.html#sorting-stack-order
+--
+bar6sort :: VegaLite
+bar6sort =
+  let enc = barleyEnc
+            . order [ OName "siteOrder" ]
+
+      trans = transform
+              . calculateAs "if(datum.site === 'University Farm', 0, if(datum.site === 'Grand Rapids', 1, 2))" "siteOrder"
+
+  in toVegaLite [ barley
+                , trans []
+                , mark Bar []
+                , enc []
+                ]
 
 
 -- bar10 in GalleryBar.elm
diff --git a/tests/Gallery/Facet.hs b/tests/Gallery/Facet.hs
--- a/tests/Gallery/Facet.hs
+++ b/tests/Gallery/Facet.hs
@@ -8,10 +8,13 @@
 
 import Graphics.Vega.VegaLite
 
--- import qualified Data.Text as T
+import qualified Data.Text as T
 
 import Prelude hiding (filter, lookup, repeat)
 
+import Data.Aeson (Value, (.=), object, toJSON)
+
+
 testSpecs :: [(String, VegaLite)]
 testSpecs = [ ("facet1", facet1)
             , ("facet2", facet2)
@@ -22,6 +25,7 @@
             , ("facet7", facet7)
             , ("trellisareaseattle", trellisAreaSeattle)
             , ("facetgridbar", facetGridBar)
+            , ("facet_bullet", facetBullet)
             ]
 
 
@@ -326,4 +330,70 @@
                 , spacing 5
                 , mark Bar []
                 , enc []
+                ]
+
+
+bullets :: Value
+bullets =
+  let item :: T.Text -> T.Text -> [Double] -> [Double] -> [Double] -> Value
+      item ttl subtitle ranges measures markers =
+        object [ "title" .= ttl
+               , "subtitle" .= subtitle
+               , "ranges" .= ranges
+               , "measures" .= measures
+               , "markers" .= markers
+               ]
+
+  in toJSON [ item "Revenue" "US$, in thousands" [150,225,300] [220,270] [250]
+            , item "Profit" "%" [20,25,30] [21,23] [26]
+            , item "Order Size" "US$, average" [350,500,600] [100,320] [550]
+            , item "New Customers" "count" [1400,2000,2500] [1000,1650] [2100]
+            , item "Satisfaction" "out of 5" [3.5,4.25,5] [3.2,4.7] [4.4]
+            ]
+
+
+-- https://vega.github.io/vega-lite/examples/facet_bullet.html
+facetBullet :: VegaLite
+facetBullet =
+  let facetOpts = facet [ RowBy [ FName "title"
+                                , FmType Ordinal
+                                , FHeader [ HLabelAngle 0
+                                          , HNoTitle ]
+                                ]
+                        ]
+
+      plot = asSpec [ encoding
+                      (position X [ PmType Quantitative
+                                  , PScale [SNice (IsNice False)]
+                                  , PNoTitle
+                                  ] [])
+                    , layer (map asSpec plots)
+                    ]
+
+      encX fld = encoding (position X [PName fld] [])
+
+      plots = [ [ mark Bar [MColor "#eee"]
+                , encX "ranges[2]" ]
+              , [ mark Bar [MColor "#ddd"]
+                , encX "ranges[1]" ]
+              , [ mark Bar [MColor "#ccc"]
+                , encX "ranges[0]" ]
+              , [ mark Bar [MColor "lightsteelblue", MSize 10]
+                , encX "measures[1]" ]
+              , [ mark Bar [MColor "steelblue", MSize 10]
+                , encX "measures[0]" ]
+              , [ mark Tick [MColor "black"]
+                , encX "markers[0]" ]
+              ]
+
+      res = resolve . resolution (RScale [(ChX, Independent)])
+
+      cfg = configure . configuration (TickStyle [MThickness 2])
+
+  in toVegaLite [ dataFromJson bullets []
+                , facetOpts
+                , spacing 10
+                , specification plot
+                , res []
+                , cfg []
                 ]
diff --git a/tests/Gallery/Geo.hs b/tests/Gallery/Geo.hs
--- a/tests/Gallery/Geo.hs
+++ b/tests/Gallery/Geo.hs
@@ -280,7 +280,7 @@
         encoding
         . position Longitude [ PName "longitude", PmType Quantitative ]
         . position Latitude [ PName "latitude", PmType Quantitative ]
-        . order [ OName "order", OmType Ordinal ]
+        . order [ OName "order" ]
 
       flightsSpec =
         asSpec
diff --git a/tests/Gallery/Label.hs b/tests/Gallery/Label.hs
--- a/tests/Gallery/Label.hs
+++ b/tests/Gallery/Label.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE QuasiQuotes #-}
 
@@ -9,7 +10,11 @@
 
 import Data.Aeson (Value(Object))
 import Data.Aeson.QQ.Simple (aesonQQ)
+#if MIN_VERSION_aeson(2, 0, 0)
+import Data.Aeson.KeyMap (empty)
+#else
 import Data.HashMap.Strict (empty)
+#endif
 
 import Graphics.Vega.VegaLite
 
diff --git a/tests/Gallery/Line.hs b/tests/Gallery/Line.hs
--- a/tests/Gallery/Line.hs
+++ b/tests/Gallery/Line.hs
@@ -134,7 +134,7 @@
             encoding
                 . position X [ PName "miles", PmType Quantitative, PScale [ SZero False ] ]
                 . position Y [ PName "gas", PmType Quantitative, PScale [ SZero False ] ]
-                . order [ OName "year", OmType Temporal ]
+                . order [ OName "year" ]
     in
     toVegaLite
         [ des
diff --git a/tests/Gallery/Multi.hs b/tests/Gallery/Multi.hs
--- a/tests/Gallery/Multi.hs
+++ b/tests/Gallery/Multi.hs
@@ -37,7 +37,7 @@
                 . position X
                     [ PName "date"
                     , PmType Temporal
-                    , PScale [ SDomain (DSelection "myBrush") ]
+                    , PScale [ SDomainOpt (DSelection "myBrush") ]
                     , PAxis [ AxNoTitle ]
                     ]
                 . position Y [ PName "price", PmType Quantitative ]
@@ -515,8 +515,8 @@
       xr = (Number 0.2, Number 6)
       yr = (Number (-0.8), Number 0.8)
 
-      xscale = [ SDomain (DSelectionField "brush" "theta") ]
-      yscale = [ SDomain (DSelectionChannel "brush" ChY) ]
+      xscale = [ SDomainOpt (DSelectionField "brush" "theta") ]
+      yscale = [ SDomainOpt (DSelectionChannel "brush" ChY) ]
 
       plot2 = asSpec [ encoding
                        . position X [ PName "theta", PmType Quantitative, PScale xscale ]
diff --git a/tests/MarkTests.hs b/tests/MarkTests.hs
--- a/tests/MarkTests.hs
+++ b/tests/MarkTests.hs
@@ -25,6 +25,7 @@
             , ("pieChartWithLabels", pieChartWithLabels)
             , ("donutChart", donutChart)
             , ("radialChart", radialChart)
+            , ("pyramidChart", pyramidChart)
             , ("histogram_binned_no_x2", histogramBinnedNoX2)
             ]
 
@@ -226,6 +227,48 @@
                   . color [MName "data", MmType Nominal, MLegend []]
                   $ []
                 , layer [asSpec plot, asSpec label]
+                , viewBackground [VBNoStroke]
+                ]
+
+
+-- https://vega.github.io/vega-lite/examples/arc_pie_pyramid.html
+--
+pyramidChart :: VegaLite
+pyramidChart =
+  let desc = description "Reproducing http://robslink.com/SAS/democd91/pyramid_pie.htm"
+      dvals = dataFromColumns []
+              . dataColumn "value" (Numbers [75, 10, 15])
+              . dataColumn "order" (Numbers [3, 1, 2])
+              . dataColumn "category" (Strings ["Sky", "Shady side of a pyramid", "Sunny side of a pyramid"])
+              $ []
+
+      cmap = [ ("Sky", "#416D9D")
+             , ("Shady side of a pyramid", "#674028")
+             , ("Sunny side of a pyramid", "#DEAC58")
+             ]
+
+  in toVegaLite [ desc
+                , dvals
+                , mark Arc [MOuterRadius 80]
+                , encoding
+                  . position Theta [ PName "value"
+                                   , PmType Quantitative
+                                   , PScale [SRange (RPair 2.35619449 8.639379797)]
+                                   -- How to get "stack": True???
+                                   , PStack StZero
+                                   ]
+                  . color [ MName "category"
+                          , MmType Nominal
+                          , MScale (categoricalDomainMap cmap)
+                          , MLegend [ LOrient LONone
+                                    , LNoTitle
+                                    , LColumns 1
+                                    , LeX 200
+                                    , LeY 80
+                                    ]
+                          ]
+                  . order [OName "order"]
+                  $ []
                 , viewBackground [VBNoStroke]
                 ]
 
diff --git a/tests/ScaleTests.hs b/tests/ScaleTests.hs
--- a/tests/ScaleTests.hs
+++ b/tests/ScaleTests.hs
@@ -20,6 +20,8 @@
             , ("diverging1", diverging1)
             , ("diverging2", diverging2)
             , ("axisrange", axisrange)
+            , ("axislimit", axislimit)
+            , ("namedaxisrange", namedAxisRange)
             ]
 
 scale1 :: VegaLite
@@ -206,21 +208,19 @@
 
 diverging2 :: VegaLite
 diverging2 = toVegaLite [ divergingData
-                        , divergingEnc [ SDomainMid 0 ]
+                        , divergingEnc [ SDomainOpt (DMid 0) ]
                         , mark Bar []
                         ]
 
 
-axisrange :: VegaLite
-axisrange =
+axes :: [ScaleProperty] -> [ScaleProperty] -> VegaLite
+axes xscale yscale =
   let cars = dataFromUrl "https://vega.github.io/vega-lite/data/cars.json" []
 
-      ax axis vals = [ PName axis, PmType Quantitative, PScale [SRange vals] ]
-      xrange = RWidth 50
-      yrange = RHeight 60
+      ax axis vals = [ PName axis, PmType Quantitative, PScale vals ]
       enc = encoding
-            . position X (ax "Horsepower" xrange)
-            . position Y (ax "Miles_per_Gallon" yrange)
+            . position X (ax "Horsepower" xscale)
+            . position Y (ax "Miles_per_Gallon" yscale)
             . size [ MName "Acceleration", MmType Quantitative, MBin [] ]
             . opacity [ MName "Acceleration", MmType Quantitative, MBin [] ]
             
@@ -228,3 +228,26 @@
                 , enc []
                 , mark Point [ MFilled True, MStroke "white", MStrokeWidth 0.4 ]
                 ]
+
+
+axisrange, axislimit :: VegaLite
+axisrange = axes [SRange (RWidth 50)] [SRange (RHeight 60)]
+axislimit = axes
+            [SDomainOpt (DMin (-10)), SDomainOpt (DMax 300)]
+            [SRange (RMin 220), SRange (RMax 10)]
+
+
+-- Based on https://github.com/vega/vega-lite/issues/6392
+--
+namedAxisRange :: VegaLite
+namedAxisRange =
+  let dataVals = dataFromColumns []
+                 . dataColumn "col" (Strings ["X", "Y"])
+                 . dataColumn "l" (Strings ["A", "B"])
+                 . dataColumn "c" (Strings ["#ff0000", "#0000ff"])
+
+      enc = encoding
+            . position Y [PName "col", PmType Nominal]
+            . color [MName "l", MmType Nominal, MScale [SRange (RField "c")]]
+
+  in toVegaLite [dataVals [], mark Circle [], enc []]
diff --git a/tests/Test.hs b/tests/Test.hs
--- a/tests/Test.hs
+++ b/tests/Test.hs
@@ -25,7 +25,8 @@
 
 import qualified Data.ByteString.Lazy.Char8 as BL8
 
-import Data.Aeson.Encode.Pretty (encodePretty)
+import Data.Aeson (Value)
+import Data.Aeson.Encode.Pretty (Config(confCompare), encodePretty', defConfig)
 
 import System.FilePath ((</>), (<.>))
 
@@ -84,6 +85,20 @@
 import qualified Gallery.Repeat as GR
 import qualified Gallery.Scatter as GS
 import qualified Gallery.Table as GTBL
+
+
+-- Ensure we have a repeatable ordering for the output.
+-- Hopefully this is repeatable enough (brought on by
+-- changes in hashable 0.3.1.0 but it makes sense to
+-- do this here as I hadn't realised that the default
+-- encodePretty didn't actually apply any sorting to
+-- the keys).
+--
+encodePretty :: Value -> BL8.ByteString
+encodePretty = encodePretty' config
+  where
+    config = defConfig { confCompare = compare }
+
 
 -- The "golden" output is "tests/specs/<label>/<name>.vl"
 -- where label can now itself contain sub-directories, so should
diff --git a/tests/ViewCompositionTests.hs b/tests/ViewCompositionTests.hs
--- a/tests/ViewCompositionTests.hs
+++ b/tests/ViewCompositionTests.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE OverloadedStrings #-}
 
 --
@@ -13,7 +14,11 @@
 import Prelude hiding (filter, repeat)
 
 import Data.Aeson (Value(Object))
+#if MIN_VERSION_aeson(2, 0, 0)
+import Data.Aeson.KeyMap (empty)
+#else
 import Data.HashMap.Strict (empty)
+#endif
 
 
 testSpecs :: [(String, VegaLite)]
diff --git a/tests/specs/axis/axis1.vl b/tests/specs/axis/axis1.vl
--- a/tests/specs/axis/axis1.vl
+++ b/tests/specs/axis/axis1.vl
@@ -1,513 +1,509 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "x",
@@ -517,5 +513,9 @@
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis1c.vl b/tests/specs/axis/axis1c.vl
--- a/tests/specs/axis/axis1c.vl
+++ b/tests/specs/axis/axis1c.vl
@@ -1,541 +1,537 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
+        "axisQuantitative": {
+            "domainColor": "orange",
+            "gridColor": "seagreen",
+            "labelFont": "Comic Sans MS",
+            "labelOffset": 10,
+            "tickOffset": 10
+        },
         "axisTemporal": {
             "domainColor": "brown",
-            "labelColor": "purple",
-            "grid": false,
             "domainDash": [
                 4,
                 2
-            ]
-        },
-        "axisQuantitative": {
-            "domainColor": "orange",
-            "tickOffset": 10,
-            "labelOffset": 10,
-            "gridColor": "seagreen",
-            "labelFont": "Comic Sans MS"
+            ],
+            "grid": false,
+            "labelColor": "purple"
         },
         "line": {
-            "strokeWidth": 2,
-            "stroke": "gray"
+            "stroke": "gray",
+            "strokeWidth": 2
         },
         "point": {
-            "strokeWidth": 1,
-            "stroke": "black",
             "fill": "yellow",
-            "strokeOpacity": 0.4
+            "stroke": "black",
+            "strokeOpacity": 0.4,
+            "strokeWidth": 1
         }
     },
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "x",
@@ -545,5 +541,9 @@
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis2.vl b/tests/specs/axis/axis2.vl
--- a/tests/specs/axis/axis2.vl
+++ b/tests/specs/axis/axis2.vl
@@ -1,513 +1,509 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "catX",
@@ -517,5 +513,9 @@
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis2c.vl b/tests/specs/axis/axis2c.vl
--- a/tests/specs/axis/axis2c.vl
+++ b/tests/specs/axis/axis2c.vl
@@ -1,541 +1,537 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
+        "axisQuantitative": {
+            "domainColor": "orange",
+            "gridColor": "seagreen",
+            "labelFont": "Comic Sans MS",
+            "labelOffset": 10,
+            "tickOffset": 10
+        },
         "axisTemporal": {
             "domainColor": "brown",
-            "labelColor": "purple",
-            "grid": false,
             "domainDash": [
                 4,
                 2
-            ]
-        },
-        "axisQuantitative": {
-            "domainColor": "orange",
-            "tickOffset": 10,
-            "labelOffset": 10,
-            "gridColor": "seagreen",
-            "labelFont": "Comic Sans MS"
+            ],
+            "grid": false,
+            "labelColor": "purple"
         },
         "line": {
-            "strokeWidth": 2,
-            "stroke": "gray"
+            "stroke": "gray",
+            "strokeWidth": 2
         },
         "point": {
-            "strokeWidth": 1,
-            "stroke": "black",
             "fill": "yellow",
-            "strokeOpacity": 0.4
+            "stroke": "black",
+            "strokeOpacity": 0.4,
+            "strokeWidth": 1
         }
     },
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "catX",
@@ -545,5 +541,9 @@
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis3.vl b/tests/specs/axis/axis3.vl
--- a/tests/specs/axis/axis3.vl
+++ b/tests/specs/axis/axis3.vl
@@ -1,513 +1,509 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -517,5 +513,9 @@
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis3c.vl b/tests/specs/axis/axis3c.vl
--- a/tests/specs/axis/axis3c.vl
+++ b/tests/specs/axis/axis3c.vl
@@ -1,541 +1,537 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
+        "axisQuantitative": {
+            "domainColor": "orange",
+            "gridColor": "seagreen",
+            "labelFont": "Comic Sans MS",
+            "labelOffset": 10,
+            "tickOffset": 10
+        },
         "axisTemporal": {
             "domainColor": "brown",
-            "labelColor": "purple",
-            "grid": false,
             "domainDash": [
                 4,
                 2
-            ]
-        },
-        "axisQuantitative": {
-            "domainColor": "orange",
-            "tickOffset": 10,
-            "labelOffset": 10,
-            "gridColor": "seagreen",
-            "labelFont": "Comic Sans MS"
+            ],
+            "grid": false,
+            "labelColor": "purple"
         },
         "line": {
-            "strokeWidth": 2,
-            "stroke": "gray"
+            "stroke": "gray",
+            "strokeWidth": 2
         },
         "point": {
-            "strokeWidth": 1,
-            "stroke": "black",
             "fill": "yellow",
-            "strokeOpacity": 0.4
+            "stroke": "black",
+            "strokeOpacity": 0.4,
+            "strokeWidth": 1
         }
     },
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -545,5 +541,9 @@
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis4.vl b/tests/specs/axis/axis4.vl
--- a/tests/specs/axis/axis4.vl
+++ b/tests/specs/axis/axis4.vl
@@ -1,517 +1,511 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
                 "values": [
                     1,
@@ -519,11 +513,17 @@
                     39,
                     90
                 ]
-            }
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis4c.vl b/tests/specs/axis/axis4c.vl
--- a/tests/specs/axis/axis4c.vl
+++ b/tests/specs/axis/axis4c.vl
@@ -1,545 +1,539 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
+        "axisQuantitative": {
+            "domainColor": "orange",
+            "gridColor": "seagreen",
+            "labelFont": "Comic Sans MS",
+            "labelOffset": 10,
+            "tickOffset": 10
+        },
         "axisTemporal": {
             "domainColor": "brown",
-            "labelColor": "purple",
-            "grid": false,
             "domainDash": [
                 4,
                 2
-            ]
-        },
-        "axisQuantitative": {
-            "domainColor": "orange",
-            "tickOffset": 10,
-            "labelOffset": 10,
-            "gridColor": "seagreen",
-            "labelFont": "Comic Sans MS"
+            ],
+            "grid": false,
+            "labelColor": "purple"
         },
         "line": {
-            "strokeWidth": 2,
-            "stroke": "gray"
+            "stroke": "gray",
+            "strokeWidth": 2
         },
         "point": {
-            "strokeWidth": 1,
-            "stroke": "black",
             "fill": "yellow",
-            "strokeOpacity": 0.4
+            "stroke": "black",
+            "strokeOpacity": 0.4,
+            "strokeWidth": 1
         }
     },
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
                 "values": [
                     1,
@@ -547,11 +541,17 @@
                     39,
                     90
                 ]
-            }
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis5.vl b/tests/specs/axis/axis5.vl
--- a/tests/specs/axis/axis5.vl
+++ b/tests/specs/axis/axis5.vl
@@ -1,517 +1,511 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "catX",
-            "type": "ordinal",
             "axis": {
                 "values": [
                     "1",
@@ -520,11 +514,17 @@
                     "dummy",
                     "90"
                 ]
-            }
+            },
+            "field": "catX",
+            "type": "ordinal"
         },
         "y": {
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis5c.vl b/tests/specs/axis/axis5c.vl
--- a/tests/specs/axis/axis5c.vl
+++ b/tests/specs/axis/axis5c.vl
@@ -1,545 +1,539 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
+        "axisQuantitative": {
+            "domainColor": "orange",
+            "gridColor": "seagreen",
+            "labelFont": "Comic Sans MS",
+            "labelOffset": 10,
+            "tickOffset": 10
+        },
         "axisTemporal": {
             "domainColor": "brown",
-            "labelColor": "purple",
-            "grid": false,
             "domainDash": [
                 4,
                 2
-            ]
-        },
-        "axisQuantitative": {
-            "domainColor": "orange",
-            "tickOffset": 10,
-            "labelOffset": 10,
-            "gridColor": "seagreen",
-            "labelFont": "Comic Sans MS"
+            ],
+            "grid": false,
+            "labelColor": "purple"
         },
         "line": {
-            "strokeWidth": 2,
-            "stroke": "gray"
+            "stroke": "gray",
+            "strokeWidth": 2
         },
         "point": {
-            "strokeWidth": 1,
-            "stroke": "black",
             "fill": "yellow",
-            "strokeOpacity": 0.4
+            "stroke": "black",
+            "strokeOpacity": 0.4,
+            "strokeWidth": 1
         }
     },
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "catX",
-            "type": "ordinal",
             "axis": {
                 "values": [
                     "1",
@@ -548,11 +542,17 @@
                     "dummy",
                     "90"
                 ]
-            }
+            },
+            "field": "catX",
+            "type": "ordinal"
         },
         "y": {
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis6.vl b/tests/specs/axis/axis6.vl
--- a/tests/specs/axis/axis6.vl
+++ b/tests/specs/axis/axis6.vl
@@ -1,8 +1,5 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -55,34 +52,37 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "date",
-            "type": "temporal",
             "axis": {
                 "values": [
                     {
                         "date": 4,
-                        "year": 2019,
-                        "month": "Jan"
+                        "month": "Jan",
+                        "year": 2019
                     },
                     {
                         "date": 8,
-                        "year": 2019,
-                        "month": "Jan"
+                        "month": "Jan",
+                        "year": 2019
                     },
                     {
                         "date": 20,
-                        "year": 2019,
-                        "month": "Jan"
+                        "month": "Jan",
+                        "year": 2019
                     }
                 ]
-            }
+            },
+            "field": "date",
+            "type": "temporal"
         },
         "y": {
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis6c.vl b/tests/specs/axis/axis6c.vl
--- a/tests/specs/axis/axis6c.vl
+++ b/tests/specs/axis/axis6c.vl
@@ -1,36 +1,33 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
+        "axisQuantitative": {
+            "domainColor": "orange",
+            "gridColor": "seagreen",
+            "labelFont": "Comic Sans MS",
+            "labelOffset": 10,
+            "tickOffset": 10
+        },
         "axisTemporal": {
             "domainColor": "brown",
-            "labelColor": "purple",
-            "grid": false,
             "domainDash": [
                 4,
                 2
-            ]
-        },
-        "axisQuantitative": {
-            "domainColor": "orange",
-            "tickOffset": 10,
-            "labelOffset": 10,
-            "gridColor": "seagreen",
-            "labelFont": "Comic Sans MS"
+            ],
+            "grid": false,
+            "labelColor": "purple"
         },
         "line": {
-            "strokeWidth": 2,
-            "stroke": "gray"
+            "stroke": "gray",
+            "strokeWidth": 2
         },
         "point": {
-            "strokeWidth": 1,
-            "stroke": "black",
             "fill": "yellow",
-            "strokeOpacity": 0.4
+            "stroke": "black",
+            "strokeOpacity": 0.4,
+            "strokeWidth": 1
         }
     },
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
     "data": {
         "values": [
             {
@@ -83,34 +80,37 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "date",
-            "type": "temporal",
             "axis": {
                 "values": [
                     {
                         "date": 4,
-                        "year": 2019,
-                        "month": "Jan"
+                        "month": "Jan",
+                        "year": 2019
                     },
                     {
                         "date": 8,
-                        "year": 2019,
-                        "month": "Jan"
+                        "month": "Jan",
+                        "year": 2019
                     },
                     {
                         "date": 20,
-                        "year": 2019,
-                        "month": "Jan"
+                        "month": "Jan",
+                        "year": 2019
                     }
                 ]
-            }
+            },
+            "field": "date",
+            "type": "temporal"
         },
         "y": {
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis7.vl b/tests/specs/axis/axis7.vl
--- a/tests/specs/axis/axis7.vl
+++ b/tests/specs/axis/axis7.vl
@@ -1,524 +1,524 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
                 "labelExpr": "datum.value / 100"
-            }
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis7c.vl b/tests/specs/axis/axis7c.vl
--- a/tests/specs/axis/axis7c.vl
+++ b/tests/specs/axis/axis7c.vl
@@ -1,552 +1,552 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
+        "axisQuantitative": {
+            "domainColor": "orange",
+            "gridColor": "seagreen",
+            "labelFont": "Comic Sans MS",
+            "labelOffset": 10,
+            "tickOffset": 10
+        },
         "axisTemporal": {
             "domainColor": "brown",
-            "labelColor": "purple",
-            "grid": false,
             "domainDash": [
                 4,
                 2
-            ]
-        },
-        "axisQuantitative": {
-            "domainColor": "orange",
-            "tickOffset": 10,
-            "labelOffset": 10,
-            "gridColor": "seagreen",
-            "labelFont": "Comic Sans MS"
+            ],
+            "grid": false,
+            "labelColor": "purple"
         },
         "line": {
-            "strokeWidth": 2,
-            "stroke": "gray"
+            "stroke": "gray",
+            "strokeWidth": 2
         },
         "point": {
-            "strokeWidth": 1,
-            "stroke": "black",
             "fill": "yellow",
-            "strokeOpacity": 0.4
+            "stroke": "black",
+            "strokeOpacity": 0.4,
+            "strokeWidth": 1
         }
     },
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
                 "labelExpr": "datum.value / 100"
-            }
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis8.vl b/tests/specs/axis/axis8.vl
--- a/tests/specs/axis/axis8.vl
+++ b/tests/specs/axis/axis8.vl
@@ -1,524 +1,524 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "catX",
-            "type": "ordinal",
             "axis": {
                 "labelExpr": "'number' + datum.label"
-            }
+            },
+            "field": "catX",
+            "type": "ordinal"
         },
         "y": {
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axis8c.vl b/tests/specs/axis/axis8c.vl
--- a/tests/specs/axis/axis8c.vl
+++ b/tests/specs/axis/axis8c.vl
@@ -1,552 +1,552 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
+        "axisQuantitative": {
+            "domainColor": "orange",
+            "gridColor": "seagreen",
+            "labelFont": "Comic Sans MS",
+            "labelOffset": 10,
+            "tickOffset": 10
+        },
         "axisTemporal": {
             "domainColor": "brown",
-            "labelColor": "purple",
-            "grid": false,
             "domainDash": [
                 4,
                 2
-            ]
-        },
-        "axisQuantitative": {
-            "domainColor": "orange",
-            "tickOffset": 10,
-            "labelOffset": 10,
-            "gridColor": "seagreen",
-            "labelFont": "Comic Sans MS"
+            ],
+            "grid": false,
+            "labelColor": "purple"
         },
         "line": {
-            "strokeWidth": 2,
-            "stroke": "gray"
+            "stroke": "gray",
+            "strokeWidth": 2
         },
         "point": {
-            "strokeWidth": 1,
-            "stroke": "black",
             "fill": "yellow",
-            "strokeOpacity": 0.4
+            "stroke": "black",
+            "strokeOpacity": 0.4,
+            "strokeWidth": 1
         }
     },
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "catX",
-            "type": "ordinal",
             "axis": {
                 "labelExpr": "'number' + datum.label"
-            }
+            },
+            "field": "catX",
+            "type": "ordinal"
         },
         "y": {
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/axisOverlapGreedy.vl b/tests/specs/axis/axisOverlapGreedy.vl
--- a/tests/specs/axis/axisOverlapGreedy.vl
+++ b/tests/specs/axis/axisOverlapGreedy.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -24,23 +24,23 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
-                "labelOverlap": "greedy",
-                "labelFontSize": 20
-            }
+                "labelFontSize": 20,
+                "labelOverlap": "greedy"
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
-            "field": "y",
-            "type": "quantitative",
             "axis": {
-                "labelOverlap": "greedy",
-                "labelFontSize": 20
-            }
+                "labelFontSize": 20,
+                "labelOverlap": "greedy"
+            },
+            "field": "y",
+            "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle"
 }
diff --git a/tests/specs/axis/axisOverlapNone.vl b/tests/specs/axis/axisOverlapNone.vl
--- a/tests/specs/axis/axisOverlapNone.vl
+++ b/tests/specs/axis/axisOverlapNone.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -24,23 +24,23 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
-                "labelOverlap": false,
-                "labelFontSize": 20
-            }
+                "labelFontSize": 20,
+                "labelOverlap": false
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
-            "field": "y",
-            "type": "quantitative",
             "axis": {
-                "labelOverlap": false,
-                "labelFontSize": 20
-            }
+                "labelFontSize": 20,
+                "labelOverlap": false
+            },
+            "field": "y",
+            "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle"
 }
diff --git a/tests/specs/axis/axisOverlapParity.vl b/tests/specs/axis/axisOverlapParity.vl
--- a/tests/specs/axis/axisOverlapParity.vl
+++ b/tests/specs/axis/axisOverlapParity.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -24,23 +24,23 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
-                "labelOverlap": true,
-                "labelFontSize": 20
-            }
+                "labelFontSize": 20,
+                "labelOverlap": true
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
-            "field": "y",
-            "type": "quantitative",
             "axis": {
-                "labelOverlap": true,
-                "labelFontSize": 20
-            }
+                "labelFontSize": 20,
+                "labelOverlap": true
+            },
+            "field": "y",
+            "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle"
 }
diff --git a/tests/specs/axis/axisstyleempty.vl b/tests/specs/axis/axisstyleempty.vl
--- a/tests/specs/axis/axisstyleempty.vl
+++ b/tests/specs/axis/axisstyleempty.vl
@@ -1,17 +1,16 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "style": {}
     },
-    "mark": "point",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
-            "legend": null
+            "legend": null,
+            "type": "nominal"
         },
         "x": {
             "field": "Horsepower",
@@ -21,5 +20,6 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/axis/axisstyleemptyx.vl b/tests/specs/axis/axisstyleemptyx.vl
--- a/tests/specs/axis/axisstyleemptyx.vl
+++ b/tests/specs/axis/axisstyleemptyx.vl
@@ -1,30 +1,30 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "style": {
             "x-style": {}
         }
     },
-    "mark": "point",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
-            "legend": null
+            "legend": null,
+            "type": "nominal"
         },
         "x": {
-            "field": "Horsepower",
-            "type": "quantitative",
             "axis": {
                 "style": "x-style"
-            }
+            },
+            "field": "Horsepower",
+            "type": "quantitative"
         },
         "y": {
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/axis/axisstylex.vl b/tests/specs/axis/axisstylex.vl
--- a/tests/specs/axis/axisstylex.vl
+++ b/tests/specs/axis/axisstylex.vl
@@ -1,34 +1,34 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "style": {
             "x-style": {
                 "domainColor": "orange",
-                "labelExpr": "if (datum.value <= 100, 'low:' + datum.label, 'high:' + datum.label)",
-                "gridColor": "lightgreen"
+                "gridColor": "lightgreen",
+                "labelExpr": "if (datum.value <= 100, 'low:' + datum.label, 'high:' + datum.label)"
             }
         }
     },
-    "mark": "point",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
-            "legend": null
+            "legend": null,
+            "type": "nominal"
         },
         "x": {
-            "field": "Horsepower",
-            "type": "quantitative",
             "axis": {
                 "style": "x-style"
-            }
+            },
+            "field": "Horsepower",
+            "type": "quantitative"
         },
         "y": {
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/axis/axisstylexastyle.vl b/tests/specs/axis/axisstylexastyle.vl
--- a/tests/specs/axis/axisstylexastyle.vl
+++ b/tests/specs/axis/axisstylexastyle.vl
@@ -1,26 +1,25 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
+        "axisX": {
+            "style": "x-style"
+        },
         "style": {
             "x-style": {
                 "domainColor": "orange",
-                "labelExpr": "if (datum.value <= 100, 'low:' + datum.label, 'high:' + datum.label)",
-                "gridColor": "lightgreen"
+                "gridColor": "lightgreen",
+                "labelExpr": "if (datum.value <= 100, 'low:' + datum.label, 'high:' + datum.label)"
             }
-        },
-        "axisX": {
-            "style": "x-style"
         }
     },
-    "mark": "point",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
-            "legend": null
+            "legend": null,
+            "type": "nominal"
         },
         "x": {
             "field": "Horsepower",
@@ -30,5 +29,6 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/axis/axisstylexy.vl b/tests/specs/axis/axisstylexy.vl
--- a/tests/specs/axis/axisstylexy.vl
+++ b/tests/specs/axis/axisstylexy.vl
@@ -1,44 +1,44 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "style": {
             "x-style": {
                 "domainColor": "orange",
-                "labelExpr": "if (datum.value <= 100, 'low:' + datum.label, 'high:' + datum.label)",
-                "gridColor": "lightgreen"
+                "gridColor": "lightgreen",
+                "labelExpr": "if (datum.value <= 100, 'low:' + datum.label, 'high:' + datum.label)"
             },
             "y-style": {
                 "domain": false,
-                "labels": false,
                 "grid": false,
-                "title": null,
-                "ticks": false
+                "labels": false,
+                "ticks": false,
+                "title": null
             }
         }
     },
-    "mark": "point",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
-            "legend": null
+            "legend": null,
+            "type": "nominal"
         },
         "x": {
-            "field": "Horsepower",
-            "type": "quantitative",
             "axis": {
                 "style": "x-style"
-            }
+            },
+            "field": "Horsepower",
+            "type": "quantitative"
         },
         "y": {
-            "field": "Miles_per_Gallon",
-            "type": "quantitative",
             "axis": {
                 "style": "y-style"
-            }
+            },
+            "field": "Miles_per_Gallon",
+            "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/axis/multiline.vl b/tests/specs/axis/multiline.vl
--- a/tests/specs/axis/multiline.vl
+++ b/tests/specs/axis/multiline.vl
@@ -1,37 +1,37 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "axis": {
             "labelLineHeight": 20
         },
         "lineBreak": " "
     },
-    "mark": "point",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
-            "legend": null
+            "legend": null,
+            "type": "nominal"
         },
         "x": {
-            "field": "Horsepower",
-            "type": "quantitative",
             "axis": {
                 "labelExpr": "datum.label + ' horses'",
-                "labelLineHeight": 22,
-                "labelFontSize": 11
-            }
+                "labelFontSize": 11,
+                "labelLineHeight": 22
+            },
+            "field": "Horsepower",
+            "type": "quantitative"
         },
         "y": {
-            "field": "Miles_per_Gallon",
-            "type": "quantitative",
             "axis": {
                 "labelExpr": "datum.label+' mpg'",
                 "labelFontSize": 22
-            }
+            },
+            "field": "Miles_per_Gallon",
+            "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/axis/responsiveHeight.vl b/tests/specs/axis/responsiveHeight.vl
--- a/tests/specs/axis/responsiveHeight.vl
+++ b/tests/specs/axis/responsiveHeight.vl
@@ -1,514 +1,509 @@
 {
-    "height": "container",
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "x",
@@ -518,5 +513,10 @@
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "height": "container",
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/axis/responsiveWidth.vl b/tests/specs/axis/responsiveWidth.vl
--- a/tests/specs/axis/responsiveWidth.vl
+++ b/tests/specs/axis/responsiveWidth.vl
@@ -1,514 +1,509 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "x": 1,
                 "catX": "1",
+                "x": 1,
                 "y": 1
             },
             {
-                "x": 2,
                 "catX": "2",
+                "x": 2,
                 "y": 2
             },
             {
-                "x": 3,
                 "catX": "3",
+                "x": 3,
                 "y": 3
             },
             {
-                "x": 4,
                 "catX": "4",
+                "x": 4,
                 "y": 4
             },
             {
-                "x": 5,
                 "catX": "5",
+                "x": 5,
                 "y": 5
             },
             {
-                "x": 6,
                 "catX": "6",
+                "x": 6,
                 "y": 6
             },
             {
-                "x": 7,
                 "catX": "7",
+                "x": 7,
                 "y": 7
             },
             {
-                "x": 8,
                 "catX": "8",
+                "x": 8,
                 "y": 8
             },
             {
-                "x": 9,
                 "catX": "9",
+                "x": 9,
                 "y": 9
             },
             {
-                "x": 10,
                 "catX": "10",
+                "x": 10,
                 "y": 10
             },
             {
-                "x": 11,
                 "catX": "11",
+                "x": 11,
                 "y": 11
             },
             {
-                "x": 12,
                 "catX": "12",
+                "x": 12,
                 "y": 12
             },
             {
-                "x": 13,
                 "catX": "13",
+                "x": 13,
                 "y": 13
             },
             {
-                "x": 14,
                 "catX": "14",
+                "x": 14,
                 "y": 14
             },
             {
-                "x": 15,
                 "catX": "15",
+                "x": 15,
                 "y": 15
             },
             {
-                "x": 16,
                 "catX": "16",
+                "x": 16,
                 "y": 16
             },
             {
-                "x": 17,
                 "catX": "17",
+                "x": 17,
                 "y": 17
             },
             {
-                "x": 18,
                 "catX": "18",
+                "x": 18,
                 "y": 18
             },
             {
-                "x": 19,
                 "catX": "19",
+                "x": 19,
                 "y": 19
             },
             {
-                "x": 20,
                 "catX": "20",
+                "x": 20,
                 "y": 20
             },
             {
-                "x": 21,
                 "catX": "21",
+                "x": 21,
                 "y": 21
             },
             {
-                "x": 22,
                 "catX": "22",
+                "x": 22,
                 "y": 22
             },
             {
-                "x": 23,
                 "catX": "23",
+                "x": 23,
                 "y": 23
             },
             {
-                "x": 24,
                 "catX": "24",
+                "x": 24,
                 "y": 24
             },
             {
-                "x": 25,
                 "catX": "25",
+                "x": 25,
                 "y": 25
             },
             {
-                "x": 26,
                 "catX": "26",
+                "x": 26,
                 "y": 26
             },
             {
-                "x": 27,
                 "catX": "27",
+                "x": 27,
                 "y": 27
             },
             {
-                "x": 28,
                 "catX": "28",
+                "x": 28,
                 "y": 28
             },
             {
-                "x": 29,
                 "catX": "29",
+                "x": 29,
                 "y": 29
             },
             {
-                "x": 30,
                 "catX": "30",
+                "x": 30,
                 "y": 30
             },
             {
-                "x": 31,
                 "catX": "31",
+                "x": 31,
                 "y": 31
             },
             {
-                "x": 32,
                 "catX": "32",
+                "x": 32,
                 "y": 32
             },
             {
-                "x": 33,
                 "catX": "33",
+                "x": 33,
                 "y": 33
             },
             {
-                "x": 34,
                 "catX": "34",
+                "x": 34,
                 "y": 34
             },
             {
-                "x": 35,
                 "catX": "35",
+                "x": 35,
                 "y": 35
             },
             {
-                "x": 36,
                 "catX": "36",
+                "x": 36,
                 "y": 36
             },
             {
-                "x": 37,
                 "catX": "37",
+                "x": 37,
                 "y": 37
             },
             {
-                "x": 38,
                 "catX": "38",
+                "x": 38,
                 "y": 38
             },
             {
-                "x": 39,
                 "catX": "39",
+                "x": 39,
                 "y": 39
             },
             {
-                "x": 40,
                 "catX": "40",
+                "x": 40,
                 "y": 40
             },
             {
-                "x": 41,
                 "catX": "41",
+                "x": 41,
                 "y": 41
             },
             {
-                "x": 42,
                 "catX": "42",
+                "x": 42,
                 "y": 42
             },
             {
-                "x": 43,
                 "catX": "43",
+                "x": 43,
                 "y": 43
             },
             {
-                "x": 44,
                 "catX": "44",
+                "x": 44,
                 "y": 44
             },
             {
-                "x": 45,
                 "catX": "45",
+                "x": 45,
                 "y": 45
             },
             {
-                "x": 46,
                 "catX": "46",
+                "x": 46,
                 "y": 46
             },
             {
-                "x": 47,
                 "catX": "47",
+                "x": 47,
                 "y": 47
             },
             {
-                "x": 48,
                 "catX": "48",
+                "x": 48,
                 "y": 48
             },
             {
-                "x": 49,
                 "catX": "49",
+                "x": 49,
                 "y": 49
             },
             {
-                "x": 50,
                 "catX": "50",
+                "x": 50,
                 "y": 50
             },
             {
-                "x": 51,
                 "catX": "51",
+                "x": 51,
                 "y": 51
             },
             {
-                "x": 52,
                 "catX": "52",
+                "x": 52,
                 "y": 52
             },
             {
-                "x": 53,
                 "catX": "53",
+                "x": 53,
                 "y": 53
             },
             {
-                "x": 54,
                 "catX": "54",
+                "x": 54,
                 "y": 54
             },
             {
-                "x": 55,
                 "catX": "55",
+                "x": 55,
                 "y": 55
             },
             {
-                "x": 56,
                 "catX": "56",
+                "x": 56,
                 "y": 56
             },
             {
-                "x": 57,
                 "catX": "57",
+                "x": 57,
                 "y": 57
             },
             {
-                "x": 58,
                 "catX": "58",
+                "x": 58,
                 "y": 58
             },
             {
-                "x": 59,
                 "catX": "59",
+                "x": 59,
                 "y": 59
             },
             {
-                "x": 60,
                 "catX": "60",
+                "x": 60,
                 "y": 60
             },
             {
-                "x": 61,
                 "catX": "61",
+                "x": 61,
                 "y": 61
             },
             {
-                "x": 62,
                 "catX": "62",
+                "x": 62,
                 "y": 62
             },
             {
-                "x": 63,
                 "catX": "63",
+                "x": 63,
                 "y": 63
             },
             {
-                "x": 64,
                 "catX": "64",
+                "x": 64,
                 "y": 64
             },
             {
-                "x": 65,
                 "catX": "65",
+                "x": 65,
                 "y": 65
             },
             {
-                "x": 66,
                 "catX": "66",
+                "x": 66,
                 "y": 66
             },
             {
-                "x": 67,
                 "catX": "67",
+                "x": 67,
                 "y": 67
             },
             {
-                "x": 68,
                 "catX": "68",
+                "x": 68,
                 "y": 68
             },
             {
-                "x": 69,
                 "catX": "69",
+                "x": 69,
                 "y": 69
             },
             {
-                "x": 70,
                 "catX": "70",
+                "x": 70,
                 "y": 70
             },
             {
-                "x": 71,
                 "catX": "71",
+                "x": 71,
                 "y": 71
             },
             {
-                "x": 72,
                 "catX": "72",
+                "x": 72,
                 "y": 72
             },
             {
-                "x": 73,
                 "catX": "73",
+                "x": 73,
                 "y": 73
             },
             {
-                "x": 74,
                 "catX": "74",
+                "x": 74,
                 "y": 74
             },
             {
-                "x": 75,
                 "catX": "75",
+                "x": 75,
                 "y": 75
             },
             {
-                "x": 76,
                 "catX": "76",
+                "x": 76,
                 "y": 76
             },
             {
-                "x": 77,
                 "catX": "77",
+                "x": 77,
                 "y": 77
             },
             {
-                "x": 78,
                 "catX": "78",
+                "x": 78,
                 "y": 78
             },
             {
-                "x": 79,
                 "catX": "79",
+                "x": 79,
                 "y": 79
             },
             {
-                "x": 80,
                 "catX": "80",
+                "x": 80,
                 "y": 80
             },
             {
-                "x": 81,
                 "catX": "81",
+                "x": 81,
                 "y": 81
             },
             {
-                "x": 82,
                 "catX": "82",
+                "x": 82,
                 "y": 82
             },
             {
-                "x": 83,
                 "catX": "83",
+                "x": 83,
                 "y": 83
             },
             {
-                "x": 84,
                 "catX": "84",
+                "x": 84,
                 "y": 84
             },
             {
-                "x": 85,
                 "catX": "85",
+                "x": 85,
                 "y": 85
             },
             {
-                "x": 86,
                 "catX": "86",
+                "x": 86,
                 "y": 86
             },
             {
-                "x": 87,
                 "catX": "87",
+                "x": 87,
                 "y": 87
             },
             {
-                "x": 88,
                 "catX": "88",
+                "x": 88,
                 "y": 88
             },
             {
-                "x": 89,
                 "catX": "89",
+                "x": 89,
                 "y": 89
             },
             {
-                "x": 90,
                 "catX": "90",
+                "x": 90,
                 "y": 90
             },
             {
-                "x": 91,
                 "catX": "91",
+                "x": 91,
                 "y": 91
             },
             {
-                "x": 92,
                 "catX": "92",
+                "x": 92,
                 "y": 92
             },
             {
-                "x": 93,
                 "catX": "93",
+                "x": 93,
                 "y": 93
             },
             {
-                "x": 94,
                 "catX": "94",
+                "x": 94,
                 "y": 94
             },
             {
-                "x": 95,
                 "catX": "95",
+                "x": 95,
                 "y": 95
             },
             {
-                "x": 96,
                 "catX": "96",
+                "x": 96,
                 "y": 96
             },
             {
-                "x": 97,
                 "catX": "97",
+                "x": 97,
                 "y": 97
             },
             {
-                "x": 98,
                 "catX": "98",
+                "x": 98,
                 "y": 98
             },
             {
-                "x": 99,
                 "catX": "99",
+                "x": 99,
                 "y": 99
             },
             {
-                "x": 100,
                 "catX": "100",
+                "x": 100,
                 "y": 100
             }
         ]
     },
-    "width": "container",
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "x",
@@ -518,5 +513,10 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
+    },
+    "width": "container"
 }
diff --git a/tests/specs/axis/singleline.vl b/tests/specs/axis/singleline.vl
--- a/tests/specs/axis/singleline.vl
+++ b/tests/specs/axis/singleline.vl
@@ -1,28 +1,28 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
-            "legend": null
+            "legend": null,
+            "type": "nominal"
         },
         "x": {
-            "field": "Horsepower",
-            "type": "quantitative",
             "axis": {
                 "labelExpr": "datum.label + ' horses'"
-            }
+            },
+            "field": "Horsepower",
+            "type": "quantitative"
         },
         "y": {
-            "field": "Miles_per_Gallon",
-            "type": "quantitative",
             "axis": {
                 "labelExpr": "datum.label+' mpg'"
-            }
+            },
+            "field": "Miles_per_Gallon",
+            "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/axis/zorder.vl b/tests/specs/axis/zorder.vl
--- a/tests/specs/axis/zorder.vl
+++ b/tests/specs/axis/zorder.vl
@@ -1,20 +1,16 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
-        "axisY": {
-            "gridColor": "blue"
+        "axis": {
+            "gridWidth": 8
         },
         "axisX": {
             "gridColor": "red"
         },
-        "axis": {
-            "gridWidth": 8
+        "axisY": {
+            "gridColor": "blue"
         }
     },
-    "mark": {
-        "size": 5000,
-        "opacity": 1,
-        "type": "circle"
-    },
     "data": {
         "values": [
             {
@@ -29,26 +25,30 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "cat",
-            "type": "nominal",
-            "legend": null
+            "legend": null,
+            "type": "nominal"
         },
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
                 "zindex": 2
-            }
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
-            "field": "y",
-            "type": "quantitative",
             "axis": {
                 "zindex": 1
-            }
+            },
+            "field": "y",
+            "type": "quantitative"
         }
+    },
+    "mark": {
+        "opacity": 1,
+        "size": 5000,
+        "type": "circle"
     }
 }
diff --git a/tests/specs/color/customContinuous.vl b/tests/specs/color/customContinuous.vl
--- a/tests/specs/color/customContinuous.vl
+++ b/tests/specs/color/customContinuous.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Custom continuous colour scheme (red to blue ramp).",
     "encoding": {
         "color": {
             "field": "Acceleration",
@@ -21,12 +15,12 @@
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -36,5 +30,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Custom continuous colour scheme (red to blue ramp)."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/customDiscrete.vl b/tests/specs/color/customDiscrete.vl
--- a/tests/specs/color/customDiscrete.vl
+++ b/tests/specs/color/customDiscrete.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Custom discrete colours (red, green, blue).",
     "encoding": {
         "color": {
             "field": "Origin",
@@ -22,12 +16,12 @@
             },
             "type": "nominal"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -37,5 +31,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Custom discrete colours (red, green, blue)."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/defContinuous.vl b/tests/specs/color/defContinuous.vl
--- a/tests/specs/color/defContinuous.vl
+++ b/tests/specs/color/defContinuous.vl
@@ -1,26 +1,20 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Default continuous colour scales.",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -30,5 +24,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Default continuous colour scales."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/defNominal.vl b/tests/specs/color/defNominal.vl
--- a/tests/specs/color/defNominal.vl
+++ b/tests/specs/color/defNominal.vl
@@ -1,26 +1,20 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Default nominal colour scales.",
     "encoding": {
         "color": {
             "field": "Origin",
             "type": "nominal"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -30,5 +24,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Default nominal colour scales."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/defOrdinal.vl b/tests/specs/color/defOrdinal.vl
--- a/tests/specs/color/defOrdinal.vl
+++ b/tests/specs/color/defOrdinal.vl
@@ -1,26 +1,20 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Default ordinal colour scales.",
     "encoding": {
         "color": {
             "field": "Cylinders",
             "type": "ordinal"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -30,5 +24,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Default ordinal colour scales."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/gamma1.vl b/tests/specs/color/gamma1.vl
--- a/tests/specs/color/gamma1.vl
+++ b/tests/specs/color/gamma1.vl
@@ -1,37 +1,31 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "cube-helix-long interpolation, gamma of -0.1",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "scale": {
-                "range": [
-                    "yellow",
-                    "red"
-                ],
                 "interpolate": {
                     "gamma": -0.1,
                     "type": "cubehelix-long"
                 },
+                "range": [
+                    "yellow",
+                    "red"
+                ],
                 "type": "linear"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -41,5 +35,11 @@
             "type": "quantitative"
         }
     },
-    "description": "cube-helix-long interpolation, gamma of -0.1"
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/gamma2.vl b/tests/specs/color/gamma2.vl
--- a/tests/specs/color/gamma2.vl
+++ b/tests/specs/color/gamma2.vl
@@ -1,37 +1,31 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "cube-helix-long interpolation, gamma of 0",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "scale": {
-                "range": [
-                    "yellow",
-                    "red"
-                ],
                 "interpolate": {
                     "gamma": 0,
                     "type": "cubehelix-long"
                 },
+                "range": [
+                    "yellow",
+                    "red"
+                ],
                 "type": "linear"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -41,5 +35,11 @@
             "type": "quantitative"
         }
     },
-    "description": "cube-helix-long interpolation, gamma of 0"
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/gamma3.vl b/tests/specs/color/gamma3.vl
--- a/tests/specs/color/gamma3.vl
+++ b/tests/specs/color/gamma3.vl
@@ -1,37 +1,31 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "cube-helix-long interpolation with default gamma value of 1",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "scale": {
-                "range": [
-                    "yellow",
-                    "red"
-                ],
                 "interpolate": {
                     "gamma": 1,
                     "type": "cubehelix-long"
                 },
+                "range": [
+                    "yellow",
+                    "red"
+                ],
                 "type": "linear"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -41,5 +35,11 @@
             "type": "quantitative"
         }
     },
-    "description": "cube-helix-long interpolation with default gamma value of 1"
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/gamma4.vl b/tests/specs/color/gamma4.vl
--- a/tests/specs/color/gamma4.vl
+++ b/tests/specs/color/gamma4.vl
@@ -1,37 +1,31 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "cube-helix-long interpolation, gamma of 2",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "scale": {
-                "range": [
-                    "yellow",
-                    "red"
-                ],
                 "interpolate": {
                     "gamma": 2,
                     "type": "cubehelix-long"
                 },
+                "range": [
+                    "yellow",
+                    "red"
+                ],
                 "type": "linear"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -41,5 +35,11 @@
             "type": "quantitative"
         }
     },
-    "description": "cube-helix-long interpolation, gamma of 2"
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/gamma5.vl b/tests/specs/color/gamma5.vl
--- a/tests/specs/color/gamma5.vl
+++ b/tests/specs/color/gamma5.vl
@@ -1,37 +1,31 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "cube-helix-long interpolation, gamma of 10",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "scale": {
-                "range": [
-                    "yellow",
-                    "red"
-                ],
                 "interpolate": {
                     "gamma": 10,
                     "type": "cubehelix-long"
                 },
+                "range": [
+                    "yellow",
+                    "red"
+                ],
                 "type": "linear"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -41,5 +35,11 @@
             "type": "quantitative"
         }
     },
-    "description": "cube-helix-long interpolation, gamma of 10"
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/interp1.vl b/tests/specs/color/interp1.vl
--- a/tests/specs/color/interp1.vl
+++ b/tests/specs/color/interp1.vl
@@ -1,36 +1,30 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "HSL interpolation.",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "scale": {
+                "interpolate": {
+                    "type": "hsl"
+                },
                 "range": [
                     "yellow",
                     "red"
                 ],
-                "interpolate": {
-                    "type": "hsl"
-                },
                 "type": "linear"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -40,5 +34,11 @@
             "type": "quantitative"
         }
     },
-    "description": "HSL interpolation."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/interp2.vl b/tests/specs/color/interp2.vl
--- a/tests/specs/color/interp2.vl
+++ b/tests/specs/color/interp2.vl
@@ -1,36 +1,30 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "HSL-long interpolation.",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "scale": {
+                "interpolate": {
+                    "type": "hsl-long"
+                },
                 "range": [
                     "yellow",
                     "red"
                 ],
-                "interpolate": {
-                    "type": "hsl-long"
-                },
                 "type": "linear"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -40,5 +34,11 @@
             "type": "quantitative"
         }
     },
-    "description": "HSL-long interpolation."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/interp3.vl b/tests/specs/color/interp3.vl
--- a/tests/specs/color/interp3.vl
+++ b/tests/specs/color/interp3.vl
@@ -1,36 +1,30 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Lab interpolation.",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "scale": {
+                "interpolate": {
+                    "type": "lab"
+                },
                 "range": [
                     "yellow",
                     "red"
                 ],
-                "interpolate": {
-                    "type": "lab"
-                },
                 "type": "linear"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -40,5 +34,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Lab interpolation."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/interp4.vl b/tests/specs/color/interp4.vl
--- a/tests/specs/color/interp4.vl
+++ b/tests/specs/color/interp4.vl
@@ -1,36 +1,30 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "HCL interpolation.",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "scale": {
+                "interpolate": {
+                    "type": "hcl"
+                },
                 "range": [
                     "yellow",
                     "red"
                 ],
-                "interpolate": {
-                    "type": "hcl"
-                },
                 "type": "linear"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -40,5 +34,11 @@
             "type": "quantitative"
         }
     },
-    "description": "HCL interpolation."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/interp5.vl b/tests/specs/color/interp5.vl
--- a/tests/specs/color/interp5.vl
+++ b/tests/specs/color/interp5.vl
@@ -1,36 +1,30 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "HCL-long interpolation.",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "scale": {
+                "interpolate": {
+                    "type": "hcl-long"
+                },
                 "range": [
                     "yellow",
                     "red"
                 ],
-                "interpolate": {
-                    "type": "hcl-long"
-                },
                 "type": "linear"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -40,5 +34,11 @@
             "type": "quantitative"
         }
     },
-    "description": "HCL-long interpolation."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/interp6.vl b/tests/specs/color/interp6.vl
--- a/tests/specs/color/interp6.vl
+++ b/tests/specs/color/interp6.vl
@@ -1,37 +1,31 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "cube-helix interpolation.",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "scale": {
-                "range": [
-                    "yellow",
-                    "red"
-                ],
                 "interpolate": {
                     "gamma": 1,
                     "type": "cubehelix"
                 },
+                "range": [
+                    "yellow",
+                    "red"
+                ],
                 "type": "linear"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -41,5 +35,11 @@
             "type": "quantitative"
         }
     },
-    "description": "cube-helix interpolation."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/interp7.vl b/tests/specs/color/interp7.vl
--- a/tests/specs/color/interp7.vl
+++ b/tests/specs/color/interp7.vl
@@ -1,37 +1,31 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "cube-helix-long interpolation.",
     "encoding": {
         "color": {
             "field": "Acceleration",
             "scale": {
-                "range": [
-                    "yellow",
-                    "red"
-                ],
                 "interpolate": {
                     "gamma": 1,
                     "type": "cubehelix-long"
                 },
+                "range": [
+                    "yellow",
+                    "red"
+                ],
                 "type": "linear"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -41,5 +35,11 @@
             "type": "quantitative"
         }
     },
-    "description": "cube-helix-long interpolation."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/namedContinuous1.vl b/tests/specs/color/namedContinuous1.vl
--- a/tests/specs/color/namedContinuous1.vl
+++ b/tests/specs/color/namedContinuous1.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Continuous colour scale based on named vega schame. Should use the entire plasma colour scheme.",
     "encoding": {
         "color": {
             "field": "Acceleration",
@@ -18,12 +12,12 @@
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -33,5 +27,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Continuous colour scale based on named vega schame. Should use the entire plasma colour scheme."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/namedContinuous2.vl b/tests/specs/color/namedContinuous2.vl
--- a/tests/specs/color/namedContinuous2.vl
+++ b/tests/specs/color/namedContinuous2.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Continuous colour scale based on named vega schame. Should use the upper half of the plasma colour scheme.",
     "encoding": {
         "color": {
             "field": "Acceleration",
@@ -24,12 +18,12 @@
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -39,5 +33,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Continuous colour scale based on named vega schame. Should use the upper half of the plasma colour scheme."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/namedContinuous3.vl b/tests/specs/color/namedContinuous3.vl
--- a/tests/specs/color/namedContinuous3.vl
+++ b/tests/specs/color/namedContinuous3.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Continuous colour scale based on named vega schame. Should use the flipped plasma colour scheme (i.e. red to orange).",
     "encoding": {
         "color": {
             "field": "Acceleration",
@@ -19,12 +13,12 @@
             "sort": "descending",
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -34,5 +28,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Continuous colour scale based on named vega schame. Should use the flipped plasma colour scheme (i.e. red to orange)."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/namedContinuous4.vl b/tests/specs/color/namedContinuous4.vl
--- a/tests/specs/color/namedContinuous4.vl
+++ b/tests/specs/color/namedContinuous4.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Continuous colour scale based on named vega schame. Should use the first half of the flipped plasma colour scheme (i.e. red to orange).",
     "encoding": {
         "color": {
             "field": "Acceleration",
@@ -25,12 +19,12 @@
             "sort": "descending",
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -40,5 +34,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Continuous colour scale based on named vega schame. Should use the first half of the flipped plasma colour scheme (i.e. red to orange)."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/scale1.vl b/tests/specs/color/scale1.vl
--- a/tests/specs/color/scale1.vl
+++ b/tests/specs/color/scale1.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Linear (default) colour scale.",
     "encoding": {
         "color": {
             "field": "Acceleration",
@@ -22,12 +16,12 @@
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -37,5 +31,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Linear (default) colour scale."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/scale3.vl b/tests/specs/color/scale3.vl
--- a/tests/specs/color/scale3.vl
+++ b/tests/specs/color/scale3.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Power colour scale with default (1) exponent.",
     "encoding": {
         "color": {
             "field": "Acceleration",
@@ -22,12 +16,12 @@
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -37,5 +31,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Power colour scale with default (1) exponent."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/scale4.vl b/tests/specs/color/scale4.vl
--- a/tests/specs/color/scale4.vl
+++ b/tests/specs/color/scale4.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Cubic Power colour scale.",
     "encoding": {
         "color": {
             "field": "Acceleration",
@@ -23,12 +17,12 @@
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -38,5 +32,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Cubic Power colour scale."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/scale5.vl b/tests/specs/color/scale5.vl
--- a/tests/specs/color/scale5.vl
+++ b/tests/specs/color/scale5.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Square root colour scale.",
     "encoding": {
         "color": {
             "field": "Acceleration",
@@ -22,12 +16,12 @@
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -37,5 +31,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Square root colour scale."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/scale6.vl b/tests/specs/color/scale6.vl
--- a/tests/specs/color/scale6.vl
+++ b/tests/specs/color/scale6.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Log colour scale.",
     "encoding": {
         "color": {
             "field": "Acceleration",
@@ -22,12 +16,12 @@
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -37,5 +31,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Log colour scale."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/scale7.vl b/tests/specs/color/scale7.vl
--- a/tests/specs/color/scale7.vl
+++ b/tests/specs/color/scale7.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "SymLog colour scale with default slope constant (1).",
     "encoding": {
         "color": {
             "field": "accelerationZScore",
@@ -22,12 +16,12 @@
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -37,5 +31,11 @@
             "type": "quantitative"
         }
     },
-    "description": "SymLog colour scale with default slope constant (1)."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/color/scale8.vl b/tests/specs/color/scale8.vl
--- a/tests/specs/color/scale8.vl
+++ b/tests/specs/color/scale8.vl
@@ -1,34 +1,28 @@
 {
-    "transform": [
-        {
-            "as": "accelerationZScore",
-            "calculate": "(datum.Acceleration - 15.52)/2.80"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "SymLog colour scale with slope constant of 0.01.",
     "encoding": {
         "color": {
             "field": "accelerationZScore",
             "scale": {
+                "constant": 1.0e-2,
                 "range": [
                     "yellow",
                     "red"
                 ],
-                "type": "symlog",
-                "constant": 1.0e-2
+                "type": "symlog"
             },
             "type": "quantitative"
         },
-        "size": {
-            "value": 60
-        },
         "opacity": {
             "value": 1
         },
+        "size": {
+            "value": 60
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -38,5 +32,11 @@
             "type": "quantitative"
         }
     },
-    "description": "SymLog colour scale with slope constant of 0.01."
+    "mark": "circle",
+    "transform": [
+        {
+            "as": "accelerationZScore",
+            "calculate": "(datum.Acceleration - 15.52)/2.80"
+        }
+    ]
 }
diff --git a/tests/specs/composite/boxplot1.vl b/tests/specs/composite/boxplot1.vl
--- a/tests/specs/composite/boxplot1.vl
+++ b/tests/specs/composite/boxplot1.vl
@@ -1,23 +1,23 @@
 {
-    "mark": {
-        "extent": "min-max",
-        "type": "boxplot"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "age",
             "type": "ordinal"
         },
         "y": {
-            "field": "people",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": {
+        "extent": "min-max",
+        "type": "boxplot"
     }
 }
diff --git a/tests/specs/composite/boxplot2.vl b/tests/specs/composite/boxplot2.vl
--- a/tests/specs/composite/boxplot2.vl
+++ b/tests/specs/composite/boxplot2.vl
@@ -1,23 +1,23 @@
 {
-    "mark": {
-        "extent": 2,
-        "type": "boxplot"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "age",
             "type": "ordinal"
         },
         "y": {
-            "field": "people",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": {
+        "extent": 2,
+        "type": "boxplot"
     }
 }
diff --git a/tests/specs/composite/boxplot3.vl b/tests/specs/composite/boxplot3.vl
--- a/tests/specs/composite/boxplot3.vl
+++ b/tests/specs/composite/boxplot3.vl
@@ -1,42 +1,42 @@
 {
-    "mark": {
-        "median": {
-            "strokeWidth": 0,
-            "size": 18,
-            "fill": "black"
-        },
-        "box": {
-            "color": "firebrick"
-        },
-        "rule": {
-            "strokeWidth": 0.4
-        },
-        "extent": 0.5,
-        "outliers": {
-            "strokeWidth": 0.3,
-            "color": "black",
-            "size": 10
-        },
-        "type": "boxplot",
-        "ticks": {
-            "size": 8
-        }
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "age",
             "type": "ordinal"
         },
         "y": {
-            "field": "people",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": {
+        "box": {
+            "color": "firebrick"
+        },
+        "extent": 0.5,
+        "median": {
+            "fill": "black",
+            "size": 18,
+            "strokeWidth": 0
+        },
+        "outliers": {
+            "color": "black",
+            "size": 10,
+            "strokeWidth": 0.3
+        },
+        "rule": {
+            "strokeWidth": 0.4
+        },
+        "ticks": {
+            "size": 8
+        },
+        "type": "boxplot"
     }
 }
diff --git a/tests/specs/composite/boxplotnobox.vl b/tests/specs/composite/boxplotnobox.vl
--- a/tests/specs/composite/boxplotnobox.vl
+++ b/tests/specs/composite/boxplotnobox.vl
@@ -1,29 +1,29 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "boxplot": {
             "ticks": true
         }
     },
-    "mark": {
-        "box": false,
-        "extent": 0.5,
-        "type": "boxplot"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "age",
             "type": "ordinal"
         },
         "y": {
-            "field": "people",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": {
+        "box": false,
+        "extent": 0.5,
+        "type": "boxplot"
     }
 }
diff --git a/tests/specs/composite/boxplotnomedian.vl b/tests/specs/composite/boxplotnomedian.vl
--- a/tests/specs/composite/boxplotnomedian.vl
+++ b/tests/specs/composite/boxplotnomedian.vl
@@ -1,29 +1,29 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "boxplot": {
             "ticks": true
         }
     },
-    "mark": {
-        "median": false,
-        "extent": 0.5,
-        "type": "boxplot"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "age",
             "type": "ordinal"
         },
         "y": {
-            "field": "people",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": {
+        "extent": 0.5,
+        "median": false,
+        "type": "boxplot"
     }
 }
diff --git a/tests/specs/composite/boxplotnooutliers.vl b/tests/specs/composite/boxplotnooutliers.vl
--- a/tests/specs/composite/boxplotnooutliers.vl
+++ b/tests/specs/composite/boxplotnooutliers.vl
@@ -1,29 +1,29 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "boxplot": {
             "ticks": true
         }
     },
-    "mark": {
-        "extent": 0.5,
-        "outliers": false,
-        "type": "boxplot"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "age",
             "type": "ordinal"
         },
         "y": {
-            "field": "people",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": {
+        "extent": 0.5,
+        "outliers": false,
+        "type": "boxplot"
     }
 }
diff --git a/tests/specs/composite/boxplotnorule.vl b/tests/specs/composite/boxplotnorule.vl
--- a/tests/specs/composite/boxplotnorule.vl
+++ b/tests/specs/composite/boxplotnorule.vl
@@ -1,29 +1,29 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "boxplot": {
             "ticks": true
         }
     },
-    "mark": {
-        "rule": false,
-        "extent": 0.5,
-        "type": "boxplot"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "age",
             "type": "ordinal"
         },
         "y": {
-            "field": "people",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": {
+        "extent": 0.5,
+        "rule": false,
+        "type": "boxplot"
     }
 }
diff --git a/tests/specs/composite/boxplotnoticks.vl b/tests/specs/composite/boxplotnoticks.vl
--- a/tests/specs/composite/boxplotnoticks.vl
+++ b/tests/specs/composite/boxplotnoticks.vl
@@ -1,29 +1,29 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "boxplot": {
             "ticks": true
         }
     },
-    "mark": {
-        "extent": 0.5,
-        "type": "boxplot",
-        "ticks": false
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "age",
             "type": "ordinal"
         },
         "y": {
-            "field": "people",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": {
+        "extent": 0.5,
+        "ticks": false,
+        "type": "boxplot"
     }
 }
diff --git a/tests/specs/composite/errorband1.vl b/tests/specs/composite/errorband1.vl
--- a/tests/specs/composite/errorband1.vl
+++ b/tests/specs/composite/errorband1.vl
@@ -1,14 +1,8 @@
 {
-    "mark": {
-        "borders": true,
-        "extent": "ci",
-        "interpolate": "monotone",
-        "type": "errorband"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "Year",
@@ -23,5 +17,11 @@
             "title": "Miles per Gallon (95% CI)",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "borders": true,
+        "extent": "ci",
+        "interpolate": "monotone",
+        "type": "errorband"
     }
 }
diff --git a/tests/specs/composite/errorband1no.vl b/tests/specs/composite/errorband1no.vl
--- a/tests/specs/composite/errorband1no.vl
+++ b/tests/specs/composite/errorband1no.vl
@@ -1,14 +1,8 @@
 {
-    "mark": {
-        "borders": false,
-        "extent": "ci",
-        "interpolate": "monotone",
-        "type": "errorband"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "Year",
@@ -23,5 +17,11 @@
             "title": "Miles per Gallon (95% CI)",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "borders": false,
+        "extent": "ci",
+        "interpolate": "monotone",
+        "type": "errorband"
     }
 }
diff --git a/tests/specs/composite/errorband2.vl b/tests/specs/composite/errorband2.vl
--- a/tests/specs/composite/errorband2.vl
+++ b/tests/specs/composite/errorband2.vl
@@ -1,14 +1,8 @@
 {
-    "mark": {
-        "borders": true,
-        "extent": "stdev",
-        "interpolate": "monotone",
-        "type": "errorband"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "Year",
@@ -23,5 +17,11 @@
             "title": "Miles per Gallon (1 stdev)",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "borders": true,
+        "extent": "stdev",
+        "interpolate": "monotone",
+        "type": "errorband"
     }
 }
diff --git a/tests/specs/composite/errorband2no.vl b/tests/specs/composite/errorband2no.vl
--- a/tests/specs/composite/errorband2no.vl
+++ b/tests/specs/composite/errorband2no.vl
@@ -1,14 +1,8 @@
 {
-    "mark": {
-        "borders": false,
-        "extent": "stdev",
-        "interpolate": "monotone",
-        "type": "errorband"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "Year",
@@ -23,5 +17,11 @@
             "title": "Miles per Gallon (1 stdev)",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "borders": false,
+        "extent": "stdev",
+        "interpolate": "monotone",
+        "type": "errorband"
     }
 }
diff --git a/tests/specs/composite/errorbar1.vl b/tests/specs/composite/errorbar1.vl
--- a/tests/specs/composite/errorbar1.vl
+++ b/tests/specs/composite/errorbar1.vl
@@ -1,15 +1,8 @@
 {
-    "mark": {
-        "extent": "ci",
-        "type": "errorbar",
-        "ticks": {
-            "stroke": "blue"
-        }
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/barley.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "yield",
@@ -22,5 +15,12 @@
             "field": "variety",
             "type": "ordinal"
         }
+    },
+    "mark": {
+        "extent": "ci",
+        "ticks": {
+            "stroke": "blue"
+        },
+        "type": "errorbar"
     }
 }
diff --git a/tests/specs/composite/errorbar2.vl b/tests/specs/composite/errorbar2.vl
--- a/tests/specs/composite/errorbar2.vl
+++ b/tests/specs/composite/errorbar2.vl
@@ -1,15 +1,8 @@
 {
-    "mark": {
-        "extent": "stdev",
-        "type": "errorbar",
-        "ticks": {
-            "stroke": "blue"
-        }
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/barley.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "yield",
@@ -22,5 +15,12 @@
             "field": "variety",
             "type": "ordinal"
         }
+    },
+    "mark": {
+        "extent": "stdev",
+        "ticks": {
+            "stroke": "blue"
+        },
+        "type": "errorbar"
     }
 }
diff --git a/tests/specs/composite/errorbar3.vl b/tests/specs/composite/errorbar3.vl
--- a/tests/specs/composite/errorbar3.vl
+++ b/tests/specs/composite/errorbar3.vl
@@ -1,14 +1,11 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/barley.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Error bars with color encoding",
     "layer": [
         {
-            "mark": {
-                "type": "errorbar",
-                "ticks": true
-            },
             "encoding": {
                 "color": {
                     "value": "#4682b4"
@@ -24,26 +21,29 @@
                     "field": "variety",
                     "type": "ordinal"
                 }
+            },
+            "mark": {
+                "ticks": true,
+                "type": "errorbar"
             }
         },
         {
-            "mark": {
-                "color": "black",
-                "type": "point",
-                "filled": true
-            },
             "encoding": {
                 "x": {
-                    "field": "yield",
                     "aggregate": "mean",
+                    "field": "yield",
                     "type": "quantitative"
                 },
                 "y": {
                     "field": "variety",
                     "type": "ordinal"
                 }
+            },
+            "mark": {
+                "color": "black",
+                "filled": true,
+                "type": "point"
             }
         }
-    ],
-    "description": "Error bars with color encoding"
+    ]
 }
diff --git a/tests/specs/composite/errorbar3no.vl b/tests/specs/composite/errorbar3no.vl
--- a/tests/specs/composite/errorbar3no.vl
+++ b/tests/specs/composite/errorbar3no.vl
@@ -1,14 +1,11 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/barley.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Error bars with color encoding",
     "layer": [
         {
-            "mark": {
-                "type": "errorbar",
-                "ticks": false
-            },
             "encoding": {
                 "color": {
                     "value": "#4682b4"
@@ -24,26 +21,29 @@
                     "field": "variety",
                     "type": "ordinal"
                 }
+            },
+            "mark": {
+                "ticks": false,
+                "type": "errorbar"
             }
         },
         {
-            "mark": {
-                "color": "black",
-                "type": "point",
-                "filled": true
-            },
             "encoding": {
                 "x": {
-                    "field": "yield",
                     "aggregate": "mean",
+                    "field": "yield",
                     "type": "quantitative"
                 },
                 "y": {
                     "field": "variety",
                     "type": "ordinal"
                 }
+            },
+            "mark": {
+                "color": "black",
+                "filled": true,
+                "type": "point"
             }
         }
-    ],
-    "description": "Error bars with color encoding"
+    ]
 }
diff --git a/tests/specs/composite/errorbar4.vl b/tests/specs/composite/errorbar4.vl
--- a/tests/specs/composite/errorbar4.vl
+++ b/tests/specs/composite/errorbar4.vl
@@ -1,39 +1,36 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "yieldError2": -10.55,
-                "yieldError": 7.55,
                 "variety": "Glabron",
-                "yield": 32.4
+                "yield": 32.4,
+                "yieldError": 7.55,
+                "yieldError2": -10.55
             },
             {
-                "yieldError2": -3.98,
-                "yieldError": 6.98,
                 "variety": "Manchuria",
-                "yield": 30.97
+                "yield": 30.97,
+                "yieldError": 6.98,
+                "yieldError2": -3.98
             },
             {
-                "yieldError2": -0.92,
-                "yieldError": 3.92,
                 "variety": "No. 457",
-                "yield": 33.96
+                "yield": 33.96,
+                "yieldError": 3.92,
+                "yieldError2": -0.92
             },
             {
-                "yieldError2": -15.97,
-                "yieldError": 11.97,
                 "variety": "No. 462",
-                "yield": 30.45
+                "yield": 30.45,
+                "yieldError": 11.97,
+                "yieldError2": -15.97
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Symetric error bars encoded with xError channel",
     "layer": [
         {
-            "mark": {
-                "type": "errorbar",
-                "ticks": true
-            },
             "encoding": {
                 "x": {
                     "field": "yield",
@@ -49,14 +46,13 @@
                     "field": "variety",
                     "type": "ordinal"
                 }
+            },
+            "mark": {
+                "ticks": true,
+                "type": "errorbar"
             }
         },
         {
-            "mark": {
-                "color": "black",
-                "type": "point",
-                "filled": true
-            },
             "encoding": {
                 "x": {
                     "field": "yield",
@@ -66,8 +62,12 @@
                     "field": "variety",
                     "type": "ordinal"
                 }
+            },
+            "mark": {
+                "color": "black",
+                "filled": true,
+                "type": "point"
             }
         }
-    ],
-    "description": "Symetric error bars encoded with xError channel"
+    ]
 }
diff --git a/tests/specs/composite/errorbar5.vl b/tests/specs/composite/errorbar5.vl
--- a/tests/specs/composite/errorbar5.vl
+++ b/tests/specs/composite/errorbar5.vl
@@ -1,43 +1,37 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "yieldError2": -10.55,
-                "yieldError": 7.55,
                 "variety": "Glabron",
-                "yield": 32.4
+                "yield": 32.4,
+                "yieldError": 7.55,
+                "yieldError2": -10.55
             },
             {
-                "yieldError2": -3.98,
-                "yieldError": 6.98,
                 "variety": "Manchuria",
-                "yield": 30.97
+                "yield": 30.97,
+                "yieldError": 6.98,
+                "yieldError2": -3.98
             },
             {
-                "yieldError2": -0.92,
-                "yieldError": 3.92,
                 "variety": "No. 457",
-                "yield": 33.96
+                "yield": 33.96,
+                "yieldError": 3.92,
+                "yieldError2": -0.92
             },
             {
-                "yieldError2": -15.97,
-                "yieldError": 11.97,
                 "variety": "No. 462",
-                "yield": 30.45
+                "yield": 30.45,
+                "yieldError": 11.97,
+                "yieldError2": -15.97
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Asymetric error bars encoded with xError and xError2 channels",
     "layer": [
         {
-            "mark": {
-                "type": "errorbar",
-                "ticks": true
-            },
             "encoding": {
-                "xError2": {
-                    "field": "yieldError2"
-                },
                 "x": {
                     "field": "yield",
                     "scale": {
@@ -48,18 +42,20 @@
                 "xError": {
                     "field": "yieldError"
                 },
+                "xError2": {
+                    "field": "yieldError2"
+                },
                 "y": {
                     "field": "variety",
                     "type": "ordinal"
                 }
+            },
+            "mark": {
+                "ticks": true,
+                "type": "errorbar"
             }
         },
         {
-            "mark": {
-                "color": "black",
-                "type": "point",
-                "filled": true
-            },
             "encoding": {
                 "x": {
                     "field": "yield",
@@ -69,8 +65,12 @@
                     "field": "variety",
                     "type": "ordinal"
                 }
+            },
+            "mark": {
+                "color": "black",
+                "filled": true,
+                "type": "point"
             }
         }
-    ],
-    "description": "Asymetric error bars encoded with xError and xError2 channels"
+    ]
 }
diff --git a/tests/specs/composite/errorbar6.vl b/tests/specs/composite/errorbar6.vl
--- a/tests/specs/composite/errorbar6.vl
+++ b/tests/specs/composite/errorbar6.vl
@@ -1,43 +1,37 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "yieldError2": -10.55,
-                "yieldError": 7.55,
                 "variety": "Glabron",
-                "yield": 32.4
+                "yield": 32.4,
+                "yieldError": 7.55,
+                "yieldError2": -10.55
             },
             {
-                "yieldError2": -3.98,
-                "yieldError": 6.98,
                 "variety": "Manchuria",
-                "yield": 30.97
+                "yield": 30.97,
+                "yieldError": 6.98,
+                "yieldError2": -3.98
             },
             {
-                "yieldError2": -0.92,
-                "yieldError": 3.92,
                 "variety": "No. 457",
-                "yield": 33.96
+                "yield": 33.96,
+                "yieldError": 3.92,
+                "yieldError2": -0.92
             },
             {
-                "yieldError2": -15.97,
-                "yieldError": 11.97,
                 "variety": "No. 462",
-                "yield": 30.45
+                "yield": 30.45,
+                "yieldError": 11.97,
+                "yieldError2": -15.97
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Symetric error bars encoded with yError channel",
     "layer": [
         {
-            "mark": {
-                "type": "errorbar",
-                "ticks": true
-            },
             "encoding": {
-                "yError": {
-                    "field": "yieldError"
-                },
                 "x": {
                     "field": "variety",
                     "type": "ordinal"
@@ -48,15 +42,17 @@
                         "zero": false
                     },
                     "type": "quantitative"
+                },
+                "yError": {
+                    "field": "yieldError"
                 }
+            },
+            "mark": {
+                "ticks": true,
+                "type": "errorbar"
             }
         },
         {
-            "mark": {
-                "color": "black",
-                "type": "point",
-                "filled": true
-            },
             "encoding": {
                 "x": {
                     "field": "variety",
@@ -66,8 +62,12 @@
                     "field": "yield",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "black",
+                "filled": true,
+                "type": "point"
             }
         }
-    ],
-    "description": "Symetric error bars encoded with yError channel"
+    ]
 }
diff --git a/tests/specs/composite/errorbar7.vl b/tests/specs/composite/errorbar7.vl
--- a/tests/specs/composite/errorbar7.vl
+++ b/tests/specs/composite/errorbar7.vl
@@ -1,46 +1,37 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "yieldError2": -10.55,
-                "yieldError": 7.55,
                 "variety": "Glabron",
-                "yield": 32.4
+                "yield": 32.4,
+                "yieldError": 7.55,
+                "yieldError2": -10.55
             },
             {
-                "yieldError2": -3.98,
-                "yieldError": 6.98,
                 "variety": "Manchuria",
-                "yield": 30.97
+                "yield": 30.97,
+                "yieldError": 6.98,
+                "yieldError2": -3.98
             },
             {
-                "yieldError2": -0.92,
-                "yieldError": 3.92,
                 "variety": "No. 457",
-                "yield": 33.96
+                "yield": 33.96,
+                "yieldError": 3.92,
+                "yieldError2": -0.92
             },
             {
-                "yieldError2": -15.97,
-                "yieldError": 11.97,
                 "variety": "No. 462",
-                "yield": 30.45
+                "yield": 30.45,
+                "yieldError": 11.97,
+                "yieldError2": -15.97
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Asymetric error bars encoded with yError and yError2 channels",
     "layer": [
         {
-            "mark": {
-                "type": "errorbar",
-                "ticks": true
-            },
             "encoding": {
-                "yError2": {
-                    "field": "yieldError2"
-                },
-                "yError": {
-                    "field": "yieldError"
-                },
                 "x": {
                     "field": "variety",
                     "type": "ordinal"
@@ -51,15 +42,20 @@
                         "zero": false
                     },
                     "type": "quantitative"
+                },
+                "yError": {
+                    "field": "yieldError"
+                },
+                "yError2": {
+                    "field": "yieldError2"
                 }
+            },
+            "mark": {
+                "ticks": true,
+                "type": "errorbar"
             }
         },
         {
-            "mark": {
-                "color": "black",
-                "type": "point",
-                "filled": true
-            },
             "encoding": {
                 "x": {
                     "field": "variety",
@@ -69,8 +65,12 @@
                     "field": "yield",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "black",
+                "filled": true,
+                "type": "point"
             }
         }
-    ],
-    "description": "Asymetric error bars encoded with yError and yError2 channels"
+    ]
 }
diff --git a/tests/specs/conditional/axisCondition1.vl b/tests/specs/conditional/axisCondition1.vl
--- a/tests/specs/conditional/axisCondition1.vl
+++ b/tests/specs/conditional/axisCondition1.vl
@@ -1,42 +1,42 @@
 {
-    "height": 600,
-    "mark": {
-        "opacity": 0.1,
-        "type": "point"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "width": 600,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "IMDB_Rating",
-            "type": "quantitative",
             "axis": {
-                "tickCount": 20,
+                "gridColor": {
+                    "condition": {
+                        "test": "datum.value <= 7",
+                        "value": "green"
+                    },
+                    "value": "red"
+                },
                 "gridDash": {
-                    "value": [],
                     "condition": {
+                        "test": "datum.value <= 5",
                         "value": [
                             5,
                             5
-                        ],
-                        "test": "datum.value <= 5"
-                    }
+                        ]
+                    },
+                    "value": []
                 },
-                "gridColor": {
-                    "value": "red",
-                    "condition": {
-                        "value": "green",
-                        "test": "datum.value <= 7"
-                    }
-                }
-            }
+                "tickCount": 20
+            },
+            "field": "IMDB_Rating",
+            "type": "quantitative"
         },
         "y": {
             "field": "Rotten_Tomatoes_Rating",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 600,
+    "mark": {
+        "opacity": 0.1,
+        "type": "point"
+    },
+    "width": 600
 }
diff --git a/tests/specs/conditional/axisCondition2.vl b/tests/specs/conditional/axisCondition2.vl
--- a/tests/specs/conditional/axisCondition2.vl
+++ b/tests/specs/conditional/axisCondition2.vl
@@ -1,70 +1,70 @@
 {
-    "height": 600,
-    "mark": {
-        "opacity": 0.1,
-        "type": "point"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "width": 600,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "IMDB_Rating",
-            "type": "quantitative",
             "axis": {
-                "tickSize": {
-                    "value": 5,
+                "labelPadding": {
                     "condition": {
-                        "value": 20,
-                        "test": "(datum.value > 0) && (datum.value < 3)"
-                    }
+                        "test": "(datum.value >= 1) && (datum.value <= 4)",
+                        "value": 20
+                    },
+                    "value": 5
                 },
-                "tickWidth": {
-                    "value": 2,
+                "tickColor": {
                     "condition": {
-                        "value": 5,
-                        "test": "datum.label =='4.0'"
-                    }
+                        "test": "datum.value <= 2",
+                        "value": "red"
+                    },
+                    "value": "blue"
                 },
+                "tickCount": 20,
                 "tickDash": {
-                    "value": [],
                     "condition": {
+                        "test": "(datum.value >= 5) && (datum.value <= 8)",
                         "value": [
                             2,
                             2
-                        ],
-                        "test": "(datum.value >= 5) && (datum.value <= 8)"
-                    }
+                        ]
+                    },
+                    "value": []
                 },
-                "tickCount": 20,
                 "tickOpacity": {
-                    "value": 0.8,
                     "condition": {
-                        "value": 0.3,
-                        "test": "datum.value >=8"
-                    }
+                        "test": "datum.value >=8",
+                        "value": 0.3
+                    },
+                    "value": 0.8
                 },
-                "labelPadding": {
-                    "value": 5,
+                "tickSize": {
                     "condition": {
-                        "value": 20,
-                        "test": "(datum.value >= 1) && (datum.value <= 4)"
-                    }
+                        "test": "(datum.value > 0) && (datum.value < 3)",
+                        "value": 20
+                    },
+                    "value": 5
                 },
-                "tickColor": {
-                    "value": "blue",
+                "tickWidth": {
                     "condition": {
-                        "value": "red",
-                        "test": "datum.value <= 2"
-                    }
+                        "test": "datum.label =='4.0'",
+                        "value": 5
+                    },
+                    "value": 2
                 }
-            }
+            },
+            "field": "IMDB_Rating",
+            "type": "quantitative"
         },
         "y": {
             "field": "Rotten_Tomatoes_Rating",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 600,
+    "mark": {
+        "opacity": 0.1,
+        "type": "point"
+    },
+    "width": 600
 }
diff --git a/tests/specs/conditional/axisCondition3.vl b/tests/specs/conditional/axisCondition3.vl
--- a/tests/specs/conditional/axisCondition3.vl
+++ b/tests/specs/conditional/axisCondition3.vl
@@ -1,81 +1,81 @@
 {
-    "height": 600,
-    "mark": {
-        "opacity": 0.1,
-        "type": "point"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "width": 600,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "IMDB_Rating",
-            "type": "quantitative",
             "axis": {
-                "labelOpacity": {
-                    "value": 0.8,
+                "labelAlign": {
                     "condition": {
-                        "value": 0.3,
-                        "test": "datum.value >=9"
-                    }
+                        "test": "datum.value <= 1",
+                        "value": "right"
+                    },
+                    "value": "left"
                 },
-                "labelFontStyle": {
-                    "value": "italic",
+                "labelBaseline": {
                     "condition": {
-                        "value": "normal",
-                        "test": "datum.value <=8"
-                    }
+                        "test": "datum.value <= 3",
+                        "value": "top"
+                    },
+                    "value": "bottom"
                 },
                 "labelColor": {
-                    "value": "blue",
                     "condition": {
-                        "value": "red",
-                        "test": "datum.value <= 2"
-                    }
+                        "test": "datum.value <= 2",
+                        "value": "red"
+                    },
+                    "value": "blue"
                 },
-                "tickCount": 20,
-                "labelFontWeight": {
-                    "value": 100,
+                "labelFont": {
                     "condition": {
-                        "value": "bold",
-                        "test": "datum.label =='4.0'"
-                    }
+                        "test": "datum.value <= 4",
+                        "value": "serif"
+                    },
+                    "value": "sans-serif"
                 },
-                "labelBaseline": {
-                    "value": "bottom",
+                "labelFontSize": {
                     "condition": {
-                        "value": "top",
-                        "test": "datum.value <= 3"
-                    }
+                        "test": "datum.value <= 6",
+                        "value": 12
+                    },
+                    "value": 18
                 },
-                "labelFont": {
-                    "value": "sans-serif",
+                "labelFontStyle": {
                     "condition": {
-                        "value": "serif",
-                        "test": "datum.value <= 4"
-                    }
+                        "test": "datum.value <=8",
+                        "value": "normal"
+                    },
+                    "value": "italic"
                 },
-                "labelFontSize": {
-                    "value": 18,
+                "labelFontWeight": {
                     "condition": {
-                        "value": 12,
-                        "test": "datum.value <= 6"
-                    }
+                        "test": "datum.label =='4.0'",
+                        "value": "bold"
+                    },
+                    "value": 100
                 },
-                "labelAlign": {
-                    "value": "left",
+                "labelOpacity": {
                     "condition": {
-                        "value": "right",
-                        "test": "datum.value <= 1"
-                    }
-                }
-            }
+                        "test": "datum.value >=9",
+                        "value": 0.3
+                    },
+                    "value": 0.8
+                },
+                "tickCount": 20
+            },
+            "field": "IMDB_Rating",
+            "type": "quantitative"
         },
         "y": {
             "field": "Rotten_Tomatoes_Rating",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 600,
+    "mark": {
+        "opacity": 0.1,
+        "type": "point"
+    },
+    "width": 600
 }
diff --git a/tests/specs/conditional/axisDateCondition1.vl b/tests/specs/conditional/axisDateCondition1.vl
--- a/tests/specs/conditional/axisDateCondition1.vl
+++ b/tests/specs/conditional/axisDateCondition1.vl
@@ -1,25 +1,13 @@
 {
-    "mark": {
-        "borders": true,
-        "extent": "iqr",
-        "interpolate": "monotone",
-        "type": "errorband"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 600,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "Year",
-            "timeUnit": "year",
-            "type": "temporal",
             "axis": {
                 "gridWidth": {
-                    "value": 1,
                     "condition": {
-                        "value": 4,
                         "test": {
                             "equal": {
                                 "date": 1,
@@ -27,10 +15,15 @@
                             },
                             "field": "value",
                             "timeUnit": "monthdate"
-                        }
-                    }
+                        },
+                        "value": 4
+                    },
+                    "value": 1
                 }
-            }
+            },
+            "field": "Year",
+            "timeUnit": "year",
+            "type": "temporal"
         },
         "y": {
             "field": "Miles_per_Gallon",
@@ -39,5 +32,12 @@
             },
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "borders": true,
+        "extent": "iqr",
+        "interpolate": "monotone",
+        "type": "errorband"
+    },
+    "width": 600
 }
diff --git a/tests/specs/conditional/axisconditionlabeloffset.vl b/tests/specs/conditional/axisconditionlabeloffset.vl
--- a/tests/specs/conditional/axisconditionlabeloffset.vl
+++ b/tests/specs/conditional/axisconditionlabeloffset.vl
@@ -1,32 +1,32 @@
 {
-    "height": 600,
-    "mark": {
-        "opacity": 0.1,
-        "type": "point"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "width": 600,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "IMDB_Rating",
-            "type": "quantitative",
             "axis": {
                 "labelOffset": {
-                    "value": 5,
                     "condition": {
-                        "value": 10,
-                        "test": "datum.value <= 5"
-                    }
+                        "test": "datum.value <= 5",
+                        "value": 10
+                    },
+                    "value": 5
                 },
                 "tickCount": 20
-            }
+            },
+            "field": "IMDB_Rating",
+            "type": "quantitative"
         },
         "y": {
             "field": "Rotten_Tomatoes_Rating",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 600,
+    "mark": {
+        "opacity": 0.1,
+        "type": "point"
+    },
+    "width": 600
 }
diff --git a/tests/specs/conditional/bindScales1.vl b/tests/specs/conditional/bindScales1.vl
--- a/tests/specs/conditional/bindScales1.vl
+++ b/tests/specs/conditional/bindScales1.vl
@@ -1,17 +1,8 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "myZoomPan": {
-            "bind": "scales",
-            "type": "interval"
-        }
-    },
     "encoding": {
         "x": {
             "field": "Horsepower",
@@ -21,5 +12,14 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "selection": {
+        "myZoomPan": {
+            "bind": "scales",
+            "type": "interval"
+        }
+    },
+    "width": 300
 }
diff --git a/tests/specs/conditional/bindScales2.vl b/tests/specs/conditional/bindScales2.vl
--- a/tests/specs/conditional/bindScales2.vl
+++ b/tests/specs/conditional/bindScales2.vl
@@ -1,18 +1,8 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "myZoomPan": {
-            "clear": "click[event.shiftKey]",
-            "bind": "scales",
-            "type": "interval"
-        }
-    },
     "encoding": {
         "x": {
             "field": "Horsepower",
@@ -22,5 +12,15 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "selection": {
+        "myZoomPan": {
+            "bind": "scales",
+            "clear": "click[event.shiftKey]",
+            "type": "interval"
+        }
+    },
+    "width": 300
 }
diff --git a/tests/specs/conditional/markCondition1.vl b/tests/specs/conditional/markCondition1.vl
--- a/tests/specs/conditional/markCondition1.vl
+++ b/tests/specs/conditional/markCondition1.vl
@@ -1,31 +1,25 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "mark": {
             "invalid": null
         }
     },
-    "mark": {
-        "tooltip": {
-            "content": "encoding"
-        },
-        "type": "point"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
-            "value": "#0099ee",
             "condition": {
-                "value": "#ddd",
                 "test": {
                     "or": [
                         "datum.IMDB_Rating === null",
                         "datum.Rotten_Tomatoes_Rating === null"
                     ]
-                }
-            }
+                },
+                "value": "#ddd"
+            },
+            "value": "#0099ee"
         },
         "x": {
             "field": "IMDB_Rating",
@@ -35,5 +29,11 @@
             "field": "Rotten_Tomatoes_Rating",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "tooltip": {
+            "content": "encoding"
+        },
+        "type": "point"
     }
 }
diff --git a/tests/specs/conditional/markCondition2.vl b/tests/specs/conditional/markCondition2.vl
--- a/tests/specs/conditional/markCondition2.vl
+++ b/tests/specs/conditional/markCondition2.vl
@@ -1,8 +1,5 @@
 {
-    "mark": {
-        "size": 800,
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -25,29 +22,32 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
-            "value": "black",
             "condition": [
                 {
-                    "value": "blue",
-                    "test": "datum.value < 40"
+                    "test": "datum.value < 40",
+                    "value": "blue"
                 },
                 {
-                    "value": "red",
-                    "test": "datum.value < 50"
+                    "test": "datum.value < 50",
+                    "value": "red"
                 },
                 {
-                    "value": "yellow",
-                    "test": "datum.value < 60"
+                    "test": "datum.value < 60",
+                    "value": "yellow"
                 }
-            ]
+            ],
+            "value": "black"
         },
         "x": {
             "field": "value",
             "type": "ordinal"
         }
-    }
+    },
+    "mark": {
+        "size": 800,
+        "type": "circle"
+    },
+    "width": 400
 }
diff --git a/tests/specs/conditional/selectionCondition1.vl b/tests/specs/conditional/selectionCondition1.vl
--- a/tests/specs/conditional/selectionCondition1.vl
+++ b/tests/specs/conditional/selectionCondition1.vl
@@ -1,33 +1,12 @@
 {
-    "mark": {
-        "cursor": "grab",
-        "type": "rect"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "alex": {
-            "type": "interval",
-            "translate": "[mousedown[!event.shiftKey], mouseup] > mousemove",
-            "on": "[mousedown[!event.shiftKey], mouseup] > mousemove"
-        },
-        "morgan": {
-            "mark": {
-                "stroke": "#e34a33",
-                "fill": "#fdbb84",
-                "fillOpacity": 0.5
-            },
-            "type": "interval",
-            "translate": "[mousedown[event.shiftKey], mouseup] > mousemove",
-            "on": "[mousedown[event.shiftKey], mouseup] > mousemove"
-        }
-    },
     "encoding": {
         "color": {
-            "field": "*",
             "aggregate": "count",
+            "field": "*",
             "type": "quantitative"
         },
         "x": {
@@ -37,6 +16,27 @@
         "y": {
             "field": "Origin",
             "type": "ordinal"
+        }
+    },
+    "mark": {
+        "cursor": "grab",
+        "type": "rect"
+    },
+    "selection": {
+        "alex": {
+            "on": "[mousedown[!event.shiftKey], mouseup] > mousemove",
+            "translate": "[mousedown[!event.shiftKey], mouseup] > mousemove",
+            "type": "interval"
+        },
+        "morgan": {
+            "mark": {
+                "fill": "#fdbb84",
+                "fillOpacity": 0.5,
+                "stroke": "#e34a33"
+            },
+            "on": "[mousedown[event.shiftKey], mouseup] > mousemove",
+            "translate": "[mousedown[event.shiftKey], mouseup] > mousemove",
+            "type": "interval"
         }
     }
 }
diff --git a/tests/specs/conditional/selectionCondition2.vl b/tests/specs/conditional/selectionCondition2.vl
--- a/tests/specs/conditional/selectionCondition2.vl
+++ b/tests/specs/conditional/selectionCondition2.vl
@@ -1,35 +1,13 @@
 {
-    "mark": {
-        "cursor": "grab",
-        "type": "rect"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "alex": {
-            "type": "interval",
-            "translate": "[mousedown[!event.shiftKey], mouseup] > mousemove",
-            "on": "[mousedown[!event.shiftKey], mouseup] > mousemove"
-        },
-        "morgan": {
-            "mark": {
-                "stroke": "#e34a33",
-                "fill": "#fdbb84",
-                "fillOpacity": 0.5
-            },
-            "type": "interval",
-            "translate": "[mousedown[event.shiftKey], mouseup] > mousemove",
-            "on": "[mousedown[event.shiftKey], mouseup] > mousemove"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "gray",
             "condition": {
-                "field": "*",
                 "aggregate": "count",
+                "field": "*",
                 "selection": {
                     "and": [
                         "alex",
@@ -37,7 +15,8 @@
                     ]
                 },
                 "type": "quantitative"
-            }
+            },
+            "value": "gray"
         },
         "x": {
             "field": "Cylinders",
@@ -46,6 +25,27 @@
         "y": {
             "field": "Origin",
             "type": "ordinal"
+        }
+    },
+    "mark": {
+        "cursor": "grab",
+        "type": "rect"
+    },
+    "selection": {
+        "alex": {
+            "on": "[mousedown[!event.shiftKey], mouseup] > mousemove",
+            "translate": "[mousedown[!event.shiftKey], mouseup] > mousemove",
+            "type": "interval"
+        },
+        "morgan": {
+            "mark": {
+                "fill": "#fdbb84",
+                "fillOpacity": 0.5,
+                "stroke": "#e34a33"
+            },
+            "on": "[mousedown[event.shiftKey], mouseup] > mousemove",
+            "translate": "[mousedown[event.shiftKey], mouseup] > mousemove",
+            "type": "interval"
         }
     }
 }
diff --git a/tests/specs/conditional/selectionCondition3.vl b/tests/specs/conditional/selectionCondition3.vl
--- a/tests/specs/conditional/selectionCondition3.vl
+++ b/tests/specs/conditional/selectionCondition3.vl
@@ -1,15 +1,10 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
     "vconcat": [
         {
-            "mark": "point",
-            "selection": {
-                "brush": {
-                    "type": "interval"
-                }
-            },
             "encoding": {
                 "x": {
                     "field": "Horsepower",
@@ -19,22 +14,15 @@
                     "field": "Miles_per_Gallon",
                     "type": "quantitative"
                 }
+            },
+            "mark": "point",
+            "selection": {
+                "brush": {
+                    "type": "interval"
+                }
             }
         },
         {
-            "transform": [
-                {
-                    "filter": {
-                        "and": [
-                            {
-                                "selection": "brush"
-                            },
-                            "datum.Weight_in_lbs > 3000"
-                        ]
-                    }
-                }
-            ],
-            "mark": "point",
             "encoding": {
                 "x": {
                     "field": "Acceleration",
@@ -56,8 +44,20 @@
                     },
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "point",
+            "transform": [
+                {
+                    "filter": {
+                        "and": [
+                            {
+                                "selection": "brush"
+                            },
+                            "datum.Weight_in_lbs > 3000"
+                        ]
+                    }
+                }
+            ]
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    ]
 }
diff --git a/tests/specs/conditional/selectionCondition4.vl b/tests/specs/conditional/selectionCondition4.vl
--- a/tests/specs/conditional/selectionCondition4.vl
+++ b/tests/specs/conditional/selectionCondition4.vl
@@ -1,29 +1,17 @@
 {
-    "mark": {
-        "cursor": "grab",
-        "type": "rect"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "clear": false,
-            "type": "interval",
-            "translate": "[mousedown[!event.shiftKey], mouseup] > mousemove",
-            "on": "[mousedown[!event.shiftKey], mouseup] > mousemove"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "gray",
             "condition": {
-                "field": "*",
                 "aggregate": "count",
+                "field": "*",
                 "selection": "mySelection",
                 "type": "quantitative"
-            }
+            },
+            "value": "gray"
         },
         "x": {
             "field": "Cylinders",
@@ -32,6 +20,18 @@
         "y": {
             "field": "Origin",
             "type": "ordinal"
+        }
+    },
+    "mark": {
+        "cursor": "grab",
+        "type": "rect"
+    },
+    "selection": {
+        "mySelection": {
+            "clear": false,
+            "on": "[mousedown[!event.shiftKey], mouseup] > mousemove",
+            "translate": "[mousedown[!event.shiftKey], mouseup] > mousemove",
+            "type": "interval"
         }
     }
 }
diff --git a/tests/specs/conditional/selectionCondition5.vl b/tests/specs/conditional/selectionCondition5.vl
--- a/tests/specs/conditional/selectionCondition5.vl
+++ b/tests/specs/conditional/selectionCondition5.vl
@@ -1,30 +1,17 @@
 {
-    "mark": {
-        "cursor": "grab",
-        "type": "rect"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "empty": "none",
-            "clear": "mouseup",
-            "type": "interval",
-            "translate": "[mousedown[!event.shiftKey], mouseup] > mousemove",
-            "on": "[mousedown[!event.shiftKey], mouseup] > mousemove"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "gray",
             "condition": {
-                "field": "*",
                 "aggregate": "count",
+                "field": "*",
                 "selection": "mySelection",
                 "type": "quantitative"
-            }
+            },
+            "value": "gray"
         },
         "x": {
             "field": "Cylinders",
@@ -33,6 +20,19 @@
         "y": {
             "field": "Origin",
             "type": "ordinal"
+        }
+    },
+    "mark": {
+        "cursor": "grab",
+        "type": "rect"
+    },
+    "selection": {
+        "mySelection": {
+            "clear": "mouseup",
+            "empty": "none",
+            "on": "[mousedown[!event.shiftKey], mouseup] > mousemove",
+            "translate": "[mousedown[!event.shiftKey], mouseup] > mousemove",
+            "type": "interval"
         }
     }
 }
diff --git a/tests/specs/conditional/selectionHeatMap.vl b/tests/specs/conditional/selectionHeatMap.vl
new file mode 100644
--- /dev/null
+++ b/tests/specs/conditional/selectionHeatMap.vl
@@ -0,0 +1,120 @@
+{
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "config": {
+        "axis": {
+            "domain": false
+        },
+        "range": {
+            "ramp": {
+                "scheme": "yellowgreenblue"
+            }
+        },
+        "scale": {
+            "bandPaddingInner": 0,
+            "bandPaddingOuter": 0
+        },
+        "view": {
+            "step": 40
+        }
+    },
+    "data": {
+        "values": [
+            {
+                "actual": "A",
+                "count": 13,
+                "predicted": "A"
+            },
+            {
+                "actual": "A",
+                "count": 0,
+                "predicted": "B"
+            },
+            {
+                "actual": "A",
+                "count": 0,
+                "predicted": "C"
+            },
+            {
+                "actual": "B",
+                "count": 0,
+                "predicted": "A"
+            },
+            {
+                "actual": "B",
+                "count": 10,
+                "predicted": "B"
+            },
+            {
+                "actual": "B",
+                "count": 6,
+                "predicted": "C"
+            },
+            {
+                "actual": "C",
+                "count": 0,
+                "predicted": "A"
+            },
+            {
+                "actual": "C",
+                "count": 0,
+                "predicted": "B"
+            },
+            {
+                "actual": "C",
+                "count": 9,
+                "predicted": "C"
+            }
+        ]
+    },
+    "encoding": {
+        "fill": {
+            "field": "count",
+            "type": "quantitative"
+        },
+        "opacity": {
+            "condition": {
+                "selection": "highlight",
+                "value": 1
+            },
+            "value": 0.5
+        },
+        "order": {
+            "condition": {
+                "selection": "highlight",
+                "value": 1
+            },
+            "value": 0
+        },
+        "stroke": {
+            "condition": {
+                "test": {
+                    "and": [
+                        {
+                            "selection": "highlight"
+                        },
+                        "length(data(\"highlight_store\"))"
+                    ]
+                },
+                "value": "black"
+            },
+            "value": null
+        },
+        "x": {
+            "field": "predicted",
+            "type": "nominal"
+        },
+        "y": {
+            "field": "actual",
+            "type": "nominal"
+        }
+    },
+    "mark": {
+        "strokeWidth": 2,
+        "type": "rect"
+    },
+    "selection": {
+        "highlight": {
+            "type": "single"
+        }
+    }
+}
diff --git a/tests/specs/config/axisCfg1.vl b/tests/specs/config/axisCfg1.vl
--- a/tests/specs/config/axisCfg1.vl
+++ b/tests/specs/config/axisCfg1.vl
@@ -1,24 +1,17 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "axis": {
+            "labelFont": "serif",
             "labelFontStyle": "bold",
+            "titleAnchor": "end",
             "titleFont": "serif",
-            "titleFontStyle": "italic",
-            "labelFont": "serif",
-            "titleAnchor": "end"
+            "titleFontStyle": "italic"
         }
     },
-    "mark": {
-        "size": 100,
-        "type": "point"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Car Scatter",
     "encoding": {
         "color": {
             "field": "Cylinders",
@@ -36,5 +29,12 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "size": 100,
+        "type": "point"
+    },
+    "title": "Car Scatter",
+    "width": 200
 }
diff --git a/tests/specs/config/breaklinecfg.vl b/tests/specs/config/breaklinecfg.vl
--- a/tests/specs/config/breaklinecfg.vl
+++ b/tests/specs/config/breaklinecfg.vl
@@ -1,8 +1,8 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "lineBreak": "X"
     },
-    "mark": "text",
     "data": {
         "values": [
             {
@@ -22,7 +22,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "text": {
             "field": "l",
@@ -36,5 +35,6 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "text"
 }
diff --git a/tests/specs/config/dark.vl b/tests/specs/config/dark.vl
--- a/tests/specs/config/dark.vl
+++ b/tests/specs/config/dark.vl
@@ -1,13 +1,38 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "config": {
+        "axis": {
+            "domainColor": "yellow",
+            "gridColor": "rgb(255,255,200)",
+            "gridOpacity": 0.2,
+            "labelColor": "#fcf",
+            "labelFont": "Roboto",
+            "tickColor": "white",
+            "titleColor": "rgb(200,255,200)",
+            "titleFont": "Roboto"
+        },
+        "background": "black",
+        "legend": {
+            "direction": "horizontal",
+            "fillColor": "#333",
+            "gradientStrokeColor": "yellow",
+            "labelColor": "white",
+            "labelFont": "Roboto",
+            "strokeColor": "#444",
+            "symbolFillColor": "red",
+            "titleColor": "rgb(200,200,200)",
+            "titleFont": "Roboto"
+        },
+        "title": {
+            "color": "#fff",
+            "font": "Roboto"
+        }
+    },
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/cars.json"
+    },
     "hconcat": [
         {
-            "height": 200,
-            "mark": {
-                "size": 100,
-                "type": "point"
-            },
-            "width": 200,
-            "title": "Car Scatter",
             "encoding": {
                 "color": {
                     "field": "Cylinders",
@@ -25,13 +50,16 @@
                     "field": "Miles_per_Gallon",
                     "type": "quantitative"
                 }
-            }
+            },
+            "height": 200,
+            "mark": {
+                "size": 100,
+                "type": "point"
+            },
+            "title": "Car Scatter",
+            "width": 200
         },
         {
-            "height": 200,
-            "mark": "bar",
-            "width": 200,
-            "title": "Car Histogram",
             "encoding": {
                 "color": {
                     "field": "Origin",
@@ -45,13 +73,13 @@
                     "aggregate": "count",
                     "type": "quantitative"
                 }
-            }
+            },
+            "height": 200,
+            "mark": "bar",
+            "title": "Car Histogram",
+            "width": 200
         },
         {
-            "height": 200,
-            "mark": "area",
-            "width": 200,
-            "title": "Car Streamgraph",
             "encoding": {
                 "color": {
                     "field": "Origin",
@@ -64,49 +92,21 @@
                 },
                 "y": {
                     "aggregate": "count",
-                    "type": "quantitative",
                     "axis": null,
-                    "stack": "center"
+                    "stack": "center",
+                    "type": "quantitative"
                 }
-            }
+            },
+            "height": 200,
+            "mark": "area",
+            "title": "Car Streamgraph",
+            "width": 200
         }
     ],
-    "config": {
-        "title": {
-            "color": "#fff",
-            "font": "Roboto"
-        },
-        "axis": {
-            "domainColor": "yellow",
-            "labelColor": "#fcf",
-            "titleFont": "Roboto",
-            "titleColor": "rgb(200,255,200)",
-            "gridColor": "rgb(255,255,200)",
-            "labelFont": "Roboto",
-            "tickColor": "white",
-            "gridOpacity": 0.2
-        },
-        "background": "black",
-        "legend": {
-            "gradientStrokeColor": "yellow",
-            "fillColor": "#333",
-            "direction": "horizontal",
-            "labelColor": "white",
-            "titleFont": "Roboto",
-            "symbolFillColor": "red",
-            "titleColor": "rgb(200,200,200)",
-            "labelFont": "Roboto",
-            "strokeColor": "#444"
-        }
-    },
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/cars.json"
-    },
     "resolve": {
         "scale": {
             "color": "independent",
             "shape": "independent"
         }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    }
 }
diff --git a/tests/specs/config/default.vl b/tests/specs/config/default.vl
--- a/tests/specs/config/default.vl
+++ b/tests/specs/config/default.vl
@@ -1,13 +1,11 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "config": {},
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/cars.json"
+    },
     "hconcat": [
         {
-            "height": 200,
-            "mark": {
-                "size": 100,
-                "type": "point"
-            },
-            "width": 200,
-            "title": "Car Scatter",
             "encoding": {
                 "color": {
                     "field": "Cylinders",
@@ -25,13 +23,16 @@
                     "field": "Miles_per_Gallon",
                     "type": "quantitative"
                 }
-            }
+            },
+            "height": 200,
+            "mark": {
+                "size": 100,
+                "type": "point"
+            },
+            "title": "Car Scatter",
+            "width": 200
         },
         {
-            "height": 200,
-            "mark": "bar",
-            "width": 200,
-            "title": "Car Histogram",
             "encoding": {
                 "color": {
                     "field": "Origin",
@@ -45,13 +46,13 @@
                     "aggregate": "count",
                     "type": "quantitative"
                 }
-            }
+            },
+            "height": 200,
+            "mark": "bar",
+            "title": "Car Histogram",
+            "width": 200
         },
         {
-            "height": 200,
-            "mark": "area",
-            "width": 200,
-            "title": "Car Streamgraph",
             "encoding": {
                 "color": {
                     "field": "Origin",
@@ -64,22 +65,21 @@
                 },
                 "y": {
                     "aggregate": "count",
-                    "type": "quantitative",
                     "axis": null,
-                    "stack": "center"
+                    "stack": "center",
+                    "type": "quantitative"
                 }
-            }
+            },
+            "height": 200,
+            "mark": "area",
+            "title": "Car Streamgraph",
+            "width": 200
         }
     ],
-    "config": {},
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/cars.json"
-    },
     "resolve": {
         "scale": {
             "color": "independent",
             "shape": "independent"
         }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    }
 }
diff --git a/tests/specs/config/fontCfg.vl b/tests/specs/config/fontCfg.vl
--- a/tests/specs/config/fontCfg.vl
+++ b/tests/specs/config/fontCfg.vl
@@ -1,18 +1,11 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "font": "Comic Sans MS"
     },
-    "mark": {
-        "size": 100,
-        "type": "point"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Car Scatter",
     "encoding": {
         "color": {
             "field": "Cylinders",
@@ -30,5 +23,12 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "size": 100,
+        "type": "point"
+    },
+    "title": "Car Scatter",
+    "width": 200
 }
diff --git a/tests/specs/config/headerlabels.vl b/tests/specs/config/headerlabels.vl
--- a/tests/specs/config/headerlabels.vl
+++ b/tests/specs/config/headerlabels.vl
@@ -1,40 +1,40 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year === 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex === 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {
             "labels": false
         }
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
+            "field": "people",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year === 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex === 2 ? 'Female' : 'Male'"
+        }
+    ]
 }
diff --git a/tests/specs/config/mark1.vl b/tests/specs/config/mark1.vl
--- a/tests/specs/config/mark1.vl
+++ b/tests/specs/config/mark1.vl
@@ -1,13 +1,15 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "config": {
+        "mark": {
+            "filled": false
+        }
+    },
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/cars.json"
+    },
     "hconcat": [
         {
-            "height": 200,
-            "mark": {
-                "size": 100,
-                "type": "point"
-            },
-            "width": 200,
-            "title": "Car Scatter",
             "encoding": {
                 "color": {
                     "field": "Cylinders",
@@ -25,13 +27,16 @@
                     "field": "Miles_per_Gallon",
                     "type": "quantitative"
                 }
-            }
+            },
+            "height": 200,
+            "mark": {
+                "size": 100,
+                "type": "point"
+            },
+            "title": "Car Scatter",
+            "width": 200
         },
         {
-            "height": 200,
-            "mark": "bar",
-            "width": 200,
-            "title": "Car Histogram",
             "encoding": {
                 "color": {
                     "field": "Origin",
@@ -45,13 +50,13 @@
                     "aggregate": "count",
                     "type": "quantitative"
                 }
-            }
+            },
+            "height": 200,
+            "mark": "bar",
+            "title": "Car Histogram",
+            "width": 200
         },
         {
-            "height": 200,
-            "mark": "area",
-            "width": 200,
-            "title": "Car Streamgraph",
             "encoding": {
                 "color": {
                     "field": "Origin",
@@ -64,26 +69,21 @@
                 },
                 "y": {
                     "aggregate": "count",
-                    "type": "quantitative",
                     "axis": null,
-                    "stack": "center"
+                    "stack": "center",
+                    "type": "quantitative"
                 }
-            }
+            },
+            "height": 200,
+            "mark": "area",
+            "title": "Car Streamgraph",
+            "width": 200
         }
     ],
-    "config": {
-        "mark": {
-            "filled": false
-        }
-    },
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/cars.json"
-    },
     "resolve": {
         "scale": {
             "color": "independent",
             "shape": "independent"
         }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    }
 }
diff --git a/tests/specs/config/mark2.vl b/tests/specs/config/mark2.vl
--- a/tests/specs/config/mark2.vl
+++ b/tests/specs/config/mark2.vl
@@ -1,13 +1,28 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "config": {
+        "area": {
+            "filled": false
+        },
+        "bar": {
+            "filled": true
+        },
+        "mark": {
+            "fill": "black",
+            "filled": true,
+            "opacity": 1
+        },
+        "point": {
+            "filled": true,
+            "stroke": "white",
+            "strokeOpacity": 0.2
+        }
+    },
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/cars.json"
+    },
     "hconcat": [
         {
-            "height": 200,
-            "mark": {
-                "size": 100,
-                "type": "point"
-            },
-            "width": 200,
-            "title": "Car Scatter",
             "encoding": {
                 "color": {
                     "field": "Cylinders",
@@ -25,13 +40,16 @@
                     "field": "Miles_per_Gallon",
                     "type": "quantitative"
                 }
-            }
+            },
+            "height": 200,
+            "mark": {
+                "size": 100,
+                "type": "point"
+            },
+            "title": "Car Scatter",
+            "width": 200
         },
         {
-            "height": 200,
-            "mark": "bar",
-            "width": 200,
-            "title": "Car Histogram",
             "encoding": {
                 "color": {
                     "field": "Origin",
@@ -45,13 +63,13 @@
                     "aggregate": "count",
                     "type": "quantitative"
                 }
-            }
+            },
+            "height": 200,
+            "mark": "bar",
+            "title": "Car Histogram",
+            "width": 200
         },
         {
-            "height": 200,
-            "mark": "area",
-            "width": 200,
-            "title": "Car Streamgraph",
             "encoding": {
                 "color": {
                     "field": "Origin",
@@ -64,39 +82,21 @@
                 },
                 "y": {
                     "aggregate": "count",
-                    "type": "quantitative",
                     "axis": null,
-                    "stack": "center"
+                    "stack": "center",
+                    "type": "quantitative"
                 }
-            }
+            },
+            "height": 200,
+            "mark": "area",
+            "title": "Car Streamgraph",
+            "width": 200
         }
     ],
-    "config": {
-        "area": {
-            "filled": false
-        },
-        "mark": {
-            "opacity": 1,
-            "fill": "black",
-            "filled": true
-        },
-        "point": {
-            "stroke": "white",
-            "strokeOpacity": 0.2,
-            "filled": true
-        },
-        "bar": {
-            "filled": true
-        }
-    },
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/cars.json"
-    },
     "resolve": {
         "scale": {
             "color": "independent",
             "shape": "independent"
         }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    }
 }
diff --git a/tests/specs/config/padding.vl b/tests/specs/config/padding.vl
--- a/tests/specs/config/padding.vl
+++ b/tests/specs/config/padding.vl
@@ -1,5 +1,5 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "autosize": {
             "type": "fit"
@@ -11,16 +11,9 @@
             "top": 60
         }
     },
-    "mark": {
-        "size": 100,
-        "type": "point"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Car Scatter",
     "encoding": {
         "color": {
             "field": "Cylinders",
@@ -38,5 +31,12 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "size": 100,
+        "type": "point"
+    },
+    "title": "Car Scatter",
+    "width": 200
 }
diff --git a/tests/specs/config/paddingContent.vl b/tests/specs/config/paddingContent.vl
--- a/tests/specs/config/paddingContent.vl
+++ b/tests/specs/config/paddingContent.vl
@@ -1,5 +1,5 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "autosize": {
             "contains": "content"
@@ -11,16 +11,9 @@
             "top": 60
         }
     },
-    "mark": {
-        "size": 100,
-        "type": "point"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Car Scatter",
     "encoding": {
         "color": {
             "field": "Cylinders",
@@ -38,5 +31,12 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "size": 100,
+        "type": "point"
+    },
+    "title": "Car Scatter",
+    "width": 200
 }
diff --git a/tests/specs/config/paddingNone.vl b/tests/specs/config/paddingNone.vl
--- a/tests/specs/config/paddingNone.vl
+++ b/tests/specs/config/paddingNone.vl
@@ -1,5 +1,5 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "autosize": {
             "type": "none"
@@ -11,16 +11,9 @@
             "top": 60
         }
     },
-    "mark": {
-        "size": 100,
-        "type": "point"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Car Scatter",
     "encoding": {
         "color": {
             "field": "Cylinders",
@@ -38,5 +31,12 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "size": 100,
+        "type": "point"
+    },
+    "title": "Car Scatter",
+    "width": 200
 }
diff --git a/tests/specs/config/paddingPad.vl b/tests/specs/config/paddingPad.vl
--- a/tests/specs/config/paddingPad.vl
+++ b/tests/specs/config/paddingPad.vl
@@ -1,5 +1,5 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "autosize": {
             "type": "pad"
@@ -11,16 +11,9 @@
             "top": 60
         }
     },
-    "mark": {
-        "size": 100,
-        "type": "point"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Car Scatter",
     "encoding": {
         "color": {
             "field": "Cylinders",
@@ -38,5 +31,12 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "size": 100,
+        "type": "point"
+    },
+    "title": "Car Scatter",
+    "width": 200
 }
diff --git a/tests/specs/config/paddingPadding.vl b/tests/specs/config/paddingPadding.vl
--- a/tests/specs/config/paddingPadding.vl
+++ b/tests/specs/config/paddingPadding.vl
@@ -1,5 +1,5 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "autosize": {
             "contains": "padding"
@@ -11,16 +11,9 @@
             "top": 60
         }
     },
-    "mark": {
-        "size": 100,
-        "type": "point"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Car Scatter",
     "encoding": {
         "color": {
             "field": "Cylinders",
@@ -38,5 +31,12 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "size": 100,
+        "type": "point"
+    },
+    "title": "Car Scatter",
+    "width": 200
 }
diff --git a/tests/specs/config/paddingResize.vl b/tests/specs/config/paddingResize.vl
--- a/tests/specs/config/paddingResize.vl
+++ b/tests/specs/config/paddingResize.vl
@@ -1,5 +1,5 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "autosize": {
             "resize": true
@@ -11,16 +11,9 @@
             "top": 60
         }
     },
-    "mark": {
-        "size": 100,
-        "type": "point"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Car Scatter",
     "encoding": {
         "color": {
             "field": "Cylinders",
@@ -38,5 +31,12 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "size": 100,
+        "type": "point"
+    },
+    "title": "Car Scatter",
+    "width": 200
 }
diff --git a/tests/specs/config/paddingx.vl b/tests/specs/config/paddingx.vl
--- a/tests/specs/config/paddingx.vl
+++ b/tests/specs/config/paddingx.vl
@@ -1,5 +1,5 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "autosize": {
             "type": "fit-x"
@@ -11,16 +11,9 @@
             "top": 60
         }
     },
-    "mark": {
-        "size": 100,
-        "type": "point"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Car Scatter",
     "encoding": {
         "color": {
             "field": "Cylinders",
@@ -38,5 +31,12 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "size": 100,
+        "type": "point"
+    },
+    "title": "Car Scatter",
+    "width": 200
 }
diff --git a/tests/specs/config/paddingy.vl b/tests/specs/config/paddingy.vl
--- a/tests/specs/config/paddingy.vl
+++ b/tests/specs/config/paddingy.vl
@@ -1,5 +1,5 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "autosize": {
             "type": "fit-y"
@@ -11,16 +11,9 @@
             "top": 60
         }
     },
-    "mark": {
-        "size": 100,
-        "type": "point"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Car Scatter",
     "encoding": {
         "color": {
             "field": "Cylinders",
@@ -38,5 +31,12 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "size": 100,
+        "type": "point"
+    },
+    "title": "Car Scatter",
+    "width": 200
 }
diff --git a/tests/specs/config/titleCfg1.vl b/tests/specs/config/titleCfg1.vl
--- a/tests/specs/config/titleCfg1.vl
+++ b/tests/specs/config/titleCfg1.vl
@@ -1,21 +1,8 @@
 {
-    "height": 200,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": {
-        "text": [
-            "Car",
-            "Scatter"
-        ],
-        "subtitle": [
-            "A subtitle",
-            "also over two lines"
-        ]
-    },
     "encoding": {
         "x": {
             "field": "Horsepower",
@@ -25,5 +12,18 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": "circle",
+    "title": {
+        "subtitle": [
+            "A subtitle",
+            "also over two lines"
+        ],
+        "text": [
+            "Car",
+            "Scatter"
+        ]
+    },
+    "width": 200
 }
diff --git a/tests/specs/config/titleCfg2.vl b/tests/specs/config/titleCfg2.vl
--- a/tests/specs/config/titleCfg2.vl
+++ b/tests/specs/config/titleCfg2.vl
@@ -1,32 +1,8 @@
 {
-    "height": 200,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": {
-        "dx": -30,
-        "subtitleFontWeight": 900,
-        "subtitleFont": "serif",
-        "subtitleFontSize": 10,
-        "subtitleLineHeight": 18,
-        "dy": 10,
-        "text": [
-            "Car",
-            "Scatter"
-        ],
-        "subtitlePadding": 60,
-        "anchor": "end",
-        "subtitle": [
-            "A subtitle",
-            "also over two lines"
-        ],
-        "subtitleFontStyle": "italic",
-        "subtitleColor": "red",
-        "lineHeight": 20
-    },
     "encoding": {
         "x": {
             "field": "Horsepower",
@@ -36,5 +12,29 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": "circle",
+    "title": {
+        "anchor": "end",
+        "dx": -30,
+        "dy": 10,
+        "lineHeight": 20,
+        "subtitle": [
+            "A subtitle",
+            "also over two lines"
+        ],
+        "subtitleColor": "red",
+        "subtitleFont": "serif",
+        "subtitleFontSize": 10,
+        "subtitleFontStyle": "italic",
+        "subtitleFontWeight": 900,
+        "subtitleLineHeight": 18,
+        "subtitlePadding": 60,
+        "text": [
+            "Car",
+            "Scatter"
+        ]
+    },
+    "width": 200
 }
diff --git a/tests/specs/config/titleCfg3.vl b/tests/specs/config/titleCfg3.vl
--- a/tests/specs/config/titleCfg3.vl
+++ b/tests/specs/config/titleCfg3.vl
@@ -1,36 +1,23 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "title": {
+            "anchor": "end",
             "dx": -30,
-            "subtitleFontWeight": 900,
+            "dy": 10,
+            "lineHeight": 20,
+            "subtitleColor": "red",
             "subtitleFont": "serif",
             "subtitleFontSize": 10,
-            "subtitleLineHeight": 18,
-            "dy": 10,
-            "subtitlePadding": 60,
-            "anchor": "end",
             "subtitleFontStyle": "italic",
-            "subtitleColor": "red",
-            "lineHeight": 20
+            "subtitleFontWeight": 900,
+            "subtitleLineHeight": 18,
+            "subtitlePadding": 60
         }
     },
-    "mark": "circle",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": {
-        "text": [
-            "Car",
-            "Scatter"
-        ],
-        "subtitle": [
-            "A subtitle",
-            "also over two lines"
-        ]
-    },
     "encoding": {
         "x": {
             "field": "Horsepower",
@@ -40,5 +27,18 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": "circle",
+    "title": {
+        "subtitle": [
+            "A subtitle",
+            "also over two lines"
+        ],
+        "text": [
+            "Car",
+            "Scatter"
+        ]
+    },
+    "width": 200
 }
diff --git a/tests/specs/config/vbTest.vl b/tests/specs/config/vbTest.vl
--- a/tests/specs/config/vbTest.vl
+++ b/tests/specs/config/vbTest.vl
@@ -1,17 +1,30 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "yellow",
+    "config": {
+        "legend": {
+            "title": null
+        },
+        "style": {
+            "mySecondStyle": {
+                "fill": "black",
+                "stroke": "blue"
+            },
+            "myStyle": {
+                "fill": "red",
+                "fillOpacity": 0.1,
+                "strokeOpacity": 1
+            }
+        },
+        "view": {
+            "fill": "#feb"
+        }
+    },
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/cars.json"
+    },
     "hconcat": [
         {
-            "height": 200,
-            "mark": {
-                "size": 100,
-                "type": "point"
-            },
-            "width": 200,
-            "title": {
-                "color": "brown",
-                "text": "Car Scatter",
-                "fontSize": 12
-            },
             "encoding": {
                 "color": {
                     "field": "Cylinders",
@@ -29,25 +42,20 @@
                     "field": "Miles_per_Gallon",
                     "type": "quantitative"
                 }
-            }
-        },
-        {
+            },
             "height": 200,
-            "mark": "bar",
-            "width": 200,
-            "view": {
-                "cornerRadius": 18,
-                "strokeWidth": 4,
-                "strokeCap": "round",
-                "strokeJoin": "bevel",
-                "stroke": "red",
-                "fill": "white",
-                "strokeDash": [
-                    10,
-                    10
-                ]
+            "mark": {
+                "size": 100,
+                "type": "point"
             },
-            "title": "Car Histogram",
+            "title": {
+                "color": "brown",
+                "fontSize": 12,
+                "text": "Car Scatter"
+            },
+            "width": 200
+        },
+        {
             "encoding": {
                 "color": {
                     "field": "Origin",
@@ -61,19 +69,25 @@
                     "aggregate": "count",
                     "type": "quantitative"
                 }
-            }
-        },
-        {
+            },
             "height": 200,
-            "mark": "area",
-            "width": 200,
+            "mark": "bar",
+            "title": "Car Histogram",
             "view": {
-                "style": [
-                    "myStyle",
-                    "mySecondStyle"
-                ]
+                "cornerRadius": 18,
+                "fill": "white",
+                "stroke": "red",
+                "strokeCap": "round",
+                "strokeDash": [
+                    10,
+                    10
+                ],
+                "strokeJoin": "bevel",
+                "strokeWidth": 4
             },
-            "title": "Car Streamgraph",
+            "width": 200
+        },
+        {
             "encoding": {
                 "color": {
                     "field": "Origin",
@@ -86,41 +100,27 @@
                 },
                 "y": {
                     "aggregate": "count",
-                    "type": "quantitative",
                     "axis": null,
-                    "stack": "center"
+                    "stack": "center",
+                    "type": "quantitative"
                 }
-            }
-        }
-    ],
-    "config": {
-        "style": {
-            "mySecondStyle": {
-                "stroke": "blue",
-                "fill": "black"
             },
-            "myStyle": {
-                "fill": "red",
-                "strokeOpacity": 1,
-                "fillOpacity": 0.1
-            }
-        },
-        "view": {
-            "fill": "#feb"
-        },
-        "legend": {
-            "title": null
+            "height": 200,
+            "mark": "area",
+            "title": "Car Streamgraph",
+            "view": {
+                "style": [
+                    "myStyle",
+                    "mySecondStyle"
+                ]
+            },
+            "width": 200
         }
-    },
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/cars.json"
-    },
+    ],
     "resolve": {
         "scale": {
             "color": "independent",
             "shape": "independent"
         }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "background": "yellow"
+    }
 }
diff --git a/tests/specs/data/annotate1.vl b/tests/specs/data/annotate1.vl
--- a/tests/specs/data/annotate1.vl
+++ b/tests/specs/data/annotate1.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -23,10 +24,8 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": "bar",
             "encoding": {
                 "x": {
                     "field": "a",
@@ -36,14 +35,15 @@
                     "field": "b",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "bar"
         },
         {
+            "data": null,
             "mark": {
                 "text": "Test",
                 "type": "text"
-            },
-            "data": null
+            }
         }
     ]
 }
diff --git a/tests/specs/data/argmin_spaces.vl b/tests/specs/data/argmin_spaces.vl
--- a/tests/specs/data/argmin_spaces.vl
+++ b/tests/specs/data/argmin_spaces.vl
@@ -1,55 +1,55 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "Place Rank": 1,
+                "Fighter Name": "liukang",
                 "Fighting Style": "tiger",
-                "Fighter Name": "liukang"
+                "Place Rank": 1
             },
             {
-                "Place Rank": 10,
+                "Fighter Name": "liukang",
                 "Fighting Style": "crane",
-                "Fighter Name": "liukang"
+                "Place Rank": 10
             },
             {
-                "Place Rank": 3,
+                "Fighter Name": "liukang",
                 "Fighting Style": "shaolin",
-                "Fighter Name": "liukang"
+                "Place Rank": 3
             },
             {
-                "Place Rank": 6,
+                "Fighter Name": "johnnycage",
                 "Fighting Style": "tiger",
-                "Fighter Name": "johnnycage"
+                "Place Rank": 6
             },
             {
-                "Place Rank": 5,
+                "Fighter Name": "johnnycage",
                 "Fighting Style": "crane",
-                "Fighter Name": "johnnycage"
+                "Place Rank": 5
             },
             {
-                "Place Rank": 4,
+                "Fighter Name": "johnnycage",
                 "Fighting Style": "shaolin",
-                "Fighter Name": "johnnycage"
+                "Place Rank": 4
             },
             {
-                "Place Rank": 8,
+                "Fighter Name": "raided",
                 "Fighting Style": "tiger",
-                "Fighter Name": "raided"
+                "Place Rank": 8
             },
             {
-                "Place Rank": 12,
+                "Fighter Name": "raiden",
                 "Fighting Style": "crane",
-                "Fighter Name": "raiden"
+                "Place Rank": 12
             },
             {
-                "Place Rank": 2,
+                "Fighter Name": "raiden",
                 "Fighting Style": "shaolin",
-                "Fighter Name": "raiden"
+                "Place Rank": 2
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "An example showing how to use argmin in tooltips with fields with spaces",
     "encoding": {
         "tooltip": [
             {
@@ -57,21 +57,21 @@
                 "type": "nominal"
             },
             {
-                "field": "Place Rank",
                 "aggregate": "min",
+                "field": "Place Rank",
                 "type": "quantitative"
             },
             {
-                "field": "Fighting Style",
                 "aggregate": {
                     "argmin": "Place Rank"
                 },
+                "field": "Fighting Style",
                 "type": "nominal"
             }
         ],
         "x": {
-            "field": "Place Rank",
             "aggregate": "min",
+            "field": "Place Rank",
             "type": "quantitative"
         },
         "y": {
@@ -79,5 +79,5 @@
             "type": "nominal"
         }
     },
-    "description": "An example showing how to use argmin in tooltips with fields with spaces"
+    "mark": "point"
 }
diff --git a/tests/specs/data/bin1.vl b/tests/specs/data/bin1.vl
--- a/tests/specs/data/bin1.vl
+++ b/tests/specs/data/bin1.vl
@@ -1,65 +1,65 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
+                "bin_end": 10,
                 "bin_start": 8,
-                "count": 7,
-                "bin_end": 10
+                "count": 7
             },
             {
+                "bin_end": 12,
                 "bin_start": 10,
-                "count": 29,
-                "bin_end": 12
+                "count": 29
             },
             {
+                "bin_end": 14,
                 "bin_start": 12,
-                "count": 71,
-                "bin_end": 14
+                "count": 71
             },
             {
+                "bin_end": 16,
                 "bin_start": 14,
-                "count": 127,
-                "bin_end": 16
+                "count": 127
             },
             {
+                "bin_end": 18,
                 "bin_start": 16,
-                "count": 94,
-                "bin_end": 18
+                "count": 94
             },
             {
+                "bin_end": 20,
                 "bin_start": 18,
-                "count": 54,
-                "bin_end": 20
+                "count": 54
             },
             {
+                "bin_end": 22,
                 "bin_start": 20,
-                "count": 17,
-                "bin_end": 22
+                "count": 17
             },
             {
+                "bin_end": 24,
                 "bin_start": 22,
-                "count": 5,
-                "bin_end": 24
+                "count": 5
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
-        "x2": {
-            "field": "bin_end"
-        },
         "x": {
-            "field": "bin_start",
-            "bin": "binned",
-            "type": "quantitative",
             "axis": {
                 "tickMinStep": 2
-            }
+            },
+            "bin": "binned",
+            "field": "bin_start",
+            "type": "quantitative"
         },
+        "x2": {
+            "field": "bin_end"
+        },
         "y": {
             "field": "count",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/bin2.vl b/tests/specs/data/bin2.vl
--- a/tests/specs/data/bin2.vl
+++ b/tests/specs/data/bin2.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -94,17 +94,17 @@
             }
         ]
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "x",
             "bin": true,
+            "field": "x",
             "type": "quantitative"
         },
         "y": {
             "aggregate": "count",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "width": 300
 }
diff --git a/tests/specs/data/bin3.vl b/tests/specs/data/bin3.vl
--- a/tests/specs/data/bin3.vl
+++ b/tests/specs/data/bin3.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -217,19 +217,19 @@
             }
         ]
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "x",
             "bin": {
                 "anchor": 0.5
             },
+            "field": "x",
             "type": "quantitative"
         },
         "y": {
             "aggregate": "count",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "width": 300
 }
diff --git a/tests/specs/data/data1.vl b/tests/specs/data/data1.vl
--- a/tests/specs/data/data1.vl
+++ b/tests/specs/data/data1.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -16,7 +16,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -26,5 +25,6 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/data10.vl b/tests/specs/data/data10.vl
--- a/tests/specs/data/data10.vl
+++ b/tests/specs/data/data10.vl
@@ -1,19 +1,8 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "name": "myData3"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "encoding": {
-        "x": {
-            "field": "cat",
-            "type": "nominal"
-        },
-        "y": {
-            "field": "val",
-            "type": "quantitative"
-        }
-    },
     "datasets": {
         "myData1": [
             {
@@ -57,5 +46,16 @@
                 "val": 12
             }
         ]
-    }
+    },
+    "encoding": {
+        "x": {
+            "field": "cat",
+            "type": "nominal"
+        },
+        "y": {
+            "field": "val",
+            "type": "quantitative"
+        }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/data2.vl b/tests/specs/data/data2.vl
--- a/tests/specs/data/data2.vl
+++ b/tests/specs/data/data2.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -16,7 +16,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -26,5 +25,6 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/data3.vl b/tests/specs/data/data3.vl
--- a/tests/specs/data/data3.vl
+++ b/tests/specs/data/data3.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -16,7 +16,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -26,5 +25,6 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/data4.vl b/tests/specs/data/data4.vl
--- a/tests/specs/data/data4.vl
+++ b/tests/specs/data/data4.vl
@@ -1,9 +1,8 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "data/dataTest.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -13,5 +12,6 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/data5.vl b/tests/specs/data/data5.vl
--- a/tests/specs/data/data5.vl
+++ b/tests/specs/data/data5.vl
@@ -1,9 +1,8 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "data/dataTest.tsv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -13,5 +12,6 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/data6.vl b/tests/specs/data/data6.vl
--- a/tests/specs/data/data6.vl
+++ b/tests/specs/data/data6.vl
@@ -1,13 +1,12 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
-        "url": "data/dataTest.csv",
         "format": {
-            "type": "dsv",
-            "delimiter": ","
-        }
+            "delimiter": ",",
+            "type": "dsv"
+        },
+        "url": "data/dataTest.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -17,5 +16,6 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/data7.vl b/tests/specs/data/data7.vl
--- a/tests/specs/data/data7.vl
+++ b/tests/specs/data/data7.vl
@@ -1,9 +1,8 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "data/dataTest.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -13,5 +12,6 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/data8.vl b/tests/specs/data/data8.vl
--- a/tests/specs/data/data8.vl
+++ b/tests/specs/data/data8.vl
@@ -1,19 +1,8 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "name": "myData1"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "encoding": {
-        "x": {
-            "field": "cat",
-            "type": "nominal"
-        },
-        "y": {
-            "field": "val",
-            "type": "quantitative"
-        }
-    },
     "datasets": {
         "myData1": [
             {
@@ -57,5 +46,16 @@
                 "val": 12
             }
         ]
-    }
+    },
+    "encoding": {
+        "x": {
+            "field": "cat",
+            "type": "nominal"
+        },
+        "y": {
+            "field": "val",
+            "type": "quantitative"
+        }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/data9.vl b/tests/specs/data/data9.vl
--- a/tests/specs/data/data9.vl
+++ b/tests/specs/data/data9.vl
@@ -1,19 +1,8 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "name": "myData2"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "encoding": {
-        "x": {
-            "field": "cat",
-            "type": "nominal"
-        },
-        "y": {
-            "field": "val",
-            "type": "quantitative"
-        }
-    },
     "datasets": {
         "myData1": [
             {
@@ -57,5 +46,16 @@
                 "val": 12
             }
         ]
-    }
+    },
+    "encoding": {
+        "x": {
+            "field": "cat",
+            "type": "nominal"
+        },
+        "y": {
+            "field": "val",
+            "type": "quantitative"
+        }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/domain1.vl b/tests/specs/data/domain1.vl
--- a/tests/specs/data/domain1.vl
+++ b/tests/specs/data/domain1.vl
@@ -1,8 +1,5 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -23,7 +20,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "x",
@@ -36,5 +32,9 @@
             },
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/data/domain2.vl b/tests/specs/data/domain2.vl
--- a/tests/specs/data/domain2.vl
+++ b/tests/specs/data/domain2.vl
@@ -1,8 +1,5 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -23,7 +20,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "x",
@@ -40,5 +36,9 @@
             },
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/data/domain3.vl b/tests/specs/data/domain3.vl
--- a/tests/specs/data/domain3.vl
+++ b/tests/specs/data/domain3.vl
@@ -1,8 +1,5 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -23,7 +20,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "x",
@@ -42,5 +38,9 @@
             },
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/data/filter1.vl b/tests/specs/data/filter1.vl
--- a/tests/specs/data/filter1.vl
+++ b/tests/specs/data/filter1.vl
@@ -1,10 +1,5 @@
 {
-    "transform": [
-        {
-            "filter": "datum.a == 'A' || datum.a == 'C' || datum.a == 'E'"
-        }
-    ],
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -45,7 +40,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "a",
@@ -55,5 +49,11 @@
             "field": "b",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.a == 'A' || datum.a == 'C' || datum.a == 'E'"
+        }
+    ]
 }
diff --git a/tests/specs/data/filter2.vl b/tests/specs/data/filter2.vl
--- a/tests/specs/data/filter2.vl
+++ b/tests/specs/data/filter2.vl
@@ -1,29 +1,5 @@
 {
-    "transform": [
-        {
-            "filter": {
-                "or": [
-                    {
-                        "or": [
-                            {
-                                "equal": "A",
-                                "field": "a"
-                            },
-                            {
-                                "equal": "C",
-                                "field": "a"
-                            }
-                        ]
-                    },
-                    {
-                        "equal": "E",
-                        "field": "a"
-                    }
-                ]
-            }
-        }
-    ],
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -64,7 +40,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "a",
@@ -74,5 +49,30 @@
             "field": "b",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": {
+                "or": [
+                    {
+                        "or": [
+                            {
+                                "equal": "A",
+                                "field": "a"
+                            },
+                            {
+                                "equal": "C",
+                                "field": "a"
+                            }
+                        ]
+                    },
+                    {
+                        "equal": "E",
+                        "field": "a"
+                    }
+                ]
+            }
+        }
+    ]
 }
diff --git a/tests/specs/data/flatten1.vl b/tests/specs/data/flatten1.vl
--- a/tests/specs/data/flatten1.vl
+++ b/tests/specs/data/flatten1.vl
@@ -1,45 +1,32 @@
 {
-    "transform": [
-        {
-            "as": [
-                "quant",
-                "cat"
-            ],
-            "flatten": [
-                "foo",
-                "bar"
-            ]
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
+                "bar": [
+                    "A",
+                    "B"
+                ],
                 "foo": [
                     1,
                     2
                 ],
-                "key": "alpha",
-                "bar": [
-                    "A",
-                    "B"
-                ]
+                "key": "alpha"
             },
             {
+                "bar": [
+                    "C",
+                    "D"
+                ],
                 "foo": [
                     3,
                     4,
                     5
                 ],
-                "key": "beta",
-                "bar": [
-                    "C",
-                    "D"
-                ]
+                "key": "beta"
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "key",
@@ -53,5 +40,18 @@
             "field": "cat",
             "type": "nominal"
         }
-    }
+    },
+    "mark": "circle",
+    "transform": [
+        {
+            "as": [
+                "quant",
+                "cat"
+            ],
+            "flatten": [
+                "foo",
+                "bar"
+            ]
+        }
+    ]
 }
diff --git a/tests/specs/data/fold1.vl b/tests/specs/data/fold1.vl
--- a/tests/specs/data/fold1.vl
+++ b/tests/specs/data/fold1.vl
@@ -1,48 +1,48 @@
 {
-    "transform": [
-        {
-            "as": [
-                "k",
-                "v"
-            ],
-            "fold": [
-                "gold",
-                "silver"
-            ]
-        }
-    ],
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "silver": 20,
                 "country": "USA",
-                "gold": 10
+                "gold": 10,
+                "silver": 20
             },
             {
-                "silver": 26,
                 "country": "Canada",
-                "gold": 7
+                "gold": 7,
+                "silver": 26
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "country",
             "type": "nominal"
         },
-        "x": {
-            "field": "country",
-            "type": "nominal"
-        },
         "column": {
             "field": "k",
             "type": "nominal"
         },
+        "x": {
+            "field": "country",
+            "type": "nominal"
+        },
         "y": {
             "field": "v",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "as": [
+                "k",
+                "v"
+            ],
+            "fold": [
+                "gold",
+                "silver"
+            ]
+        }
+    ]
 }
diff --git a/tests/specs/data/geodata1.vl b/tests/specs/data/geodata1.vl
--- a/tests/specs/data/geodata1.vl
+++ b/tests/specs/data/geodata1.vl
@@ -1,24 +1,24 @@
 {
-    "height": 500,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "mark": "geoshape",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/londonBoroughs.json",
         "format": {
             "feature": "boroughs",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/londonBoroughs.json"
     },
-    "width": 700,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "id",
             "type": "nominal"
         }
-    }
+    },
+    "height": 500,
+    "mark": "geoshape",
+    "width": 700
 }
diff --git a/tests/specs/data/geodata2.vl b/tests/specs/data/geodata2.vl
--- a/tests/specs/data/geodata2.vl
+++ b/tests/specs/data/geodata2.vl
@@ -1,12 +1,15 @@
 {
-    "height": 400,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "mark": "geoshape",
     "data": {
+        "format": {
+            "property": "features",
+            "type": "json"
+        },
         "values": {
             "features": [
                 {
@@ -37,10 +40,10 @@
                         ],
                         "type": "Polygon"
                     },
-                    "type": "Feature",
                     "properties": {
                         "Region": "Southsville"
-                    }
+                    },
+                    "type": "Feature"
                 },
                 {
                     "geometry": {
@@ -70,31 +73,28 @@
                         ],
                         "type": "Polygon"
                     },
-                    "type": "Feature",
                     "properties": {
                         "Region": "Northerton"
-                    }
+                    },
+                    "type": "Feature"
                 }
             ],
             "type": "FeatureCollection"
-        },
-        "format": {
-            "property": "features",
-            "type": "json"
         }
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "orthographic"
-    },
     "encoding": {
         "color": {
             "field": "properties.Region",
-            "type": "nominal",
             "legend": {
                 "title": null
-            }
+            },
+            "type": "nominal"
         }
-    }
+    },
+    "height": 400,
+    "mark": "geoshape",
+    "projection": {
+        "type": "orthographic"
+    },
+    "width": 300
 }
diff --git a/tests/specs/data/impute1.vl b/tests/specs/data/impute1.vl
--- a/tests/specs/data/impute1.vl
+++ b/tests/specs/data/impute1.vl
@@ -1,15 +1,5 @@
 {
-    "transform": [
-        {
-            "groupby": [
-                "c"
-            ],
-            "value": 0,
-            "key": "a",
-            "impute": "b"
-        }
-    ],
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -49,7 +39,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "c",
@@ -66,5 +55,16 @@
             "field": "b",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line",
+    "transform": [
+        {
+            "groupby": [
+                "c"
+            ],
+            "impute": "b",
+            "key": "a",
+            "value": 0
+        }
+    ]
 }
diff --git a/tests/specs/data/impute2.vl b/tests/specs/data/impute2.vl
--- a/tests/specs/data/impute2.vl
+++ b/tests/specs/data/impute2.vl
@@ -1,19 +1,5 @@
 {
-    "transform": [
-        {
-            "groupby": [
-                "c"
-            ],
-            "key": "a",
-            "method": "mean",
-            "frame": [
-                -2,
-                2
-            ],
-            "impute": "b"
-        }
-    ],
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -53,7 +39,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "c",
@@ -70,5 +55,20 @@
             "field": "b",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line",
+    "transform": [
+        {
+            "frame": [
+                -2,
+                2
+            ],
+            "groupby": [
+                "c"
+            ],
+            "impute": "b",
+            "key": "a",
+            "method": "mean"
+        }
+    ]
 }
diff --git a/tests/specs/data/impute3.vl b/tests/specs/data/impute3.vl
--- a/tests/specs/data/impute3.vl
+++ b/tests/specs/data/impute3.vl
@@ -1,20 +1,5 @@
 {
-    "transform": [
-        {
-            "groupby": [
-                "c"
-            ],
-            "keyvals": {
-                "start": 1,
-                "step": 1,
-                "stop": 4
-            },
-            "value": 100,
-            "key": "a",
-            "impute": "b"
-        }
-    ],
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -54,7 +39,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "c",
@@ -71,5 +55,21 @@
             "field": "b",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line",
+    "transform": [
+        {
+            "groupby": [
+                "c"
+            ],
+            "impute": "b",
+            "key": "a",
+            "keyvals": {
+                "start": 1,
+                "step": 1,
+                "stop": 4
+            },
+            "value": 100
+        }
+    ]
 }
diff --git a/tests/specs/data/impute4.vl b/tests/specs/data/impute4.vl
--- a/tests/specs/data/impute4.vl
+++ b/tests/specs/data/impute4.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -39,7 +39,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "c",
@@ -59,5 +58,6 @@
             },
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line"
 }
diff --git a/tests/specs/data/impute5.vl b/tests/specs/data/impute5.vl
--- a/tests/specs/data/impute5.vl
+++ b/tests/specs/data/impute5.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -39,7 +39,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "c",
@@ -59,5 +58,6 @@
             },
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line"
 }
diff --git a/tests/specs/data/impute6.vl b/tests/specs/data/impute6.vl
--- a/tests/specs/data/impute6.vl
+++ b/tests/specs/data/impute6.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -39,7 +39,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "c",
@@ -55,13 +54,14 @@
         "y": {
             "field": "b",
             "impute": {
-                "method": "mean",
                 "frame": [
                     -2,
                     2
-                ]
+                ],
+                "method": "mean"
             },
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line"
 }
diff --git a/tests/specs/data/impute7.vl b/tests/specs/data/impute7.vl
--- a/tests/specs/data/impute7.vl
+++ b/tests/specs/data/impute7.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -39,7 +39,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "c",
@@ -62,5 +61,6 @@
             },
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line"
 }
diff --git a/tests/specs/data/impute8.vl b/tests/specs/data/impute8.vl
--- a/tests/specs/data/impute8.vl
+++ b/tests/specs/data/impute8.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -39,7 +39,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "c",
@@ -64,5 +63,6 @@
             },
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line"
 }
diff --git a/tests/specs/data/namedData1.vl b/tests/specs/data/namedData1.vl
--- a/tests/specs/data/namedData1.vl
+++ b/tests/specs/data/namedData1.vl
@@ -1,6 +1,7 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
+        "name": "source",
         "values": [
             {
                 "a": "A",
@@ -38,10 +39,8 @@
                 "a": "I",
                 "b": 52
             }
-        ],
-        "name": "source"
+        ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "a",
@@ -51,5 +50,6 @@
             "field": "b",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/namedData2.vl b/tests/specs/data/namedData2.vl
--- a/tests/specs/data/namedData2.vl
+++ b/tests/specs/data/namedData2.vl
@@ -1,10 +1,9 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
-        "url": "data/dataTest.tsv",
-        "name": "myName"
+        "name": "myName",
+        "url": "data/dataTest.tsv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -14,5 +13,6 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/namedData3.vl b/tests/specs/data/namedData3.vl
--- a/tests/specs/data/namedData3.vl
+++ b/tests/specs/data/namedData3.vl
@@ -1,10 +1,9 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
-        "values": [],
-        "name": "source"
+        "name": "source",
+        "values": []
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -14,5 +13,6 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/data/null1.vl b/tests/specs/data/null1.vl
--- a/tests/specs/data/null1.vl
+++ b/tests/specs/data/null1.vl
@@ -1,8 +1,5 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -35,7 +32,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "x",
@@ -45,5 +41,9 @@
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "point": true,
+        "type": "line"
     }
 }
diff --git a/tests/specs/data/pivot1.vl b/tests/specs/data/pivot1.vl
--- a/tests/specs/data/pivot1.vl
+++ b/tests/specs/data/pivot1.vl
@@ -1,39 +1,30 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "repeat": [
         "gold",
         "silver"
     ],
     "spec": {
-        "transform": [
-            {
-                "groupby": [
-                    "country"
-                ],
-                "value": "count",
-                "pivot": "medalType"
-            }
-        ],
-        "mark": "bar",
         "data": {
             "values": [
                 {
-                    "country": "USA",
                     "count": 10,
+                    "country": "USA",
                     "medalType": "gold"
                 },
                 {
-                    "country": "USA",
                     "count": 20,
+                    "country": "USA",
                     "medalType": "silver"
                 },
                 {
-                    "country": "Canada",
                     "count": 7,
+                    "country": "Canada",
                     "medalType": "gold"
                 },
                 {
-                    "country": "Canada",
                     "count": 26,
+                    "country": "Canada",
                     "medalType": "silver"
                 }
             ]
@@ -53,7 +44,16 @@
                 },
                 "type": "quantitative"
             }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+        },
+        "mark": "bar",
+        "transform": [
+            {
+                "groupby": [
+                    "country"
+                ],
+                "pivot": "medalType",
+                "value": "count"
+            }
+        ]
+    }
 }
diff --git a/tests/specs/data/pivotDocs.vl b/tests/specs/data/pivotDocs.vl
--- a/tests/specs/data/pivotDocs.vl
+++ b/tests/specs/data/pivotDocs.vl
@@ -1,49 +1,39 @@
 {
-    "transform": [
-        {
-            "groupby": [
-                "city"
-            ],
-            "value": "temperature",
-            "pivot": "year"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
+                "city": "Bristol",
                 "temperature": 12,
-                "year": 2017,
-                "city": "Bristol"
+                "year": 2017
             },
             {
+                "city": "Bristol",
                 "temperature": 14,
-                "year": 2018,
-                "city": "Bristol"
+                "year": 2018
             },
             {
+                "city": "Sheffield",
                 "temperature": 11,
-                "year": 2017,
-                "city": "Sheffield"
+                "year": 2017
             },
             {
+                "city": "Sheffield",
                 "temperature": 13,
-                "year": 2018,
-                "city": "Sheffield"
+                "year": 2018
             },
             {
+                "city": "Glasgow",
                 "temperature": 7,
-                "year": 2017,
-                "city": "Glasgow"
+                "year": 2017
             },
             {
+                "city": "Glasgow",
                 "temperature": 10,
-                "year": 2018,
-                "city": "Glasgow"
+                "year": 2018
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "2017",
@@ -53,5 +43,15 @@
             "field": "city",
             "type": "nominal"
         }
-    }
+    },
+    "mark": "circle",
+    "transform": [
+        {
+            "groupby": [
+                "city"
+            ],
+            "pivot": "year",
+            "value": "temperature"
+        }
+    ]
 }
diff --git a/tests/specs/data/sample1.vl b/tests/specs/data/sample1.vl
--- a/tests/specs/data/sample1.vl
+++ b/tests/specs/data/sample1.vl
@@ -1,7 +1,10 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/cars.json"
+    },
     "hconcat": [
         {
-            "mark": "point",
             "encoding": {
                 "x": {
                     "field": "Horsepower",
@@ -11,15 +14,10 @@
                     "field": "Miles_per_Gallon",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "point"
         },
         {
-            "transform": [
-                {
-                    "sample": 200
-                }
-            ],
-            "mark": "point",
             "encoding": {
                 "x": {
                     "field": "Horsepower",
@@ -29,11 +27,13 @@
                     "field": "Miles_per_Gallon",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "point",
+            "transform": [
+                {
+                    "sample": 200
+                }
+            ]
         }
-    ],
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/cars.json"
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    ]
 }
diff --git a/tests/specs/data/sequence1.vl b/tests/specs/data/sequence1.vl
--- a/tests/specs/data/sequence1.vl
+++ b/tests/specs/data/sequence1.vl
@@ -1,11 +1,5 @@
 {
-    "transform": [
-        {
-            "as": "v",
-            "calculate": "sin(datum.data)"
-        }
-    ],
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "sequence": {
             "start": 0,
@@ -13,7 +7,6 @@
             "stop": 12.7
         }
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "data",
@@ -23,5 +16,12 @@
             "field": "v",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line",
+    "transform": [
+        {
+            "as": "v",
+            "calculate": "sin(datum.data)"
+        }
+    ]
 }
diff --git a/tests/specs/data/sequence2.vl b/tests/specs/data/sequence2.vl
--- a/tests/specs/data/sequence2.vl
+++ b/tests/specs/data/sequence2.vl
@@ -1,11 +1,5 @@
 {
-    "transform": [
-        {
-            "as": "v",
-            "calculate": "sin(datum.u)"
-        }
-    ],
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "sequence": {
             "as": "u",
@@ -14,7 +8,6 @@
             "stop": 12.7
         }
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "u",
@@ -24,5 +17,12 @@
             "field": "v",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line",
+    "transform": [
+        {
+            "as": "v",
+            "calculate": "sin(datum.u)"
+        }
+    ]
 }
diff --git a/tests/specs/fillstroke/combined1.vl b/tests/specs/fillstroke/combined1.vl
--- a/tests/specs/fillstroke/combined1.vl
+++ b/tests/specs/fillstroke/combined1.vl
@@ -1,49 +1,43 @@
 {
-    "height": 200,
-    "mark": {
-        "stroke": "black",
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 36,
                 "val": 4,
+                "x": 36,
                 "y": 4
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "cat",
             "type": "nominal"
         },
+        "fill": {},
         "size": {
             "value": 2000
         },
         "stroke": {},
-        "fill": {},
         "x": {
             "field": "x",
             "type": "quantitative"
@@ -52,5 +46,11 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "stroke": "black",
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/combined2.vl b/tests/specs/fillstroke/combined2.vl
--- a/tests/specs/fillstroke/combined2.vl
+++ b/tests/specs/fillstroke/combined2.vl
@@ -1,44 +1,41 @@
 {
-    "height": 200,
-    "mark": {
-        "stroke": "black",
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 36,
                 "val": 4,
+                "x": 36,
                 "y": 4
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "cat",
             "type": "nominal"
         },
+        "fill": {
+            "value": "red"
+        },
         "size": {
             "value": 2000
         },
@@ -46,9 +43,6 @@
             "field": "y",
             "type": "ordinal"
         },
-        "fill": {
-            "value": "red"
-        },
         "x": {
             "field": "x",
             "type": "quantitative"
@@ -57,5 +51,11 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "stroke": "black",
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/combined3.vl b/tests/specs/fillstroke/combined3.vl
--- a/tests/specs/fillstroke/combined3.vl
+++ b/tests/specs/fillstroke/combined3.vl
@@ -1,54 +1,48 @@
 {
-    "height": 200,
-    "mark": {
-        "stroke": "black",
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 36,
                 "val": 4,
+                "x": 36,
                 "y": 4
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "cat",
             "type": "nominal"
         },
+        "fill": {
+            "field": "y",
+            "type": "ordinal"
+        },
         "size": {
             "value": 2000
         },
         "stroke": {
             "value": "red"
         },
-        "fill": {
-            "field": "y",
-            "type": "ordinal"
-        },
         "x": {
             "field": "x",
             "type": "quantitative"
@@ -57,5 +51,11 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "stroke": "black",
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/default.vl b/tests/specs/fillstroke/default.vl
--- a/tests/specs/fillstroke/default.vl
+++ b/tests/specs/fillstroke/default.vl
@@ -1,39 +1,33 @@
 {
-    "height": 200,
-    "mark": {
-        "stroke": "black",
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 36,
                 "val": 4,
+                "x": 36,
                 "y": 4
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "cat",
@@ -50,5 +44,11 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "stroke": "black",
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/fill1.vl b/tests/specs/fillstroke/fill1.vl
--- a/tests/specs/fillstroke/fill1.vl
+++ b/tests/specs/fillstroke/fill1.vl
@@ -1,48 +1,42 @@
 {
-    "height": 200,
-    "mark": {
-        "stroke": "black",
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 36,
                 "val": 4,
+                "x": 36,
                 "y": 4
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "cat",
             "type": "nominal"
         },
+        "fill": {},
         "size": {
             "value": 2000
         },
-        "fill": {},
         "x": {
             "field": "x",
             "type": "quantitative"
@@ -51,5 +45,11 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "stroke": "black",
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/fill2.vl b/tests/specs/fillstroke/fill2.vl
--- a/tests/specs/fillstroke/fill2.vl
+++ b/tests/specs/fillstroke/fill2.vl
@@ -1,51 +1,45 @@
 {
-    "height": 200,
-    "mark": {
-        "stroke": "black",
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 36,
                 "val": 4,
+                "x": 36,
                 "y": 4
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "cat",
             "type": "nominal"
         },
-        "size": {
-            "value": 2000
-        },
         "fill": {
             "field": "y",
             "type": "ordinal"
         },
+        "size": {
+            "value": 2000
+        },
         "x": {
             "field": "x",
             "type": "quantitative"
@@ -54,5 +48,11 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "stroke": "black",
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/fill3.vl b/tests/specs/fillstroke/fill3.vl
--- a/tests/specs/fillstroke/fill3.vl
+++ b/tests/specs/fillstroke/fill3.vl
@@ -1,50 +1,44 @@
 {
-    "height": 200,
-    "mark": {
-        "stroke": "black",
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 36,
                 "val": 4,
+                "x": 36,
                 "y": 4
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "cat",
             "type": "nominal"
         },
-        "size": {
-            "value": 2000
-        },
         "fill": {
             "value": "red"
         },
+        "size": {
+            "value": 2000
+        },
         "x": {
             "field": "x",
             "type": "quantitative"
@@ -53,5 +47,11 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "stroke": "black",
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/fillopacity.vl b/tests/specs/fillstroke/fillopacity.vl
--- a/tests/specs/fillstroke/fillopacity.vl
+++ b/tests/specs/fillstroke/fillopacity.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -12,22 +12,22 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
-        "x": {
-            "field": "a",
-            "type": "ordinal",
-            "axis": {
-                "labelAngle": 0
-            }
-        },
         "fillOpacity": {
             "field": "b",
             "type": "quantitative"
         },
+        "x": {
+            "axis": {
+                "labelAngle": 0
+            },
+            "field": "a",
+            "type": "ordinal"
+        },
         "y": {
             "field": "b",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/fillstroke/geo1.vl b/tests/specs/fillstroke/geo1.vl
--- a/tests/specs/fillstroke/geo1.vl
+++ b/tests/specs/fillstroke/geo1.vl
@@ -1,6 +1,5 @@
 {
-    "height": 300,
-    "mark": "geoshape",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": {
             "features": [
@@ -58,6 +57,7 @@
             "type": "FeatureCollection"
         }
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    "height": 300,
+    "mark": "geoshape",
+    "width": 300
 }
diff --git a/tests/specs/fillstroke/geo2.vl b/tests/specs/fillstroke/geo2.vl
--- a/tests/specs/fillstroke/geo2.vl
+++ b/tests/specs/fillstroke/geo2.vl
@@ -1,6 +1,5 @@
 {
-    "height": 300,
-    "mark": "geoshape",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": {
             "features": [
@@ -58,12 +57,13 @@
             "type": "FeatureCollection"
         }
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "features.geometry.type",
             "type": "nominal"
         }
-    }
+    },
+    "height": 300,
+    "mark": "geoshape",
+    "width": 300
 }
diff --git a/tests/specs/fillstroke/gradient1.vl b/tests/specs/fillstroke/gradient1.vl
--- a/tests/specs/fillstroke/gradient1.vl
+++ b/tests/specs/fillstroke/gradient1.vl
@@ -1,50 +1,25 @@
 {
-    "mark": {
-        "color": {
-            "x2": 1,
-            "y1": 0,
-            "stops": [
-                {
-                    "color": "red",
-                    "offset": 0
-                },
-                {
-                    "color": "orange",
-                    "offset": 0.4
-                },
-                {
-                    "color": "blue",
-                    "offset": 1
-                }
-            ],
-            "gradient": "linear",
-            "y2": 1,
-            "x1": 1
-        },
-        "type": "bar"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "value": 10,
-                "cat": "a"
+                "cat": "a",
+                "value": 10
             },
             {
-                "value": 5,
-                "cat": "b"
+                "cat": "b",
+                "value": 5
             },
             {
-                "value": 20,
-                "cat": "c"
+                "cat": "c",
+                "value": 20
             },
             {
-                "value": 8,
-                "cat": "d"
+                "cat": "d",
+                "value": 8
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -54,5 +29,30 @@
             "field": "value",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "color": {
+            "gradient": "linear",
+            "stops": [
+                {
+                    "color": "red",
+                    "offset": 0
+                },
+                {
+                    "color": "orange",
+                    "offset": 0.4
+                },
+                {
+                    "color": "blue",
+                    "offset": 1
+                }
+            ],
+            "x1": 1,
+            "x2": 1,
+            "y1": 0,
+            "y2": 1
+        },
+        "type": "bar"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/gradient2.vl b/tests/specs/fillstroke/gradient2.vl
--- a/tests/specs/fillstroke/gradient2.vl
+++ b/tests/specs/fillstroke/gradient2.vl
@@ -1,46 +1,25 @@
 {
-    "mark": {
-        "color": {
-            "x2": 1,
-            "y1": 1,
-            "stops": [
-                {
-                    "color": "red",
-                    "offset": 0
-                },
-                {
-                    "color": "blue",
-                    "offset": 1
-                }
-            ],
-            "gradient": "linear",
-            "y2": 1,
-            "x1": 0
-        },
-        "type": "bar"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "value": 10,
-                "cat": "a"
+                "cat": "a",
+                "value": 10
             },
             {
-                "value": 5,
-                "cat": "b"
+                "cat": "b",
+                "value": 5
             },
             {
-                "value": 20,
-                "cat": "c"
+                "cat": "c",
+                "value": 20
             },
             {
-                "value": 8,
-                "cat": "d"
+                "cat": "d",
+                "value": 8
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -50,5 +29,26 @@
             "field": "value",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "color": {
+            "gradient": "linear",
+            "stops": [
+                {
+                    "color": "red",
+                    "offset": 0
+                },
+                {
+                    "color": "blue",
+                    "offset": 1
+                }
+            ],
+            "x1": 0,
+            "x2": 1,
+            "y1": 1,
+            "y2": 1
+        },
+        "type": "bar"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/gradient3.vl b/tests/specs/fillstroke/gradient3.vl
--- a/tests/specs/fillstroke/gradient3.vl
+++ b/tests/specs/fillstroke/gradient3.vl
@@ -1,46 +1,25 @@
 {
-    "mark": {
-        "color": {
-            "x2": 1,
-            "y1": 0,
-            "stops": [
-                {
-                    "color": "blue",
-                    "offset": 0
-                },
-                {
-                    "color": "red",
-                    "offset": 1
-                }
-            ],
-            "gradient": "linear",
-            "y2": 1,
-            "x1": 0
-        },
-        "type": "bar"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "value": 10,
-                "cat": "a"
+                "cat": "a",
+                "value": 10
             },
             {
-                "value": 5,
-                "cat": "b"
+                "cat": "b",
+                "value": 5
             },
             {
-                "value": 20,
-                "cat": "c"
+                "cat": "c",
+                "value": 20
             },
             {
-                "value": 8,
-                "cat": "d"
+                "cat": "d",
+                "value": 8
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -50,5 +29,26 @@
             "field": "value",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "color": {
+            "gradient": "linear",
+            "stops": [
+                {
+                    "color": "blue",
+                    "offset": 0
+                },
+                {
+                    "color": "red",
+                    "offset": 1
+                }
+            ],
+            "x1": 0,
+            "x2": 1,
+            "y1": 0,
+            "y2": 1
+        },
+        "type": "bar"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/gradientr1.vl b/tests/specs/fillstroke/gradientr1.vl
--- a/tests/specs/fillstroke/gradientr1.vl
+++ b/tests/specs/fillstroke/gradientr1.vl
@@ -1,47 +1,25 @@
 {
-    "mark": {
-        "color": {
-            "stops": [
-                {
-                    "color": "red",
-                    "offset": 0
-                },
-                {
-                    "color": "white",
-                    "offset": 0.5
-                },
-                {
-                    "color": "blue",
-                    "offset": 1
-                }
-            ],
-            "gradient": "radial"
-        },
-        "size": 1000,
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "value": 10,
-                "cat": "a"
+                "cat": "a",
+                "value": 10
             },
             {
-                "value": 5,
-                "cat": "b"
+                "cat": "b",
+                "value": 5
             },
             {
-                "value": 20,
-                "cat": "c"
+                "cat": "c",
+                "value": 20
             },
             {
-                "value": 8,
-                "cat": "d"
+                "cat": "d",
+                "value": 8
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -51,5 +29,27 @@
             "field": "value",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "color": {
+            "gradient": "radial",
+            "stops": [
+                {
+                    "color": "red",
+                    "offset": 0
+                },
+                {
+                    "color": "white",
+                    "offset": 0.5
+                },
+                {
+                    "color": "blue",
+                    "offset": 1
+                }
+            ]
+        },
+        "size": 1000,
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/gradientr2.vl b/tests/specs/fillstroke/gradientr2.vl
--- a/tests/specs/fillstroke/gradientr2.vl
+++ b/tests/specs/fillstroke/gradientr2.vl
@@ -1,51 +1,25 @@
 {
-    "mark": {
-        "color": {
-            "x2": 0.5,
-            "y1": 0.5,
-            "stops": [
-                {
-                    "color": "red",
-                    "offset": 0
-                },
-                {
-                    "color": "white",
-                    "offset": 0.5
-                },
-                {
-                    "color": "blue",
-                    "offset": 1
-                }
-            ],
-            "gradient": "radial",
-            "y2": 0.5,
-            "x1": 0.5
-        },
-        "size": 1000,
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "value": 10,
-                "cat": "a"
+                "cat": "a",
+                "value": 10
             },
             {
-                "value": 5,
-                "cat": "b"
+                "cat": "b",
+                "value": 5
             },
             {
-                "value": 20,
-                "cat": "c"
+                "cat": "c",
+                "value": 20
             },
             {
-                "value": 8,
-                "cat": "d"
+                "cat": "d",
+                "value": 8
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -55,5 +29,31 @@
             "field": "value",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "color": {
+            "gradient": "radial",
+            "stops": [
+                {
+                    "color": "red",
+                    "offset": 0
+                },
+                {
+                    "color": "white",
+                    "offset": 0.5
+                },
+                {
+                    "color": "blue",
+                    "offset": 1
+                }
+            ],
+            "x1": 0.5,
+            "x2": 0.5,
+            "y1": 0.5,
+            "y2": 0.5
+        },
+        "size": 1000,
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/gradientr3.vl b/tests/specs/fillstroke/gradientr3.vl
--- a/tests/specs/fillstroke/gradientr3.vl
+++ b/tests/specs/fillstroke/gradientr3.vl
@@ -1,53 +1,25 @@
 {
-    "mark": {
-        "color": {
-            "x2": 0.8,
-            "y1": 0.7,
-            "r2": 0.4,
-            "stops": [
-                {
-                    "color": "red",
-                    "offset": 0
-                },
-                {
-                    "color": "white",
-                    "offset": 0.5
-                },
-                {
-                    "color": "blue",
-                    "offset": 1
-                }
-            ],
-            "gradient": "radial",
-            "y2": 0.3,
-            "r1": 0.2,
-            "x1": 0.2
-        },
-        "size": 1000,
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "value": 10,
-                "cat": "a"
+                "cat": "a",
+                "value": 10
             },
             {
-                "value": 5,
-                "cat": "b"
+                "cat": "b",
+                "value": 5
             },
             {
-                "value": 20,
-                "cat": "c"
+                "cat": "c",
+                "value": 20
             },
             {
-                "value": 8,
-                "cat": "d"
+                "cat": "d",
+                "value": 8
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -57,5 +29,33 @@
             "field": "value",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "color": {
+            "gradient": "radial",
+            "r1": 0.2,
+            "r2": 0.4,
+            "stops": [
+                {
+                    "color": "red",
+                    "offset": 0
+                },
+                {
+                    "color": "white",
+                    "offset": 0.5
+                },
+                {
+                    "color": "blue",
+                    "offset": 1
+                }
+            ],
+            "x1": 0.2,
+            "x2": 0.8,
+            "y1": 0.7,
+            "y2": 0.3
+        },
+        "size": 1000,
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/hrounded.vl b/tests/specs/fillstroke/hrounded.vl
--- a/tests/specs/fillstroke/hrounded.vl
+++ b/tests/specs/fillstroke/hrounded.vl
@@ -1,8 +1,5 @@
 {
-    "mark": {
-        "cornerRadiusEnd": 4,
-        "type": "bar"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -43,7 +40,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "b",
@@ -53,5 +49,9 @@
             "field": "a",
             "type": "ordinal"
         }
+    },
+    "mark": {
+        "cornerRadiusEnd": 4,
+        "type": "bar"
     }
 }
diff --git a/tests/specs/fillstroke/stroke1.vl b/tests/specs/fillstroke/stroke1.vl
--- a/tests/specs/fillstroke/stroke1.vl
+++ b/tests/specs/fillstroke/stroke1.vl
@@ -1,39 +1,33 @@
 {
-    "height": 200,
-    "mark": {
-        "stroke": "black",
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 36,
                 "val": 4,
+                "x": 36,
                 "y": 4
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "cat",
@@ -51,5 +45,11 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "stroke": "black",
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/stroke2.vl b/tests/specs/fillstroke/stroke2.vl
--- a/tests/specs/fillstroke/stroke2.vl
+++ b/tests/specs/fillstroke/stroke2.vl
@@ -1,39 +1,33 @@
 {
-    "height": 200,
-    "mark": {
-        "stroke": "black",
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 36,
                 "val": 4,
+                "x": 36,
                 "y": 4
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "cat",
@@ -54,5 +48,11 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "stroke": "black",
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/stroke3.vl b/tests/specs/fillstroke/stroke3.vl
--- a/tests/specs/fillstroke/stroke3.vl
+++ b/tests/specs/fillstroke/stroke3.vl
@@ -1,39 +1,33 @@
 {
-    "height": 200,
-    "mark": {
-        "stroke": "black",
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 36,
                 "val": 4,
+                "x": 36,
                 "y": 4
             }
         ]
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "cat",
@@ -53,5 +47,11 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "stroke": "black",
+        "type": "circle"
+    },
+    "width": 200
 }
diff --git a/tests/specs/fillstroke/strokedash1.vl b/tests/specs/fillstroke/strokedash1.vl
--- a/tests/specs/fillstroke/strokedash1.vl
+++ b/tests/specs/fillstroke/strokedash1.vl
@@ -1,14 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 1,
-        "opacity": 0.6,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "width": 350,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "strokeDash": {
             "field": "symbol",
@@ -22,5 +16,11 @@
             "field": "price",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "opacity": 0.6,
+        "strokeWidth": 1,
+        "type": "line"
+    },
+    "width": 350
 }
diff --git a/tests/specs/fillstroke/strokedash2.vl b/tests/specs/fillstroke/strokedash2.vl
--- a/tests/specs/fillstroke/strokedash2.vl
+++ b/tests/specs/fillstroke/strokedash2.vl
@@ -1,14 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 1,
-        "opacity": 0.6,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "width": 350,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "strokeDash": {
             "field": "symbol",
@@ -53,5 +47,11 @@
             "field": "price",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "opacity": 0.6,
+        "strokeWidth": 1,
+        "type": "line"
+    },
+    "width": 350
 }
diff --git a/tests/specs/fillstroke/strokedash3.vl b/tests/specs/fillstroke/strokedash3.vl
--- a/tests/specs/fillstroke/strokedash3.vl
+++ b/tests/specs/fillstroke/strokedash3.vl
@@ -1,13 +1,54 @@
 {
-    "config": {
-        "line": {
-            "strokeWidth": 1,
-            "color": "orange",
-            "opacity": 0.6
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "concat": [
+        {
+            "encoding": {
+                "strokeDash": {
+                    "field": "cat",
+                    "type": "nominal"
+                },
+                "x": {
+                    "field": "x",
+                    "type": "quantitative"
+                },
+                "y": {
+                    "field": "y",
+                    "type": "quantitative"
+                }
+            },
+            "mark": "line",
+            "title": "Nominal",
+            "width": 200
         },
+        {
+            "encoding": {
+                "strokeDash": {
+                    "field": "cat",
+                    "type": "ordinal"
+                },
+                "x": {
+                    "field": "x",
+                    "type": "quantitative"
+                },
+                "y": {
+                    "field": "y",
+                    "type": "quantitative"
+                }
+            },
+            "mark": "line",
+            "title": "Ordinal",
+            "width": 200
+        }
+    ],
+    "config": {
         "axis": {
             "grid": false,
             "title": null
+        },
+        "line": {
+            "color": "orange",
+            "opacity": 0.6,
+            "strokeWidth": 1
         }
     },
     "data": {
@@ -118,46 +159,5 @@
         "scale": {
             "strokeDash": "independent"
         }
-    },
-    "concat": [
-        {
-            "mark": "line",
-            "width": 200,
-            "title": "Nominal",
-            "encoding": {
-                "strokeDash": {
-                    "field": "cat",
-                    "type": "nominal"
-                },
-                "x": {
-                    "field": "x",
-                    "type": "quantitative"
-                },
-                "y": {
-                    "field": "y",
-                    "type": "quantitative"
-                }
-            }
-        },
-        {
-            "mark": "line",
-            "width": 200,
-            "title": "Ordinal",
-            "encoding": {
-                "strokeDash": {
-                    "field": "cat",
-                    "type": "ordinal"
-                },
-                "x": {
-                    "field": "x",
-                    "type": "quantitative"
-                },
-                "y": {
-                    "field": "y",
-                    "type": "quantitative"
-                }
-            }
-        }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    }
 }
diff --git a/tests/specs/fillstroke/strokedash4.vl b/tests/specs/fillstroke/strokedash4.vl
--- a/tests/specs/fillstroke/strokedash4.vl
+++ b/tests/specs/fillstroke/strokedash4.vl
@@ -1,129 +1,7 @@
 {
-    "config": {
-        "line": {
-            "strokeWidth": 1,
-            "color": "orange",
-            "opacity": 0.6
-        },
-        "axis": {
-            "grid": false,
-            "title": null
-        }
-    },
-    "data": {
-        "values": [
-            {
-                "cat": 1,
-                "x": 0,
-                "y": 100
-            },
-            {
-                "cat": 1,
-                "x": 1,
-                "y": 100
-            },
-            {
-                "cat": 2,
-                "x": 0,
-                "y": 90
-            },
-            {
-                "cat": 2,
-                "x": 1,
-                "y": 90
-            },
-            {
-                "cat": 3,
-                "x": 0,
-                "y": 80
-            },
-            {
-                "cat": 3,
-                "x": 1,
-                "y": 80
-            },
-            {
-                "cat": 4,
-                "x": 0,
-                "y": 70
-            },
-            {
-                "cat": 4,
-                "x": 1,
-                "y": 70
-            },
-            {
-                "cat": 5,
-                "x": 0,
-                "y": 60
-            },
-            {
-                "cat": 5,
-                "x": 1,
-                "y": 60
-            },
-            {
-                "cat": 6,
-                "x": 0,
-                "y": 50
-            },
-            {
-                "cat": 6,
-                "x": 1,
-                "y": 50
-            },
-            {
-                "cat": 7,
-                "x": 0,
-                "y": 40
-            },
-            {
-                "cat": 7,
-                "x": 1,
-                "y": 40
-            },
-            {
-                "cat": 8,
-                "x": 0,
-                "y": 30
-            },
-            {
-                "cat": 8,
-                "x": 1,
-                "y": 30
-            },
-            {
-                "cat": 9,
-                "x": 0,
-                "y": 20
-            },
-            {
-                "cat": 9,
-                "x": 1,
-                "y": 20
-            },
-            {
-                "cat": 10,
-                "x": 0,
-                "y": 10
-            },
-            {
-                "cat": 10,
-                "x": 1,
-                "y": 10
-            }
-        ]
-    },
-    "resolve": {
-        "scale": {
-            "strokeDash": "independent"
-        }
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "concat": [
         {
-            "mark": "line",
-            "width": 200,
-            "title": "Nominal",
             "encoding": {
                 "strokeDash": {
                     "field": "cat",
@@ -195,12 +73,12 @@
                     "field": "y",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "line",
+            "title": "Nominal",
+            "width": 200
         },
         {
-            "mark": "line",
-            "width": 200,
-            "title": "Ordinal",
             "encoding": {
                 "strokeDash": {
                     "field": "cat",
@@ -272,8 +150,130 @@
                     "field": "y",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "line",
+            "title": "Ordinal",
+            "width": 200
         }
     ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    "config": {
+        "axis": {
+            "grid": false,
+            "title": null
+        },
+        "line": {
+            "color": "orange",
+            "opacity": 0.6,
+            "strokeWidth": 1
+        }
+    },
+    "data": {
+        "values": [
+            {
+                "cat": 1,
+                "x": 0,
+                "y": 100
+            },
+            {
+                "cat": 1,
+                "x": 1,
+                "y": 100
+            },
+            {
+                "cat": 2,
+                "x": 0,
+                "y": 90
+            },
+            {
+                "cat": 2,
+                "x": 1,
+                "y": 90
+            },
+            {
+                "cat": 3,
+                "x": 0,
+                "y": 80
+            },
+            {
+                "cat": 3,
+                "x": 1,
+                "y": 80
+            },
+            {
+                "cat": 4,
+                "x": 0,
+                "y": 70
+            },
+            {
+                "cat": 4,
+                "x": 1,
+                "y": 70
+            },
+            {
+                "cat": 5,
+                "x": 0,
+                "y": 60
+            },
+            {
+                "cat": 5,
+                "x": 1,
+                "y": 60
+            },
+            {
+                "cat": 6,
+                "x": 0,
+                "y": 50
+            },
+            {
+                "cat": 6,
+                "x": 1,
+                "y": 50
+            },
+            {
+                "cat": 7,
+                "x": 0,
+                "y": 40
+            },
+            {
+                "cat": 7,
+                "x": 1,
+                "y": 40
+            },
+            {
+                "cat": 8,
+                "x": 0,
+                "y": 30
+            },
+            {
+                "cat": 8,
+                "x": 1,
+                "y": 30
+            },
+            {
+                "cat": 9,
+                "x": 0,
+                "y": 20
+            },
+            {
+                "cat": 9,
+                "x": 1,
+                "y": 20
+            },
+            {
+                "cat": 10,
+                "x": 0,
+                "y": 10
+            },
+            {
+                "cat": 10,
+                "x": 1,
+                "y": 10
+            }
+        ]
+    },
+    "resolve": {
+        "scale": {
+            "strokeDash": "independent"
+        }
+    }
 }
diff --git a/tests/specs/fillstroke/strokedash5.vl b/tests/specs/fillstroke/strokedash5.vl
--- a/tests/specs/fillstroke/strokedash5.vl
+++ b/tests/specs/fillstroke/strokedash5.vl
@@ -1,24 +1,5 @@
 {
-    "transform": [
-        {
-            "as": "y0",
-            "calculate": "abs(sin(datum.x0+random()))"
-        },
-        {
-            "as": "x",
-            "calculate": "datum.x0 %10"
-        },
-        {
-            "as": "cat",
-            "calculate": "floor(datum.x0 / 10)"
-        },
-        {
-            "as": "y",
-            "calculate": "datum.y0 + datum.cat"
-        }
-    ],
-    "height": 300,
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "sequence": {
             "as": "x0",
@@ -27,9 +8,6 @@
             "stop": 100
         }
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Dash scale 0.2",
     "encoding": {
         "strokeDash": {
             "field": "cat",
@@ -94,18 +72,40 @@
             "type": "ordinal"
         },
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
                 "grid": false
-            }
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
-            "field": "y",
-            "type": "quantitative",
             "axis": {
                 "grid": false
-            }
+            },
+            "field": "y",
+            "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "line",
+    "title": "Dash scale 0.2",
+    "transform": [
+        {
+            "as": "y0",
+            "calculate": "abs(sin(datum.x0+random()))"
+        },
+        {
+            "as": "x",
+            "calculate": "datum.x0 %10"
+        },
+        {
+            "as": "cat",
+            "calculate": "floor(datum.x0 / 10)"
+        },
+        {
+            "as": "y",
+            "calculate": "datum.y0 + datum.cat"
+        }
+    ],
+    "width": 300
 }
diff --git a/tests/specs/fillstroke/strokedash6.vl b/tests/specs/fillstroke/strokedash6.vl
--- a/tests/specs/fillstroke/strokedash6.vl
+++ b/tests/specs/fillstroke/strokedash6.vl
@@ -1,24 +1,5 @@
 {
-    "transform": [
-        {
-            "as": "y0",
-            "calculate": "abs(sin(datum.x0+random()))"
-        },
-        {
-            "as": "x",
-            "calculate": "datum.x0 %10"
-        },
-        {
-            "as": "cat",
-            "calculate": "floor(datum.x0 / 10)"
-        },
-        {
-            "as": "y",
-            "calculate": "datum.y0 + datum.cat"
-        }
-    ],
-    "height": 300,
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "sequence": {
             "as": "x0",
@@ -27,9 +8,6 @@
             "stop": 100
         }
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Dash scale 0.5",
     "encoding": {
         "strokeDash": {
             "field": "cat",
@@ -94,18 +72,40 @@
             "type": "ordinal"
         },
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
                 "grid": false
-            }
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
-            "field": "y",
-            "type": "quantitative",
             "axis": {
                 "grid": false
-            }
+            },
+            "field": "y",
+            "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "line",
+    "title": "Dash scale 0.5",
+    "transform": [
+        {
+            "as": "y0",
+            "calculate": "abs(sin(datum.x0+random()))"
+        },
+        {
+            "as": "x",
+            "calculate": "datum.x0 %10"
+        },
+        {
+            "as": "cat",
+            "calculate": "floor(datum.x0 / 10)"
+        },
+        {
+            "as": "y",
+            "calculate": "datum.y0 + datum.cat"
+        }
+    ],
+    "width": 300
 }
diff --git a/tests/specs/fillstroke/strokedash7.vl b/tests/specs/fillstroke/strokedash7.vl
--- a/tests/specs/fillstroke/strokedash7.vl
+++ b/tests/specs/fillstroke/strokedash7.vl
@@ -1,24 +1,5 @@
 {
-    "transform": [
-        {
-            "as": "y0",
-            "calculate": "abs(sin(datum.x0+random()))"
-        },
-        {
-            "as": "x",
-            "calculate": "datum.x0 %10"
-        },
-        {
-            "as": "cat",
-            "calculate": "floor(datum.x0 / 10)"
-        },
-        {
-            "as": "y",
-            "calculate": "datum.y0 + datum.cat"
-        }
-    ],
-    "height": 300,
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "sequence": {
             "as": "x0",
@@ -27,9 +8,6 @@
             "stop": 100
         }
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Dash scale 1.0",
     "encoding": {
         "strokeDash": {
             "field": "cat",
@@ -94,18 +72,40 @@
             "type": "ordinal"
         },
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
                 "grid": false
-            }
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
-            "field": "y",
-            "type": "quantitative",
             "axis": {
                 "grid": false
-            }
+            },
+            "field": "y",
+            "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "line",
+    "title": "Dash scale 1.0",
+    "transform": [
+        {
+            "as": "y0",
+            "calculate": "abs(sin(datum.x0+random()))"
+        },
+        {
+            "as": "x",
+            "calculate": "datum.x0 %10"
+        },
+        {
+            "as": "cat",
+            "calculate": "floor(datum.x0 / 10)"
+        },
+        {
+            "as": "y",
+            "calculate": "datum.y0 + datum.cat"
+        }
+    ],
+    "width": 300
 }
diff --git a/tests/specs/fillstroke/strokedash8.vl b/tests/specs/fillstroke/strokedash8.vl
--- a/tests/specs/fillstroke/strokedash8.vl
+++ b/tests/specs/fillstroke/strokedash8.vl
@@ -1,24 +1,5 @@
 {
-    "transform": [
-        {
-            "as": "y0",
-            "calculate": "abs(sin(datum.x0+random()))"
-        },
-        {
-            "as": "x",
-            "calculate": "datum.x0 %10"
-        },
-        {
-            "as": "cat",
-            "calculate": "floor(datum.x0 / 10)"
-        },
-        {
-            "as": "y",
-            "calculate": "datum.y0 + datum.cat"
-        }
-    ],
-    "height": 300,
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "sequence": {
             "as": "x0",
@@ -27,9 +8,6 @@
             "stop": 100
         }
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Dash scale 2.0",
     "encoding": {
         "strokeDash": {
             "field": "cat",
@@ -94,18 +72,40 @@
             "type": "ordinal"
         },
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
                 "grid": false
-            }
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
-            "field": "y",
-            "type": "quantitative",
             "axis": {
                 "grid": false
-            }
+            },
+            "field": "y",
+            "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "line",
+    "title": "Dash scale 2.0",
+    "transform": [
+        {
+            "as": "y0",
+            "calculate": "abs(sin(datum.x0+random()))"
+        },
+        {
+            "as": "x",
+            "calculate": "datum.x0 %10"
+        },
+        {
+            "as": "cat",
+            "calculate": "floor(datum.x0 / 10)"
+        },
+        {
+            "as": "y",
+            "calculate": "datum.y0 + datum.cat"
+        }
+    ],
+    "width": 300
 }
diff --git a/tests/specs/fillstroke/strokedash9.vl b/tests/specs/fillstroke/strokedash9.vl
--- a/tests/specs/fillstroke/strokedash9.vl
+++ b/tests/specs/fillstroke/strokedash9.vl
@@ -1,24 +1,5 @@
 {
-    "transform": [
-        {
-            "as": "y0",
-            "calculate": "abs(sin(datum.x0+random()))"
-        },
-        {
-            "as": "x",
-            "calculate": "datum.x0 %10"
-        },
-        {
-            "as": "cat",
-            "calculate": "floor(datum.x0 / 10)"
-        },
-        {
-            "as": "y",
-            "calculate": "datum.y0 + datum.cat"
-        }
-    ],
-    "height": 300,
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "sequence": {
             "as": "x0",
@@ -27,9 +8,6 @@
             "stop": 100
         }
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Dash scale 4.0",
     "encoding": {
         "strokeDash": {
             "field": "cat",
@@ -94,18 +72,40 @@
             "type": "ordinal"
         },
         "x": {
-            "field": "x",
-            "type": "quantitative",
             "axis": {
                 "grid": false
-            }
+            },
+            "field": "x",
+            "type": "quantitative"
         },
         "y": {
-            "field": "y",
-            "type": "quantitative",
             "axis": {
                 "grid": false
-            }
+            },
+            "field": "y",
+            "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "line",
+    "title": "Dash scale 4.0",
+    "transform": [
+        {
+            "as": "y0",
+            "calculate": "abs(sin(datum.x0+random()))"
+        },
+        {
+            "as": "x",
+            "calculate": "datum.x0 %10"
+        },
+        {
+            "as": "cat",
+            "calculate": "floor(datum.x0 / 10)"
+        },
+        {
+            "as": "y",
+            "calculate": "datum.y0 + datum.cat"
+        }
+    ],
+    "width": 300
 }
diff --git a/tests/specs/fillstroke/vrounded.vl b/tests/specs/fillstroke/vrounded.vl
--- a/tests/specs/fillstroke/vrounded.vl
+++ b/tests/specs/fillstroke/vrounded.vl
@@ -1,8 +1,5 @@
 {
-    "mark": {
-        "cornerRadiusEnd": 4,
-        "type": "bar"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -43,7 +40,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "a",
@@ -53,5 +49,9 @@
             "field": "b",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "cornerRadiusEnd": 4,
+        "type": "bar"
     }
 }
diff --git a/tests/specs/gallery/advanced/advanced1.vl b/tests/specs/gallery/advanced/advanced1.vl
--- a/tests/specs/gallery/advanced/advanced1.vl
+++ b/tests/specs/gallery/advanced/advanced1.vl
@@ -1,64 +1,64 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "sum",
-                    "as": "TotalTime",
-                    "field": "Time"
-                }
-            ],
-            "frame": [
-                null,
-                null
-            ]
-        },
-        {
-            "as": "PercentOfTotal",
-            "calculate": "datum.Time/datum.TotalTime * 100"
-        }
-    ],
-    "height": {
-        "step": 12
-    },
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "Time": 8,
-                "Activity": "Sleeping"
+                "Activity": "Sleeping",
+                "Time": 8
             },
             {
-                "Time": 2,
-                "Activity": "Eating"
+                "Activity": "Eating",
+                "Time": 2
             },
             {
-                "Time": 4,
-                "Activity": "TV"
+                "Activity": "TV",
+                "Time": 4
             },
             {
-                "Time": 8,
-                "Activity": "Work"
+                "Activity": "Work",
+                "Time": 8
             },
             {
-                "Time": 2,
-                "Activity": "Exercise"
+                "Activity": "Exercise",
+                "Time": 2
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Calculation of percentage of total",
     "encoding": {
         "x": {
-            "field": "PercentOfTotal",
-            "type": "quantitative",
             "axis": {
                 "title": "% of total time"
-            }
+            },
+            "field": "PercentOfTotal",
+            "type": "quantitative"
         },
         "y": {
             "field": "Activity",
             "type": "nominal"
         }
     },
-    "description": "Calculation of percentage of total"
+    "height": {
+        "step": 12
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "frame": [
+                null,
+                null
+            ],
+            "window": [
+                {
+                    "as": "TotalTime",
+                    "field": "Time",
+                    "op": "sum"
+                }
+            ]
+        },
+        {
+            "as": "PercentOfTotal",
+            "calculate": "datum.Time/datum.TotalTime * 100"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/advanced/advanced2.vl b/tests/specs/gallery/advanced/advanced2.vl
--- a/tests/specs/gallery/advanced/advanced2.vl
+++ b/tests/specs/gallery/advanced/advanced2.vl
@@ -1,59 +1,59 @@
 {
-    "transform": [
-        {
-            "filter": "isValid(datum.IMDB_Rating)"
-        },
-        {
-            "window": [
-                {
-                    "op": "mean",
-                    "as": "AverageRating",
-                    "field": "IMDB_Rating"
-                }
-            ],
-            "frame": [
-                null,
-                null
-            ]
-        },
-        {
-            "filter": "(datum.IMDB_Rating - datum.AverageRating) > 2.5"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Calculation of difference from average",
     "layer": [
         {
-            "mark": "bar",
             "encoding": {
                 "x": {
-                    "field": "IMDB_Rating",
-                    "type": "quantitative",
                     "axis": {
                         "title": "IMDB Rating"
-                    }
+                    },
+                    "field": "IMDB_Rating",
+                    "type": "quantitative"
                 },
                 "y": {
                     "field": "Title",
                     "type": "ordinal"
                 }
-            }
+            },
+            "mark": "bar"
         },
         {
-            "mark": {
-                "color": "red",
-                "type": "rule"
-            },
             "encoding": {
                 "x": {
-                    "field": "AverageRating",
                     "aggregate": "mean",
+                    "field": "AverageRating",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "type": "rule"
             }
         }
     ],
-    "description": "Calculation of difference from average"
+    "transform": [
+        {
+            "filter": "isValid(datum.IMDB_Rating)"
+        },
+        {
+            "frame": [
+                null,
+                null
+            ],
+            "window": [
+                {
+                    "as": "AverageRating",
+                    "field": "IMDB_Rating",
+                    "op": "mean"
+                }
+            ]
+        },
+        {
+            "filter": "(datum.IMDB_Rating - datum.AverageRating) > 2.5"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/advanced/advanced3.vl b/tests/specs/gallery/advanced/advanced3.vl
--- a/tests/specs/gallery/advanced/advanced3.vl
+++ b/tests/specs/gallery/advanced/advanced3.vl
@@ -1,64 +1,35 @@
 {
-    "transform": [
-        {
-            "filter": "isValid(datum.IMDB_Rating)"
-        },
-        {
-            "as": "year",
-            "field": "Release_Date",
-            "timeUnit": "year"
-        },
-        {
-            "window": [
-                {
-                    "op": "mean",
-                    "as": "AverageYearRating",
-                    "field": "IMDB_Rating"
-                }
-            ],
-            "groupby": [
-                "year"
-            ],
-            "frame": [
-                null,
-                null
-            ]
-        },
-        {
-            "filter": "(datum.IMDB_Rating - datum.AverageYearRating) > 2.5"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/movies.json",
         "format": {
             "parse": {
                 "Release_Date": "date:'%d-%b-%y'"
             }
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Calculation of difference from annual average",
     "layer": [
         {
-            "mark": {
-                "type": "bar",
-                "clip": true
-            },
             "encoding": {
                 "x": {
-                    "field": "IMDB_Rating",
-                    "type": "quantitative",
                     "axis": {
                         "title": "IMDB Rating"
-                    }
+                    },
+                    "field": "IMDB_Rating",
+                    "type": "quantitative"
                 },
                 "y": {
                     "field": "Title",
                     "type": "ordinal"
                 }
+            },
+            "mark": {
+                "clip": true,
+                "type": "bar"
             }
         },
         {
-            "mark": "tick",
             "encoding": {
                 "color": {
                     "value": "red"
@@ -71,8 +42,37 @@
                     "field": "Title",
                     "type": "ordinal"
                 }
-            }
+            },
+            "mark": "tick"
         }
     ],
-    "description": "Calculation of difference from annual average"
+    "transform": [
+        {
+            "filter": "isValid(datum.IMDB_Rating)"
+        },
+        {
+            "as": "year",
+            "field": "Release_Date",
+            "timeUnit": "year"
+        },
+        {
+            "frame": [
+                null,
+                null
+            ],
+            "groupby": [
+                "year"
+            ],
+            "window": [
+                {
+                    "as": "AverageYearRating",
+                    "field": "IMDB_Rating",
+                    "op": "mean"
+                }
+            ]
+        },
+        {
+            "filter": "(datum.IMDB_Rating - datum.AverageYearRating) > 2.5"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/advanced/advanced4.vl b/tests/specs/gallery/advanced/advanced4.vl
--- a/tests/specs/gallery/advanced/advanced4.vl
+++ b/tests/specs/gallery/advanced/advanced4.vl
@@ -1,4 +1,27 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/movies.json"
+    },
+    "description": "A scatterplot showing each movie in the database and the difference from the average movie rating.",
+    "encoding": {
+        "x": {
+            "field": "Release_Date",
+            "type": "temporal"
+        },
+        "y": {
+            "axis": {
+                "title": "Residual"
+            },
+            "field": "RatingDelta",
+            "type": "quantitative"
+        }
+    },
+    "mark": {
+        "opacity": 0.3,
+        "strokeWidth": 0.3,
+        "type": "point"
+    },
     "transform": [
         {
             "filter": "isValid(datum.IMDB_Rating)"
@@ -15,44 +38,21 @@
             }
         },
         {
+            "frame": [
+                null,
+                null
+            ],
             "window": [
                 {
-                    "op": "mean",
                     "as": "AverageRating",
-                    "field": "IMDB_Rating"
+                    "field": "IMDB_Rating",
+                    "op": "mean"
                 }
-            ],
-            "frame": [
-                null,
-                null
             ]
         },
         {
             "as": "RatingDelta",
             "calculate": "datum.IMDB_Rating - datum.AverageRating"
         }
-    ],
-    "mark": {
-        "strokeWidth": 0.3,
-        "opacity": 0.3,
-        "type": "point"
-    },
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/movies.json"
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "encoding": {
-        "x": {
-            "field": "Release_Date",
-            "type": "temporal"
-        },
-        "y": {
-            "field": "RatingDelta",
-            "type": "quantitative",
-            "axis": {
-                "title": "Residual"
-            }
-        }
-    },
-    "description": "A scatterplot showing each movie in the database and the difference from the average movie rating."
+    ]
 }
diff --git a/tests/specs/gallery/advanced/advanced5.vl b/tests/specs/gallery/advanced/advanced5.vl
--- a/tests/specs/gallery/advanced/advanced5.vl
+++ b/tests/specs/gallery/advanced/advanced5.vl
@@ -1,113 +1,82 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "rank",
-                    "as": "rank"
-                }
-            ],
-            "groupby": [
-                "matchday"
-            ],
-            "sort": [
-                {
-                    "field": "point",
-                    "order": "descending"
-                },
-                {
-                    "field": "diff",
-                    "order": "descending"
-                }
-            ]
-        }
-    ],
-    "mark": {
-        "orient": "vertical",
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "diff": -1,
-                "point": 0,
                 "matchday": 1,
+                "point": 0,
                 "team": "Germany"
             },
             {
                 "diff": 1,
-                "point": 3,
                 "matchday": 1,
+                "point": 3,
                 "team": "Mexico"
             },
             {
                 "diff": -1,
-                "point": 0,
                 "matchday": 1,
+                "point": 0,
                 "team": "South Korea"
             },
             {
                 "diff": 1,
-                "point": 3,
                 "matchday": 1,
+                "point": 3,
                 "team": "Sweden"
             },
             {
                 "diff": 0,
-                "point": 3,
                 "matchday": 2,
+                "point": 3,
                 "team": "Germany"
             },
             {
                 "diff": 2,
-                "point": 6,
                 "matchday": 2,
+                "point": 6,
                 "team": "Mexico"
             },
             {
                 "diff": -2,
-                "point": 0,
                 "matchday": 2,
+                "point": 0,
                 "team": "South Korea"
             },
             {
                 "diff": 0,
-                "point": 3,
                 "matchday": 2,
+                "point": 3,
                 "team": "Sweden"
             },
             {
                 "diff": -2,
-                "point": 3,
                 "matchday": 3,
+                "point": 3,
                 "team": "Germany"
             },
             {
                 "diff": -1,
-                "point": 6,
                 "matchday": 3,
+                "point": 6,
                 "team": "Mexico"
             },
             {
                 "diff": 0,
-                "point": 3,
                 "matchday": 3,
+                "point": 3,
                 "team": "South Korea"
             },
             {
                 "diff": 3,
-                "point": 6,
                 "matchday": 3,
+                "point": 6,
                 "team": "Sweden"
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": {
-        "fontStyle": "italic",
-        "text": "World Cup 2018: Group F Rankings",
-        "frame": "bounds"
-    },
+    "description": "Line chart showing ranks over time for thw World Cup 2018 Group F teams",
     "encoding": {
         "color": {
             "field": "team",
@@ -136,5 +105,36 @@
             "type": "ordinal"
         }
     },
-    "description": "Line chart showing ranks over time for thw World Cup 2018 Group F teams"
+    "mark": {
+        "orient": "vertical",
+        "type": "line"
+    },
+    "title": {
+        "fontStyle": "italic",
+        "frame": "bounds",
+        "text": "World Cup 2018: Group F Rankings"
+    },
+    "transform": [
+        {
+            "groupby": [
+                "matchday"
+            ],
+            "sort": [
+                {
+                    "field": "point",
+                    "order": "descending"
+                },
+                {
+                    "field": "diff",
+                    "order": "descending"
+                }
+            ],
+            "window": [
+                {
+                    "as": "rank",
+                    "op": "rank"
+                }
+            ]
+        }
+    ]
 }
diff --git a/tests/specs/gallery/advanced/advanced6.vl b/tests/specs/gallery/advanced/advanced6.vl
--- a/tests/specs/gallery/advanced/advanced6.vl
+++ b/tests/specs/gallery/advanced/advanced6.vl
@@ -1,53 +1,5 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "sum",
-                    "as": "sum",
-                    "field": "amount"
-                }
-            ]
-        },
-        {
-            "window": [
-                {
-                    "op": "lead",
-                    "as": "lead",
-                    "field": "label"
-                }
-            ]
-        },
-        {
-            "as": "lead",
-            "calculate": "datum.lead === null ? datum.label : datum.lead"
-        },
-        {
-            "as": "previous_sum",
-            "calculate": "datum.label === 'End' ? 0 : datum.sum - datum.amount"
-        },
-        {
-            "as": "amount",
-            "calculate": "datum.label === 'End' ? datum.sum : datum.amount"
-        },
-        {
-            "as": "text_amount",
-            "calculate": "(datum.label !== 'Begin' && datum.label !== 'End' && datum.amount > 0 ? '+' : '') + datum.amount"
-        },
-        {
-            "as": "center",
-            "calculate": "(datum.sum + datum.previous_sum) / 2"
-        },
-        {
-            "as": "sum_dec",
-            "calculate": "datum.sum < datum.previous_sum ? datum.sum : ''"
-        },
-        {
-            "as": "sum_inc",
-            "calculate": "datum.sum > datum.previous_sum ? datum.sum : ''"
-        }
-    ],
-    "height": 450,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -108,47 +60,47 @@
             }
         ]
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Waterfall chart of monthly profit and loss",
+    "encoding": {
+        "x": {
+            "field": "label",
+            "sort": null,
+            "title": "Months",
+            "type": "ordinal"
+        }
+    },
+    "height": 450,
     "layer": [
         {
-            "mark": {
-                "size": 45,
-                "type": "bar"
-            },
             "encoding": {
                 "color": {
-                    "value": "#93c4aa",
                     "condition": [
                         {
-                            "value": "#f7e0b6",
-                            "test": "datum.label === 'Begin' || datum.label === 'End'"
+                            "test": "datum.label === 'Begin' || datum.label === 'End'",
+                            "value": "#f7e0b6"
                         },
                         {
-                            "value": "#f78a64",
-                            "test": "datum.sum < datum.previous_sum"
+                            "test": "datum.sum < datum.previous_sum",
+                            "value": "#f78a64"
                         }
-                    ]
-                },
-                "y2": {
-                    "field": "sum"
+                    ],
+                    "value": "#93c4aa"
                 },
                 "y": {
                     "field": "previous_sum",
                     "title": "Amount",
                     "type": "quantitative"
+                },
+                "y2": {
+                    "field": "sum"
                 }
+            },
+            "mark": {
+                "size": 45,
+                "type": "bar"
             }
         },
         {
-            "mark": {
-                "x2Offset": 22.5,
-                "strokeWidth": 2,
-                "color": "#404040",
-                "opacity": 1,
-                "xOffset": -22.5,
-                "type": "rule"
-            },
             "encoding": {
                 "x2": {
                     "field": "lead"
@@ -157,15 +109,17 @@
                     "field": "sum",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "#404040",
+                "opacity": 1,
+                "strokeWidth": 2,
+                "type": "rule",
+                "x2Offset": 22.5,
+                "xOffset": -22.5
             }
         },
         {
-            "mark": {
-                "dy": -8,
-                "color": "#404040",
-                "type": "text",
-                "fontWeight": "bold"
-            },
             "encoding": {
                 "text": {
                     "field": "sum_inc",
@@ -175,16 +129,15 @@
                     "field": "sum_inc",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "#404040",
+                "dy": -8,
+                "fontWeight": "bold",
+                "type": "text"
             }
         },
         {
-            "mark": {
-                "dy": 8,
-                "color": "#404040",
-                "type": "text",
-                "baseline": "top",
-                "fontWeight": "bold"
-            },
             "encoding": {
                 "text": {
                     "field": "sum_dec",
@@ -194,21 +147,23 @@
                     "field": "sum_dec",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "baseline": "top",
+                "color": "#404040",
+                "dy": 8,
+                "fontWeight": "bold",
+                "type": "text"
             }
         },
         {
-            "mark": {
-                "type": "text",
-                "baseline": "middle",
-                "fontWeight": "bold"
-            },
             "encoding": {
                 "color": {
-                    "value": "white",
                     "condition": {
-                        "value": "#725a30",
-                        "test": "datum.label === 'Begin' || datum.label === 'End'"
-                    }
+                        "test": "datum.label === 'Begin' || datum.label === 'End'",
+                        "value": "#725a30"
+                    },
+                    "value": "white"
                 },
                 "text": {
                     "field": "text_amount",
@@ -218,16 +173,61 @@
                     "field": "center",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "baseline": "middle",
+                "fontWeight": "bold",
+                "type": "text"
             }
         }
     ],
-    "encoding": {
-        "x": {
-            "field": "label",
-            "sort": null,
-            "title": "Months",
-            "type": "ordinal"
+    "transform": [
+        {
+            "window": [
+                {
+                    "as": "sum",
+                    "field": "amount",
+                    "op": "sum"
+                }
+            ]
+        },
+        {
+            "window": [
+                {
+                    "as": "lead",
+                    "field": "label",
+                    "op": "lead"
+                }
+            ]
+        },
+        {
+            "as": "lead",
+            "calculate": "datum.lead === null ? datum.label : datum.lead"
+        },
+        {
+            "as": "previous_sum",
+            "calculate": "datum.label === 'End' ? 0 : datum.sum - datum.amount"
+        },
+        {
+            "as": "amount",
+            "calculate": "datum.label === 'End' ? datum.sum : datum.amount"
+        },
+        {
+            "as": "text_amount",
+            "calculate": "(datum.label !== 'Begin' && datum.label !== 'End' && datum.amount > 0 ? '+' : '') + datum.amount"
+        },
+        {
+            "as": "center",
+            "calculate": "(datum.sum + datum.previous_sum) / 2"
+        },
+        {
+            "as": "sum_dec",
+            "calculate": "datum.sum < datum.previous_sum ? datum.sum : ''"
+        },
+        {
+            "as": "sum_inc",
+            "calculate": "datum.sum > datum.previous_sum ? datum.sum : ''"
         }
-    },
-    "description": "Waterfall chart of monthly profit and loss"
+    ],
+    "width": 800
 }
diff --git a/tests/specs/gallery/advanced/advanced7.vl b/tests/specs/gallery/advanced/advanced7.vl
--- a/tests/specs/gallery/advanced/advanced7.vl
+++ b/tests/specs/gallery/advanced/advanced7.vl
@@ -1,34 +1,34 @@
 {
-    "transform": [
-        {
-            "from": {
-                "data": {
-                    "url": "https://vega.github.io/vega-lite/data/lookup_people.csv"
-                },
-                "key": "name",
-                "fields": [
-                    "age",
-                    "height"
-                ]
-            },
-            "lookup": "person"
-        }
-    ],
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/lookup_groups.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Using the lookup transform to combine data",
     "encoding": {
         "x": {
             "field": "group",
             "type": "ordinal"
         },
         "y": {
-            "field": "age",
             "aggregate": "mean",
+            "field": "age",
             "type": "quantitative"
         }
     },
-    "description": "Using the lookup transform to combine data"
+    "mark": "bar",
+    "transform": [
+        {
+            "from": {
+                "data": {
+                    "url": "https://vega.github.io/vega-lite/data/lookup_people.csv"
+                },
+                "fields": [
+                    "age",
+                    "height"
+                ],
+                "key": "name"
+            },
+            "lookup": "person"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/advanced/advanced8.vl b/tests/specs/gallery/advanced/advanced8.vl
--- a/tests/specs/gallery/advanced/advanced8.vl
+++ b/tests/specs/gallery/advanced/advanced8.vl
@@ -1,86 +1,43 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "count",
-                    "as": "index"
-                }
-            ]
-        },
-        {
-            "fold": [
-                "petalLength",
-                "petalWidth",
-                "sepalLength",
-                "sepalWidth"
-            ]
-        },
-        {
-            "groupby": [
-                "key"
-            ],
-            "joinaggregate": [
-                {
-                    "op": "min",
-                    "as": "min",
-                    "field": "value"
-                },
-                {
-                    "op": "max",
-                    "as": "max",
-                    "field": "value"
-                }
-            ]
-        },
-        {
-            "as": "normVal",
-            "calculate": "(datum.value - datum.min) / (datum.max-datum.min)"
-        },
-        {
-            "as": "mid",
-            "calculate": "(datum.min + datum.max) / 2"
-        }
-    ],
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
+        "axisX": {
+            "domain": false,
+            "labelAngle": 0,
+            "tickColor": "#ccc"
+        },
         "style": {
+            "label": {
+                "align": "right",
+                "baseline": "middle",
+                "dx": -5,
+                "tooltip": null
+            },
             "tick": {
                 "orient": "horizontal",
                 "tooltip": null
-            },
-            "label": {
-                "dx": -5,
-                "tooltip": null,
-                "align": "right",
-                "baseline": "middle"
             }
         },
         "view": {
             "stroke": null
-        },
-        "axisX": {
-            "labelAngle": 0,
-            "domain": false,
-            "tickColor": "#ccc"
         }
     },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/iris.json"
     },
-    "width": 600,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Parallel coordinates plot with manual generation of parallel axes",
+    "height": 300,
     "layer": [
         {
-            "mark": {
-                "opacity": 0.3,
-                "type": "line"
-            },
             "encoding": {
                 "color": {
                     "field": "species",
                     "type": "nominal"
                 },
+                "detail": {
+                    "field": "index",
+                    "type": "nominal"
+                },
                 "tooltip": [
                     {
                         "field": "petalLength",
@@ -103,45 +60,41 @@
                     "field": "key",
                     "type": "nominal"
                 },
-                "detail": {
-                    "field": "index",
-                    "type": "nominal"
-                },
                 "y": {
+                    "axis": null,
                     "field": "normVal",
-                    "type": "quantitative",
-                    "axis": null
+                    "type": "quantitative"
                 }
+            },
+            "mark": {
+                "opacity": 0.3,
+                "type": "line"
             }
         },
         {
-            "mark": {
-                "color": "#ccc",
-                "type": "rule"
-            },
             "encoding": {
-                "x": {
-                    "field": "key",
-                    "type": "nominal",
-                    "axis": {
-                        "title": null
-                    }
-                },
                 "detail": {
                     "aggregate": "count",
                     "type": "quantitative"
+                },
+                "x": {
+                    "axis": {
+                        "title": null
+                    },
+                    "field": "key",
+                    "type": "nominal"
                 }
+            },
+            "mark": {
+                "color": "#ccc",
+                "type": "rule"
             }
         },
         {
-            "mark": {
-                "style": "label",
-                "type": "text"
-            },
             "encoding": {
                 "text": {
-                    "field": "max",
                     "aggregate": "max",
+                    "field": "max",
                     "type": "quantitative"
                 },
                 "x": {
@@ -151,17 +104,17 @@
                 "y": {
                     "value": 0
                 }
-            }
-        },
-        {
+            },
             "mark": {
                 "style": "label",
                 "type": "text"
-            },
+            }
+        },
+        {
             "encoding": {
                 "text": {
-                    "field": "mid",
                     "aggregate": "min",
+                    "field": "mid",
                     "type": "quantitative"
                 },
                 "x": {
@@ -171,17 +124,17 @@
                 "y": {
                     "value": 150
                 }
-            }
-        },
-        {
+            },
             "mark": {
                 "style": "label",
                 "type": "text"
-            },
+            }
+        },
+        {
             "encoding": {
                 "text": {
-                    "field": "min",
                     "aggregate": "min",
+                    "field": "min",
                     "type": "quantitative"
                 },
                 "x": {
@@ -191,8 +144,55 @@
                 "y": {
                     "value": "height"
                 }
+            },
+            "mark": {
+                "style": "label",
+                "type": "text"
             }
         }
     ],
-    "description": "Parallel coordinates plot with manual generation of parallel axes"
+    "transform": [
+        {
+            "window": [
+                {
+                    "as": "index",
+                    "op": "count"
+                }
+            ]
+        },
+        {
+            "fold": [
+                "petalLength",
+                "petalWidth",
+                "sepalLength",
+                "sepalWidth"
+            ]
+        },
+        {
+            "groupby": [
+                "key"
+            ],
+            "joinaggregate": [
+                {
+                    "as": "min",
+                    "field": "value",
+                    "op": "min"
+                },
+                {
+                    "as": "max",
+                    "field": "value",
+                    "op": "max"
+                }
+            ]
+        },
+        {
+            "as": "normVal",
+            "calculate": "(datum.value - datum.min) / (datum.max-datum.min)"
+        },
+        {
+            "as": "mid",
+            "calculate": "(datum.min + datum.max) / 2"
+        }
+    ],
+    "width": 600
 }
diff --git a/tests/specs/gallery/advanced/advanced9.vl b/tests/specs/gallery/advanced/advanced9.vl
--- a/tests/specs/gallery/advanced/advanced9.vl
+++ b/tests/specs/gallery/advanced/advanced9.vl
@@ -1,15 +1,15 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Production budget of the film with highest US Gross in each major genre.",
     "encoding": {
         "x": {
-            "field": "Production_Budget",
             "aggregate": {
                 "argmax": "US_Gross"
             },
+            "field": "Production_Budget",
             "type": "quantitative"
         },
         "y": {
@@ -17,5 +17,5 @@
             "type": "nominal"
         }
     },
-    "description": "Production budget of the film with highest US Gross in each major genre."
+    "mark": "bar"
 }
diff --git a/tests/specs/gallery/advanced/benchmark.vl b/tests/specs/gallery/advanced/benchmark.vl
--- a/tests/specs/gallery/advanced/benchmark.vl
+++ b/tests/specs/gallery/advanced/benchmark.vl
@@ -1,306 +1,6 @@
 {
-    "height": 300,
-    "width": 500,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "layer": [
-        {
-            "transform": [
-                {
-                    "window": [
-                        {
-                            "op": "row_number",
-                            "as": "row"
-                        }
-                    ]
-                },
-                {
-                    "as": "fps",
-                    "calculate": "1000/datum.data"
-                },
-                {
-                    "as": "system",
-                    "calculate": "'Falcon'"
-                }
-            ],
-            "mark": "line",
-            "data": {
-                "name": "falcon"
-            }
-        },
-        {
-            "transform": [
-                {
-                    "window": [
-                        {
-                            "op": "row_number",
-                            "as": "row"
-                        }
-                    ]
-                },
-                {
-                    "as": "fps",
-                    "calculate": "1000/datum.data"
-                },
-                {
-                    "as": "system",
-                    "calculate": "'Square Crossfilter (3M)'"
-                }
-            ],
-            "mark": "line",
-            "data": {
-                "name": "square"
-            }
-        }
-    ],
-    "encoding": {
-        "color": {
-            "field": "system",
-            "type": "nominal",
-            "legend": {
-                "orient": "bottom-right",
-                "title": "System"
-            }
-        },
-        "size": {
-            "value": 1
-        },
-        "x": {
-            "field": "row",
-            "scale": {
-                "nice": false
-            },
-            "type": "quantitative",
-            "axis": {
-                "grid": false,
-                "title": "Trial"
-            }
-        },
-        "y": {
-            "field": "fps",
-            "scale": {
-                "type": "log"
-            },
-            "type": "quantitative",
-            "axis": {
-                "grid": false,
-                "title": "Frames per Second (fps)"
-            }
-        }
-    },
-    "description": "Line chart to show benchmarking results.",
     "datasets": {
-        "square": [
-            24.200000762939453,
-            17.899999618530273,
-            15.800000190734863,
-            58.400001525878906,
-            151,
-            2523.10009765625,
-            245.3000030517578,
-            136,
-            72.30000305175781,
-            55.70000076293945,
-            42.400001525878906,
-            37.70000076293945,
-            30.100000381469727,
-            30.100000381469727,
-            21.799999237060547,
-            20.600000381469727,
-            21.799999237060547,
-            17.600000381469727,
-            18.200000762939453,
-            21,
-            941.7000122070313,
-            177.39999389648438,
-            2821.800048828125,
-            359.20001220703125,
-            318,
-            217.10000610351563,
-            126,
-            69,
-            57.79999923706055,
-            45.29999923706055,
-            35.599998474121094,
-            29.100000381469727,
-            23.799999237060547,
-            44.20000076293945,
-            17.700000762939453,
-            17.700000762939453,
-            15.699999809265137,
-            27.799999237060547,
-            22.799999237060547,
-            3853.60009765625,
-            91.5999984741211,
-            181.39999389648438,
-            476.29998779296875,
-            265.8999938964844,
-            254.60000610351563,
-            2583.199951171875,
-            124.80000305175781,
-            73.19999694824219,
-            56.400001525878906,
-            48.70000076293945,
-            41.599998474121094,
-            21.100000381469727,
-            20.299999237060547,
-            21.299999237060547,
-            18.299999237060547,
-            17.100000381469727,
-            19.5,
-            828.2000122070313,
-            162.1999969482422,
-            217.89999389648438,
-            205.5,
-            197.60000610351563,
-            2249.800048828125,
-            103.0999984741211,
-            71.69999694824219,
-            57.599998474121094,
-            41.400001525878906,
-            34.5,
-            22,
-            20.5,
-            21.700000762939453,
-            18.299999237060547,
-            17.299999237060547,
-            19.399999618530273,
-            666.7999877929688,
-            214.89999389648438,
-            212.3000030517578,
-            125.80000305175781,
-            67.69999694824219,
-            56.099998474121094,
-            45.79999923706055,
-            38.29999923706055,
-            33,
-            35.400001525878906,
-            22.700000762939453,
-            19.399999618530273,
-            19.899999618530273,
-            24.100000381469727,
-            19.299999237060547,
-            21.299999237060547,
-            3508.699951171875,
-            204.10000610351563,
-            125.4000015258789,
-            65.30000305175781,
-            60.79999923706055,
-            44.099998474121094,
-            36.29999923706055,
-            30.5,
-            28.600000381469727,
-            16.5,
-            18.600000381469727,
-            23.700000762939453,
-            22.299999237060547,
-            17.600000381469727,
-            19.200000762939453,
-            448.79998779296875,
-            124.4000015258789,
-            66.5999984741211,
-            53.5,
-            51,
-            45.20000076293945,
-            28.399999618530273,
-            29.200000762939453,
-            26.700000762939453,
-            25.899999618530273,
-            18.100000381469727,
-            17.600000381469727,
-            20.100000381469727,
-            25.200000762939453,
-            3332,
-            67.5,
-            53.599998474121094,
-            56.599998474121094,
-            39.900001525878906,
-            27.600000381469727,
-            29.600000381469727,
-            33.5,
-            17.200000762939453,
-            18.799999237060547,
-            25.200000762939453,
-            16.700000762939453,
-            16.899999618530273,
-            240.1999969482422,
-            52.400001525878906,
-            42.099998474121094,
-            33.900001525878906,
-            28,
-            28.600000381469727,
-            17.299999237060547,
-            20,
-            21,
-            22.799999237060547,
-            16.700000762939453,
-            19.200000762939453,
-            175.39999389648438,
-            43.5,
-            34.70000076293945,
-            29.700000762939453,
-            34.900001525878906,
-            25.799999237060547,
-            17.299999237060547,
-            22.600000381469727,
-            17.600000381469727,
-            17.200000762939453,
-            19.200000762939453,
-            111.80000305175781,
-            35.400001525878906,
-            27.600000381469727,
-            25.399999618530273,
-            21.899999618530273,
-            18.600000381469727,
-            18.100000381469727,
-            21.200000762939453,
-            17.899999618530273,
-            17,
-            80.5999984741211,
-            29.799999237060547,
-            30.100000381469727,
-            16,
-            26.799999237060547,
-            17.5,
-            22.299999237060547,
-            16.799999237060547,
-            22.399999618530273,
-            77.4000015258789,
-            31,
-            29.700000762939453,
-            28.700000762939453,
-            26,
-            16.899999618530273,
-            15.800000190734863,
-            19,
-            52.599998474121094,
-            25.200000762939453,
-            16.700000762939453,
-            17.899999618530273,
-            21,
-            19.799999237060547,
-            18.799999237060547,
-            46.5,
-            17.5,
-            16.799999237060547,
-            18.299999237060547,
-            18.299999237060547,
-            14.899999618530273,
-            41,
-            18.299999237060547,
-            17.299999237060547,
-            17,
-            17.5,
-            32.29999923706055,
-            22.600000381469727,
-            16.600000381469727,
-            17.899999618530273,
-            25.600000381469727,
-            17.5,
-            20.299999237060547,
-            25.200000762939453,
-            18.600000381469727,
-            17.700000762939453
-        ],
         "falcon": [
             16.81999969482422,
             19.759998321533203,
@@ -512,6 +212,306 @@
             16.239999771118164,
             16.040000915527344,
             16.239999771118164
+        ],
+        "square": [
+            24.200000762939453,
+            17.899999618530273,
+            15.800000190734863,
+            58.400001525878906,
+            151,
+            2523.10009765625,
+            245.3000030517578,
+            136,
+            72.30000305175781,
+            55.70000076293945,
+            42.400001525878906,
+            37.70000076293945,
+            30.100000381469727,
+            30.100000381469727,
+            21.799999237060547,
+            20.600000381469727,
+            21.799999237060547,
+            17.600000381469727,
+            18.200000762939453,
+            21,
+            941.7000122070313,
+            177.39999389648438,
+            2821.800048828125,
+            359.20001220703125,
+            318,
+            217.10000610351563,
+            126,
+            69,
+            57.79999923706055,
+            45.29999923706055,
+            35.599998474121094,
+            29.100000381469727,
+            23.799999237060547,
+            44.20000076293945,
+            17.700000762939453,
+            17.700000762939453,
+            15.699999809265137,
+            27.799999237060547,
+            22.799999237060547,
+            3853.60009765625,
+            91.5999984741211,
+            181.39999389648438,
+            476.29998779296875,
+            265.8999938964844,
+            254.60000610351563,
+            2583.199951171875,
+            124.80000305175781,
+            73.19999694824219,
+            56.400001525878906,
+            48.70000076293945,
+            41.599998474121094,
+            21.100000381469727,
+            20.299999237060547,
+            21.299999237060547,
+            18.299999237060547,
+            17.100000381469727,
+            19.5,
+            828.2000122070313,
+            162.1999969482422,
+            217.89999389648438,
+            205.5,
+            197.60000610351563,
+            2249.800048828125,
+            103.0999984741211,
+            71.69999694824219,
+            57.599998474121094,
+            41.400001525878906,
+            34.5,
+            22,
+            20.5,
+            21.700000762939453,
+            18.299999237060547,
+            17.299999237060547,
+            19.399999618530273,
+            666.7999877929688,
+            214.89999389648438,
+            212.3000030517578,
+            125.80000305175781,
+            67.69999694824219,
+            56.099998474121094,
+            45.79999923706055,
+            38.29999923706055,
+            33,
+            35.400001525878906,
+            22.700000762939453,
+            19.399999618530273,
+            19.899999618530273,
+            24.100000381469727,
+            19.299999237060547,
+            21.299999237060547,
+            3508.699951171875,
+            204.10000610351563,
+            125.4000015258789,
+            65.30000305175781,
+            60.79999923706055,
+            44.099998474121094,
+            36.29999923706055,
+            30.5,
+            28.600000381469727,
+            16.5,
+            18.600000381469727,
+            23.700000762939453,
+            22.299999237060547,
+            17.600000381469727,
+            19.200000762939453,
+            448.79998779296875,
+            124.4000015258789,
+            66.5999984741211,
+            53.5,
+            51,
+            45.20000076293945,
+            28.399999618530273,
+            29.200000762939453,
+            26.700000762939453,
+            25.899999618530273,
+            18.100000381469727,
+            17.600000381469727,
+            20.100000381469727,
+            25.200000762939453,
+            3332,
+            67.5,
+            53.599998474121094,
+            56.599998474121094,
+            39.900001525878906,
+            27.600000381469727,
+            29.600000381469727,
+            33.5,
+            17.200000762939453,
+            18.799999237060547,
+            25.200000762939453,
+            16.700000762939453,
+            16.899999618530273,
+            240.1999969482422,
+            52.400001525878906,
+            42.099998474121094,
+            33.900001525878906,
+            28,
+            28.600000381469727,
+            17.299999237060547,
+            20,
+            21,
+            22.799999237060547,
+            16.700000762939453,
+            19.200000762939453,
+            175.39999389648438,
+            43.5,
+            34.70000076293945,
+            29.700000762939453,
+            34.900001525878906,
+            25.799999237060547,
+            17.299999237060547,
+            22.600000381469727,
+            17.600000381469727,
+            17.200000762939453,
+            19.200000762939453,
+            111.80000305175781,
+            35.400001525878906,
+            27.600000381469727,
+            25.399999618530273,
+            21.899999618530273,
+            18.600000381469727,
+            18.100000381469727,
+            21.200000762939453,
+            17.899999618530273,
+            17,
+            80.5999984741211,
+            29.799999237060547,
+            30.100000381469727,
+            16,
+            26.799999237060547,
+            17.5,
+            22.299999237060547,
+            16.799999237060547,
+            22.399999618530273,
+            77.4000015258789,
+            31,
+            29.700000762939453,
+            28.700000762939453,
+            26,
+            16.899999618530273,
+            15.800000190734863,
+            19,
+            52.599998474121094,
+            25.200000762939453,
+            16.700000762939453,
+            17.899999618530273,
+            21,
+            19.799999237060547,
+            18.799999237060547,
+            46.5,
+            17.5,
+            16.799999237060547,
+            18.299999237060547,
+            18.299999237060547,
+            14.899999618530273,
+            41,
+            18.299999237060547,
+            17.299999237060547,
+            17,
+            17.5,
+            32.29999923706055,
+            22.600000381469727,
+            16.600000381469727,
+            17.899999618530273,
+            25.600000381469727,
+            17.5,
+            20.299999237060547,
+            25.200000762939453,
+            18.600000381469727,
+            17.700000762939453
         ]
-    }
+    },
+    "description": "Line chart to show benchmarking results.",
+    "encoding": {
+        "color": {
+            "field": "system",
+            "legend": {
+                "orient": "bottom-right",
+                "title": "System"
+            },
+            "type": "nominal"
+        },
+        "size": {
+            "value": 1
+        },
+        "x": {
+            "axis": {
+                "grid": false,
+                "title": "Trial"
+            },
+            "field": "row",
+            "scale": {
+                "nice": false
+            },
+            "type": "quantitative"
+        },
+        "y": {
+            "axis": {
+                "grid": false,
+                "title": "Frames per Second (fps)"
+            },
+            "field": "fps",
+            "scale": {
+                "type": "log"
+            },
+            "type": "quantitative"
+        }
+    },
+    "height": 300,
+    "layer": [
+        {
+            "data": {
+                "name": "falcon"
+            },
+            "mark": "line",
+            "transform": [
+                {
+                    "window": [
+                        {
+                            "as": "row",
+                            "op": "row_number"
+                        }
+                    ]
+                },
+                {
+                    "as": "fps",
+                    "calculate": "1000/datum.data"
+                },
+                {
+                    "as": "system",
+                    "calculate": "'Falcon'"
+                }
+            ]
+        },
+        {
+            "data": {
+                "name": "square"
+            },
+            "mark": "line",
+            "transform": [
+                {
+                    "window": [
+                        {
+                            "as": "row",
+                            "op": "row_number"
+                        }
+                    ]
+                },
+                {
+                    "as": "fps",
+                    "calculate": "1000/datum.data"
+                },
+                {
+                    "as": "system",
+                    "calculate": "'Square Crossfilter (3M)'"
+                }
+            ]
+        }
+    ],
+    "width": 500
 }
diff --git a/tests/specs/gallery/advanced/density1.vl b/tests/specs/gallery/advanced/density1.vl
--- a/tests/specs/gallery/advanced/density1.vl
+++ b/tests/specs/gallery/advanced/density1.vl
@@ -1,4 +1,25 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/iris.json"
+    },
+    "encoding": {
+        "row": {
+            "field": "organ",
+            "type": "nominal"
+        },
+        "x": {
+            "field": "value",
+            "title": "value (cm)",
+            "type": "quantitative"
+        },
+        "y": {
+            "field": "density",
+            "type": "quantitative"
+        }
+    },
+    "height": 50,
+    "mark": "area",
     "transform": [
         {
             "as": [
@@ -13,33 +34,12 @@
             ]
         },
         {
+            "bandwidth": 0.3,
+            "density": "value",
             "groupby": [
                 "organ"
-            ],
-            "bandwidth": 0.3,
-            "density": "value"
+            ]
         }
     ],
-    "height": 50,
-    "mark": "area",
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/iris.json"
-    },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "encoding": {
-        "row": {
-            "field": "organ",
-            "type": "nominal"
-        },
-        "x": {
-            "field": "value",
-            "title": "value (cm)",
-            "type": "quantitative"
-        },
-        "y": {
-            "field": "density",
-            "type": "quantitative"
-        }
-    }
+    "width": 300
 }
diff --git a/tests/specs/gallery/advanced/density2.vl b/tests/specs/gallery/advanced/density2.vl
--- a/tests/specs/gallery/advanced/density2.vl
+++ b/tests/specs/gallery/advanced/density2.vl
@@ -1,4 +1,28 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/iris.json"
+    },
+    "encoding": {
+        "color": {
+            "field": "measurement",
+            "type": "nominal"
+        },
+        "x": {
+            "field": "value",
+            "title": "width/length (cm)",
+            "type": "quantitative"
+        },
+        "y": {
+            "field": "density",
+            "type": "quantitative"
+        }
+    },
+    "height": 100,
+    "mark": {
+        "opacity": 0.5,
+        "type": "area"
+    },
     "transform": [
         {
             "as": [
@@ -13,41 +37,17 @@
             ]
         },
         {
-            "groupby": [
-                "measurement"
-            ],
+            "bandwidth": 0.3,
+            "density": "value",
             "extent": [
                 0,
                 8
             ],
-            "steps": 200,
-            "bandwidth": 0.3,
-            "density": "value"
+            "groupby": [
+                "measurement"
+            ],
+            "steps": 200
         }
     ],
-    "height": 100,
-    "mark": {
-        "opacity": 0.5,
-        "type": "area"
-    },
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/iris.json"
-    },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "encoding": {
-        "color": {
-            "field": "measurement",
-            "type": "nominal"
-        },
-        "x": {
-            "field": "value",
-            "title": "width/length (cm)",
-            "type": "quantitative"
-        },
-        "y": {
-            "field": "density",
-            "type": "quantitative"
-        }
-    }
+    "width": 400
 }
diff --git a/tests/specs/gallery/advanced/filter1.vl b/tests/specs/gallery/advanced/filter1.vl
--- a/tests/specs/gallery/advanced/filter1.vl
+++ b/tests/specs/gallery/advanced/filter1.vl
@@ -1,24 +1,5 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "rank",
-                    "as": "rank"
-                }
-            ],
-            "sort": [
-                {
-                    "field": "score",
-                    "order": "descending"
-                }
-            ]
-        },
-        {
-            "filter": "datum.rank <=5"
-        }
-    ],
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -111,7 +92,7 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Filtering the top-k items",
     "encoding": {
         "x": {
             "field": "score",
@@ -126,5 +107,24 @@
             "type": "nominal"
         }
     },
-    "description": "Filtering the top-k items"
+    "mark": "bar",
+    "transform": [
+        {
+            "sort": [
+                {
+                    "field": "score",
+                    "order": "descending"
+                }
+            ],
+            "window": [
+                {
+                    "as": "rank",
+                    "op": "rank"
+                }
+            ]
+        },
+        {
+            "filter": "datum.rank <=5"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/advanced/filter2.vl b/tests/specs/gallery/advanced/filter2.vl
--- a/tests/specs/gallery/advanced/filter2.vl
+++ b/tests/specs/gallery/advanced/filter2.vl
@@ -1,58 +1,58 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/movies.json"
+    },
+    "description": "Top-k items with 'others'",
+    "encoding": {
+        "x": {
+            "aggregate": "mean",
+            "field": "aggregateGross",
+            "title": null,
+            "type": "quantitative"
+        },
+        "y": {
+            "field": "rankedDirector",
+            "sort": {
+                "encoding": "x",
+                "order": "descending"
+            },
+            "title": null,
+            "type": "ordinal"
+        }
+    },
+    "mark": "bar",
+    "title": "Top Directors by Average Worldwide Gross",
     "transform": [
         {
-            "groupby": [
-                "Director"
-            ],
             "aggregate": [
                 {
-                    "op": "mean",
                     "as": "aggregateGross",
-                    "field": "Worldwide_Gross"
+                    "field": "Worldwide_Gross",
+                    "op": "mean"
                 }
+            ],
+            "groupby": [
+                "Director"
             ]
         },
         {
-            "window": [
-                {
-                    "op": "row_number",
-                    "as": "rank"
-                }
-            ],
             "sort": [
                 {
                     "field": "aggregateGross",
                     "order": "descending"
                 }
+            ],
+            "window": [
+                {
+                    "as": "rank",
+                    "op": "row_number"
+                }
             ]
         },
         {
             "as": "rankedDirector",
             "calculate": "datum.rank < 10 ? datum.Director : 'All Others'"
         }
-    ],
-    "mark": "bar",
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/movies.json"
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Top Directors by Average Worldwide Gross",
-    "encoding": {
-        "x": {
-            "field": "aggregateGross",
-            "aggregate": "mean",
-            "title": null,
-            "type": "quantitative"
-        },
-        "y": {
-            "field": "rankedDirector",
-            "sort": {
-                "encoding": "x",
-                "order": "descending"
-            },
-            "title": null,
-            "type": "ordinal"
-        }
-    },
-    "description": "Top-k items with 'others'"
+    ]
 }
diff --git a/tests/specs/gallery/advanced/irisScatterplotMatrix.vl b/tests/specs/gallery/advanced/irisScatterplotMatrix.vl
--- a/tests/specs/gallery/advanced/irisScatterplotMatrix.vl
+++ b/tests/specs/gallery/advanced/irisScatterplotMatrix.vl
@@ -1,25 +1,23 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/iris.json"
     },
     "repeat": {
-        "row": [
-            "petalWidth",
-            "petalLength",
-            "sepalWidth",
-            "sepalLength"
-        ],
         "column": [
             "sepalLength",
             "sepalWidth",
             "petalLength",
             "petalWidth"
+        ],
+        "row": [
+            "petalWidth",
+            "petalLength",
+            "sepalWidth",
+            "sepalLength"
         ]
     },
     "spec": {
-        "height": 150,
-        "mark": "point",
-        "width": 150,
         "encoding": {
             "color": {
                 "field": "species",
@@ -43,7 +41,9 @@
                 },
                 "type": "quantitative"
             }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+        },
+        "height": 150,
+        "mark": "point",
+        "width": 150
+    }
 }
diff --git a/tests/specs/gallery/advanced/layered1.vl b/tests/specs/gallery/advanced/layered1.vl
--- a/tests/specs/gallery/advanced/layered1.vl
+++ b/tests/specs/gallery/advanced/layered1.vl
@@ -1,32 +1,71 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/movies.json"
+    },
+    "description": "Layered Histogram and Cumulative Histogram",
+    "encoding": {
+        "x": {
+            "field": "binIMDB_Rating",
+            "scale": {
+                "zero": false
+            },
+            "title": "IMDB Rating",
+            "type": "quantitative"
+        },
+        "x2": {
+            "field": "binIMDB_Rating_end"
+        }
+    },
+    "layer": [
+        {
+            "encoding": {
+                "y": {
+                    "field": "cumulativeCount",
+                    "type": "quantitative"
+                }
+            },
+            "mark": "bar"
+        },
+        {
+            "encoding": {
+                "y": {
+                    "field": "count",
+                    "type": "quantitative"
+                }
+            },
+            "mark": {
+                "color": "yellow",
+                "opacity": 0.5,
+                "type": "bar"
+            }
+        }
+    ],
     "transform": [
         {
             "as": "binIMDB_Rating",
-            "field": "IMDB_Rating",
-            "bin": true
+            "bin": true,
+            "field": "IMDB_Rating"
         },
         {
-            "groupby": [
-                "binIMDB_Rating",
-                "binIMDB_Rating_end"
-            ],
             "aggregate": [
                 {
-                    "op": "count",
-                    "as": "count"
+                    "as": "count",
+                    "op": "count"
                 }
+            ],
+            "groupby": [
+                "binIMDB_Rating",
+                "binIMDB_Rating_end"
             ]
         },
         {
             "filter": "datum.binIMDB_Rating !== null"
         },
         {
-            "window": [
-                {
-                    "op": "sum",
-                    "as": "cumulativeCount",
-                    "field": "count"
-                }
+            "frame": [
+                null,
+                0
             ],
             "sort": [
                 {
@@ -34,52 +73,13 @@
                     "order": "ascending"
                 }
             ],
-            "frame": [
-                null,
-                0
-            ]
-        }
-    ],
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/movies.json"
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "layer": [
-        {
-            "mark": "bar",
-            "encoding": {
-                "y": {
-                    "field": "cumulativeCount",
-                    "type": "quantitative"
-                }
-            }
-        },
-        {
-            "mark": {
-                "color": "yellow",
-                "opacity": 0.5,
-                "type": "bar"
-            },
-            "encoding": {
-                "y": {
+            "window": [
+                {
+                    "as": "cumulativeCount",
                     "field": "count",
-                    "type": "quantitative"
+                    "op": "sum"
                 }
-            }
-        }
-    ],
-    "encoding": {
-        "x2": {
-            "field": "binIMDB_Rating_end"
-        },
-        "x": {
-            "field": "binIMDB_Rating",
-            "scale": {
-                "zero": false
-            },
-            "title": "IMDB Rating",
-            "type": "quantitative"
+            ]
         }
-    },
-    "description": "Layered Histogram and Cumulative Histogram"
+    ]
 }
diff --git a/tests/specs/gallery/advanced/layered2.vl b/tests/specs/gallery/advanced/layered2.vl
--- a/tests/specs/gallery/advanced/layered2.vl
+++ b/tests/specs/gallery/advanced/layered2.vl
@@ -1,19 +1,11 @@
 {
-    "transform": [
-        {
-            "filter": "datum.symbol === 'GOOG'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Plot showing average data with raw values in the background.",
     "layer": [
         {
-            "mark": {
-                "opacity": 0.3,
-                "type": "point"
-            },
             "encoding": {
                 "x": {
                     "field": "date",
@@ -24,10 +16,13 @@
                     "field": "price",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "opacity": 0.3,
+                "type": "point"
             }
         },
         {
-            "mark": "line",
             "encoding": {
                 "x": {
                     "field": "date",
@@ -35,12 +30,17 @@
                     "type": "temporal"
                 },
                 "y": {
-                    "field": "price",
                     "aggregate": "mean",
+                    "field": "price",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "line"
         }
     ],
-    "description": "Plot showing average data with raw values in the background."
+    "transform": [
+        {
+            "filter": "datum.symbol === 'GOOG'"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/advanced/layered3.vl b/tests/specs/gallery/advanced/layered3.vl
--- a/tests/specs/gallery/advanced/layered3.vl
+++ b/tests/specs/gallery/advanced/layered3.vl
@@ -1,31 +1,12 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "mean",
-                    "as": "rollingMean",
-                    "field": "temp_max"
-                }
-            ],
-            "frame": [
-                -15,
-                15
-            ]
-        }
-    ],
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Plot showing a 30 day rolling average with raw values in the background.",
+    "height": 300,
     "layer": [
         {
-            "mark": {
-                "opacity": 0.3,
-                "type": "point"
-            },
             "encoding": {
                 "x": {
                     "field": "date",
@@ -37,14 +18,13 @@
                     "title": "Maximum temperature",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "opacity": 0.3,
+                "type": "point"
             }
         },
         {
-            "mark": {
-                "color": "red",
-                "size": 3,
-                "type": "line"
-            },
             "encoding": {
                 "x": {
                     "field": "date",
@@ -54,8 +34,28 @@
                     "field": "rollingMean",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "size": 3,
+                "type": "line"
             }
         }
     ],
-    "description": "Plot showing a 30 day rolling average with raw values in the background."
+    "transform": [
+        {
+            "frame": [
+                -15,
+                15
+            ],
+            "window": [
+                {
+                    "as": "rollingMean",
+                    "field": "temp_max",
+                    "op": "mean"
+                }
+            ]
+        }
+    ],
+    "width": 400
 }
diff --git a/tests/specs/gallery/advanced/transform1.vl b/tests/specs/gallery/advanced/transform1.vl
--- a/tests/specs/gallery/advanced/transform1.vl
+++ b/tests/specs/gallery/advanced/transform1.vl
@@ -1,87 +1,87 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "count",
-                    "as": "cumulativeCount"
-                }
-            ],
-            "sort": [
-                {
-                    "field": "NOX",
-                    "order": "ascending"
-                }
-            ]
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "format": {
+            "parse": {
+                "NOX": "number"
+            }
+        },
+        "url": "https://gicentre.github.io/data/putneyAirQuality2018.csv"
+    },
+    "description": "Cumulative Frequency Distribution",
+    "encoding": {
+        "x": {
+            "field": "NOX",
+            "title": "NOX concentration (μg/㎥)",
+            "type": "quantitative"
+        },
+        "y": {
+            "field": "cumulativeCount",
+            "type": "quantitative"
         }
-    ],
+    },
     "mark": {
-        "strokeWidth": 2,
-        "stroke": {
+        "fill": {
+            "gradient": "linear",
             "stops": [
                 {
-                    "color": "orange",
+                    "color": "white",
                     "offset": 0
                 },
                 {
-                    "color": "green",
-                    "offset": 0.5
-                },
-                {
-                    "color": "purple",
+                    "color": "black",
                     "offset": 1
                 }
             ],
-            "gradient": "linear"
-        },
-        "fill": {
+            "x1": 0,
             "x2": 1,
             "y1": 1,
+            "y2": 1
+        },
+        "fillOpacity": 0.5,
+        "stroke": {
+            "gradient": "linear",
             "stops": [
                 {
-                    "color": "white",
+                    "color": "orange",
                     "offset": 0
                 },
                 {
-                    "color": "black",
+                    "color": "green",
+                    "offset": 0.5
+                },
+                {
+                    "color": "purple",
                     "offset": 1
                 }
-            ],
-            "gradient": "linear",
-            "y2": 1,
-            "x1": 0
+            ]
         },
-        "strokeDashOffset": 5,
         "strokeDash": [
             10,
             6,
             6,
             6
         ],
+        "strokeDashOffset": 5,
         "strokeOpacity": 0.8,
-        "type": "area",
-        "fillOpacity": 0.5
-    },
-    "data": {
-        "url": "https://gicentre.github.io/data/putneyAirQuality2018.csv",
-        "format": {
-            "parse": {
-                "NOX": "number"
-            }
-        }
+        "strokeWidth": 2,
+        "type": "area"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "encoding": {
-        "x": {
-            "field": "NOX",
-            "title": "NOX concentration (μg/㎥)",
-            "type": "quantitative"
-        },
-        "y": {
-            "field": "cumulativeCount",
-            "type": "quantitative"
+    "transform": [
+        {
+            "sort": [
+                {
+                    "field": "NOX",
+                    "order": "ascending"
+                }
+            ],
+            "window": [
+                {
+                    "as": "cumulativeCount",
+                    "op": "count"
+                }
+            ]
         }
-    },
-    "description": "Cumulative Frequency Distribution"
+    ],
+    "width": 500
 }
diff --git a/tests/specs/gallery/area/area1.vl b/tests/specs/gallery/area/area1.vl
--- a/tests/specs/gallery/area/area1.vl
+++ b/tests/specs/gallery/area/area1.vl
@@ -1,28 +1,28 @@
 {
-    "height": 200,
-    "mark": "area",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/unemployment-across-industries.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Unemployment over time (area chart)",
     "encoding": {
         "x": {
-            "field": "date",
-            "timeUnit": "yearmonth",
-            "type": "temporal",
             "axis": {
                 "format": "%Y"
-            }
+            },
+            "field": "date",
+            "timeUnit": "yearmonth",
+            "type": "temporal"
         },
         "y": {
-            "field": "count",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Count"
-            }
+            },
+            "field": "count",
+            "type": "quantitative"
         }
     },
-    "description": "Unemployment over time (area chart)"
+    "height": 200,
+    "mark": "area",
+    "width": 300
 }
diff --git a/tests/specs/gallery/area/area2.vl b/tests/specs/gallery/area/area2.vl
--- a/tests/specs/gallery/area/area2.vl
+++ b/tests/specs/gallery/area/area2.vl
@@ -1,30 +1,30 @@
 {
-    "transform": [
-        {
-            "filter": "datum.symbol === 'GOOG'"
-        }
-    ],
-    "mark": {
-        "line": true,
-        "point": true,
-        "type": "area"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Area chart with overlaid lines and point markers",
     "encoding": {
         "x": {
-            "field": "date",
-            "type": "temporal",
             "axis": {
                 "format": "%Y"
-            }
+            },
+            "field": "date",
+            "type": "temporal"
         },
         "y": {
             "field": "price",
             "type": "quantitative"
         }
     },
-    "description": "Area chart with overlaid lines and point markers"
+    "mark": {
+        "line": true,
+        "point": true,
+        "type": "area"
+    },
+    "transform": [
+        {
+            "filter": "datum.symbol === 'GOOG'"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/area/area3.vl b/tests/specs/gallery/area/area3.vl
--- a/tests/specs/gallery/area/area3.vl
+++ b/tests/specs/gallery/area/area3.vl
@@ -1,9 +1,9 @@
 {
-    "mark": "area",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/unemployment-across-industries.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Unemployment across industries as a stacked area chart.",
     "encoding": {
         "color": {
             "field": "series",
@@ -13,18 +13,18 @@
             "type": "nominal"
         },
         "x": {
-            "field": "date",
-            "timeUnit": "yearmonth",
-            "type": "temporal",
             "axis": {
                 "format": "%Y"
-            }
+            },
+            "field": "date",
+            "timeUnit": "yearmonth",
+            "type": "temporal"
         },
         "y": {
-            "field": "count",
             "aggregate": "sum",
+            "field": "count",
             "type": "quantitative"
         }
     },
-    "description": "Unemployment across industries as a stacked area chart."
+    "mark": "area"
 }
diff --git a/tests/specs/gallery/area/area4.vl b/tests/specs/gallery/area/area4.vl
--- a/tests/specs/gallery/area/area4.vl
+++ b/tests/specs/gallery/area/area4.vl
@@ -1,11 +1,9 @@
 {
-    "height": 200,
-    "mark": "area",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/unemployment-across-industries.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Unemployment across industries as a normalised area chart.",
     "encoding": {
         "color": {
             "field": "series",
@@ -15,21 +13,23 @@
             "type": "nominal"
         },
         "x": {
-            "field": "date",
-            "timeUnit": "yearmonth",
-            "type": "temporal",
             "axis": {
                 "domain": false,
                 "format": "%Y"
-            }
+            },
+            "field": "date",
+            "timeUnit": "yearmonth",
+            "type": "temporal"
         },
         "y": {
-            "field": "count",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": null,
-            "stack": "normalize"
+            "field": "count",
+            "stack": "normalize",
+            "type": "quantitative"
         }
     },
-    "description": "Unemployment across industries as a normalised area chart."
+    "height": 200,
+    "mark": "area",
+    "width": 300
 }
diff --git a/tests/specs/gallery/area/area5.vl b/tests/specs/gallery/area/area5.vl
--- a/tests/specs/gallery/area/area5.vl
+++ b/tests/specs/gallery/area/area5.vl
@@ -1,11 +1,9 @@
 {
-    "height": 200,
-    "mark": "area",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/unemployment-across-industries.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Unemployment across industries as a streamgraph (centred, stacked area chart).",
     "encoding": {
         "color": {
             "field": "series",
@@ -15,21 +13,23 @@
             "type": "nominal"
         },
         "x": {
-            "field": "date",
-            "timeUnit": "yearmonth",
-            "type": "temporal",
             "axis": {
                 "domain": false,
                 "format": "%Y"
-            }
+            },
+            "field": "date",
+            "timeUnit": "yearmonth",
+            "type": "temporal"
         },
         "y": {
-            "field": "count",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": null,
-            "stack": "center"
+            "field": "count",
+            "stack": "center",
+            "type": "quantitative"
         }
     },
-    "description": "Unemployment across industries as a streamgraph (centred, stacked area chart)."
+    "height": 200,
+    "mark": "area",
+    "width": 300
 }
diff --git a/tests/specs/gallery/area/area6.vl b/tests/specs/gallery/area/area6.vl
--- a/tests/specs/gallery/area/area6.vl
+++ b/tests/specs/gallery/area/area6.vl
@@ -1,9 +1,9 @@
 {
-    "height": 50,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "area": {
-            "orient": "vertical",
-            "interpolate": "monotone"
+            "interpolate": "monotone",
+            "orient": "vertical"
         }
     },
     "data": {
@@ -90,14 +90,20 @@
             }
         ]
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Horizon chart with 2 layers. (See https://idl.cs.washington.edu/papers/horizon/ for more details on horizon charts.)",
+    "encoding": {
+        "x": {
+            "field": "x",
+            "scale": {
+                "nice": false,
+                "zero": false
+            },
+            "type": "quantitative"
+        }
+    },
+    "height": 50,
     "layer": [
         {
-            "mark": {
-                "type": "area",
-                "clip": true
-            },
             "encoding": {
                 "opacity": {
                     "value": 0.6
@@ -112,24 +118,21 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "clip": true,
+                "type": "area"
             }
         },
         {
-            "transform": [
-                {
-                    "as": "ny",
-                    "calculate": "datum.y - 50"
-                }
-            ],
-            "mark": {
-                "type": "area",
-                "clip": true
-            },
             "encoding": {
                 "opacity": {
                     "value": 0.3
                 },
                 "y": {
+                    "axis": {
+                        "title": "y"
+                    },
                     "field": "ny",
                     "scale": {
                         "domain": [
@@ -137,23 +140,20 @@
                             50
                         ]
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": "y"
-                    }
+                    "type": "quantitative"
                 }
-            }
-        }
-    ],
-    "encoding": {
-        "x": {
-            "field": "x",
-            "scale": {
-                "zero": false,
-                "nice": false
             },
-            "type": "quantitative"
+            "mark": {
+                "clip": true,
+                "type": "area"
+            },
+            "transform": [
+                {
+                    "as": "ny",
+                    "calculate": "datum.y - 50"
+                }
+            ]
         }
-    },
-    "description": "Horizon chart with 2 layers. (See https://idl.cs.washington.edu/papers/horizon/ for more details on horizon charts.)"
+    ],
+    "width": 300
 }
diff --git a/tests/specs/gallery/area/area7.vl b/tests/specs/gallery/area/area7.vl
--- a/tests/specs/gallery/area/area7.vl
+++ b/tests/specs/gallery/area/area7.vl
@@ -1,23 +1,46 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "config": {
+        "axis": {
+            "domain": false,
+            "grid": false,
+            "labels": false,
+            "ticks": false
+        },
+        "concat": {
+            "spacing": 10
+        },
+        "view": {
+            "stroke": null
+        }
+    },
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/cars.json"
+    },
+    "resolve": {
+        "scale": {
+            "x": "shared"
+        }
+    },
     "transform": [
         {
-            "groupby": [
-                "Origin",
-                "Cylinders"
-            ],
             "aggregate": [
                 {
-                    "op": "count",
-                    "as": "count_*"
+                    "as": "count_*",
+                    "op": "count"
                 }
+            ],
+            "groupby": [
+                "Origin",
+                "Cylinders"
             ]
         },
         {
-            "groupby": [],
             "as": [
                 "stack_count_Origin1",
                 "stack_count_Origin2"
             ],
+            "groupby": [],
             "offset": "normalize",
             "sort": [
                 {
@@ -28,47 +51,45 @@
             "stack": "count_*"
         },
         {
+            "frame": [
+                null,
+                null
+            ],
+            "groupby": [
+                "Origin"
+            ],
+            "sort": [
+                {
+                    "field": "Cylinders",
+                    "order": "ascending"
+                }
+            ],
             "window": [
                 {
-                    "op": "min",
                     "as": "x",
-                    "field": "stack_count_Origin1"
+                    "field": "stack_count_Origin1",
+                    "op": "min"
                 },
                 {
-                    "op": "max",
                     "as": "x2",
-                    "field": "stack_count_Origin2"
+                    "field": "stack_count_Origin2",
+                    "op": "max"
                 },
                 {
-                    "op": "dense_rank",
-                    "as": "rank_Cylinders"
+                    "as": "rank_Cylinders",
+                    "op": "dense_rank"
                 },
                 {
-                    "op": "distinct",
                     "as": "distinct_Cylinders",
-                    "field": "Cylinders"
-                }
-            ],
-            "groupby": [
-                "Origin"
-            ],
-            "sort": [
-                {
                     "field": "Cylinders",
-                    "order": "ascending"
+                    "op": "distinct"
                 }
-            ],
-            "frame": [
-                null,
-                null
             ]
         },
         {
-            "window": [
-                {
-                    "op": "dense_rank",
-                    "as": "rank_Origin"
-                }
+            "frame": [
+                null,
+                null
             ],
             "sort": [
                 {
@@ -76,19 +97,21 @@
                     "order": "ascending"
                 }
             ],
-            "frame": [
-                null,
-                null
+            "window": [
+                {
+                    "as": "rank_Origin",
+                    "op": "dense_rank"
+                }
             ]
         },
         {
-            "groupby": [
-                "Origin"
-            ],
             "as": [
                 "y",
                 "y2"
             ],
+            "groupby": [
+                "Origin"
+            ],
             "offset": "normalize",
             "sort": [
                 {
@@ -123,73 +146,47 @@
             "calculate": "(datum.ny+datum.ny2)/2"
         }
     ],
-    "config": {
-        "concat": {
-            "spacing": 10
-        },
-        "view": {
-            "stroke": null
-        },
-        "axis": {
-            "domain": false,
-            "labels": false,
-            "grid": false,
-            "ticks": false
-        }
-    },
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/cars.json"
-    },
-    "resolve": {
-        "scale": {
-            "x": "shared"
-        }
-    },
     "vconcat": [
         {
-            "mark": {
-                "align": "center",
-                "type": "text",
-                "baseline": "middle"
-            },
             "encoding": {
                 "color": {
                     "field": "Origin",
-                    "type": "nominal",
-                    "legend": null
+                    "legend": null,
+                    "type": "nominal"
                 },
                 "text": {
                     "field": "Origin",
                     "type": "nominal"
                 },
                 "x": {
-                    "field": "xc",
                     "aggregate": "min",
-                    "title": "Origin",
-                    "type": "quantitative",
                     "axis": {
                         "orient": "top"
-                    }
+                    },
+                    "field": "xc",
+                    "title": "Origin",
+                    "type": "quantitative"
                 }
+            },
+            "mark": {
+                "align": "center",
+                "baseline": "middle",
+                "type": "text"
             }
         },
         {
             "layer": [
                 {
-                    "mark": "rect",
                     "encoding": {
-                        "x2": {
-                            "field": "nx2"
-                        },
                         "color": {
                             "field": "Origin",
-                            "type": "nominal",
-                            "legend": null
+                            "legend": null,
+                            "type": "nominal"
                         },
                         "opacity": {
                             "field": "Cylinders",
-                            "type": "quantitative",
-                            "legend": null
+                            "legend": null,
+                            "type": "quantitative"
                         },
                         "tooltip": [
                             {
@@ -202,46 +199,49 @@
                             }
                         ],
                         "x": {
+                            "axis": null,
                             "field": "nx",
-                            "type": "quantitative",
-                            "axis": null
+                            "type": "quantitative"
                         },
-                        "y2": {
-                            "field": "ny2"
+                        "x2": {
+                            "field": "nx2"
                         },
                         "y": {
+                            "axis": null,
                             "field": "ny",
-                            "type": "quantitative",
-                            "axis": null
+                            "type": "quantitative"
+                        },
+                        "y2": {
+                            "field": "ny2"
                         }
-                    }
+                    },
+                    "mark": "rect"
                 },
                 {
-                    "mark": {
-                        "type": "text",
-                        "baseline": "middle"
-                    },
                     "encoding": {
                         "text": {
                             "field": "Cylinders",
                             "type": "nominal"
                         },
                         "x": {
+                            "axis": null,
                             "field": "xc",
-                            "type": "quantitative",
-                            "axis": null
+                            "type": "quantitative"
                         },
                         "y": {
-                            "field": "yc",
-                            "type": "quantitative",
                             "axis": {
                                 "title": "Cylinders"
-                            }
+                            },
+                            "field": "yc",
+                            "type": "quantitative"
                         }
+                    },
+                    "mark": {
+                        "baseline": "middle",
+                        "type": "text"
                     }
                 }
             ]
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    ]
 }
diff --git a/tests/specs/gallery/area/lasagna.vl b/tests/specs/gallery/area/lasagna.vl
--- a/tests/specs/gallery/area/lasagna.vl
+++ b/tests/specs/gallery/area/lasagna.vl
@@ -1,36 +1,21 @@
 {
-    "transform": [
-        {
-            "filter": "datum.symbol !== 'GOOG'"
-        }
-    ],
-    "height": 100,
-    "mark": "rect",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
-            "field": "price",
             "aggregate": "sum",
+            "field": "price",
             "title": "Price",
             "type": "quantitative"
         },
         "x": {
-            "field": "date",
-            "timeUnit": "yearmonthdate",
-            "title": "Time",
-            "type": "ordinal",
             "axis": {
-                "labelAngle": 0,
-                "labelOverlap": false,
                 "format": "%Y",
+                "labelAngle": 0,
                 "labelColor": {
-                    "value": null,
                     "condition": {
-                        "value": "black",
                         "test": {
                             "equal": {
                                 "date": 1,
@@ -38,13 +23,14 @@
                             },
                             "field": "value",
                             "timeUnit": "monthdate"
-                        }
-                    }
+                        },
+                        "value": "black"
+                    },
+                    "value": null
                 },
+                "labelOverlap": false,
                 "tickColor": {
-                    "value": null,
                     "condition": {
-                        "value": "black",
                         "test": {
                             "equal": {
                                 "date": 1,
@@ -52,15 +38,29 @@
                             },
                             "field": "value",
                             "timeUnit": "monthdate"
-                        }
-                    }
+                        },
+                        "value": "black"
+                    },
+                    "value": null
                 }
-            }
+            },
+            "field": "date",
+            "timeUnit": "yearmonthdate",
+            "title": "Time",
+            "type": "ordinal"
         },
         "y": {
             "field": "symbol",
             "title": null,
             "type": "nominal"
         }
-    }
+    },
+    "height": 100,
+    "mark": "rect",
+    "transform": [
+        {
+            "filter": "datum.symbol !== 'GOOG'"
+        }
+    ],
+    "width": 300
 }
diff --git a/tests/specs/gallery/bar/agesorted.vl b/tests/specs/gallery/bar/agesorted.vl
--- a/tests/specs/gallery/bar/agesorted.vl
+++ b/tests/specs/gallery/bar/agesorted.vl
@@ -1,25 +1,17 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        }
-    ],
-    "height": {
-        "step": 17
-    },
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A bar chart showing the US population distribution of age groups in 2000, sorted by population",
     "encoding": {
         "x": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         },
         "y": {
             "field": "age",
@@ -30,5 +22,13 @@
             "type": "ordinal"
         }
     },
-    "description": "A bar chart showing the US population distribution of age groups in 2000, sorted by population"
+    "height": {
+        "step": 17
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/bar/bar1.vl b/tests/specs/gallery/bar/bar1.vl
--- a/tests/specs/gallery/bar/bar1.vl
+++ b/tests/specs/gallery/bar/bar1.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -40,7 +40,7 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A simple bar chart with embedded data.",
     "encoding": {
         "x": {
             "field": "a",
@@ -51,5 +51,5 @@
             "type": "quantitative"
         }
     },
-    "description": "A simple bar chart with embedded data."
+    "mark": "bar"
 }
diff --git a/tests/specs/gallery/bar/bar10.vl b/tests/specs/gallery/bar/bar10.vl
--- a/tests/specs/gallery/bar/bar10.vl
+++ b/tests/specs/gallery/bar/bar10.vl
@@ -1,21 +1,9 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Layered bar chart showing the US population distribution of age groups and gender in 2000.",
     "encoding": {
         "color": {
             "field": "gender",
@@ -35,14 +23,26 @@
             "type": "ordinal"
         },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
             },
-            "stack": null
+            "field": "people",
+            "stack": null,
+            "type": "quantitative"
         }
     },
-    "description": "Layered bar chart showing the US population distribution of age groups and gender in 2000."
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
+    }
 }
diff --git a/tests/specs/gallery/bar/bar11.vl b/tests/specs/gallery/bar/bar11.vl
--- a/tests/specs/gallery/bar/bar11.vl
+++ b/tests/specs/gallery/bar/bar11.vl
@@ -1,336 +1,336 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
+                "percentage": 0.7,
                 "percentage_end": -18.4,
-                "value": 24,
                 "percentage_start": -19.1,
+                "question": "Q1",
                 "type": "Strongly disagree",
-                "percentage": 0.7,
-                "question": "Q1"
+                "value": 24
             },
             {
+                "percentage": 9.1,
                 "percentage_end": -9.2,
-                "value": 294,
                 "percentage_start": -18.4,
+                "question": "Q1",
                 "type": "Disagree",
-                "percentage": 9.1,
-                "question": "Q1"
+                "value": 294
             },
             {
+                "percentage": 18.5,
                 "percentage_end": 9.2,
-                "value": 594,
                 "percentage_start": -9.2,
+                "question": "Q1",
                 "type": "Neither agree nor disagree",
-                "percentage": 18.5,
-                "question": "Q1"
+                "value": 594
             },
             {
+                "percentage": 59.9,
                 "percentage_end": 69.2,
-                "value": 1927,
                 "percentage_start": 9.2,
+                "question": "Q1",
                 "type": "Agree",
-                "percentage": 59.9,
-                "question": "Q1"
+                "value": 1927
             },
             {
+                "percentage": 11.7,
                 "percentage_end": 80.9,
-                "value": 376,
                 "percentage_start": 69.2,
+                "question": "Q1",
                 "type": "Strongly agree",
-                "percentage": 11.7,
-                "question": "Q1"
+                "value": 376
             },
             {
+                "percentage": 18.2,
                 "percentage_end": -18.2,
-                "value": 2,
                 "percentage_start": -36.4,
+                "question": "Q2",
                 "type": "Strongly disagree",
-                "percentage": 18.2,
-                "question": "Q2"
+                "value": 2
             },
             {
+                "percentage": 18.2,
                 "percentage_end": 0,
-                "value": 2,
                 "percentage_start": -18.2,
+                "question": "Q2",
                 "type": "Disagree",
-                "percentage": 18.2,
-                "question": "Q2"
+                "value": 2
             },
             {
+                "percentage": 0,
                 "percentage_end": 0,
-                "value": 0,
                 "percentage_start": 0,
+                "question": "Q2",
                 "type": "Neither agree nor disagree",
-                "percentage": 0,
-                "question": "Q2"
+                "value": 0
             },
             {
+                "percentage": 63.6,
                 "percentage_end": 63.6,
-                "value": 7,
                 "percentage_start": 0,
+                "question": "Q2",
                 "type": "Agree",
-                "percentage": 63.6,
-                "question": "Q2"
+                "value": 7
             },
             {
+                "percentage": 0,
                 "percentage_end": 63.6,
-                "value": 11,
                 "percentage_start": 63.6,
+                "question": "Q2",
                 "type": "Strongly agree",
-                "percentage": 0,
-                "question": "Q2"
+                "value": 11
             },
             {
+                "percentage": 20,
                 "percentage_end": -10,
-                "value": 2,
                 "percentage_start": -30,
+                "question": "Q3",
                 "type": "Strongly disagree",
-                "percentage": 20,
-                "question": "Q3"
+                "value": 2
             },
             {
+                "percentage": 0,
                 "percentage_end": -10,
-                "value": 0,
                 "percentage_start": -10,
+                "question": "Q3",
                 "type": "Disagree",
-                "percentage": 0,
-                "question": "Q3"
+                "value": 0
             },
             {
+                "percentage": 20,
                 "percentage_end": 10,
-                "value": 2,
                 "percentage_start": -10,
+                "question": "Q3",
                 "type": "Neither agree nor disagree",
-                "percentage": 20,
-                "question": "Q3"
+                "value": 2
             },
             {
+                "percentage": 40,
                 "percentage_end": 50,
-                "value": 4,
                 "percentage_start": 10,
+                "question": "Q3",
                 "type": "Agree",
-                "percentage": 40,
-                "question": "Q3"
+                "value": 4
             },
             {
+                "percentage": 20,
                 "percentage_end": 70,
-                "value": 2,
                 "percentage_start": 50,
+                "question": "Q3",
                 "type": "Strongly agree",
-                "percentage": 20,
-                "question": "Q3"
+                "value": 2
             },
             {
+                "percentage": 0,
                 "percentage_end": -15.6,
-                "value": 0,
                 "percentage_start": -15.6,
+                "question": "Q4",
                 "type": "Strongly disagree",
-                "percentage": 0,
-                "question": "Q4"
+                "value": 0
             },
             {
+                "percentage": 12.5,
                 "percentage_end": -3.1,
-                "value": 2,
                 "percentage_start": -15.6,
+                "question": "Q4",
                 "type": "Disagree",
-                "percentage": 12.5,
-                "question": "Q4"
+                "value": 2
             },
             {
+                "percentage": 6.3,
                 "percentage_end": 3.1,
-                "value": 1,
                 "percentage_start": -3.1,
+                "question": "Q4",
                 "type": "Neither agree nor disagree",
-                "percentage": 6.3,
-                "question": "Q4"
+                "value": 1
             },
             {
+                "percentage": 43.8,
                 "percentage_end": 46.9,
-                "value": 7,
                 "percentage_start": 3.1,
+                "question": "Q4",
                 "type": "Agree",
-                "percentage": 43.8,
-                "question": "Q4"
+                "value": 7
             },
             {
+                "percentage": 37.5,
                 "percentage_end": 84.4,
-                "value": 6,
                 "percentage_start": 46.9,
+                "question": "Q4",
                 "type": "Strongly agree",
-                "percentage": 37.5,
-                "question": "Q4"
+                "value": 6
             },
             {
+                "percentage": 0,
                 "percentage_end": -10.4,
-                "value": 0,
                 "percentage_start": -10.4,
+                "question": "Q5",
                 "type": "Strongly disagree",
-                "percentage": 0,
-                "question": "Q5"
+                "value": 0
             },
             {
+                "percentage": 4.2,
                 "percentage_end": -6.3,
-                "value": 1,
                 "percentage_start": -10.4,
+                "question": "Q5",
                 "type": "Disagree",
-                "percentage": 4.2,
-                "question": "Q5"
+                "value": 1
             },
             {
+                "percentage": 12.5,
                 "percentage_end": 6.3,
-                "value": 3,
                 "percentage_start": -6.3,
+                "question": "Q5",
                 "type": "Neither agree nor disagree",
-                "percentage": 12.5,
-                "question": "Q5"
+                "value": 3
             },
             {
+                "percentage": 66.7,
                 "percentage_end": 72.9,
-                "value": 16,
                 "percentage_start": 6.3,
+                "question": "Q5",
                 "type": "Agree",
-                "percentage": 66.7,
-                "question": "Q5"
+                "value": 16
             },
             {
+                "percentage": 16.7,
                 "percentage_end": 89.6,
-                "value": 4,
                 "percentage_start": 72.9,
+                "question": "Q5",
                 "type": "Strongly agree",
-                "percentage": 16.7,
-                "question": "Q5"
+                "value": 4
             },
             {
+                "percentage": 6.3,
                 "percentage_end": -12.5,
-                "value": 1,
                 "percentage_start": -18.8,
+                "question": "Q6",
                 "type": "Strongly disagree",
-                "percentage": 6.3,
-                "question": "Q6"
+                "value": 1
             },
             {
+                "percentage": 6.3,
                 "percentage_end": -6.3,
-                "value": 1,
                 "percentage_start": -12.5,
+                "question": "Q6",
                 "type": "Disagree",
-                "percentage": 6.3,
-                "question": "Q6"
+                "value": 1
             },
             {
+                "percentage": 12.5,
                 "percentage_end": 6.3,
-                "value": 2,
                 "percentage_start": -6.3,
+                "question": "Q6",
                 "type": "Neither agree nor disagree",
-                "percentage": 12.5,
-                "question": "Q6"
+                "value": 2
             },
             {
+                "percentage": 56.3,
                 "percentage_end": 62.5,
-                "value": 9,
                 "percentage_start": 6.3,
+                "question": "Q6",
                 "type": "Agree",
-                "percentage": 56.3,
-                "question": "Q6"
+                "value": 9
             },
             {
+                "percentage": 18.8,
                 "percentage_end": 81.3,
-                "value": 3,
                 "percentage_start": 62.5,
+                "question": "Q6",
                 "type": "Strongly agree",
-                "percentage": 18.8,
-                "question": "Q6"
+                "value": 3
             },
             {
+                "percentage": 0,
                 "percentage_end": -10,
-                "value": 0,
                 "percentage_start": -10,
+                "question": "Q7",
                 "type": "Strongly disagree",
-                "percentage": 0,
-                "question": "Q7"
+                "value": 0
             },
             {
+                "percentage": 0,
                 "percentage_end": -10,
-                "value": 0,
                 "percentage_start": -10,
+                "question": "Q7",
                 "type": "Disagree",
-                "percentage": 0,
-                "question": "Q7"
+                "value": 0
             },
             {
+                "percentage": 20,
                 "percentage_end": 10,
-                "value": 1,
                 "percentage_start": -10,
+                "question": "Q7",
                 "type": "Neither agree nor disagree",
-                "percentage": 20,
-                "question": "Q7"
+                "value": 1
             },
             {
+                "percentage": 80,
                 "percentage_end": 90,
-                "value": 4,
                 "percentage_start": 10,
+                "question": "Q7",
                 "type": "Agree",
-                "percentage": 80,
-                "question": "Q7"
+                "value": 4
             },
             {
+                "percentage": 0,
                 "percentage_end": 90,
-                "value": 0,
                 "percentage_start": 90,
+                "question": "Q7",
                 "type": "Strongly agree",
-                "percentage": 0,
-                "question": "Q7"
+                "value": 0
             },
             {
+                "percentage": 0,
                 "percentage_end": 0,
-                "value": 0,
                 "percentage_start": 0,
+                "question": "Q8",
                 "type": "Strongly disagree",
-                "percentage": 0,
-                "question": "Q8"
+                "value": 0
             },
             {
+                "percentage": 0,
                 "percentage_end": 0,
-                "value": 0,
                 "percentage_start": 0,
+                "question": "Q8",
                 "type": "Disagree",
-                "percentage": 0,
-                "question": "Q8"
+                "value": 0
             },
             {
+                "percentage": 0,
                 "percentage_end": 0,
-                "value": 0,
                 "percentage_start": 0,
+                "question": "Q8",
                 "type": "Neither agree nor disagree",
-                "percentage": 0,
-                "question": "Q8"
+                "value": 0
             },
             {
+                "percentage": 0,
                 "percentage_end": 0,
-                "value": 0,
                 "percentage_start": 0,
+                "question": "Q8",
                 "type": "Agree",
-                "percentage": 0,
-                "question": "Q8"
+                "value": 0
             },
             {
+                "percentage": 100,
                 "percentage_end": 100,
-                "value": 2,
                 "percentage_start": 0,
+                "question": "Q8",
                 "type": "Strongly agree",
-                "percentage": 100,
-                "question": "Q8"
+                "value": 2
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A diverging stacked bar chart for sentiments towards a set of eight questions, displayed as percentages with neutral responses straddling the 0% mark.",
     "encoding": {
-        "x2": {
-            "field": "percentage_end"
-        },
         "color": {
             "field": "type",
+            "legend": {
+                "title": "Response"
+            },
             "scale": {
                 "domain": [
                     "Strongly disagree",
@@ -348,29 +348,29 @@
                 ],
                 "type": "ordinal"
             },
-            "type": "nominal",
-            "legend": {
-                "title": "Response"
-            }
+            "type": "nominal"
         },
         "x": {
-            "field": "percentage_start",
-            "type": "quantitative",
             "axis": {
                 "title": "Percentage"
-            }
+            },
+            "field": "percentage_start",
+            "type": "quantitative"
         },
+        "x2": {
+            "field": "percentage_end"
+        },
         "y": {
-            "field": "question",
-            "type": "nominal",
             "axis": {
+                "domain": false,
                 "minExtent": 60,
                 "offset": 5,
-                "domain": false,
-                "title": "Question",
-                "ticks": false
-            }
+                "ticks": false,
+                "title": "Question"
+            },
+            "field": "question",
+            "type": "nominal"
         }
     },
-    "description": "A diverging stacked bar chart for sentiments towards a set of eight questions, displayed as percentages with neutral responses straddling the 0% mark."
+    "mark": "bar"
 }
diff --git a/tests/specs/gallery/bar/bar12.vl b/tests/specs/gallery/bar/bar12.vl
--- a/tests/specs/gallery/bar/bar12.vl
+++ b/tests/specs/gallery/bar/bar12.vl
@@ -1,10 +1,11 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "style": {
             "label": {
-                "dx": 3,
                 "align": "left",
-                "baseline": "middle"
+                "baseline": "middle",
+                "dx": 3
             }
         }
     },
@@ -24,33 +25,32 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A simple bar chart with embedded data labels.",
+    "encoding": {
+        "x": {
+            "field": "b",
+            "type": "quantitative"
+        },
+        "y": {
+            "field": "a",
+            "type": "ordinal"
+        }
+    },
     "layer": [
         {
             "mark": "bar"
         },
         {
-            "mark": {
-                "style": "label",
-                "type": "text"
-            },
             "encoding": {
                 "text": {
                     "field": "b",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "style": "label",
+                "type": "text"
             }
         }
-    ],
-    "encoding": {
-        "x": {
-            "field": "b",
-            "type": "quantitative"
-        },
-        "y": {
-            "field": "a",
-            "type": "ordinal"
-        }
-    },
-    "description": "A simple bar chart with embedded data labels."
+    ]
 }
diff --git a/tests/specs/gallery/bar/bar13.vl b/tests/specs/gallery/bar/bar13.vl
--- a/tests/specs/gallery/bar/bar13.vl
+++ b/tests/specs/gallery/bar/bar13.vl
@@ -1,208 +1,204 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
     "data": {
         "values": [
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 1
+                "col": 1,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 2
+                "col": 2,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 3
+                "col": 3,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 4
+                "col": 4,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 5
+                "col": 5,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 6
+                "col": 6,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 7
+                "col": 7,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 8
+                "col": 8,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 9
+                "col": 9,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "pigs",
-                "col": 1
+                "col": 1,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "pigs",
-                "col": 2
+                "col": 2,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "pigs",
-                "col": 3
+                "col": 3,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "pigs",
-                "col": 4
+                "col": 4,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "pigs",
-                "col": 5
+                "col": 5,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "pigs",
-                "col": 6
+                "col": 6,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 1
+                "col": 1,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 2
+                "col": 2,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 3
+                "col": 3,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 4
+                "col": 4,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 5
+                "col": 5,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 6
+                "col": 6,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 7
+                "col": 7,
+                "country": "United States"
             },
             {
-                "country": "Great Britain",
                 "animal": "cattle",
-                "col": 1
+                "col": 1,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "cattle",
-                "col": 2
+                "col": 2,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "cattle",
-                "col": 3
+                "col": 3,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "pigs",
-                "col": 1
+                "col": 1,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "pigs",
-                "col": 2
+                "col": 2,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 1
+                "col": 1,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 2
+                "col": 2,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 3
+                "col": 3,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 4
+                "col": 4,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 5
+                "col": 5,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 6
+                "col": 6,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 7
+                "col": 7,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 8
+                "col": 8,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 9
+                "col": 9,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 10
+                "col": 10,
+                "country": "Great Britain"
             }
         ]
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Isotype bar chart inspired by this Only An Ocean Between, 1943. Population Live Stock, p.13.",
     "encoding": {
         "color": {
             "field": "animal",
+            "legend": null,
             "scale": {
                 "domain": [
                     "person",
@@ -217,17 +213,21 @@
                     "rgb(91,131,149)"
                 ]
             },
-            "type": "nominal",
-            "legend": null
-        },
-        "size": {
-            "value": 200
+            "type": "nominal"
         },
         "opacity": {
             "value": 1
         },
+        "row": {
+            "field": "country",
+            "header": {
+                "title": null
+            },
+            "type": "nominal"
+        },
         "shape": {
             "field": "animal",
+            "legend": null,
             "scale": {
                 "domain": [
                     "person",
@@ -242,26 +242,26 @@
                     "M-4.1 -0.5c0.2 0 0.2 0.2 0.5 0.2c0.3 0 0.3 -0.2 0.5 -0.2c0.2 0 0.2 0.2 0.4 0.2c0.2 0 0.2 -0.2 0.5 -0.2c0.2 0 0.2 0.2 0.4 0.2c0.2 0 0.2 -0.2 0.4 -0.2c0.1 0 0.2 0.2 0.4 0.1c0.2 0 0.2 -0.2 0.4 -0.3c0.1 0 0.1 -0.1 0.4 0c0.3 0 0.3 -0.4 0.6 -0.4c0.3 0 0.6 -0.3 0.7 -0.2c0.1 0.1 1.4 1 1.3 1.4c-0.1 0.4 -0.3 0.3 -0.4 0.3c-0.1 0 -0.5 -0.4 -0.7 -0.2c-0.3 0.2 -0.1 0.4 -0.2 0.6c-0.1 0.1 -0.2 0.2 -0.3 0.4c0 0.2 0.1 0.3 0 0.5c-0.1 0.2 -0.3 0.2 -0.3 0.5c0 0.3 -0.2 0.3 -0.3 0.6c-0.1 0.2 0 0.3 -0.1 0.5c-0.1 0.2 -0.1 0.2 -0.2 0.3c-0.1 0.1 0.3 1.1 0.3 1.1l-0.3 0c0 0 -0.3 -0.9 -0.3 -1c0 -0.1 -0.1 -0.2 -0.3 -0.2c-0.2 0 -0.3 0.1 -0.4 0.4c0 0.3 -0.2 0.8 -0.2 0.8l-0.3 0l0.3 -1c0 0 0.1 -0.6 -0.2 -0.5c-0.3 0.1 -0.2 -0.1 -0.4 -0.1c-0.2 -0.1 -0.3 0.1 -0.4 0c-0.2 -0.1 -0.3 0.1 -0.5 0c-0.2 -0.1 -0.1 0 -0.3 0.3c-0.2 0.3 -0.4 0.3 -0.4 0.3l0.2 1.1l-0.3 0l-0.2 -1.1c0 0 -0.4 -0.6 -0.5 -0.4c-0.1 0.3 -0.1 0.4 -0.3 0.4c-0.1 -0.1 -0.2 1.1 -0.2 1.1l-0.3 0l0.2 -1.1c0 0 -0.3 -0.1 -0.3 -0.5c0 -0.3 0.1 -0.5 0.1 -0.7c0.1 -0.2 -0.1 -1 -0.2 -1.1c-0.1 -0.2 -0.2 -0.8 -0.2 -0.8c0 0 -0.1 -0.5 0.4 -0.8z"
                 ]
             },
-            "type": "nominal",
-            "legend": null
-        },
-        "row": {
-            "field": "country",
-            "header": {
-                "title": null
-            },
             "type": "nominal"
         },
+        "size": {
+            "value": 200
+        },
         "x": {
+            "axis": null,
             "field": "col",
-            "type": "ordinal",
-            "axis": null
+            "type": "ordinal"
         },
         "y": {
+            "axis": null,
             "field": "animal",
-            "type": "ordinal",
-            "axis": null
+            "type": "ordinal"
         }
     },
-    "description": "Isotype bar chart inspired by this Only An Ocean Between, 1943. Population Live Stock, p.13."
+    "height": 200,
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "width": 800
 }
diff --git a/tests/specs/gallery/bar/bar14.vl b/tests/specs/gallery/bar/bar14.vl
--- a/tests/specs/gallery/bar/bar14.vl
+++ b/tests/specs/gallery/bar/bar14.vl
@@ -1,231 +1,201 @@
 {
-    "transform": [
-        {
-            "as": "emoji",
-            "calculate": "{'cattle': '🐄', 'pigs': '🐖', 'sheep': '🐏'}[datum.animal]"
-        },
-        {
-            "window": [
-                {
-                    "op": "rank",
-                    "as": "rank"
-                }
-            ],
-            "groupby": [
-                "country",
-                "animal"
-            ]
-        }
-    ],
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "mark": {
-        "type": "text",
-        "baseline": "middle"
-    },
     "data": {
         "values": [
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 1
+                "col": 1,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 2
+                "col": 2,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 3
+                "col": 3,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 4
+                "col": 4,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 5
+                "col": 5,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 6
+                "col": 6,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 7
+                "col": 7,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 8
+                "col": 8,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "cattle",
-                "col": 9
+                "col": 9,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "pigs",
-                "col": 1
+                "col": 1,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "pigs",
-                "col": 2
+                "col": 2,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "pigs",
-                "col": 3
+                "col": 3,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "pigs",
-                "col": 4
+                "col": 4,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "pigs",
-                "col": 5
+                "col": 5,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "pigs",
-                "col": 6
+                "col": 6,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 1
+                "col": 1,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 2
+                "col": 2,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 3
+                "col": 3,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 4
+                "col": 4,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 5
+                "col": 5,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 6
+                "col": 6,
+                "country": "United States"
             },
             {
-                "country": "United States",
                 "animal": "sheep",
-                "col": 7
+                "col": 7,
+                "country": "United States"
             },
             {
-                "country": "Great Britain",
                 "animal": "cattle",
-                "col": 1
+                "col": 1,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "cattle",
-                "col": 2
+                "col": 2,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "cattle",
-                "col": 3
+                "col": 3,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "pigs",
-                "col": 1
+                "col": 1,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "pigs",
-                "col": 2
+                "col": 2,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 1
+                "col": 1,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 2
+                "col": 2,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 3
+                "col": 3,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 4
+                "col": 4,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 5
+                "col": 5,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 6
+                "col": 6,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 7
+                "col": 7,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 8
+                "col": 8,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 9
+                "col": 9,
+                "country": "Great Britain"
             },
             {
-                "country": "Great Britain",
                 "animal": "sheep",
-                "col": 10
+                "col": 10,
+                "country": "Great Britain"
             }
         ]
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Isotype bar chart using emojis for symbols",
     "encoding": {
-        "size": {
-            "value": 65
-        },
-        "text": {
-            "field": "emoji",
-            "type": "nominal"
-        },
         "row": {
             "field": "country",
             "header": {
@@ -233,17 +203,47 @@
             },
             "type": "nominal"
         },
+        "size": {
+            "value": 65
+        },
+        "text": {
+            "field": "emoji",
+            "type": "nominal"
+        },
         "x": {
+            "axis": null,
             "field": "rank",
-            "type": "ordinal",
-            "axis": null
+            "type": "ordinal"
         },
         "y": {
+            "axis": null,
             "field": "animal",
             "sort": null,
-            "type": "nominal",
-            "axis": null
+            "type": "nominal"
         }
     },
-    "description": "Isotype bar chart using emojis for symbols"
+    "height": 200,
+    "mark": {
+        "baseline": "middle",
+        "type": "text"
+    },
+    "transform": [
+        {
+            "as": "emoji",
+            "calculate": "{'cattle': '🐄', 'pigs': '🐖', 'sheep': '🐏'}[datum.animal]"
+        },
+        {
+            "groupby": [
+                "country",
+                "animal"
+            ],
+            "window": [
+                {
+                    "as": "rank",
+                    "op": "rank"
+                }
+            ]
+        }
+    ],
+    "width": 800
 }
diff --git a/tests/specs/gallery/bar/bar2.vl b/tests/specs/gallery/bar/bar2.vl
--- a/tests/specs/gallery/bar/bar2.vl
+++ b/tests/specs/gallery/bar/bar2.vl
@@ -1,16 +1,13 @@
 {
-    "mark": {
-        "binSpacing": 0,
-        "type": "bar"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Simple histogram of IMDB ratings.",
     "encoding": {
         "x": {
-            "field": "IMDB_Rating",
             "bin": true,
+            "field": "IMDB_Rating",
             "type": "quantitative"
         },
         "y": {
@@ -18,5 +15,8 @@
             "type": "quantitative"
         }
     },
-    "description": "Simple histogram of IMDB ratings."
+    "mark": {
+        "binSpacing": 0,
+        "type": "bar"
+    }
 }
diff --git a/tests/specs/gallery/bar/bar3.vl b/tests/specs/gallery/bar/bar3.vl
--- a/tests/specs/gallery/bar/bar3.vl
+++ b/tests/specs/gallery/bar/bar3.vl
@@ -1,25 +1,17 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        }
-    ],
-    "height": {
-        "step": 17
-    },
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A bar chart showing the US population distribution of age groups in 2000.",
     "encoding": {
         "x": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         },
         "y": {
             "field": "age",
@@ -27,5 +19,13 @@
             "type": "ordinal"
         }
     },
-    "description": "A bar chart showing the US population distribution of age groups in 2000."
+    "height": {
+        "step": 17
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/bar/bar4.vl b/tests/specs/gallery/bar/bar4.vl
--- a/tests/specs/gallery/bar/bar4.vl
+++ b/tests/specs/gallery/bar/bar4.vl
@@ -1,29 +1,17 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
-        "view": {
-            "stroke": null
-        },
         "axis": {
             "domainWidth": 1
+        },
+        "view": {
+            "stroke": null
         }
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 12
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Grouped bar chart showing population structure by age and gender.",
     "encoding": {
         "color": {
             "field": "gender",
@@ -35,26 +23,38 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "gender",
-            "type": "nominal",
-            "axis": {
-                "title": null
-            }
-        },
         "column": {
             "field": "age",
             "type": "ordinal"
         },
+        "x": {
+            "axis": {
+                "title": null
+            },
+            "field": "gender",
+            "type": "nominal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "grid": false,
                 "title": "population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
     },
-    "description": "Grouped bar chart showing population structure by age and gender."
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 12
+    }
 }
diff --git a/tests/specs/gallery/bar/bar5.vl b/tests/specs/gallery/bar/bar5.vl
--- a/tests/specs/gallery/bar/bar5.vl
+++ b/tests/specs/gallery/bar/bar5.vl
@@ -1,12 +1,15 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Seattle weather stacked bar chart",
     "encoding": {
         "color": {
             "field": "weather",
+            "legend": {
+                "title": "Weather type"
+            },
             "scale": {
                 "domain": [
                     "sun",
@@ -23,23 +26,20 @@
                     "#9467bd"
                 ]
             },
-            "type": "nominal",
-            "legend": {
-                "title": "Weather type"
-            }
+            "type": "nominal"
         },
         "x": {
-            "field": "date",
-            "timeUnit": "month",
-            "type": "ordinal",
             "axis": {
                 "title": "Month of the year"
-            }
+            },
+            "field": "date",
+            "timeUnit": "month",
+            "type": "ordinal"
         },
         "y": {
             "aggregate": "count",
             "type": "quantitative"
         }
     },
-    "description": "Seattle weather stacked bar chart"
+    "mark": "bar"
 }
diff --git a/tests/specs/gallery/bar/bar6.vl b/tests/specs/gallery/bar/bar6.vl
--- a/tests/specs/gallery/bar/bar6.vl
+++ b/tests/specs/gallery/bar/bar6.vl
@@ -1,17 +1,17 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/barley.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Barley crop yields as a horizontal stacked bar chart",
     "encoding": {
         "color": {
             "field": "site",
             "type": "nominal"
         },
         "x": {
-            "field": "yield",
             "aggregate": "sum",
+            "field": "yield",
             "type": "quantitative"
         },
         "y": {
@@ -19,5 +19,5 @@
             "type": "nominal"
         }
     },
-    "description": "Barley crop yields as a horizontal stacked bar chart"
+    "mark": "bar"
 }
diff --git a/tests/specs/gallery/bar/bar6order.vl b/tests/specs/gallery/bar/bar6order.vl
new file mode 100644
--- /dev/null
+++ b/tests/specs/gallery/bar/bar6order.vl
@@ -0,0 +1,27 @@
+{
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/barley.json"
+    },
+    "encoding": {
+        "color": {
+            "field": "site",
+            "type": "nominal"
+        },
+        "order": {
+            "aggregate": "sum",
+            "field": "yield",
+            "type": "quantitative"
+        },
+        "x": {
+            "aggregate": "sum",
+            "field": "yield",
+            "type": "quantitative"
+        },
+        "y": {
+            "field": "variety",
+            "type": "nominal"
+        }
+    },
+    "mark": "bar"
+}
diff --git a/tests/specs/gallery/bar/bar6sort.vl b/tests/specs/gallery/bar/bar6sort.vl
new file mode 100644
--- /dev/null
+++ b/tests/specs/gallery/bar/bar6sort.vl
@@ -0,0 +1,31 @@
+{
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/barley.json"
+    },
+    "encoding": {
+        "color": {
+            "field": "site",
+            "type": "nominal"
+        },
+        "order": {
+            "field": "siteOrder"
+        },
+        "x": {
+            "aggregate": "sum",
+            "field": "yield",
+            "type": "quantitative"
+        },
+        "y": {
+            "field": "variety",
+            "type": "nominal"
+        }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "as": "siteOrder",
+            "calculate": "if(datum.site === 'University Farm', 0, if(datum.site === 'Grand Rapids', 1, 2))"
+        }
+    ]
+}
diff --git a/tests/specs/gallery/bar/bar7.vl b/tests/specs/gallery/bar/bar7.vl
--- a/tests/specs/gallery/bar/bar7.vl
+++ b/tests/specs/gallery/bar/bar7.vl
@@ -1,21 +1,9 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Population structure as a normalised stacked bar chart.",
     "encoding": {
         "color": {
             "field": "gender",
@@ -32,14 +20,26 @@
             "type": "ordinal"
         },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
             },
-            "stack": "normalize"
+            "field": "people",
+            "stack": "normalize",
+            "type": "quantitative"
         }
     },
-    "description": "Population structure as a normalised stacked bar chart."
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
+    }
 }
diff --git a/tests/specs/gallery/bar/bar8.vl b/tests/specs/gallery/bar/bar8.vl
--- a/tests/specs/gallery/bar/bar8.vl
+++ b/tests/specs/gallery/bar/bar8.vl
@@ -1,37 +1,37 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "start": 1,
                 "end": 3,
+                "start": 1,
                 "task": "A"
             },
             {
-                "start": 3,
                 "end": 8,
+                "start": 3,
                 "task": "B"
             },
             {
-                "start": 8,
                 "end": 10,
+                "start": 8,
                 "task": "C"
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A simple bar chart with ranged data (aka Gantt Chart).",
     "encoding": {
-        "x2": {
-            "field": "end"
-        },
         "x": {
             "field": "start",
             "type": "quantitative"
         },
+        "x2": {
+            "field": "end"
+        },
         "y": {
             "field": "task",
             "type": "ordinal"
         }
     },
-    "description": "A simple bar chart with ranged data (aka Gantt Chart)."
+    "mark": "bar"
 }
diff --git a/tests/specs/gallery/bar/bar9.vl b/tests/specs/gallery/bar/bar9.vl
--- a/tests/specs/gallery/bar/bar9.vl
+++ b/tests/specs/gallery/bar/bar9.vl
@@ -1,22 +1,22 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "color": "red",
-                "b": 28
+                "b": 28,
+                "color": "red"
             },
             {
-                "color": "green",
-                "b": 55
+                "b": 55,
+                "color": "green"
             },
             {
-                "color": "blue",
-                "b": 43
+                "b": 43,
+                "color": "blue"
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A bar chart that directly encodes color names in the data.",
     "encoding": {
         "color": {
             "field": "color",
@@ -32,5 +32,5 @@
             "type": "quantitative"
         }
     },
-    "description": "A bar chart that directly encodes color names in the data."
+    "mark": "bar"
 }
diff --git a/tests/specs/gallery/bar/baraxisspacesaving.vl b/tests/specs/gallery/bar/baraxisspacesaving.vl
--- a/tests/specs/gallery/bar/baraxisspacesaving.vl
+++ b/tests/specs/gallery/bar/baraxisspacesaving.vl
@@ -1,46 +1,46 @@
 {
-    "height": {
-        "step": 50
-    },
-    "mark": {
-        "cornerRadiusEnd": 2,
-        "yOffset": 5,
-        "type": "bar"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Bar Chart with a spacing-saving y-axis",
     "encoding": {
         "x": {
             "aggregate": "count",
-            "type": "quantitative",
             "axis": {
                 "grid": false
-            }
+            },
+            "type": "quantitative"
         },
         "y": {
-            "field": "Origin",
-            "scale": {
-                "padding": 0
-            },
-            "type": "nominal",
             "axis": {
-                "titleAlign": "left",
                 "bandPosition": 0,
-                "titleX": 5,
                 "domain": false,
-                "labelOffset": -15,
-                "titleY": -5,
-                "labelPadding": -5,
-                "labelBaseline": "middle",
                 "grid": true,
                 "labelAlign": "left",
+                "labelBaseline": "middle",
+                "labelOffset": -15,
+                "labelPadding": -5,
                 "ticks": false,
-                "titleAngle": 0
+                "titleAlign": "left",
+                "titleAngle": 0,
+                "titleX": 5,
+                "titleY": -5
             },
-            "band": 0.5
+            "band": 0.5,
+            "field": "Origin",
+            "scale": {
+                "padding": 0
+            },
+            "type": "nominal"
         }
     },
-    "description": "Bar Chart with a spacing-saving y-axis"
+    "height": {
+        "step": 50
+    },
+    "mark": {
+        "cornerRadiusEnd": 2,
+        "type": "bar",
+        "yOffset": 5
+    }
 }
diff --git a/tests/specs/gallery/bar/barnegative.vl b/tests/specs/gallery/bar/barnegative.vl
--- a/tests/specs/gallery/bar/barnegative.vl
+++ b/tests/specs/gallery/bar/barnegative.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -40,31 +40,31 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A bar chart with negative values. We can hide the axis domain line, and instead use a conditional grid color to draw a zero baseline.",
     "encoding": {
         "x": {
-            "field": "a",
-            "type": "ordinal",
             "axis": {
-                "labelAngle": 0,
                 "domain": false,
+                "labelAngle": 0,
                 "labelPadding": 4,
                 "ticks": false
-            }
+            },
+            "field": "a",
+            "type": "ordinal"
         },
         "y": {
-            "field": "b",
-            "type": "quantitative",
             "axis": {
                 "gridColor": {
-                    "value": "#ddd",
                     "condition": {
-                        "value": "black",
-                        "test": "datum.value === 0"
-                    }
+                        "test": "datum.value === 0",
+                        "value": "black"
+                    },
+                    "value": "#ddd"
                 }
-            }
+            },
+            "field": "b",
+            "type": "quantitative"
         }
     },
-    "description": "A bar chart with negative values. We can hide the axis domain line, and instead use a conditional grid color to draw a zero baseline."
+    "mark": "bar"
 }
diff --git a/tests/specs/gallery/bar/explicitbins.vl b/tests/specs/gallery/bar/explicitbins.vl
--- a/tests/specs/gallery/bar/explicitbins.vl
+++ b/tests/specs/gallery/bar/explicitbins.vl
@@ -1,64 +1,64 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "binEnd": 10,
-                "count": 7,
-                "binStart": 8
+                "binStart": 8,
+                "count": 7
             },
             {
                 "binEnd": 12,
-                "count": 29,
-                "binStart": 10
+                "binStart": 10,
+                "count": 29
             },
             {
                 "binEnd": 14,
-                "count": 71,
-                "binStart": 12
+                "binStart": 12,
+                "count": 71
             },
             {
                 "binEnd": 16,
-                "count": 127,
-                "binStart": 14
+                "binStart": 14,
+                "count": 127
             },
             {
                 "binEnd": 18,
-                "count": 94,
-                "binStart": 16
+                "binStart": 16,
+                "count": 94
             },
             {
                 "binEnd": 20,
-                "count": 54,
-                "binStart": 18
+                "binStart": 18,
+                "count": 54
             },
             {
                 "binEnd": 22,
-                "count": 17,
-                "binStart": 20
+                "binStart": 20,
+                "count": 17
             },
             {
                 "binEnd": 24,
-                "count": 5,
-                "binStart": 22
+                "binStart": 22,
+                "count": 5
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
-        "x2": {
-            "field": "binEnd"
-        },
         "x": {
-            "field": "binStart",
             "bin": {
                 "step": 2
             },
+            "field": "binStart",
             "type": "quantitative"
         },
+        "x2": {
+            "field": "binEnd"
+        },
         "y": {
             "field": "count",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/gallery/bar/initialletter.vl b/tests/specs/gallery/bar/initialletter.vl
--- a/tests/specs/gallery/bar/initialletter.vl
+++ b/tests/specs/gallery/bar/initialletter.vl
@@ -1,9 +1,30 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
+    },
+    "description": "Using `labelExpr` to show only initial letters of month names.",
+    "encoding": {
+        "x": {
+            "axis": {
+                "labelAlign": "left",
+                "labelExpr": "datum.label[0]"
+            },
+            "field": "date",
+            "timeUnit": "month",
+            "type": "temporal"
+        },
+        "y": {
+            "aggregate": "mean",
+            "field": "precipitation",
+            "type": "quantitative"
+        }
+    },
     "height": 300,
     "mark": {
-        "cornerRadius": 10,
-        "strokeWidth": 4,
+        "blend": "difference",
         "color": {
+            "gradient": "linear",
             "stops": [
                 {
                     "color": "orange",
@@ -13,36 +34,15 @@
                     "color": "cyan",
                     "offset": 1
                 }
-            ],
-            "gradient": "linear"
+            ]
         },
-        "blend": "difference",
+        "cornerRadius": 10,
         "stroke": "yellow",
+        "strokeWidth": 4,
         "tooltip": {
             "content": "data"
         },
         "type": "bar"
     },
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
-    },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "encoding": {
-        "x": {
-            "field": "date",
-            "timeUnit": "month",
-            "type": "temporal",
-            "axis": {
-                "labelExpr": "datum.label[0]",
-                "labelAlign": "left"
-            }
-        },
-        "y": {
-            "field": "precipitation",
-            "aggregate": "mean",
-            "type": "quantitative"
-        }
-    },
-    "description": "Using `labelExpr` to show only initial letters of month names."
+    "width": 400
 }
diff --git a/tests/specs/gallery/bar/labeloverlay.vl b/tests/specs/gallery/bar/labeloverlay.vl
--- a/tests/specs/gallery/bar/labeloverlay.vl
+++ b/tests/specs/gallery/bar/labeloverlay.vl
@@ -1,26 +1,39 @@
 {
-    "transform": [
-        {
-            "as": "genre",
-            "calculate": "isValid(datum.Major_Genre)? datum.Major_Genre : 'unclassified'"
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/movies.json"
+    },
+    "description": "Bar chart with label overlay",
+    "encoding": {
+        "y": {
+            "axis": null,
+            "field": "genre",
+            "sort": [
+                "Action",
+                "Adventure",
+                "Comedy",
+                "Black Comedy",
+                "Romantic Comedy",
+                "Concert/Performance",
+                "Documentary",
+                "Drama",
+                "Horror",
+                "Musical",
+                "Thriller/Suspense",
+                "Western",
+                "unclassified"
+            ],
+            "type": "nominal"
         }
-    ],
+    },
     "height": {
         "step": 16
     },
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/movies.json"
-    },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": {
-                "color": "#ddd",
-                "type": "bar"
-            },
             "encoding": {
                 "x": {
+                    "aggregate": "mean",
                     "field": "IMDB_Rating",
                     "scale": {
                         "domain": [
@@ -28,51 +41,38 @@
                             10
                         ]
                     },
-                    "aggregate": "mean",
                     "title": "Mean IMDB Ratings",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "#ddd",
+                "type": "bar"
             }
         },
         {
-            "mark": {
-                "dx": 5,
-                "align": "center",
-                "type": "text"
-            },
             "encoding": {
-                "text": {
-                    "field": "genre",
-                    "type": "nominal"
-                },
                 "detail": {
                     "aggregate": "count",
                     "type": "quantitative"
+                },
+                "text": {
+                    "field": "genre",
+                    "type": "nominal"
                 }
+            },
+            "mark": {
+                "align": "center",
+                "dx": 5,
+                "type": "text"
             }
         }
     ],
-    "encoding": {
-        "y": {
-            "field": "genre",
-            "sort": [
-                "Action",
-                "Adventure",
-                "Comedy",
-                "Black Comedy",
-                "Romantic Comedy",
-                "Concert/Performance",
-                "Documentary",
-                "Drama",
-                "Horror",
-                "Musical",
-                "Thriller/Suspense",
-                "Western",
-                "unclassified"
-            ],
-            "type": "nominal",
-            "axis": null
+    "transform": [
+        {
+            "as": "genre",
+            "calculate": "isValid(datum.Major_Genre)? datum.Major_Genre : 'unclassified'"
         }
-    },
-    "description": "Bar chart with label overlay"
+    ],
+    "width": 200
 }
diff --git a/tests/specs/gallery/bar/layer_bar_labels_grey.vl b/tests/specs/gallery/bar/layer_bar_labels_grey.vl
--- a/tests/specs/gallery/bar/layer_bar_labels_grey.vl
+++ b/tests/specs/gallery/bar/layer_bar_labels_grey.vl
@@ -1,20 +1,23 @@
 {
-    "height": {
-        "step": 16
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "encoding": {
+        "y": {
+            "axis": null,
+            "field": "Major_Genre",
+            "type": "nominal"
+        }
+    },
+    "height": {
+        "step": 16
+    },
     "layer": [
         {
-            "mark": {
-                "color": "#ddd",
-                "type": "bar"
-            },
             "encoding": {
                 "x": {
+                    "aggregate": "mean",
                     "field": "IMDB_Rating",
                     "scale": {
                         "domain": [
@@ -22,35 +25,32 @@
                             10
                         ]
                     },
-                    "aggregate": "mean",
                     "title": "Mean IMDB Ratings",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "#ddd",
+                "type": "bar"
             }
         },
         {
-            "mark": {
-                "align": "left",
-                "x": 5,
-                "type": "text"
-            },
             "encoding": {
-                "text": {
-                    "field": "Major_Genre",
-                    "type": "nominal"
-                },
                 "detail": {
                     "aggregate": "count",
                     "type": "quantitative"
+                },
+                "text": {
+                    "field": "Major_Genre",
+                    "type": "nominal"
                 }
+            },
+            "mark": {
+                "align": "left",
+                "type": "text",
+                "x": 5
             }
         }
     ],
-    "encoding": {
-        "y": {
-            "field": "Major_Genre",
-            "type": "nominal",
-            "axis": null
-        }
-    }
+    "width": 200
 }
diff --git a/tests/specs/gallery/bar/logscaled.vl b/tests/specs/gallery/bar/logscaled.vl
--- a/tests/specs/gallery/bar/logscaled.vl
+++ b/tests/specs/gallery/bar/logscaled.vl
@@ -1,24 +1,5 @@
 {
-    "transform": [
-        {
-            "as": "logX",
-            "calculate": "log(datum.x)/log(10)"
-        },
-        {
-            "as": "binLogX",
-            "field": "logX",
-            "bin": true
-        },
-        {
-            "as": "x1",
-            "calculate": "pow(10,datum.binLogX)"
-        },
-        {
-            "as": "x2",
-            "calculate": "pow(10,datum.binLogX_end)"
-        }
-    ],
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -56,26 +37,45 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Log-scaled Histogram (may improve after https://github.com/vega/vega-lite/issues/4792)",
     "encoding": {
-        "x2": {
-            "field": "x2"
-        },
         "x": {
+            "axis": {
+                "tickCount": 5
+            },
             "field": "x1",
             "scale": {
                 "base": 10,
                 "type": "log"
             },
-            "type": "quantitative",
-            "axis": {
-                "tickCount": 5
-            }
+            "type": "quantitative"
         },
+        "x2": {
+            "field": "x2"
+        },
         "y": {
             "aggregate": "count",
             "type": "quantitative"
         }
     },
-    "description": "Log-scaled Histogram (may improve after https://github.com/vega/vega-lite/issues/4792)"
+    "mark": "bar",
+    "transform": [
+        {
+            "as": "logX",
+            "calculate": "log(datum.x)/log(10)"
+        },
+        {
+            "as": "binLogX",
+            "bin": true,
+            "field": "logX"
+        },
+        {
+            "as": "x1",
+            "calculate": "pow(10,datum.binLogX)"
+        },
+        {
+            "as": "x2",
+            "calculate": "pow(10,datum.binLogX_end)"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/bar/signedpopulation.vl b/tests/specs/gallery/bar/signedpopulation.vl
--- a/tests/specs/gallery/bar/signedpopulation.vl
+++ b/tests/specs/gallery/bar/signedpopulation.vl
@@ -1,61 +1,61 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        },
-        {
-            "as": "signedPeople",
-            "calculate": "datum.sex == 2 ? datum.people : -datum.people"
-        }
-    ],
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
-        "view": {
-            "stroke": null
-        },
         "axis": {
             "grid": false
+        },
+        "view": {
+            "stroke": null
         }
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
+            "legend": {
+                "orient": "top",
+                "title": ""
+            },
             "scale": {
                 "range": [
                     "#675193",
                     "#ca8861"
                 ]
             },
-            "type": "nominal",
-            "legend": {
-                "orient": "top",
-                "title": ""
-            }
+            "type": "nominal"
         },
         "x": {
-            "field": "signedPeople",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "format": "s",
                 "title": "Population"
-            }
+            },
+            "field": "signedPeople",
+            "type": "quantitative"
         },
         "y": {
+            "axis": null,
             "field": "age",
             "sort": "descending",
-            "type": "ordinal",
-            "axis": null
+            "type": "ordinal"
         }
-    }
+    },
+    "height": 200,
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        },
+        {
+            "as": "signedPeople",
+            "calculate": "datum.sex == 2 ? datum.people : -datum.people"
+        }
+    ],
+    "width": 300
 }
diff --git a/tests/specs/gallery/bar/wilkinsondotplot.vl b/tests/specs/gallery/bar/wilkinsondotplot.vl
--- a/tests/specs/gallery/bar/wilkinsondotplot.vl
+++ b/tests/specs/gallery/bar/wilkinsondotplot.vl
@@ -1,28 +1,10 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "rank",
-                    "as": "id",
-                    "field": "rank"
-                }
-            ],
-            "groupby": [
-                "data"
-            ]
-        }
-    ],
-    "height": 100,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "mark": {
-        "opacity": 1,
-        "type": "circle"
-    },
     "data": {
         "values": [
             {
@@ -90,18 +72,36 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A Wilkinson dot plot",
     "encoding": {
         "x": {
             "field": "data",
             "type": "ordinal"
         },
         "y": {
+            "axis": null,
             "field": "id",
             "sort": "descending",
-            "type": "ordinal",
-            "axis": null
+            "type": "ordinal"
         }
     },
-    "description": "A Wilkinson dot plot"
+    "height": 100,
+    "mark": {
+        "opacity": 1,
+        "type": "circle"
+    },
+    "transform": [
+        {
+            "groupby": [
+                "data"
+            ],
+            "window": [
+                {
+                    "as": "id",
+                    "field": "rank",
+                    "op": "rank"
+                }
+            ]
+        }
+    ]
 }
diff --git a/tests/specs/gallery/dist/dist1.vl b/tests/specs/gallery/dist/dist1.vl
--- a/tests/specs/gallery/dist/dist1.vl
+++ b/tests/specs/gallery/dist/dist1.vl
@@ -1,16 +1,13 @@
 {
-    "mark": {
-        "binSpacing": 0,
-        "type": "bar"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Simple histogram of IMDB ratings.",
     "encoding": {
         "x": {
-            "field": "IMDB_Rating",
             "bin": true,
+            "field": "IMDB_Rating",
             "type": "quantitative"
         },
         "y": {
@@ -18,5 +15,8 @@
             "type": "quantitative"
         }
     },
-    "description": "Simple histogram of IMDB ratings."
+    "mark": {
+        "binSpacing": 0,
+        "type": "bar"
+    }
 }
diff --git a/tests/specs/gallery/dist/dist2.vl b/tests/specs/gallery/dist/dist2.vl
--- a/tests/specs/gallery/dist/dist2.vl
+++ b/tests/specs/gallery/dist/dist2.vl
@@ -1,30 +1,9 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "count",
-                    "as": "cumulativeCount",
-                    "field": "count"
-                }
-            ],
-            "sort": [
-                {
-                    "field": "IMDB_Rating",
-                    "order": "ascending"
-                }
-            ],
-            "frame": [
-                null,
-                0
-            ]
-        }
-    ],
-    "mark": "area",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Cumulative frequency distribution",
     "encoding": {
         "x": {
             "field": "IMDB_Rating",
@@ -35,5 +14,26 @@
             "type": "quantitative"
         }
     },
-    "description": "Cumulative frequency distribution"
+    "mark": "area",
+    "transform": [
+        {
+            "frame": [
+                null,
+                0
+            ],
+            "sort": [
+                {
+                    "field": "IMDB_Rating",
+                    "order": "ascending"
+                }
+            ],
+            "window": [
+                {
+                    "as": "cumulativeCount",
+                    "field": "count",
+                    "op": "count"
+                }
+            ]
+        }
+    ]
 }
diff --git a/tests/specs/gallery/dist/dist3.vl b/tests/specs/gallery/dist/dist3.vl
--- a/tests/specs/gallery/dist/dist3.vl
+++ b/tests/specs/gallery/dist/dist3.vl
@@ -1,32 +1,73 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/movies.json"
+    },
+    "description": "A layered histogram and cumulative histogram.",
+    "encoding": {
+        "x": {
+            "axis": {
+                "title": "IMDB rating"
+            },
+            "field": "bin_IMDB_Rating",
+            "scale": {
+                "zero": false
+            },
+            "type": "quantitative"
+        },
+        "x2": {
+            "field": "bin_IMDB_Rating_end"
+        }
+    },
+    "layer": [
+        {
+            "encoding": {
+                "y": {
+                    "field": "cumulativeCount",
+                    "type": "quantitative"
+                }
+            },
+            "mark": "bar"
+        },
+        {
+            "encoding": {
+                "y": {
+                    "field": "count",
+                    "type": "quantitative"
+                }
+            },
+            "mark": {
+                "color": "yellow",
+                "opacity": 0.5,
+                "type": "bar"
+            }
+        }
+    ],
     "transform": [
         {
             "as": "bin_IMDB_Rating",
-            "field": "IMDB_Rating",
-            "bin": true
+            "bin": true,
+            "field": "IMDB_Rating"
         },
         {
-            "groupby": [
-                "bin_IMDB_Rating",
-                "bin_IMDB_Rating_end"
-            ],
             "aggregate": [
                 {
-                    "op": "count",
-                    "as": "count"
+                    "as": "count",
+                    "op": "count"
                 }
+            ],
+            "groupby": [
+                "bin_IMDB_Rating",
+                "bin_IMDB_Rating_end"
             ]
         },
         {
             "filter": "datum.bin_IMDB_Rating !== null"
         },
         {
-            "window": [
-                {
-                    "op": "sum",
-                    "as": "cumulativeCount",
-                    "field": "count"
-                }
+            "frame": [
+                null,
+                0
             ],
             "sort": [
                 {
@@ -34,54 +75,13 @@
                     "order": "ascending"
                 }
             ],
-            "frame": [
-                null,
-                0
-            ]
-        }
-    ],
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/movies.json"
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "layer": [
-        {
-            "mark": "bar",
-            "encoding": {
-                "y": {
-                    "field": "cumulativeCount",
-                    "type": "quantitative"
-                }
-            }
-        },
-        {
-            "mark": {
-                "color": "yellow",
-                "opacity": 0.5,
-                "type": "bar"
-            },
-            "encoding": {
-                "y": {
+            "window": [
+                {
+                    "as": "cumulativeCount",
                     "field": "count",
-                    "type": "quantitative"
+                    "op": "sum"
                 }
-            }
-        }
-    ],
-    "encoding": {
-        "x2": {
-            "field": "bin_IMDB_Rating_end"
-        },
-        "x": {
-            "field": "bin_IMDB_Rating",
-            "scale": {
-                "zero": false
-            },
-            "type": "quantitative",
-            "axis": {
-                "title": "IMDB rating"
-            }
+            ]
         }
-    },
-    "description": "A layered histogram and cumulative histogram."
+    ]
 }
diff --git a/tests/specs/gallery/dist/dist4.vl b/tests/specs/gallery/dist/dist4.vl
--- a/tests/specs/gallery/dist/dist4.vl
+++ b/tests/specs/gallery/dist/dist4.vl
@@ -1,99 +1,68 @@
 {
-    "transform": [
-        {
-            "groupby": [
-                "age"
-            ],
-            "aggregate": [
-                {
-                    "op": "min",
-                    "as": "lowerWhisker",
-                    "field": "people"
-                },
-                {
-                    "op": "q1",
-                    "as": "lowerBox",
-                    "field": "people"
-                },
-                {
-                    "op": "median",
-                    "as": "midBox",
-                    "field": "people"
-                },
-                {
-                    "op": "q3",
-                    "as": "upperBox",
-                    "field": "people"
-                },
-                {
-                    "op": "max",
-                    "as": "upperWhisker",
-                    "field": "people"
-                }
-            ]
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A vertical 2D box plot showing median, min, and max in the US population distribution of age groups in 2000.",
+    "encoding": {
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        }
+    },
     "layer": [
         {
-            "mark": {
-                "style": "boxWhisker",
-                "type": "rule"
-            },
             "encoding": {
-                "y2": {
-                    "field": "lowerBox"
-                },
                 "y": {
-                    "field": "lowerWhisker",
-                    "type": "quantitative",
                     "axis": {
                         "title": "Population"
-                    }
+                    },
+                    "field": "lowerWhisker",
+                    "type": "quantitative"
+                },
+                "y2": {
+                    "field": "lowerBox"
                 }
-            }
-        },
-        {
+            },
             "mark": {
                 "style": "boxWhisker",
                 "type": "rule"
-            },
+            }
+        },
+        {
             "encoding": {
-                "y2": {
-                    "field": "upperWhisker"
-                },
                 "y": {
                     "field": "upperBox",
                     "type": "quantitative"
+                },
+                "y2": {
+                    "field": "upperWhisker"
                 }
+            },
+            "mark": {
+                "style": "boxWhisker",
+                "type": "rule"
             }
         },
         {
-            "mark": {
-                "style": "box",
-                "type": "bar"
-            },
             "encoding": {
                 "size": {
                     "value": 5
                 },
-                "y2": {
-                    "field": "upperBox"
-                },
                 "y": {
                     "field": "lowerBox",
                     "type": "quantitative"
+                },
+                "y2": {
+                    "field": "upperBox"
                 }
+            },
+            "mark": {
+                "style": "box",
+                "type": "bar"
             }
         },
         {
-            "mark": {
-                "style": "boxMid",
-                "type": "tick"
-            },
             "encoding": {
                 "color": {
                     "value": "white"
@@ -105,14 +74,45 @@
                     "field": "midBox",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "style": "boxMid",
+                "type": "tick"
             }
         }
     ],
-    "encoding": {
-        "x": {
-            "field": "age",
-            "type": "ordinal"
+    "transform": [
+        {
+            "aggregate": [
+                {
+                    "as": "lowerWhisker",
+                    "field": "people",
+                    "op": "min"
+                },
+                {
+                    "as": "lowerBox",
+                    "field": "people",
+                    "op": "q1"
+                },
+                {
+                    "as": "midBox",
+                    "field": "people",
+                    "op": "median"
+                },
+                {
+                    "as": "upperBox",
+                    "field": "people",
+                    "op": "q3"
+                },
+                {
+                    "as": "upperWhisker",
+                    "field": "people",
+                    "op": "max"
+                }
+            ],
+            "groupby": [
+                "age"
+            ]
         }
-    },
-    "description": "A vertical 2D box plot showing median, min, and max in the US population distribution of age groups in 2000."
+    ]
 }
diff --git a/tests/specs/gallery/dist/dist5.vl b/tests/specs/gallery/dist/dist5.vl
--- a/tests/specs/gallery/dist/dist5.vl
+++ b/tests/specs/gallery/dist/dist5.vl
@@ -1,101 +1,68 @@
 {
-    "transform": [
-        {
-            "groupby": [
-                "age"
-            ],
-            "aggregate": [
-                {
-                    "op": "q1",
-                    "as": "lowerBox",
-                    "field": "people"
-                },
-                {
-                    "op": "q3",
-                    "as": "upperBox",
-                    "field": "people"
-                },
-                {
-                    "op": "median",
-                    "as": "midBox",
-                    "field": "people"
-                }
-            ]
-        },
-        {
-            "as": "IQR",
-            "calculate": "datum.upperBox - datum.lowerBox"
-        },
-        {
-            "as": "upperWhisker",
-            "calculate": "datum.upperBox + datum.IQR * 1.5"
-        },
-        {
-            "as": "lowerWhisker",
-            "calculate": "max(0,datum.lowerBox - datum.IQR *1.5)"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A Tukey box plot showing median and interquartile range in the US population distribution of age groups in 2000. This isn't strictly a Tukey box plot as the IQR extends beyond the min/max values for some age cohorts.",
+    "encoding": {
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        }
+    },
     "layer": [
         {
-            "mark": {
-                "style": "boxWhisker",
-                "type": "rule"
-            },
             "encoding": {
-                "y2": {
-                    "field": "lowerBox"
-                },
                 "y": {
-                    "field": "lowerWhisker",
-                    "type": "quantitative",
                     "axis": {
                         "title": "Population"
-                    }
+                    },
+                    "field": "lowerWhisker",
+                    "type": "quantitative"
+                },
+                "y2": {
+                    "field": "lowerBox"
                 }
-            }
-        },
-        {
+            },
             "mark": {
                 "style": "boxWhisker",
                 "type": "rule"
-            },
+            }
+        },
+        {
             "encoding": {
-                "y2": {
-                    "field": "upperWhisker"
-                },
                 "y": {
                     "field": "upperBox",
                     "type": "quantitative"
+                },
+                "y2": {
+                    "field": "upperWhisker"
                 }
+            },
+            "mark": {
+                "style": "boxWhisker",
+                "type": "rule"
             }
         },
         {
-            "mark": {
-                "style": "box",
-                "type": "bar"
-            },
             "encoding": {
                 "size": {
                     "value": 5
                 },
-                "y2": {
-                    "field": "upperBox"
-                },
                 "y": {
                     "field": "lowerBox",
                     "type": "quantitative"
+                },
+                "y2": {
+                    "field": "upperBox"
                 }
+            },
+            "mark": {
+                "style": "box",
+                "type": "bar"
             }
         },
         {
-            "mark": {
-                "style": "boxMid",
-                "type": "tick"
-            },
             "encoding": {
                 "color": {
                     "value": "white"
@@ -107,14 +74,47 @@
                     "field": "midBox",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "style": "boxMid",
+                "type": "tick"
             }
         }
     ],
-    "encoding": {
-        "x": {
-            "field": "age",
-            "type": "ordinal"
+    "transform": [
+        {
+            "aggregate": [
+                {
+                    "as": "lowerBox",
+                    "field": "people",
+                    "op": "q1"
+                },
+                {
+                    "as": "upperBox",
+                    "field": "people",
+                    "op": "q3"
+                },
+                {
+                    "as": "midBox",
+                    "field": "people",
+                    "op": "median"
+                }
+            ],
+            "groupby": [
+                "age"
+            ]
+        },
+        {
+            "as": "IQR",
+            "calculate": "datum.upperBox - datum.lowerBox"
+        },
+        {
+            "as": "upperWhisker",
+            "calculate": "datum.upperBox + datum.IQR * 1.5"
+        },
+        {
+            "as": "lowerWhisker",
+            "calculate": "max(0,datum.lowerBox - datum.IQR *1.5)"
         }
-    },
-    "description": "A Tukey box plot showing median and interquartile range in the US population distribution of age groups in 2000. This isn't strictly a Tukey box plot as the IQR extends beyond the min/max values for some age cohorts."
+    ]
 }
diff --git a/tests/specs/gallery/dist/quantile1.vl b/tests/specs/gallery/dist/quantile1.vl
--- a/tests/specs/gallery/dist/quantile1.vl
+++ b/tests/specs/gallery/dist/quantile1.vl
@@ -1,25 +1,10 @@
 {
-    "transform": [
-        {
-            "as": [
-                "p",
-                "v"
-            ],
-            "quantile": "u",
-            "step": 1.0e-2
-        },
-        {
-            "as": "unif",
-            "calculate": "quantileUniform(datum.p)"
-        },
-        {
-            "as": "norm",
-            "calculate": "quantileNormal(datum.p)"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/normal-2d.json"
+    },
     "hconcat": [
         {
-            "mark": "point",
             "encoding": {
                 "x": {
                     "field": "unif",
@@ -29,10 +14,10 @@
                     "field": "v",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "point"
         },
         {
-            "mark": "point",
             "encoding": {
                 "x": {
                     "field": "norm",
@@ -42,11 +27,26 @@
                     "field": "v",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "point"
         }
     ],
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/normal-2d.json"
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    "transform": [
+        {
+            "as": [
+                "p",
+                "v"
+            ],
+            "quantile": "u",
+            "step": 1.0e-2
+        },
+        {
+            "as": "unif",
+            "calculate": "quantileUniform(datum.p)"
+        },
+        {
+            "as": "norm",
+            "calculate": "quantileNormal(datum.p)"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/error/error1.vl b/tests/specs/gallery/error/error1.vl
--- a/tests/specs/gallery/error/error1.vl
+++ b/tests/specs/gallery/error/error1.vl
@@ -1,51 +1,51 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/barley.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Error bars showing confidence intervals",
+    "encoding": {
+        "y": {
+            "field": "variety",
+            "type": "ordinal"
+        }
+    },
     "layer": [
         {
-            "mark": {
-                "type": "point",
-                "filled": true
-            },
             "encoding": {
                 "color": {
                     "value": "black"
                 },
                 "x": {
+                    "aggregate": "mean",
+                    "axis": {
+                        "title": "Barley Yield"
+                    },
                     "field": "yield",
                     "scale": {
                         "zero": false
                     },
-                    "aggregate": "mean",
-                    "type": "quantitative",
-                    "axis": {
-                        "title": "Barley Yield"
-                    }
+                    "type": "quantitative"
                 }
+            },
+            "mark": {
+                "filled": true,
+                "type": "point"
             }
         },
         {
-            "mark": "rule",
             "encoding": {
-                "x2": {
-                    "field": "yield",
-                    "aggregate": "ci1"
-                },
                 "x": {
-                    "field": "yield",
                     "aggregate": "ci0",
+                    "field": "yield",
                     "type": "quantitative"
+                },
+                "x2": {
+                    "aggregate": "ci1",
+                    "field": "yield"
                 }
-            }
-        }
-    ],
-    "encoding": {
-        "y": {
-            "field": "variety",
-            "type": "ordinal"
+            },
+            "mark": "rule"
         }
-    },
-    "description": "Error bars showing confidence intervals"
+    ]
 }
diff --git a/tests/specs/gallery/error/error2.vl b/tests/specs/gallery/error/error2.vl
--- a/tests/specs/gallery/error/error2.vl
+++ b/tests/specs/gallery/error/error2.vl
@@ -1,75 +1,75 @@
 {
-    "transform": [
-        {
-            "groupby": [
-                "variety"
-            ],
-            "aggregate": [
-                {
-                    "op": "mean",
-                    "as": "mean",
-                    "field": "yield"
-                },
-                {
-                    "op": "stdev",
-                    "as": "stdev",
-                    "field": "yield"
-                }
-            ]
-        },
-        {
-            "as": "lower",
-            "calculate": "datum.mean-datum.stdev"
-        },
-        {
-            "as": "upper",
-            "calculate": "datum.mean+datum.stdev"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/barley.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Error bars showing standard deviations",
+    "encoding": {
+        "y": {
+            "field": "variety",
+            "type": "ordinal"
+        }
+    },
     "layer": [
         {
-            "mark": {
-                "type": "point",
-                "filled": true
-            },
             "encoding": {
                 "color": {
                     "value": "black"
                 },
                 "x": {
+                    "axis": {
+                        "title": "Barley Yield"
+                    },
                     "field": "mean",
                     "scale": {
                         "zero": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": "Barley Yield"
-                    }
+                    "type": "quantitative"
                 }
+            },
+            "mark": {
+                "filled": true,
+                "type": "point"
             }
         },
         {
-            "mark": "rule",
             "encoding": {
-                "x2": {
-                    "field": "lower"
-                },
                 "x": {
                     "field": "upper",
                     "type": "quantitative"
+                },
+                "x2": {
+                    "field": "lower"
                 }
-            }
+            },
+            "mark": "rule"
         }
     ],
-    "encoding": {
-        "y": {
-            "field": "variety",
-            "type": "ordinal"
+    "transform": [
+        {
+            "aggregate": [
+                {
+                    "as": "mean",
+                    "field": "yield",
+                    "op": "mean"
+                },
+                {
+                    "as": "stdev",
+                    "field": "yield",
+                    "op": "stdev"
+                }
+            ],
+            "groupby": [
+                "variety"
+            ]
+        },
+        {
+            "as": "lower",
+            "calculate": "datum.mean-datum.stdev"
+        },
+        {
+            "as": "upper",
+            "calculate": "datum.mean+datum.stdev"
         }
-    },
-    "description": "Error bars showing standard deviations"
+    ]
 }
diff --git a/tests/specs/gallery/error/error3.vl b/tests/specs/gallery/error/error3.vl
--- a/tests/specs/gallery/error/error3.vl
+++ b/tests/specs/gallery/error/error3.vl
@@ -1,46 +1,46 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Line chart with confidence interval band.",
+    "encoding": {
+        "x": {
+            "field": "Year",
+            "timeUnit": "year",
+            "type": "temporal"
+        }
+    },
     "layer": [
         {
-            "mark": "area",
             "encoding": {
                 "opacity": {
                     "value": 0.3
                 },
-                "y2": {
-                    "field": "Miles_per_Gallon",
-                    "aggregate": "ci1"
-                },
                 "y": {
-                    "field": "Miles_per_Gallon",
                     "aggregate": "ci0",
-                    "type": "quantitative",
                     "axis": {
                         "title": "Miles/Gallon"
-                    }
+                    },
+                    "field": "Miles_per_Gallon",
+                    "type": "quantitative"
+                },
+                "y2": {
+                    "aggregate": "ci1",
+                    "field": "Miles_per_Gallon"
                 }
-            }
+            },
+            "mark": "area"
         },
         {
-            "mark": "line",
             "encoding": {
                 "y": {
-                    "field": "Miles_per_Gallon",
                     "aggregate": "mean",
+                    "field": "Miles_per_Gallon",
                     "type": "quantitative"
                 }
-            }
-        }
-    ],
-    "encoding": {
-        "x": {
-            "field": "Year",
-            "timeUnit": "year",
-            "type": "temporal"
+            },
+            "mark": "line"
         }
-    },
-    "description": "Line chart with confidence interval band."
+    ]
 }
diff --git a/tests/specs/gallery/error/error4.vl b/tests/specs/gallery/error/error4.vl
--- a/tests/specs/gallery/error/error4.vl
+++ b/tests/specs/gallery/error/error4.vl
@@ -1,11 +1,11 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A scatterplot showing horsepower and miles per gallon for various cars with a global mean and standard deviation overlay.",
     "layer": [
         {
-            "mark": "point",
             "encoding": {
                 "x": {
                     "field": "Horsepower",
@@ -15,61 +15,61 @@
                     "field": "Miles_per_Gallon",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "point"
         },
         {
-            "transform": [
-                {
-                    "groupby": [],
-                    "aggregate": [
-                        {
-                            "op": "mean",
-                            "as": "mean_MPG",
-                            "field": "Miles_per_Gallon"
-                        },
-                        {
-                            "op": "stdev",
-                            "as": "dev_MPG",
-                            "field": "Miles_per_Gallon"
-                        }
-                    ]
-                },
-                {
-                    "as": "upper",
-                    "calculate": "datum.mean_MPG+datum.dev_MPG"
-                },
-                {
-                    "as": "lower",
-                    "calculate": "datum.mean_MPG-datum.dev_MPG"
-                }
-            ],
             "layer": [
                 {
-                    "mark": "rule",
                     "encoding": {
                         "y": {
                             "field": "mean_MPG",
                             "type": "quantitative"
                         }
-                    }
+                    },
+                    "mark": "rule"
                 },
                 {
-                    "mark": "rect",
                     "encoding": {
                         "opacity": {
                             "value": 0.2
                         },
-                        "y2": {
-                            "field": "upper"
-                        },
                         "y": {
                             "field": "lower",
                             "type": "quantitative"
+                        },
+                        "y2": {
+                            "field": "upper"
                         }
-                    }
+                    },
+                    "mark": "rect"
                 }
+            ],
+            "transform": [
+                {
+                    "aggregate": [
+                        {
+                            "as": "mean_MPG",
+                            "field": "Miles_per_Gallon",
+                            "op": "mean"
+                        },
+                        {
+                            "as": "dev_MPG",
+                            "field": "Miles_per_Gallon",
+                            "op": "stdev"
+                        }
+                    ],
+                    "groupby": []
+                },
+                {
+                    "as": "upper",
+                    "calculate": "datum.mean_MPG+datum.dev_MPG"
+                },
+                {
+                    "as": "lower",
+                    "calculate": "datum.mean_MPG-datum.dev_MPG"
+                }
             ]
         }
-    ],
-    "description": "A scatterplot showing horsepower and miles per gallon for various cars with a global mean and standard deviation overlay."
+    ]
 }
diff --git a/tests/specs/gallery/facet/facet1.vl b/tests/specs/gallery/facet/facet1.vl
--- a/tests/specs/gallery/facet/facet1.vl
+++ b/tests/specs/gallery/facet/facet1.vl
@@ -1,21 +1,9 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A trellis bar chart showing the US population distribution of age groups and gender in 2000",
     "encoding": {
         "color": {
             "field": "gender",
@@ -36,13 +24,25 @@
             "type": "ordinal"
         },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
     },
-    "description": "A trellis bar chart showing the US population distribution of age groups and gender in 2000"
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
+    }
 }
diff --git a/tests/specs/gallery/facet/facet2.vl b/tests/specs/gallery/facet/facet2.vl
--- a/tests/specs/gallery/facet/facet2.vl
+++ b/tests/specs/gallery/facet/facet2.vl
@@ -1,27 +1,27 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/barley.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Barley crop yields in 1931 and 1932 shown as stacked bar charts",
     "encoding": {
         "color": {
             "field": "site",
             "type": "nominal"
         },
-        "x": {
-            "field": "yield",
-            "aggregate": "sum",
-            "type": "quantitative"
-        },
         "column": {
             "field": "year",
             "type": "ordinal"
         },
+        "x": {
+            "aggregate": "sum",
+            "field": "yield",
+            "type": "quantitative"
+        },
         "y": {
             "field": "variety",
             "type": "nominal"
         }
     },
-    "description": "Barley crop yields in 1931 and 1932 shown as stacked bar charts"
+    "mark": "bar"
 }
diff --git a/tests/specs/gallery/facet/facet3.vl b/tests/specs/gallery/facet/facet3.vl
--- a/tests/specs/gallery/facet/facet3.vl
+++ b/tests/specs/gallery/facet/facet3.vl
@@ -1,22 +1,22 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Scatterplots of movie takings vs profits for different MPAA ratings",
     "encoding": {
-        "x": {
-            "field": "Worldwide_Gross",
-            "type": "quantitative"
-        },
         "column": {
             "field": "MPAA_Rating",
             "type": "ordinal"
         },
+        "x": {
+            "field": "Worldwide_Gross",
+            "type": "quantitative"
+        },
         "y": {
             "field": "US_DVD_Sales",
             "type": "quantitative"
         }
     },
-    "description": "Scatterplots of movie takings vs profits for different MPAA ratings"
+    "mark": "point"
 }
diff --git a/tests/specs/gallery/facet/facet4.vl b/tests/specs/gallery/facet/facet4.vl
--- a/tests/specs/gallery/facet/facet4.vl
+++ b/tests/specs/gallery/facet/facet4.vl
@@ -1,9 +1,9 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Distributions of car engine power for different countries of origin",
     "encoding": {
         "row": {
             "field": "Origin",
@@ -11,10 +11,10 @@
             "type": "ordinal"
         },
         "x": {
-            "field": "Horsepower",
             "bin": {
                 "maxbins": 15
             },
+            "field": "Horsepower",
             "type": "quantitative"
         },
         "y": {
@@ -22,5 +22,5 @@
             "type": "quantitative"
         }
     },
-    "description": "Distributions of car engine power for different countries of origin"
+    "mark": "bar"
 }
diff --git a/tests/specs/gallery/facet/facet5.vl b/tests/specs/gallery/facet/facet5.vl
--- a/tests/specs/gallery/facet/facet5.vl
+++ b/tests/specs/gallery/facet/facet5.vl
@@ -1,10 +1,14 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/anscombe.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Anscombe's Quartet",
     "encoding": {
+        "column": {
+            "field": "Series",
+            "type": "ordinal"
+        },
         "opacity": {
             "value": 1
         },
@@ -15,10 +19,6 @@
             },
             "type": "quantitative"
         },
-        "column": {
-            "field": "Series",
-            "type": "ordinal"
-        },
         "y": {
             "field": "Y",
             "scale": {
@@ -27,5 +27,5 @@
             "type": "quantitative"
         }
     },
-    "description": "Anscombe's Quartet"
+    "mark": "circle"
 }
diff --git a/tests/specs/gallery/facet/facet6.vl b/tests/specs/gallery/facet/facet6.vl
--- a/tests/specs/gallery/facet/facet6.vl
+++ b/tests/specs/gallery/facet/facet6.vl
@@ -1,23 +1,33 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "columns": 2,
     "data": {
         "url": "https://vega.github.io/vega-lite/data/barley.json"
     },
-    "spec": {
-        "height": {
-            "step": 12
+    "description": "The Trellis display by Becker et al. helped establish small multiples as a 'powerful mechanism for understanding interactions in studies of how a response depends on explanatory variables'",
+    "facet": {
+        "field": "site",
+        "header": {
+            "title": null
         },
-        "mark": "point",
+        "sort": {
+            "field": "yield",
+            "op": "median"
+        },
+        "type": "ordinal"
+    },
+    "spec": {
         "encoding": {
             "color": {
                 "field": "year",
                 "type": "nominal"
             },
             "x": {
+                "aggregate": "median",
                 "field": "yield",
                 "scale": {
                     "zero": false
                 },
-                "aggregate": "median",
                 "type": "quantitative"
             },
             "y": {
@@ -28,20 +38,10 @@
                 },
                 "type": "ordinal"
             }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "columns": 2,
-    "facet": {
-        "field": "site",
-        "header": {
-            "title": null
         },
-        "sort": {
-            "op": "median",
-            "field": "yield"
+        "height": {
+            "step": 12
         },
-        "type": "ordinal"
-    },
-    "description": "The Trellis display by Becker et al. helped establish small multiples as a 'powerful mechanism for understanding interactions in studies of how a response depends on explanatory variables'"
+        "mark": "point"
+    }
 }
diff --git a/tests/specs/gallery/facet/facet7.vl b/tests/specs/gallery/facet/facet7.vl
--- a/tests/specs/gallery/facet/facet7.vl
+++ b/tests/specs/gallery/facet/facet7.vl
@@ -1,59 +1,59 @@
 {
-    "height": 50,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "mark": "area",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "width": 300,
-    "resolve": {
-        "scale": {
-            "y": "independent"
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Stock prices of five large companies as a small multiples of area charts",
     "encoding": {
         "color": {
             "field": "symbol",
-            "type": "nominal",
-            "legend": null
+            "legend": null,
+            "type": "nominal"
         },
         "row": {
             "field": "symbol",
             "header": {
+                "labelAlign": "left",
                 "labelAngle": 0,
-                "labelFontStyle": "italic",
                 "labelExpr": "'{' + datum.label + '}'",
-                "titleLineHeight": 20,
+                "labelFontStyle": "italic",
                 "title": [
                     "Stock",
                     "price"
                 ],
-                "labelAlign": "left"
+                "titleLineHeight": 20
             },
             "type": "nominal"
         },
         "x": {
-            "field": "date",
-            "type": "temporal",
             "axis": {
                 "format": "%Y",
                 "grid": false,
                 "title": null
-            }
+            },
+            "field": "date",
+            "type": "temporal"
         },
         "y": {
-            "field": "price",
-            "type": "quantitative",
             "axis": {
                 "grid": false,
                 "title": null
-            }
+            },
+            "field": "price",
+            "type": "quantitative"
         }
     },
-    "description": "Stock prices of five large companies as a small multiples of area charts"
+    "height": 50,
+    "mark": "area",
+    "resolve": {
+        "scale": {
+            "y": "independent"
+        }
+    },
+    "width": 300
 }
diff --git a/tests/specs/gallery/facet/facet_bullet.vl b/tests/specs/gallery/facet/facet_bullet.vl
new file mode 100644
--- /dev/null
+++ b/tests/specs/gallery/facet/facet_bullet.vl
@@ -0,0 +1,189 @@
+{
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "config": {
+        "tick": {
+            "thickness": 2
+        }
+    },
+    "data": {
+        "values": [
+            {
+                "markers": [
+                    250
+                ],
+                "measures": [
+                    220,
+                    270
+                ],
+                "ranges": [
+                    150,
+                    225,
+                    300
+                ],
+                "subtitle": "US$, in thousands",
+                "title": "Revenue"
+            },
+            {
+                "markers": [
+                    26
+                ],
+                "measures": [
+                    21,
+                    23
+                ],
+                "ranges": [
+                    20,
+                    25,
+                    30
+                ],
+                "subtitle": "%",
+                "title": "Profit"
+            },
+            {
+                "markers": [
+                    550
+                ],
+                "measures": [
+                    100,
+                    320
+                ],
+                "ranges": [
+                    350,
+                    500,
+                    600
+                ],
+                "subtitle": "US$, average",
+                "title": "Order Size"
+            },
+            {
+                "markers": [
+                    2100
+                ],
+                "measures": [
+                    1000,
+                    1650
+                ],
+                "ranges": [
+                    1400,
+                    2000,
+                    2500
+                ],
+                "subtitle": "count",
+                "title": "New Customers"
+            },
+            {
+                "markers": [
+                    4.4
+                ],
+                "measures": [
+                    3.2,
+                    4.7
+                ],
+                "ranges": [
+                    3.5,
+                    4.25,
+                    5
+                ],
+                "subtitle": "out of 5",
+                "title": "Satisfaction"
+            }
+        ]
+    },
+    "facet": {
+        "row": {
+            "field": "title",
+            "header": {
+                "labelAngle": 0,
+                "title": null
+            },
+            "type": "ordinal"
+        }
+    },
+    "resolve": {
+        "scale": {
+            "x": "independent"
+        }
+    },
+    "spacing": 10,
+    "spec": {
+        "encoding": {
+            "x": {
+                "scale": {
+                    "nice": false
+                },
+                "title": null,
+                "type": "quantitative"
+            }
+        },
+        "layer": [
+            {
+                "encoding": {
+                    "x": {
+                        "field": "ranges[2]"
+                    }
+                },
+                "mark": {
+                    "color": "#eee",
+                    "type": "bar"
+                }
+            },
+            {
+                "encoding": {
+                    "x": {
+                        "field": "ranges[1]"
+                    }
+                },
+                "mark": {
+                    "color": "#ddd",
+                    "type": "bar"
+                }
+            },
+            {
+                "encoding": {
+                    "x": {
+                        "field": "ranges[0]"
+                    }
+                },
+                "mark": {
+                    "color": "#ccc",
+                    "type": "bar"
+                }
+            },
+            {
+                "encoding": {
+                    "x": {
+                        "field": "measures[1]"
+                    }
+                },
+                "mark": {
+                    "color": "lightsteelblue",
+                    "size": 10,
+                    "type": "bar"
+                }
+            },
+            {
+                "encoding": {
+                    "x": {
+                        "field": "measures[0]"
+                    }
+                },
+                "mark": {
+                    "color": "steelblue",
+                    "size": 10,
+                    "type": "bar"
+                }
+            },
+            {
+                "encoding": {
+                    "x": {
+                        "field": "markers[0]"
+                    }
+                },
+                "mark": {
+                    "color": "black",
+                    "type": "tick"
+                }
+            }
+        ]
+    }
+}
diff --git a/tests/specs/gallery/facet/facetgridbar.vl b/tests/specs/gallery/facet/facetgridbar.vl
--- a/tests/specs/gallery/facet/facetgridbar.vl
+++ b/tests/specs/gallery/facet/facetgridbar.vl
@@ -1,186 +1,187 @@
 {
-    "height": {
-        "step": 8
-    },
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "p": "0.14",
                 "a": "a1",
                 "b": "b1",
-                "c": "x"
+                "c": "x",
+                "p": "0.14"
             },
             {
-                "p": "0.60",
                 "a": "a1",
                 "b": "b1",
-                "c": "y"
+                "c": "y",
+                "p": "0.60"
             },
             {
-                "p": "0.03",
                 "a": "a1",
                 "b": "b1",
-                "c": "z"
+                "c": "z",
+                "p": "0.03"
             },
             {
-                "p": "0.80",
                 "a": "a1",
                 "b": "b2",
-                "c": "x"
+                "c": "x",
+                "p": "0.80"
             },
             {
-                "p": "0.38",
                 "a": "a1",
                 "b": "b2",
-                "c": "y"
+                "c": "y",
+                "p": "0.38"
             },
             {
-                "p": "0.55",
                 "a": "a1",
                 "b": "b2",
-                "c": "z"
+                "c": "z",
+                "p": "0.55"
             },
             {
-                "p": "0.11",
                 "a": "a1",
                 "b": "b3",
-                "c": "x"
+                "c": "x",
+                "p": "0.11"
             },
             {
-                "p": "0.58",
                 "a": "a1",
                 "b": "b3",
-                "c": "y"
+                "c": "y",
+                "p": "0.58"
             },
             {
-                "p": "0.79",
                 "a": "a1",
                 "b": "b3",
-                "c": "z"
+                "c": "z",
+                "p": "0.79"
             },
             {
-                "p": "0.83",
                 "a": "a2",
                 "b": "b1",
-                "c": "x"
+                "c": "x",
+                "p": "0.83"
             },
             {
-                "p": "0.87",
                 "a": "a2",
                 "b": "b1",
-                "c": "y"
+                "c": "y",
+                "p": "0.87"
             },
             {
-                "p": "0.67",
                 "a": "a2",
                 "b": "b1",
-                "c": "z"
+                "c": "z",
+                "p": "0.67"
             },
             {
-                "p": "0.97",
                 "a": "a2",
                 "b": "b2",
-                "c": "x"
+                "c": "x",
+                "p": "0.97"
             },
             {
-                "p": "0.84",
                 "a": "a2",
                 "b": "b2",
-                "c": "y"
+                "c": "y",
+                "p": "0.84"
             },
             {
-                "p": "0.90",
                 "a": "a2",
                 "b": "b2",
-                "c": "z"
+                "c": "z",
+                "p": "0.90"
             },
             {
-                "p": "0.74",
                 "a": "a2",
                 "b": "b3",
-                "c": "x"
+                "c": "x",
+                "p": "0.74"
             },
             {
-                "p": "0.64",
                 "a": "a2",
                 "b": "b3",
-                "c": "y"
+                "c": "y",
+                "p": "0.64"
             },
             {
-                "p": "0.19",
                 "a": "a2",
                 "b": "b3",
-                "c": "z"
+                "c": "z",
+                "p": "0.19"
             },
             {
-                "p": "0.57",
                 "a": "a3",
                 "b": "b1",
-                "c": "x"
+                "c": "x",
+                "p": "0.57"
             },
             {
-                "p": "0.35",
                 "a": "a3",
                 "b": "b1",
-                "c": "y"
+                "c": "y",
+                "p": "0.35"
             },
             {
-                "p": "0.49",
                 "a": "a3",
                 "b": "b1",
-                "c": "z"
+                "c": "z",
+                "p": "0.49"
             },
             {
-                "p": "0.91",
                 "a": "a3",
                 "b": "b2",
-                "c": "x"
+                "c": "x",
+                "p": "0.91"
             },
             {
-                "p": "0.38",
                 "a": "a3",
                 "b": "b2",
-                "c": "y"
+                "c": "y",
+                "p": "0.38"
             },
             {
-                "p": "0.91",
                 "a": "a3",
                 "b": "b2",
-                "c": "z"
+                "c": "z",
+                "p": "0.91"
             },
             {
-                "p": "0.99",
                 "a": "a3",
                 "b": "b3",
-                "c": "x"
+                "c": "x",
+                "p": "0.99"
             },
             {
-                "p": "0.80",
                 "a": "a3",
                 "b": "b3",
-                "c": "y"
+                "c": "y",
+                "p": "0.80"
             },
             {
-                "p": "0.37",
                 "a": "a3",
                 "b": "b3",
-                "c": "z"
+                "c": "z",
+                "p": "0.37"
             }
         ]
     },
-    "width": 60,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A simple grid of bar charts to compare performance data.",
     "encoding": {
         "color": {
             "field": "c",
-            "title": "settings",
-            "type": "nominal",
             "legend": {
                 "orient": "bottom",
                 "titleOrient": "left"
-            }
+            },
+            "title": "settings",
+            "type": "nominal"
         },
+        "column": {
+            "field": "b",
+            "title": "Factor B",
+            "type": "nominal"
+        },
         "row": {
             "field": "a",
             "header": {
@@ -190,24 +191,23 @@
             "type": "nominal"
         },
         "x": {
-            "field": "p",
-            "title": null,
-            "type": "quantitative",
             "axis": {
                 "format": "%"
-            }
-        },
-        "column": {
-            "field": "b",
-            "title": "Factor B",
-            "type": "nominal"
+            },
+            "field": "p",
+            "title": null,
+            "type": "quantitative"
         },
         "y": {
+            "axis": null,
             "field": "c",
-            "type": "nominal",
-            "axis": null
+            "type": "nominal"
         }
     },
-    "description": "A simple grid of bar charts to compare performance data.",
-    "spacing": 5
+    "height": {
+        "step": 8
+    },
+    "mark": "bar",
+    "spacing": 5,
+    "width": 60
 }
diff --git a/tests/specs/gallery/facet/trellisareaseattle.vl b/tests/specs/gallery/facet/trellisareaseattle.vl
--- a/tests/specs/gallery/facet/trellisareaseattle.vl
+++ b/tests/specs/gallery/facet/trellisareaseattle.vl
@@ -1,10 +1,5 @@
 {
-    "transform": [
-        {
-            "as": "order",
-            "calculate": "(hours(datum.date) + 18) % 24"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "axis": {
             "domain": false,
@@ -14,56 +9,61 @@
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-temps.csv"
     },
-    "spec": {
-        "height": 25,
-        "mark": "area",
-        "width": 800,
-        "view": {
-            "stroke": null
-        },
-        "encoding": {
-            "x": {
-                "field": "date",
-                "title": "Month",
-                "type": "temporal",
-                "axis": {
-                    "format": "%b"
-                }
-            },
-            "y": {
-                "field": "temp",
-                "scale": {
-                    "zero": false
-                },
-                "type": "quantitative",
-                "axis": {
-                    "labels": false,
-                    "title": null,
-                    "ticks": false
-                }
-            }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Average temps in Seattle, by hour",
     "facet": {
         "row": {
             "field": "date",
-            "timeUnit": "hours",
             "header": {
+                "labelAlign": "left",
                 "labelAngle": 0,
                 "labelExpr": "hours(datum.value) == 0 ? 'Midnight' : hours(datum.value) == 12 ? 'Noon' : timeFormat(datum.value, '%I:%M %p')",
-                "titlePadding": -4,
                 "labelPadding": 2,
-                "labelAlign": "left"
+                "titlePadding": -4
             },
             "sort": {
-                "op": "max",
-                "field": "order"
+                "field": "order",
+                "op": "max"
             },
+            "timeUnit": "hours",
             "type": "nominal"
         }
     },
+    "spacing": 1,
+    "spec": {
+        "encoding": {
+            "x": {
+                "axis": {
+                    "format": "%b"
+                },
+                "field": "date",
+                "title": "Month",
+                "type": "temporal"
+            },
+            "y": {
+                "axis": {
+                    "labels": false,
+                    "ticks": false,
+                    "title": null
+                },
+                "field": "temp",
+                "scale": {
+                    "zero": false
+                },
+                "type": "quantitative"
+            }
+        },
+        "height": 25,
+        "mark": "area",
+        "view": {
+            "stroke": null
+        },
+        "width": 800
+    },
     "title": "Seattle Annual Temperatures",
-    "description": "Average temps in Seattle, by hour",
-    "spacing": 1
+    "transform": [
+        {
+            "as": "order",
+            "calculate": "(hours(datum.date) + 18) % 24"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/geo/geo1.vl b/tests/specs/gallery/geo/geo1.vl
--- a/tests/specs/gallery/geo/geo1.vl
+++ b/tests/specs/gallery/geo/geo1.vl
@@ -1,36 +1,16 @@
 {
-    "transform": [
-        {
-            "from": {
-                "data": {
-                    "url": "https://vega.github.io/vega-lite/data/unemployment.tsv"
-                },
-                "key": "id",
-                "fields": [
-                    "rate"
-                ]
-            },
-            "lookup": "id"
-        }
-    ],
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "mark": "geoshape",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/us-10m.json",
         "format": {
             "feature": "counties",
             "type": "topojson"
-        }
-    },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
+        },
+        "url": "https://vega.github.io/vega-lite/data/us-10m.json"
     },
     "encoding": {
         "color": {
@@ -38,5 +18,25 @@
             "sort": "descending",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "geoshape",
+    "projection": {
+        "type": "albersUsa"
+    },
+    "transform": [
+        {
+            "from": {
+                "data": {
+                    "url": "https://vega.github.io/vega-lite/data/unemployment.tsv"
+                },
+                "fields": [
+                    "rate"
+                ],
+                "key": "id"
+            },
+            "lookup": "id"
+        }
+    ],
+    "width": 500
 }
diff --git a/tests/specs/gallery/geo/geo2.vl b/tests/specs/gallery/geo/geo2.vl
--- a/tests/specs/gallery/geo/geo2.vl
+++ b/tests/specs/gallery/geo/geo2.vl
@@ -1,33 +1,19 @@
 {
-    "transform": [
-        {
-            "as": "digit",
-            "calculate": "substring(datum.zip_code, 0, 1)"
-        }
-    ],
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "mark": "circle",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/zipcodes.csv"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
-    },
+    "description": "US zip codes: One dot per zipcode colored by first digit",
     "encoding": {
         "color": {
             "field": "digit",
             "type": "nominal"
         },
-        "size": {
-            "value": 1
-        },
         "latitude": {
             "field": "latitude",
             "type": "quantitative"
@@ -35,7 +21,21 @@
         "longitude": {
             "field": "longitude",
             "type": "quantitative"
+        },
+        "size": {
+            "value": 1
         }
     },
-    "description": "US zip codes: One dot per zipcode colored by first digit"
+    "height": 300,
+    "mark": "circle",
+    "projection": {
+        "type": "albersUsa"
+    },
+    "transform": [
+        {
+            "as": "digit",
+            "calculate": "substring(datum.zip_code, 0, 1)"
+        }
+    ],
+    "width": 500
 }
diff --git a/tests/specs/gallery/geo/geo3.vl b/tests/specs/gallery/geo/geo3.vl
--- a/tests/specs/gallery/geo/geo3.vl
+++ b/tests/specs/gallery/geo/geo3.vl
@@ -1,33 +1,29 @@
 {
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
-    },
+    "description": "One dot per airport in the US overlayed on geoshape",
+    "height": 300,
     "layer": [
         {
-            "mark": "geoshape",
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/us-10m.json",
                 "format": {
                     "feature": "states",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/us-10m.json"
             },
             "encoding": {
                 "color": {
                     "value": "#eee"
                 }
-            }
+            },
+            "mark": "geoshape"
         },
         {
-            "mark": "circle",
             "data": {
                 "url": "https://vega.github.io/vega-lite/data/airports.csv"
             },
@@ -35,9 +31,6 @@
                 "color": {
                     "value": "steelblue"
                 },
-                "size": {
-                    "value": 5
-                },
                 "latitude": {
                     "field": "latitude",
                     "type": "quantitative"
@@ -45,9 +38,16 @@
                 "longitude": {
                     "field": "longitude",
                     "type": "quantitative"
+                },
+                "size": {
+                    "value": 5
                 }
-            }
+            },
+            "mark": "circle"
         }
     ],
-    "description": "One dot per airport in the US overlayed on geoshape"
+    "projection": {
+        "type": "albersUsa"
+    },
+    "width": 500
 }
diff --git a/tests/specs/gallery/geo/geo4.vl b/tests/specs/gallery/geo/geo4.vl
--- a/tests/specs/gallery/geo/geo4.vl
+++ b/tests/specs/gallery/geo/geo4.vl
@@ -1,33 +1,29 @@
 {
-    "height": 500,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
-    },
+    "description": "Rules (line segments) connecting SEA to every airport reachable via direct flight",
+    "height": 500,
     "layer": [
         {
-            "mark": "geoshape",
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/us-10m.json",
                 "format": {
                     "feature": "states",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/us-10m.json"
             },
             "encoding": {
                 "color": {
                     "value": "#eee"
                 }
-            }
+            },
+            "mark": "geoshape"
         },
         {
-            "mark": "circle",
             "data": {
                 "url": "https://vega.github.io/vega-lite/data/airports.csv"
             },
@@ -35,9 +31,6 @@
                 "color": {
                     "value": "gray"
                 },
-                "size": {
-                    "value": 5
-                },
                 "latitude": {
                     "field": "latitude",
                     "type": "quantitative"
@@ -45,10 +38,34 @@
                 "longitude": {
                     "field": "longitude",
                     "type": "quantitative"
+                },
+                "size": {
+                    "value": 5
                 }
-            }
+            },
+            "mark": "circle"
         },
         {
+            "data": {
+                "url": "https://vega.github.io/vega-lite/data/flights-airport.csv"
+            },
+            "encoding": {
+                "latitude": {
+                    "field": "o.latitude",
+                    "type": "quantitative"
+                },
+                "latitude2": {
+                    "field": "d.latitude"
+                },
+                "longitude": {
+                    "field": "o.longitude",
+                    "type": "quantitative"
+                },
+                "longitude2": {
+                    "field": "d.longitude"
+                }
+            },
+            "mark": "rule",
             "transform": [
                 {
                     "filter": {
@@ -76,28 +93,11 @@
                     },
                     "lookup": "destination"
                 }
-            ],
-            "mark": "rule",
-            "data": {
-                "url": "https://vega.github.io/vega-lite/data/flights-airport.csv"
-            },
-            "encoding": {
-                "latitude": {
-                    "field": "o.latitude",
-                    "type": "quantitative"
-                },
-                "latitude2": {
-                    "field": "d.latitude"
-                },
-                "longitude": {
-                    "field": "o.longitude",
-                    "type": "quantitative"
-                },
-                "longitude2": {
-                    "field": "d.longitude"
-                }
-            }
+            ]
         }
     ],
-    "description": "Rules (line segments) connecting SEA to every airport reachable via direct flight"
+    "projection": {
+        "type": "albersUsa"
+    },
+    "width": 800
 }
diff --git a/tests/specs/gallery/geo/geo5.vl b/tests/specs/gallery/geo/geo5.vl
--- a/tests/specs/gallery/geo/geo5.vl
+++ b/tests/specs/gallery/geo/geo5.vl
@@ -1,14 +1,11 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "resolve": {
-        "scale": {
-            "color": "independent"
-        }
-    },
+    "description": "Population per state, engineers per state, and hurricanes per state",
     "repeat": {
         "row": [
             "population",
@@ -16,32 +13,15 @@
             "hurricanes"
         ]
     },
+    "resolve": {
+        "scale": {
+            "color": "independent"
+        }
+    },
     "spec": {
-        "transform": [
-            {
-                "as": "geo",
-                "from": {
-                    "data": {
-                        "url": "https://vega.github.io/vega-lite/data/us-10m.json",
-                        "format": {
-                            "feature": "states",
-                            "type": "topojson"
-                        }
-                    },
-                    "key": "id"
-                },
-                "lookup": "id"
-            }
-        ],
-        "height": 300,
-        "mark": "geoshape",
         "data": {
             "url": "https://vega.github.io/vega-lite/data/population_engineers_hurricanes.csv"
         },
-        "width": 500,
-        "projection": {
-            "type": "albersUsa"
-        },
         "encoding": {
             "color": {
                 "field": {
@@ -54,8 +34,28 @@
                 "field": "geo",
                 "type": "geojson"
             }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "Population per state, engineers per state, and hurricanes per state"
+        },
+        "height": 300,
+        "mark": "geoshape",
+        "projection": {
+            "type": "albersUsa"
+        },
+        "transform": [
+            {
+                "as": "geo",
+                "from": {
+                    "data": {
+                        "format": {
+                            "feature": "states",
+                            "type": "topojson"
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/us-10m.json"
+                    },
+                    "key": "id"
+                },
+                "lookup": "id"
+            }
+        ],
+        "width": 500
+    }
 }
diff --git a/tests/specs/gallery/geo/geo6.vl b/tests/specs/gallery/geo/geo6.vl
--- a/tests/specs/gallery/geo/geo6.vl
+++ b/tests/specs/gallery/geo/geo6.vl
@@ -1,41 +1,33 @@
 {
-    "height": 500,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
-    },
+    "description": "US state capitals overlayed on map of the US",
+    "height": 500,
     "layer": [
         {
-            "mark": "geoshape",
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/us-10m.json",
                 "format": {
                     "feature": "states",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/us-10m.json"
             },
             "encoding": {
                 "color": {
                     "value": "#ccc"
                 }
-            }
+            },
+            "mark": "geoshape"
         },
         {
-            "mark": "text",
             "data": {
                 "url": "https://vega.github.io/vega-lite/data/us-state-capitals.json"
             },
             "encoding": {
-                "text": {
-                    "field": "city",
-                    "type": "nominal"
-                },
                 "latitude": {
                     "field": "lat",
                     "type": "quantitative"
@@ -43,9 +35,17 @@
                 "longitude": {
                     "field": "lon",
                     "type": "quantitative"
+                },
+                "text": {
+                    "field": "city",
+                    "type": "nominal"
                 }
-            }
+            },
+            "mark": "text"
         }
     ],
-    "description": "US state capitals overlayed on map of the US"
+    "projection": {
+        "type": "albersUsa"
+    },
+    "width": 800
 }
diff --git a/tests/specs/gallery/geo/geo7.vl b/tests/specs/gallery/geo/geo7.vl
--- a/tests/specs/gallery/geo/geo7.vl
+++ b/tests/specs/gallery/geo/geo7.vl
@@ -1,33 +1,29 @@
 {
-    "height": 500,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
-    },
+    "description": "Line drawn between airports in the U.S. simulating a flight itinerary",
+    "height": 500,
     "layer": [
         {
-            "mark": "geoshape",
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/us-10m.json",
                 "format": {
                     "feature": "states",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/us-10m.json"
             },
             "encoding": {
                 "color": {
                     "value": "#eee"
                 }
-            }
+            },
+            "mark": "geoshape"
         },
         {
-            "mark": "circle",
             "data": {
                 "url": "https://vega.github.io/vega-lite/data/airports.csv"
             },
@@ -35,9 +31,6 @@
                 "color": {
                     "value": "gray"
                 },
-                "size": {
-                    "value": 5
-                },
                 "latitude": {
                     "field": "latitude",
                     "type": "quantitative"
@@ -45,26 +38,14 @@
                 "longitude": {
                     "field": "longitude",
                     "type": "quantitative"
+                },
+                "size": {
+                    "value": 5
                 }
-            }
+            },
+            "mark": "circle"
         },
         {
-            "transform": [
-                {
-                    "from": {
-                        "data": {
-                            "url": "https://vega.github.io/vega-lite/data/airports.csv"
-                        },
-                        "key": "iata",
-                        "fields": [
-                            "latitude",
-                            "longitude"
-                        ]
-                    },
-                    "lookup": "airport"
-                }
-            ],
-            "mark": "line",
             "data": {
                 "values": [
                     {
@@ -115,11 +96,29 @@
                     "type": "quantitative"
                 },
                 "order": {
-                    "field": "order",
-                    "type": "ordinal"
+                    "field": "order"
                 }
-            }
+            },
+            "mark": "line",
+            "transform": [
+                {
+                    "from": {
+                        "data": {
+                            "url": "https://vega.github.io/vega-lite/data/airports.csv"
+                        },
+                        "fields": [
+                            "latitude",
+                            "longitude"
+                        ],
+                        "key": "iata"
+                    },
+                    "lookup": "airport"
+                }
+            ]
         }
     ],
-    "description": "Line drawn between airports in the U.S. simulating a flight itinerary"
+    "projection": {
+        "type": "albersUsa"
+    },
+    "width": 800
 }
diff --git a/tests/specs/gallery/geo/geo8.vl b/tests/specs/gallery/geo/geo8.vl
--- a/tests/specs/gallery/geo/geo8.vl
+++ b/tests/specs/gallery/geo/geo8.vl
@@ -1,49 +1,49 @@
 {
-    "transform": [
-        {
-            "as": "geo",
-            "from": {
-                "data": {
-                    "url": "https://vega.github.io/vega-lite/data/us-10m.json",
-                    "format": {
-                        "feature": "states",
-                        "type": "topojson"
-                    }
-                },
-                "key": "id"
-            },
-            "lookup": "id"
-        }
-    ],
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "mark": "geoshape",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/income.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
-    },
+    "description": "Income in the U.S. by state, faceted over income brackets",
     "encoding": {
         "color": {
             "field": "pct",
             "sort": "descending",
             "type": "quantitative"
         },
-        "shape": {
-            "field": "geo",
-            "type": "geojson"
-        },
         "row": {
             "field": "group",
             "type": "nominal"
+        },
+        "shape": {
+            "field": "geo",
+            "type": "geojson"
         }
     },
-    "description": "Income in the U.S. by state, faceted over income brackets"
+    "height": 300,
+    "mark": "geoshape",
+    "projection": {
+        "type": "albersUsa"
+    },
+    "transform": [
+        {
+            "as": "geo",
+            "from": {
+                "data": {
+                    "format": {
+                        "feature": "states",
+                        "type": "topojson"
+                    },
+                    "url": "https://vega.github.io/vega-lite/data/us-10m.json"
+                },
+                "key": "id"
+            },
+            "lookup": "id"
+        }
+    ],
+    "width": 500
 }
diff --git a/tests/specs/gallery/geo/geo9.vl b/tests/specs/gallery/geo/geo9.vl
--- a/tests/specs/gallery/geo/geo9.vl
+++ b/tests/specs/gallery/geo/geo9.vl
@@ -1,80 +1,80 @@
 {
-    "height": 500,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "width": 700,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Geographic position of London underground lines",
+    "height": 500,
     "layer": [
         {
-            "mark": {
-                "strokeWidth": 2,
-                "stroke": "rgb(251,247,238)",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/londonBoroughs.json",
                 "format": {
                     "feature": "boroughs",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/londonBoroughs.json"
             },
             "encoding": {
                 "color": {
                     "value": "#ddc"
                 }
+            },
+            "mark": {
+                "stroke": "rgb(251,247,238)",
+                "strokeWidth": 2,
+                "type": "geoshape"
             }
         },
         {
-            "transform": [
-                {
-                    "as": "bLabel",
-                    "calculate": "indexof (datum.name,' ') > 0  ? substring(datum.name,0,indexof(datum.name, ' ')) : datum.name"
-                }
-            ],
-            "mark": "text",
             "data": {
                 "url": "https://vega.github.io/vega-lite/data/londonCentroids.json"
             },
             "encoding": {
-                "size": {
-                    "value": 8
-                },
-                "text": {
-                    "field": "bLabel",
-                    "type": "nominal"
-                },
                 "latitude": {
                     "field": "cy",
                     "type": "quantitative"
                 },
-                "opacity": {
-                    "value": 0.6
-                },
                 "longitude": {
                     "field": "cx",
                     "type": "quantitative"
+                },
+                "opacity": {
+                    "value": 0.6
+                },
+                "size": {
+                    "value": 8
+                },
+                "text": {
+                    "field": "bLabel",
+                    "type": "nominal"
                 }
-            }
+            },
+            "mark": "text",
+            "transform": [
+                {
+                    "as": "bLabel",
+                    "calculate": "indexof (datum.name,' ') > 0  ? substring(datum.name,0,indexof(datum.name, ' ')) : datum.name"
+                }
+            ]
         },
         {
-            "mark": {
-                "strokeWidth": 2,
-                "type": "geoshape",
-                "filled": false
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/londonTubeLines.json",
                 "format": {
                     "feature": "line",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/londonTubeLines.json"
             },
             "encoding": {
                 "color": {
                     "field": "id",
+                    "legend": {
+                        "offset": 0,
+                        "orient": "bottom-right",
+                        "title": null
+                    },
                     "scale": {
                         "domain": [
                             "Bakerloo",
@@ -105,15 +105,15 @@
                             "rgb(106,187,170)"
                         ]
                     },
-                    "type": "nominal",
-                    "legend": {
-                        "offset": 0,
-                        "orient": "bottom-right",
-                        "title": null
-                    }
+                    "type": "nominal"
                 }
+            },
+            "mark": {
+                "filled": false,
+                "strokeWidth": 2,
+                "type": "geoshape"
             }
         }
     ],
-    "description": "Geographic position of London underground lines"
+    "width": 700
 }
diff --git a/tests/specs/gallery/histogram/histogram_rel_freq.vl b/tests/specs/gallery/histogram/histogram_rel_freq.vl
--- a/tests/specs/gallery/histogram/histogram_rel_freq.vl
+++ b/tests/specs/gallery/histogram/histogram_rel_freq.vl
@@ -1,30 +1,62 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/cars.json"
+    },
+    "description": "Relative frequency histogram. The data is binned with first transform. The number of values per bin and the total number are calculated in the second and third transform to calculate the relative frequency in the last transformation step.",
+    "encoding": {
+        "x": {
+            "bin": {
+                "binned": true
+            },
+            "field": "bin_Horsepwoer",
+            "title": "Horsepower",
+            "type": "quantitative"
+        },
+        "x2": {
+            "field": "bin_Horsepwoer_end"
+        },
+        "y": {
+            "axis": {
+                "format": ".1~%"
+            },
+            "field": "PercentOfTotal",
+            "title": "Relative Frequency",
+            "type": "quantitative"
+        }
+    },
+    "mark": {
+        "tooltip": {
+            "content": "encoding"
+        },
+        "type": "bar"
+    },
     "transform": [
         {
             "as": "bin_Horsepwoer",
-            "field": "Horsepower",
             "bin": {
                 "binned": true
-            }
+            },
+            "field": "Horsepower"
         },
         {
-            "groupby": [
-                "bin_Horsepwoer",
-                "bin_Horsepwoer_end"
-            ],
             "aggregate": [
                 {
-                    "op": "count",
-                    "as": "Count"
+                    "as": "Count",
+                    "op": "count"
                 }
+            ],
+            "groupby": [
+                "bin_Horsepwoer",
+                "bin_Horsepwoer_end"
             ]
         },
         {
             "joinaggregate": [
                 {
-                    "op": "sum",
                     "as": "TotalCount",
-                    "field": "Count"
+                    "field": "Count",
+                    "op": "sum"
                 }
             ]
         },
@@ -32,37 +64,5 @@
             "as": "PercentOfTotal",
             "calculate": "datum.Count/datum.TotalCount"
         }
-    ],
-    "mark": {
-        "tooltip": {
-            "content": "encoding"
-        },
-        "type": "bar"
-    },
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/cars.json"
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "encoding": {
-        "x2": {
-            "field": "bin_Horsepwoer_end"
-        },
-        "x": {
-            "field": "bin_Horsepwoer",
-            "bin": {
-                "binned": true
-            },
-            "title": "Horsepower",
-            "type": "quantitative"
-        },
-        "y": {
-            "field": "PercentOfTotal",
-            "title": "Relative Frequency",
-            "type": "quantitative",
-            "axis": {
-                "format": ".1~%"
-            }
-        }
-    },
-    "description": "Relative frequency histogram. The data is binned with first transform. The number of values per bin and the total number are calculated in the second and third transform to calculate the relative frequency in the last transformation step."
+    ]
 }
diff --git a/tests/specs/gallery/interaction/interaction1.vl b/tests/specs/gallery/interaction/interaction1.vl
--- a/tests/specs/gallery/interaction/interaction1.vl
+++ b/tests/specs/gallery/interaction/interaction1.vl
@@ -1,15 +1,10 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "scale": {
             "bandPaddingInner": 0.2
         }
     },
-    "mark": {
-        "cursor": "pointer",
-        "stroke": "black",
-        "fill": "#4C78A8",
-        "type": "bar"
-    },
     "data": {
         "values": [
             {
@@ -50,23 +45,18 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "highlight": {
-            "empty": "none",
-            "type": "single",
-            "on": "mouseover"
-        },
-        "select": {
-            "type": "multi"
-        }
-    },
+    "description": "A bar chart with highlighting on hover and selecting on click. Inspired by Tableau's interaction style.",
     "encoding": {
+        "fillOpacity": {
+            "condition": {
+                "selection": "select",
+                "value": 1
+            },
+            "value": 0.3
+        },
         "strokeWidth": {
-            "value": 0,
             "condition": [
                 {
-                    "value": 2,
                     "test": {
                         "and": [
                             {
@@ -74,29 +64,39 @@
                             },
                             "length(data(\"select_store\"))"
                         ]
-                    }
+                    },
+                    "value": 2
                 },
                 {
-                    "value": 1,
-                    "selection": "highlight"
+                    "selection": "highlight",
+                    "value": 1
                 }
-            ]
+            ],
+            "value": 0
         },
         "x": {
             "field": "a",
             "type": "ordinal"
         },
-        "fillOpacity": {
-            "value": 0.3,
-            "condition": {
-                "value": 1,
-                "selection": "select"
-            }
-        },
         "y": {
             "field": "b",
             "type": "quantitative"
         }
     },
-    "description": "A bar chart with highlighting on hover and selecting on click. Inspired by Tableau's interaction style."
+    "mark": {
+        "cursor": "pointer",
+        "fill": "#4C78A8",
+        "stroke": "black",
+        "type": "bar"
+    },
+    "selection": {
+        "highlight": {
+            "empty": "none",
+            "on": "mouseover",
+            "type": "single"
+        },
+        "select": {
+            "type": "multi"
+        }
+    }
 }
diff --git a/tests/specs/gallery/interaction/interaction10.vl b/tests/specs/gallery/interaction/interaction10.vl
--- a/tests/specs/gallery/interaction/interaction10.vl
+++ b/tests/specs/gallery/interaction/interaction10.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "axisY": {
             "minExtent": 30
@@ -7,74 +8,73 @@
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Multi Series Line Chart with Tooltip",
+    "encoding": {
+        "tooltip": [
+            {
+                "field": "date",
+                "timeUnit": "yearmonthdate",
+                "type": "temporal"
+            },
+            {
+                "field": "temp_max",
+                "type": "quantitative"
+            },
+            {
+                "field": "temp_min",
+                "type": "quantitative"
+            }
+        ],
+        "x": {
+            "field": "date",
+            "timeUnit": "yearmonthdate",
+            "type": "temporal"
+        }
+    },
     "layer": [
         {
-            "mark": {
-                "color": "orange",
-                "type": "line"
-            },
             "encoding": {
                 "y": {
                     "field": "temp_max",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "orange",
+                "type": "line"
             }
         },
         {
-            "mark": {
-                "color": "red",
-                "type": "line"
-            },
             "encoding": {
                 "y": {
                     "field": "temp_min",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "type": "line"
             }
         },
         {
-            "mark": "rule",
-            "selection": {
-                "hover": {
-                    "empty": "none",
-                    "type": "single",
-                    "on": "mouseover"
-                }
-            },
             "encoding": {
                 "color": {
                     "condition": {
-                        "value": "transparent",
                         "selection": {
                             "not": "hover"
-                        }
+                        },
+                        "value": "transparent"
                     }
                 }
-            }
-        }
-    ],
-    "encoding": {
-        "tooltip": [
-            {
-                "field": "date",
-                "timeUnit": "yearmonthdate",
-                "type": "temporal"
             },
-            {
-                "field": "temp_max",
-                "type": "quantitative"
-            },
-            {
-                "field": "temp_min",
-                "type": "quantitative"
+            "mark": "rule",
+            "selection": {
+                "hover": {
+                    "empty": "none",
+                    "on": "mouseover",
+                    "type": "single"
+                }
             }
-        ],
-        "x": {
-            "field": "date",
-            "timeUnit": "yearmonthdate",
-            "type": "temporal"
         }
-    },
-    "description": "Multi Series Line Chart with Tooltip"
+    ]
 }
diff --git a/tests/specs/gallery/interaction/interaction11a.vl b/tests/specs/gallery/interaction/interaction11a.vl
--- a/tests/specs/gallery/interaction/interaction11a.vl
+++ b/tests/specs/gallery/interaction/interaction11a.vl
@@ -1,22 +1,17 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "brush": {
-            "type": "interval"
-        }
-    },
+    "description": "Drag out a rectangular brush to highlight points.",
     "encoding": {
         "color": {
-            "value": "grey",
             "condition": {
                 "field": "Cylinders",
                 "selection": "brush",
                 "type": "ordinal"
-            }
+            },
+            "value": "grey"
         },
         "x": {
             "field": "Horsepower",
@@ -27,5 +22,10 @@
             "type": "quantitative"
         }
     },
-    "description": "Drag out a rectangular brush to highlight points."
+    "mark": "point",
+    "selection": {
+        "brush": {
+            "type": "interval"
+        }
+    }
 }
diff --git a/tests/specs/gallery/interaction/interaction11b.vl b/tests/specs/gallery/interaction/interaction11b.vl
--- a/tests/specs/gallery/interaction/interaction11b.vl
+++ b/tests/specs/gallery/interaction/interaction11b.vl
@@ -1,28 +1,17 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "brush": {
-            "init": {
-                "x": [
-                    55,
-                    160
-                ]
-            },
-            "type": "interval"
-        }
-    },
+    "description": "Drag out a rectangular brush to highlight points.",
     "encoding": {
         "color": {
-            "value": "grey",
             "condition": {
                 "field": "Cylinders",
                 "selection": "brush",
                 "type": "ordinal"
-            }
+            },
+            "value": "grey"
         },
         "x": {
             "field": "Horsepower",
@@ -33,5 +22,16 @@
             "type": "quantitative"
         }
     },
-    "description": "Drag out a rectangular brush to highlight points."
+    "mark": "point",
+    "selection": {
+        "brush": {
+            "init": {
+                "x": [
+                    55,
+                    160
+                ]
+            },
+            "type": "interval"
+        }
+    }
 }
diff --git a/tests/specs/gallery/interaction/interaction11c.vl b/tests/specs/gallery/interaction/interaction11c.vl
--- a/tests/specs/gallery/interaction/interaction11c.vl
+++ b/tests/specs/gallery/interaction/interaction11c.vl
@@ -1,28 +1,17 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "brush": {
-            "init": {
-                "y": [
-                    13,
-                    37
-                ]
-            },
-            "type": "interval"
-        }
-    },
+    "description": "Drag out a rectangular brush to highlight points.",
     "encoding": {
         "color": {
-            "value": "grey",
             "condition": {
                 "field": "Cylinders",
                 "selection": "brush",
                 "type": "ordinal"
-            }
+            },
+            "value": "grey"
         },
         "x": {
             "field": "Horsepower",
@@ -33,5 +22,16 @@
             "type": "quantitative"
         }
     },
-    "description": "Drag out a rectangular brush to highlight points."
+    "mark": "point",
+    "selection": {
+        "brush": {
+            "init": {
+                "y": [
+                    13,
+                    37
+                ]
+            },
+            "type": "interval"
+        }
+    }
 }
diff --git a/tests/specs/gallery/interaction/interaction11d.vl b/tests/specs/gallery/interaction/interaction11d.vl
--- a/tests/specs/gallery/interaction/interaction11d.vl
+++ b/tests/specs/gallery/interaction/interaction11d.vl
@@ -1,32 +1,17 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "brush": {
-            "init": {
-                "x": [
-                    55,
-                    160
-                ],
-                "y": [
-                    13,
-                    37
-                ]
-            },
-            "type": "interval"
-        }
-    },
+    "description": "Drag out a rectangular brush to highlight points.",
     "encoding": {
         "color": {
-            "value": "grey",
             "condition": {
                 "field": "Cylinders",
                 "selection": "brush",
                 "type": "ordinal"
-            }
+            },
+            "value": "grey"
         },
         "x": {
             "field": "Horsepower",
@@ -37,5 +22,20 @@
             "type": "quantitative"
         }
     },
-    "description": "Drag out a rectangular brush to highlight points."
+    "mark": "point",
+    "selection": {
+        "brush": {
+            "init": {
+                "x": [
+                    55,
+                    160
+                ],
+                "y": [
+                    13,
+                    37
+                ]
+            },
+            "type": "interval"
+        }
+    }
 }
diff --git a/tests/specs/gallery/interaction/interaction2.vl b/tests/specs/gallery/interaction/interaction2.vl
--- a/tests/specs/gallery/interaction/interaction2.vl
+++ b/tests/specs/gallery/interaction/interaction2.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "url",
-            "calculate": "'https://www.google.com/search?q=' + datum.Name"
-        }
-    ],
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Scatterplot with external links and tooltips",
     "encoding": {
         "color": {
             "field": "Origin",
@@ -32,5 +26,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Scatterplot with external links and tooltips"
+    "mark": "point",
+    "transform": [
+        {
+            "as": "url",
+            "calculate": "'https://www.google.com/search?q=' + datum.Name"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/interaction/interaction3.vl b/tests/specs/gallery/interaction/interaction3.vl
--- a/tests/specs/gallery/interaction/interaction3.vl
+++ b/tests/specs/gallery/interaction/interaction3.vl
@@ -1,22 +1,17 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "myBrush": {
-            "type": "interval"
-        }
-    },
+    "description": "Drag out a rectangular brush to highlight points",
     "encoding": {
         "color": {
-            "value": "grey",
             "condition": {
                 "field": "Cylinders",
                 "selection": "myBrush",
                 "type": "ordinal"
-            }
+            },
+            "value": "grey"
         },
         "x": {
             "field": "Horsepower",
@@ -27,5 +22,10 @@
             "type": "quantitative"
         }
     },
-    "description": "Drag out a rectangular brush to highlight points"
+    "mark": "point",
+    "selection": {
+        "myBrush": {
+            "type": "interval"
+        }
+    }
 }
diff --git a/tests/specs/gallery/interaction/interaction4.vl b/tests/specs/gallery/interaction/interaction4.vl
--- a/tests/specs/gallery/interaction/interaction4.vl
+++ b/tests/specs/gallery/interaction/interaction4.vl
@@ -1,8 +1,21 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/unemployment-across-industries.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Area chart with rectangular brush",
+    "encoding": {
+        "x": {
+            "field": "date",
+            "timeUnit": "yearmonth",
+            "type": "temporal"
+        },
+        "y": {
+            "aggregate": "sum",
+            "field": "count",
+            "type": "quantitative"
+        }
+    },
     "layer": [
         {
             "mark": "area",
@@ -16,30 +29,17 @@
             }
         },
         {
+            "mark": {
+                "color": "goldenrod",
+                "type": "area"
+            },
             "transform": [
                 {
                     "filter": {
                         "selection": "myBrush"
                     }
                 }
-            ],
-            "mark": {
-                "color": "goldenrod",
-                "type": "area"
-            }
-        }
-    ],
-    "encoding": {
-        "x": {
-            "field": "date",
-            "timeUnit": "yearmonth",
-            "type": "temporal"
-        },
-        "y": {
-            "field": "count",
-            "aggregate": "sum",
-            "type": "quantitative"
+            ]
         }
-    },
-    "description": "Area chart with rectangular brush"
+    ]
 }
diff --git a/tests/specs/gallery/interaction/interaction5.vl b/tests/specs/gallery/interaction/interaction5.vl
--- a/tests/specs/gallery/interaction/interaction5.vl
+++ b/tests/specs/gallery/interaction/interaction5.vl
@@ -1,23 +1,16 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "myPaintbrush": {
-            "nearest": true,
-            "type": "multi",
-            "on": "mouseover"
-        }
-    },
+    "description": "Mouse over individual points or select multiple points with the shift key",
     "encoding": {
         "size": {
-            "value": 50,
             "condition": {
-                "value": 300,
-                "selection": "myPaintbrush"
-            }
+                "selection": "myPaintbrush",
+                "value": 300
+            },
+            "value": 50
         },
         "x": {
             "field": "Horsepower",
@@ -28,5 +21,12 @@
             "type": "quantitative"
         }
     },
-    "description": "Mouse over individual points or select multiple points with the shift key"
+    "mark": "point",
+    "selection": {
+        "myPaintbrush": {
+            "nearest": true,
+            "on": "mouseover",
+            "type": "multi"
+        }
+    }
 }
diff --git a/tests/specs/gallery/interaction/interaction6.vl b/tests/specs/gallery/interaction/interaction6.vl
--- a/tests/specs/gallery/interaction/interaction6.vl
+++ b/tests/specs/gallery/interaction/interaction6.vl
@@ -1,15 +1,9 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "myGrid": {
-            "bind": "scales",
-            "type": "interval"
-        }
-    },
+    "description": "Drag to pan. Zoom in or out with mousewheel/zoom gesture.",
     "encoding": {
         "size": {
             "field": "Cylinders",
@@ -36,5 +30,11 @@
             "type": "quantitative"
         }
     },
-    "description": "Drag to pan. Zoom in or out with mousewheel/zoom gesture."
+    "mark": "circle",
+    "selection": {
+        "myGrid": {
+            "bind": "scales",
+            "type": "interval"
+        }
+    }
 }
diff --git a/tests/specs/gallery/interaction/interaction7.vl b/tests/specs/gallery/interaction/interaction7.vl
--- a/tests/specs/gallery/interaction/interaction7.vl
+++ b/tests/specs/gallery/interaction/interaction7.vl
@@ -1,66 +1,63 @@
 {
-    "transform": [
-        {
-            "as": "Year",
-            "calculate": "year(datum.Year)"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Drag the sliders to highlight points",
+    "encoding": {
+        "x": {
+            "field": "Horsepower",
+            "type": "quantitative"
+        },
+        "y": {
+            "field": "Miles_per_Gallon",
+            "type": "quantitative"
+        }
+    },
     "layer": [
         {
+            "encoding": {
+                "color": {
+                    "condition": {
+                        "field": "Origin",
+                        "selection": "CylYr",
+                        "type": "nominal"
+                    },
+                    "value": "grey"
+                }
+            },
             "mark": "circle",
             "selection": {
                 "CylYr": {
-                    "init": {
-                        "Cylinders": 4,
-                        "Year": 1977
-                    },
                     "bind": {
                         "Cylinders": {
-                            "max": 8,
                             "input": "range",
+                            "max": 8,
+                            "min": 3,
                             "name": "Cylinders ",
-                            "step": 1,
-                            "min": 3
+                            "step": 1
                         },
                         "Year": {
-                            "max": 1981,
                             "input": "range",
+                            "max": 1981,
+                            "min": 1969,
                             "name": "Year ",
-                            "step": 1,
-                            "min": 1969
+                            "step": 1
                         }
                     },
-                    "type": "single",
                     "fields": [
                         "Cylinders",
                         "Year"
-                    ]
-                }
-            },
-            "encoding": {
-                "color": {
-                    "value": "grey",
-                    "condition": {
-                        "field": "Origin",
-                        "selection": "CylYr",
-                        "type": "nominal"
-                    }
+                    ],
+                    "init": {
+                        "Cylinders": 4,
+                        "Year": 1977
+                    },
+                    "type": "single"
                 }
             }
         },
         {
-            "transform": [
-                {
-                    "filter": {
-                        "selection": "CylYr"
-                    }
-                }
-            ],
-            "mark": "circle",
             "encoding": {
                 "color": {
                     "field": "Origin",
@@ -69,18 +66,21 @@
                 "size": {
                     "value": 100
                 }
-            }
+            },
+            "mark": "circle",
+            "transform": [
+                {
+                    "filter": {
+                        "selection": "CylYr"
+                    }
+                }
+            ]
         }
     ],
-    "encoding": {
-        "x": {
-            "field": "Horsepower",
-            "type": "quantitative"
-        },
-        "y": {
-            "field": "Miles_per_Gallon",
-            "type": "quantitative"
+    "transform": [
+        {
+            "as": "Year",
+            "calculate": "year(datum.Year)"
         }
-    },
-    "description": "Drag the sliders to highlight points"
+    ]
 }
diff --git a/tests/specs/gallery/interaction/interaction8.vl b/tests/specs/gallery/interaction/interaction8.vl
--- a/tests/specs/gallery/interaction/interaction8.vl
+++ b/tests/specs/gallery/interaction/interaction8.vl
@@ -1,43 +1,43 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "encoding": {
+        "y": {
+            "aggregate": "mean",
+            "field": "precipitation",
+            "type": "quantitative"
+        }
+    },
     "layer": [
         {
-            "mark": "bar",
-            "selection": {
-                "myBrush": {
-                    "encodings": [
-                        "x"
-                    ],
-                    "type": "interval"
-                }
-            },
             "encoding": {
                 "opacity": {
-                    "value": 0.7,
                     "condition": {
-                        "value": 1,
-                        "selection": "myBrush"
-                    }
+                        "selection": "myBrush",
+                        "value": 1
+                    },
+                    "value": 0.7
                 },
                 "x": {
                     "field": "date",
                     "timeUnit": "month",
                     "type": "ordinal"
                 }
+            },
+            "mark": "bar",
+            "selection": {
+                "myBrush": {
+                    "encodings": [
+                        "x"
+                    ],
+                    "type": "interval"
+                }
             }
         },
         {
-            "transform": [
-                {
-                    "filter": {
-                        "selection": "myBrush"
-                    }
-                }
-            ],
-            "mark": "rule",
+            "description": "Drag over bars to update selection average",
             "encoding": {
                 "color": {
                     "value": "firebrick"
@@ -46,14 +46,14 @@
                     "value": 3
                 }
             },
-            "description": "Drag over bars to update selection average"
-        }
-    ],
-    "encoding": {
-        "y": {
-            "field": "precipitation",
-            "aggregate": "mean",
-            "type": "quantitative"
+            "mark": "rule",
+            "transform": [
+                {
+                    "filter": {
+                        "selection": "myBrush"
+                    }
+                }
+            ]
         }
-    }
+    ]
 }
diff --git a/tests/specs/gallery/interaction/interaction9.vl b/tests/specs/gallery/interaction/interaction9.vl
--- a/tests/specs/gallery/interaction/interaction9.vl
+++ b/tests/specs/gallery/interaction/interaction9.vl
@@ -1,88 +1,75 @@
 {
-    "height": 400,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/stocks.csv",
         "format": {
             "parse": {
                 "date": "date"
             }
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Displays tooltips for all stock prices of the hovered time",
+    "height": 400,
     "layer": [
         {
+            "encoding": {
+                "color": {
+                    "field": "symbol",
+                    "type": "nominal"
+                },
+                "x": {
+                    "field": "date",
+                    "type": "temporal"
+                },
+                "y": {
+                    "field": "price",
+                    "type": "quantitative"
+                }
+            },
             "layer": [
                 {
                     "mark": "line"
                 },
                 {
+                    "encoding": {
+                        "opacity": {
+                            "condition": {
+                                "selection": "myTooltip",
+                                "value": 1
+                            },
+                            "value": 0
+                        }
+                    },
                     "mark": "point",
                     "selection": {
                         "myTooltip": {
-                            "nearest": true,
                             "empty": "none",
                             "encodings": [
                                 "x"
                             ],
-                            "type": "single",
-                            "on": "mouseover"
-                        }
-                    },
-                    "encoding": {
-                        "opacity": {
-                            "value": 0,
-                            "condition": {
-                                "value": 1,
-                                "selection": "myTooltip"
-                            }
+                            "nearest": true,
+                            "on": "mouseover",
+                            "type": "single"
                         }
                     }
                 }
-            ],
-            "encoding": {
-                "color": {
-                    "field": "symbol",
-                    "type": "nominal"
-                },
-                "x": {
-                    "field": "date",
-                    "type": "temporal"
-                },
-                "y": {
-                    "field": "price",
-                    "type": "quantitative"
-                }
-            }
+            ]
         },
         {
-            "transform": [
-                {
-                    "filter": {
-                        "selection": "myTooltip"
-                    }
-                }
-            ],
             "layer": [
                 {
-                    "mark": {
-                        "color": "gray",
-                        "type": "rule"
-                    },
                     "encoding": {
                         "x": {
                             "field": "date",
                             "type": "temporal"
                         }
+                    },
+                    "mark": {
+                        "color": "gray",
+                        "type": "rule"
                     }
                 },
                 {
-                    "mark": {
-                        "dx": 5,
-                        "dy": -5,
-                        "align": "left",
-                        "type": "text"
-                    },
                     "encoding": {
                         "color": {
                             "field": "symbol",
@@ -100,10 +87,23 @@
                             "field": "price",
                             "type": "quantitative"
                         }
+                    },
+                    "mark": {
+                        "align": "left",
+                        "dx": 5,
+                        "dy": -5,
+                        "type": "text"
                     }
                 }
+            ],
+            "transform": [
+                {
+                    "filter": {
+                        "selection": "myTooltip"
+                    }
+                }
             ]
         }
     ],
-    "description": "Displays tooltips for all stock prices of the hovered time"
+    "width": 800
 }
diff --git a/tests/specs/gallery/interaction/interactivelinehover.vl b/tests/specs/gallery/interaction/interactivelinehover.vl
--- a/tests/specs/gallery/interaction/interactivelinehover.vl
+++ b/tests/specs/gallery/interaction/interactivelinehover.vl
@@ -1,9 +1,5 @@
 {
-    "transform": [
-        {
-            "filter": "datum.symbol!=='IBM'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
@@ -12,100 +8,104 @@
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Multi-series line chart with labels and interactive highlight on hover.  We also set the selection's initial value to provide a better screenshot",
+    "encoding": {
+        "color": {
+            "condition": {
+                "field": "symbol",
+                "legend": null,
+                "selection": "hover",
+                "type": "nominal"
+            },
+            "value": "grey"
+        },
+        "opacity": {
+            "condition": {
+                "selection": "hover",
+                "value": 1
+            },
+            "value": 0.2
+        }
+    },
     "layer": [
         {
+            "encoding": {
+                "x": {
+                    "field": "date",
+                    "title": "date",
+                    "type": "temporal"
+                },
+                "y": {
+                    "field": "price",
+                    "title": "price",
+                    "type": "quantitative"
+                }
+            },
             "layer": [
                 {
+                    "description": "transparent layer to make it easier to trigger selection",
                     "mark": {
-                        "strokeWidth": 8,
                         "stroke": "transparent",
+                        "strokeWidth": 8,
                         "type": "line"
                     },
                     "selection": {
                         "hover": {
+                            "empty": "none",
+                            "fields": [
+                                "symbol"
+                            ],
                             "init": {
                                 "symbol": "AAPL"
                             },
-                            "empty": "none",
-                            "type": "single",
                             "on": "mouseover",
-                            "fields": [
-                                "symbol"
-                            ]
+                            "type": "single"
                         }
-                    },
-                    "description": "transparent layer to make it easier to trigger selection"
+                    }
                 },
                 {
                     "mark": "line"
                 }
-            ],
+            ]
+        },
+        {
             "encoding": {
                 "x": {
+                    "aggregate": "max",
                     "field": "date",
-                    "title": "date",
                     "type": "temporal"
                 },
                 "y": {
+                    "aggregate": {
+                        "argmax": "date"
+                    },
                     "field": "price",
-                    "title": "price",
                     "type": "quantitative"
                 }
-            }
-        },
-        {
+            },
             "layer": [
                 {
                     "mark": "circle"
                 },
                 {
-                    "mark": {
-                        "dx": 4,
-                        "align": "left",
-                        "type": "text"
-                    },
                     "encoding": {
                         "text": {
                             "field": "symbol",
                             "type": "nominal"
                         }
-                    }
-                }
-            ],
-            "encoding": {
-                "x": {
-                    "field": "date",
-                    "aggregate": "max",
-                    "type": "temporal"
-                },
-                "y": {
-                    "field": "price",
-                    "aggregate": {
-                        "argmax": "date"
                     },
-                    "type": "quantitative"
+                    "mark": {
+                        "align": "left",
+                        "dx": 4,
+                        "type": "text"
+                    }
                 }
-            }
+            ]
         }
     ],
-    "encoding": {
-        "color": {
-            "value": "grey",
-            "condition": {
-                "field": "symbol",
-                "selection": "hover",
-                "type": "nominal",
-                "legend": null
-            }
-        },
-        "opacity": {
-            "value": 0.2,
-            "condition": {
-                "value": 1,
-                "selection": "hover"
-            }
+    "transform": [
+        {
+            "filter": "datum.symbol!=='IBM'"
         }
-    },
-    "description": "Multi-series line chart with labels and interactive highlight on hover.  We also set the selection's initial value to provide a better screenshot"
+    ]
 }
diff --git a/tests/specs/gallery/label/baselines.vl b/tests/specs/gallery/label/baselines.vl
--- a/tests/specs/gallery/label/baselines.vl
+++ b/tests/specs/gallery/label/baselines.vl
@@ -1,33 +1,8 @@
 {
-    "config": {
-        "mark": {
-            "fontStyle": "italic",
-            "fontSize": 20,
-            "lineHeight": 30
-        },
-        "title": {
-            "font": "Comic Sans MS"
-        }
-    },
-    "data": {
-        "values": [
-            {
-                "x": 5,
-                "y": 5
-            },
-            {
-                "x": 30,
-                "y": 30
-            }
-        ]
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "columns": 2,
     "concat": [
         {
-            "mark": {
-                "type": "text",
-                "baseline": "top"
-            },
-            "title": "top",
             "encoding": {
                 "text": {
                     "value": [
@@ -36,6 +11,9 @@
                     ]
                 },
                 "x": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "x",
                     "scale": {
                         "domain": [
@@ -44,12 +22,12 @@
                         ],
                         "nice": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 },
                 "y": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "y",
                     "scale": {
                         "domain": [
@@ -58,19 +36,16 @@
                         ],
                         "nice": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 }
-            }
-        },
-        {
+            },
             "mark": {
-                "type": "text",
-                "baseline": "line-top"
+                "baseline": "top",
+                "type": "text"
             },
-            "title": "line-top",
+            "title": "top"
+        },
+        {
             "encoding": {
                 "text": {
                     "value": [
@@ -79,6 +54,9 @@
                     ]
                 },
                 "x": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "x",
                     "scale": {
                         "domain": [
@@ -87,12 +65,12 @@
                         ],
                         "nice": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 },
                 "y": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "y",
                     "scale": {
                         "domain": [
@@ -101,19 +79,16 @@
                         ],
                         "nice": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 }
-            }
-        },
-        {
+            },
             "mark": {
-                "type": "text",
-                "baseline": "middle"
+                "baseline": "line-top",
+                "type": "text"
             },
-            "title": "middle",
+            "title": "line-top"
+        },
+        {
             "encoding": {
                 "text": {
                     "value": [
@@ -122,6 +97,9 @@
                     ]
                 },
                 "x": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "x",
                     "scale": {
                         "domain": [
@@ -130,12 +108,12 @@
                         ],
                         "nice": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 },
                 "y": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "y",
                     "scale": {
                         "domain": [
@@ -144,19 +122,16 @@
                         ],
                         "nice": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 }
-            }
-        },
-        {
+            },
             "mark": {
-                "type": "text",
-                "baseline": "alphabetic"
+                "baseline": "middle",
+                "type": "text"
             },
-            "title": "baseline",
+            "title": "middle"
+        },
+        {
             "encoding": {
                 "text": {
                     "value": [
@@ -165,6 +140,9 @@
                     ]
                 },
                 "x": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "x",
                     "scale": {
                         "domain": [
@@ -173,12 +151,12 @@
                         ],
                         "nice": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 },
                 "y": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "y",
                     "scale": {
                         "domain": [
@@ -187,19 +165,16 @@
                         ],
                         "nice": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 }
-            }
-        },
-        {
+            },
             "mark": {
-                "type": "text",
-                "baseline": "bottom"
+                "baseline": "alphabetic",
+                "type": "text"
             },
-            "title": "bottom",
+            "title": "baseline"
+        },
+        {
             "encoding": {
                 "text": {
                     "value": [
@@ -208,6 +183,9 @@
                     ]
                 },
                 "x": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "x",
                     "scale": {
                         "domain": [
@@ -216,12 +194,12 @@
                         ],
                         "nice": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 },
                 "y": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "y",
                     "scale": {
                         "domain": [
@@ -230,19 +208,16 @@
                         ],
                         "nice": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 }
-            }
-        },
-        {
+            },
             "mark": {
-                "type": "text",
-                "baseline": "line-bottom"
+                "baseline": "bottom",
+                "type": "text"
             },
-            "title": "line-bottom",
+            "title": "bottom"
+        },
+        {
             "encoding": {
                 "text": {
                     "value": [
@@ -251,6 +226,9 @@
                     ]
                 },
                 "x": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "x",
                     "scale": {
                         "domain": [
@@ -259,12 +237,12 @@
                         ],
                         "nice": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 },
                 "y": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "y",
                     "scale": {
                         "domain": [
@@ -273,14 +251,36 @@
                         ],
                         "nice": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 }
-            }
+            },
+            "mark": {
+                "baseline": "line-bottom",
+                "type": "text"
+            },
+            "title": "line-bottom"
         }
     ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "columns": 2
+    "config": {
+        "mark": {
+            "fontSize": 20,
+            "fontStyle": "italic",
+            "lineHeight": 30
+        },
+        "title": {
+            "font": "Comic Sans MS"
+        }
+    },
+    "data": {
+        "values": [
+            {
+                "x": 5,
+                "y": 5
+            },
+            {
+                "x": 30,
+                "y": 30
+            }
+        ]
+    }
 }
diff --git a/tests/specs/gallery/label/label1.vl b/tests/specs/gallery/label/label1.vl
--- a/tests/specs/gallery/label/label1.vl
+++ b/tests/specs/gallery/label/label1.vl
@@ -1,10 +1,11 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "style": {
             "label": {
-                "dx": 3,
                 "align": "left",
-                "baseline": "middle"
+                "baseline": "middle",
+                "dx": 3
             }
         }
     },
@@ -24,33 +25,32 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A simple bar chart with embedded data labels",
+    "encoding": {
+        "x": {
+            "field": "b",
+            "type": "quantitative"
+        },
+        "y": {
+            "field": "a",
+            "type": "ordinal"
+        }
+    },
     "layer": [
         {
             "mark": "bar"
         },
         {
-            "mark": {
-                "style": "label",
-                "type": "text"
-            },
             "encoding": {
                 "text": {
                     "field": "b",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "style": "label",
+                "type": "text"
             }
         }
-    ],
-    "encoding": {
-        "x": {
-            "field": "b",
-            "type": "quantitative"
-        },
-        "y": {
-            "field": "a",
-            "type": "ordinal"
-        }
-    },
-    "description": "A simple bar chart with embedded data labels"
+    ]
 }
diff --git a/tests/specs/gallery/label/label2.vl b/tests/specs/gallery/label/label2.vl
--- a/tests/specs/gallery/label/label2.vl
+++ b/tests/specs/gallery/label/label2.vl
@@ -1,52 +1,52 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
-        "text": {
-            "baseline": "middle"
-        },
         "scale": {
-            "xReverse": false,
             "bandPaddingInner": 0,
-            "bandPaddingOuter": 0
+            "bandPaddingOuter": 0,
+            "xReverse": false
+        },
+        "text": {
+            "baseline": "middle"
         }
     },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Layering text over 'heatmap'",
+    "encoding": {
+        "x": {
+            "field": "Cylinders",
+            "type": "ordinal"
+        },
+        "y": {
+            "field": "Origin",
+            "type": "ordinal"
+        }
+    },
     "layer": [
         {
-            "mark": "rect",
             "encoding": {
                 "color": {
-                    "field": "*",
                     "aggregate": "count",
+                    "field": "*",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "rect"
         },
         {
-            "mark": "text",
             "encoding": {
                 "color": {
                     "value": "white"
                 },
                 "text": {
-                    "field": "*",
                     "aggregate": "count",
+                    "field": "*",
                     "type": "quantitative"
                 }
-            }
-        }
-    ],
-    "encoding": {
-        "x": {
-            "field": "Cylinders",
-            "type": "ordinal"
-        },
-        "y": {
-            "field": "Origin",
-            "type": "ordinal"
+            },
+            "mark": "text"
         }
-    },
-    "description": "Layering text over 'heatmap'"
+    ]
 }
diff --git a/tests/specs/gallery/label/label2r.vl b/tests/specs/gallery/label/label2r.vl
--- a/tests/specs/gallery/label/label2r.vl
+++ b/tests/specs/gallery/label/label2r.vl
@@ -1,52 +1,52 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
-        "text": {
-            "baseline": "middle"
-        },
         "scale": {
-            "xReverse": true,
             "bandPaddingInner": 0,
-            "bandPaddingOuter": 0
+            "bandPaddingOuter": 0,
+            "xReverse": true
+        },
+        "text": {
+            "baseline": "middle"
         }
     },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Layering text over 'heatmap'",
+    "encoding": {
+        "x": {
+            "field": "Cylinders",
+            "type": "ordinal"
+        },
+        "y": {
+            "field": "Origin",
+            "type": "ordinal"
+        }
+    },
     "layer": [
         {
-            "mark": "rect",
             "encoding": {
                 "color": {
-                    "field": "*",
                     "aggregate": "count",
+                    "field": "*",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "rect"
         },
         {
-            "mark": "text",
             "encoding": {
                 "color": {
                     "value": "white"
                 },
                 "text": {
-                    "field": "*",
                     "aggregate": "count",
+                    "field": "*",
                     "type": "quantitative"
                 }
-            }
-        }
-    ],
-    "encoding": {
-        "x": {
-            "field": "Cylinders",
-            "type": "ordinal"
-        },
-        "y": {
-            "field": "Origin",
-            "type": "ordinal"
+            },
+            "mark": "text"
         }
-    },
-    "description": "Layering text over 'heatmap'"
+    ]
 }
diff --git a/tests/specs/gallery/label/label3.vl b/tests/specs/gallery/label/label3.vl
--- a/tests/specs/gallery/label/label3.vl
+++ b/tests/specs/gallery/label/label3.vl
@@ -1,64 +1,90 @@
 {
-    "transform": [
-        {
-            "as": "year",
-            "calculate": "year(datum.Date)"
-        },
-        {
-            "as": "month",
-            "calculate": "month(datum.Date)"
-        },
-        {
-            "as": "decade",
-            "calculate": "floor(datum.year / 10)"
-        },
-        {
-            "as": "scaled_date",
-            "calculate": "(datum.year % 10) + (datum.month / 12)"
-        }
-    ],
-    "height": 500,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/co2-concentration.csv",
         "format": {
             "parse": {
                 "Date": "utc:'%Y-%m-%d'"
             }
+        },
+        "url": "https://vega.github.io/vega-lite/data/co2-concentration.csv"
+    },
+    "description": "Carbon dioxide in the atmosphere.",
+    "encoding": {
+        "x": {
+            "axis": {
+                "tickCount": 10,
+                "title": "Year into decade",
+                "values": [
+                    1,
+                    2,
+                    3,
+                    4,
+                    5,
+                    6,
+                    7,
+                    8,
+                    9
+                ]
+            },
+            "field": "scaled_date",
+            "type": "quantitative"
+        },
+        "y": {
+            "axis": {
+                "title": "CO₂ concentration in ppm"
+            },
+            "field": "CO2",
+            "scale": {
+                "zero": false
+            },
+            "type": "quantitative"
         }
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 500,
     "layer": [
         {
-            "mark": {
-                "orient": "vertical",
-                "type": "line"
-            },
             "encoding": {
                 "color": {
                     "field": "decade",
-                    "type": "nominal",
-                    "legend": null
+                    "legend": null,
+                    "type": "nominal"
                 }
+            },
+            "mark": {
+                "orient": "vertical",
+                "type": "line"
             }
         },
         {
+            "encoding": {
+                "text": {
+                    "field": "aggregated.year",
+                    "type": "nominal"
+                }
+            },
+            "mark": {
+                "align": "left",
+                "baseline": "top",
+                "dx": 3,
+                "dy": 1,
+                "type": "text"
+            },
             "transform": [
                 {
-                    "groupby": [
-                        "decade"
-                    ],
                     "aggregate": [
                         {
-                            "op": "argmin",
                             "as": "aggregated",
-                            "field": "scaled_date"
+                            "field": "scaled_date",
+                            "op": "argmin"
                         }
+                    ],
+                    "groupby": [
+                        "decade"
                     ]
                 },
                 {
@@ -69,33 +95,33 @@
                     "as": "CO2",
                     "calculate": "datum.aggregated.CO2"
                 }
-            ],
-            "mark": {
-                "dx": 3,
-                "dy": 1,
-                "align": "left",
-                "type": "text",
-                "baseline": "top"
-            },
+            ]
+        },
+        {
             "encoding": {
                 "text": {
                     "field": "aggregated.year",
                     "type": "nominal"
                 }
-            }
-        },
-        {
+            },
+            "mark": {
+                "align": "left",
+                "baseline": "bottom",
+                "dx": 3,
+                "dy": 1,
+                "type": "text"
+            },
             "transform": [
                 {
-                    "groupby": [
-                        "decade"
-                    ],
                     "aggregate": [
                         {
-                            "op": "argmax",
                             "as": "aggregated",
-                            "field": "scaled_date"
+                            "field": "scaled_date",
+                            "op": "argmax"
                         }
+                    ],
+                    "groupby": [
+                        "decade"
                     ]
                 },
                 {
@@ -106,52 +132,26 @@
                     "as": "CO2",
                     "calculate": "datum.aggregated.CO2"
                 }
-            ],
-            "mark": {
-                "dx": 3,
-                "dy": 1,
-                "align": "left",
-                "type": "text",
-                "baseline": "bottom"
-            },
-            "encoding": {
-                "text": {
-                    "field": "aggregated.year",
-                    "type": "nominal"
-                }
-            }
+            ]
         }
     ],
-    "encoding": {
-        "x": {
-            "field": "scaled_date",
-            "type": "quantitative",
-            "axis": {
-                "values": [
-                    1,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6,
-                    7,
-                    8,
-                    9
-                ],
-                "tickCount": 10,
-                "title": "Year into decade"
-            }
+    "transform": [
+        {
+            "as": "year",
+            "calculate": "year(datum.Date)"
         },
-        "y": {
-            "field": "CO2",
-            "scale": {
-                "zero": false
-            },
-            "type": "quantitative",
-            "axis": {
-                "title": "CO₂ concentration in ppm"
-            }
+        {
+            "as": "month",
+            "calculate": "month(datum.Date)"
+        },
+        {
+            "as": "decade",
+            "calculate": "floor(datum.year / 10)"
+        },
+        {
+            "as": "scaled_date",
+            "calculate": "(datum.year % 10) + (datum.month / 12)"
         }
-    },
-    "description": "Carbon dioxide in the atmosphere."
+    ],
+    "width": 800
 }
diff --git a/tests/specs/gallery/label/label4.vl b/tests/specs/gallery/label/label4.vl
--- a/tests/specs/gallery/label/label4.vl
+++ b/tests/specs/gallery/label/label4.vl
@@ -1,99 +1,90 @@
 {
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "The PM2.5 value of Beijing observed 15 days, highlighting the days when PM2.5 level is hazardous to human health. Data source https://chartaccent.github.io/chartaccent.html",
     "layer": [
         {
             "data": {
                 "values": [
                     {
-                        "Value": 54.8,
-                        "Day": 1
+                        "Day": 1,
+                        "Value": 54.8
                     },
                     {
-                        "Value": 112.1,
-                        "Day": 2
+                        "Day": 2,
+                        "Value": 112.1
                     },
                     {
-                        "Value": 63.6,
-                        "Day": 3
+                        "Day": 3,
+                        "Value": 63.6
                     },
                     {
-                        "Value": 37.6,
-                        "Day": 4
+                        "Day": 4,
+                        "Value": 37.6
                     },
                     {
-                        "Value": 79.7,
-                        "Day": 5
+                        "Day": 5,
+                        "Value": 79.7
                     },
                     {
-                        "Value": 137.9,
-                        "Day": 6
+                        "Day": 6,
+                        "Value": 137.9
                     },
                     {
-                        "Value": 120.1,
-                        "Day": 7
+                        "Day": 7,
+                        "Value": 120.1
                     },
                     {
-                        "Value": 103.3,
-                        "Day": 8
+                        "Day": 8,
+                        "Value": 103.3
                     },
                     {
-                        "Value": 394.8,
-                        "Day": 9
+                        "Day": 9,
+                        "Value": 394.8
                     },
                     {
-                        "Value": 199.5,
-                        "Day": 10
+                        "Day": 10,
+                        "Value": 199.5
                     },
                     {
-                        "Value": 72.3,
-                        "Day": 11
+                        "Day": 11,
+                        "Value": 72.3
                     },
                     {
-                        "Value": 51.1,
-                        "Day": 12
+                        "Day": 12,
+                        "Value": 51.1
                     },
                     {
-                        "Value": 112,
-                        "Day": 13
+                        "Day": 13,
+                        "Value": 112
                     },
                     {
-                        "Value": 174.5,
-                        "Day": 14
+                        "Day": 14,
+                        "Value": 174.5
                     },
                     {
-                        "Value": 130.5,
-                        "Day": 15
+                        "Day": 15,
+                        "Value": 130.5
                     }
                 ]
             },
             "layer": [
                 {
-                    "mark": "bar",
                     "encoding": {
                         "x": {
-                            "field": "Day",
-                            "type": "ordinal",
                             "axis": {
                                 "labelAngle": 0
-                            }
+                            },
+                            "field": "Day",
+                            "type": "ordinal"
                         },
                         "y": {
                             "field": "Value",
                             "type": "quantitative"
                         }
-                    }
+                    },
+                    "mark": "bar"
                 },
                 {
-                    "transform": [
-                        {
-                            "filter": "datum.Value >= 300"
-                        },
-                        {
-                            "as": "baseline",
-                            "calculate": "300"
-                        }
-                    ],
-                    "mark": "bar",
                     "encoding": {
                         "color": {
                             "value": "#e45755"
@@ -102,15 +93,25 @@
                             "field": "Day",
                             "type": "ordinal"
                         },
-                        "y2": {
-                            "field": "Value"
-                        },
                         "y": {
                             "field": "baseline",
                             "title": "PM2.5 Value",
                             "type": "quantitative"
+                        },
+                        "y2": {
+                            "field": "Value"
                         }
-                    }
+                    },
+                    "mark": "bar",
+                    "transform": [
+                        {
+                            "filter": "datum.Value >= 300"
+                        },
+                        {
+                            "as": "baseline",
+                            "calculate": "300"
+                        }
+                    ]
                 }
             ]
         },
@@ -118,28 +119,27 @@
             "data": {
                 "values": {}
             },
+            "encoding": {
+                "y": {
+                    "datum": 300
+                }
+            },
             "layer": [
                 {
                     "mark": "rule"
                 },
                 {
                     "mark": {
+                        "align": "right",
+                        "baseline": "bottom",
                         "dx": -2,
                         "dy": -2,
                         "text": "hazardous",
-                        "align": "right",
-                        "x": "width",
                         "type": "text",
-                        "baseline": "bottom"
+                        "x": "width"
                     }
                 }
-            ],
-            "encoding": {
-                "y": {
-                    "datum": 300
-                }
-            }
+            ]
         }
-    ],
-    "description": "The PM2.5 value of Beijing observed 15 days, highlighting the days when PM2.5 level is hazardous to human health. Data source https://chartaccent.github.io/chartaccent.html"
+    ]
 }
diff --git a/tests/specs/gallery/label/label5.vl b/tests/specs/gallery/label/label5.vl
--- a/tests/specs/gallery/label/label5.vl
+++ b/tests/specs/gallery/label/label5.vl
@@ -1,11 +1,11 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Monthly precipitation with mean value overlay",
     "layer": [
         {
-            "mark": "bar",
             "encoding": {
                 "x": {
                     "field": "date",
@@ -13,14 +13,14 @@
                     "type": "ordinal"
                 },
                 "y": {
-                    "field": "precipitation",
                     "aggregate": "mean",
+                    "field": "precipitation",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "bar"
         },
         {
-            "mark": "rule",
             "encoding": {
                 "color": {
                     "value": "red"
@@ -29,12 +29,12 @@
                     "value": 3
                 },
                 "y": {
-                    "field": "precipitation",
                     "aggregate": "mean",
+                    "field": "precipitation",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "rule"
         }
-    ],
-    "description": "Monthly precipitation with mean value overlay"
+    ]
 }
diff --git a/tests/specs/gallery/label/label6.vl b/tests/specs/gallery/label/label6.vl
--- a/tests/specs/gallery/label/label6.vl
+++ b/tests/specs/gallery/label/label6.vl
@@ -1,26 +1,26 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Histogram with global mean overlay",
     "layer": [
         {
-            "mark": "bar",
             "encoding": {
                 "x": {
-                    "field": "IMDB_Rating",
+                    "axis": null,
                     "bin": true,
-                    "type": "quantitative",
-                    "axis": null
+                    "field": "IMDB_Rating",
+                    "type": "quantitative"
                 },
                 "y": {
                     "aggregate": "count",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "bar"
         },
         {
-            "mark": "rule",
             "encoding": {
                 "color": {
                     "value": "red"
@@ -29,12 +29,12 @@
                     "value": 5
                 },
                 "x": {
-                    "field": "IMDB_Rating",
                     "aggregate": "mean",
+                    "field": "IMDB_Rating",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "rule"
         }
-    ],
-    "description": "Histogram with global mean overlay"
+    ]
 }
diff --git a/tests/specs/gallery/label/label7.vl b/tests/specs/gallery/label/label7.vl
--- a/tests/specs/gallery/label/label7.vl
+++ b/tests/specs/gallery/label/label7.vl
@@ -1,247 +1,247 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
+        "format": {
+            "parse": {
+                "year": "date:'%Y'"
+            }
+        },
         "values": [
             {
-                "year": "1875",
-                "population": 1309
+                "population": 1309,
+                "year": "1875"
             },
             {
-                "year": "1890",
-                "population": 1558
+                "population": 1558,
+                "year": "1890"
             },
             {
-                "year": "1910",
-                "population": 4512
+                "population": 4512,
+                "year": "1910"
             },
             {
-                "year": "1925",
-                "population": 8180
+                "population": 8180,
+                "year": "1925"
             },
             {
-                "year": "1933",
-                "population": 15915
+                "population": 15915,
+                "year": "1933"
             },
             {
-                "year": "1939",
-                "population": 24824
+                "population": 24824,
+                "year": "1939"
             },
             {
-                "year": "1946",
-                "population": 28275
+                "population": 28275,
+                "year": "1946"
             },
             {
-                "year": "1950",
-                "population": 29189
+                "population": 29189,
+                "year": "1950"
             },
             {
-                "year": "1964",
-                "population": 29881
+                "population": 29881,
+                "year": "1964"
             },
             {
-                "year": "1971",
-                "population": 26007
+                "population": 26007,
+                "year": "1971"
             },
             {
-                "year": "1981",
-                "population": 24029
+                "population": 24029,
+                "year": "1981"
             },
             {
-                "year": "1985",
-                "population": 23340
+                "population": 23340,
+                "year": "1985"
             },
             {
-                "year": "1989",
-                "population": 22307
+                "population": 22307,
+                "year": "1989"
             },
             {
-                "year": "1990",
-                "population": 22087
+                "population": 22087,
+                "year": "1990"
             },
             {
-                "year": "1991",
-                "population": 22139
+                "population": 22139,
+                "year": "1991"
             },
             {
-                "year": "1992",
-                "population": 22105
+                "population": 22105,
+                "year": "1992"
             },
             {
-                "year": "1993",
-                "population": 22242
+                "population": 22242,
+                "year": "1993"
             },
             {
-                "year": "1994",
-                "population": 22801
+                "population": 22801,
+                "year": "1994"
             },
             {
-                "year": "1995",
-                "population": 24273
+                "population": 24273,
+                "year": "1995"
             },
             {
-                "year": "1996",
-                "population": 25640
+                "population": 25640,
+                "year": "1996"
             },
             {
-                "year": "1997",
-                "population": 27393
+                "population": 27393,
+                "year": "1997"
             },
             {
-                "year": "1998",
-                "population": 29505
+                "population": 29505,
+                "year": "1998"
             },
             {
-                "year": "1999",
-                "population": 32124
+                "population": 32124,
+                "year": "1999"
             },
             {
-                "year": "2000",
-                "population": 33791
+                "population": 33791,
+                "year": "2000"
             },
             {
-                "year": "2001",
-                "population": 35297
+                "population": 35297,
+                "year": "2001"
             },
             {
-                "year": "2002",
-                "population": 36179
+                "population": 36179,
+                "year": "2002"
             },
             {
-                "year": "2003",
-                "population": 36829
+                "population": 36829,
+                "year": "2003"
             },
             {
-                "year": "2004",
-                "population": 37493
+                "population": 37493,
+                "year": "2004"
             },
             {
-                "year": "2005",
-                "population": 38376
+                "population": 38376,
+                "year": "2005"
             },
             {
-                "year": "2006",
-                "population": 39008
+                "population": 39008,
+                "year": "2006"
             },
             {
-                "year": "2007",
-                "population": 39366
+                "population": 39366,
+                "year": "2007"
             },
             {
-                "year": "2008",
-                "population": 39821
+                "population": 39821,
+                "year": "2008"
             },
             {
-                "year": "2009",
-                "population": 40179
+                "population": 40179,
+                "year": "2009"
             },
             {
-                "year": "2010",
-                "population": 40511
+                "population": 40511,
+                "year": "2010"
             },
             {
-                "year": "2011",
-                "population": 40465
+                "population": 40465,
+                "year": "2011"
             },
             {
-                "year": "2012",
-                "population": 40905
+                "population": 40905,
+                "year": "2012"
             },
             {
-                "year": "2013",
-                "population": 41258
+                "population": 41258,
+                "year": "2013"
             },
             {
-                "year": "2014",
-                "population": 41777
-            }
-        ],
-        "format": {
-            "parse": {
-                "year": "date:'%Y'"
+                "population": 41777,
+                "year": "2014"
             }
-        }
+        ]
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "The population of the German city of Falkensee over time with annotated time periods highlighted",
     "layer": [
         {
-            "mark": "rect",
             "data": {
+                "format": {
+                    "parse": {
+                        "end": "date:'%Y'",
+                        "start": "date:'%Y'"
+                    }
+                },
                 "values": [
                     {
+                        "end": "1945",
                         "event": "Nazi Rule",
-                        "start": "1933",
-                        "end": "1945"
+                        "start": "1933"
                     },
                     {
+                        "end": "1989",
                         "event": "GDR (East Germany)",
-                        "start": "1948",
-                        "end": "1989"
-                    }
-                ],
-                "format": {
-                    "parse": {
-                        "start": "date:'%Y'",
-                        "end": "date:'%Y'"
+                        "start": "1948"
                     }
-                }
+                ]
             },
             "encoding": {
-                "x2": {
-                    "field": "end",
-                    "timeUnit": "year"
-                },
                 "color": {
                     "field": "event",
                     "type": "nominal"
                 },
                 "x": {
+                    "axis": null,
                     "field": "start",
                     "timeUnit": "year",
-                    "type": "temporal",
-                    "axis": null
+                    "type": "temporal"
+                },
+                "x2": {
+                    "field": "end",
+                    "timeUnit": "year"
                 }
-            }
+            },
+            "mark": "rect"
         },
         {
-            "mark": "line",
             "encoding": {
                 "color": {
                     "value": "#333"
                 },
                 "x": {
-                    "field": "year",
-                    "timeUnit": "year",
-                    "type": "temporal",
                     "axis": {
                         "title": null
-                    }
+                    },
+                    "field": "year",
+                    "timeUnit": "year",
+                    "type": "temporal"
                 },
                 "y": {
                     "field": "population",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "line"
         },
         {
-            "mark": "point",
             "encoding": {
                 "color": {
                     "value": "#333"
                 },
                 "x": {
-                    "field": "year",
-                    "timeUnit": "year",
-                    "type": "temporal",
                     "axis": {
                         "title": null
-                    }
+                    },
+                    "field": "year",
+                    "timeUnit": "year",
+                    "type": "temporal"
                 },
                 "y": {
                     "field": "population",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "point"
         }
     ],
-    "description": "The population of the German city of Falkensee over time with annotated time periods highlighted"
+    "width": 500
 }
diff --git a/tests/specs/gallery/label/label8.vl b/tests/specs/gallery/label/label8.vl
--- a/tests/specs/gallery/label/label8.vl
+++ b/tests/specs/gallery/label/label8.vl
@@ -1,5 +1,5 @@
 {
-    "height": 175,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
@@ -8,1019 +8,1019 @@
     "data": {
         "name": "medians"
     },
-    "width": 250,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Questionnaire Ratings",
-    "layer": [
-        {
-            "transform": [
-                {
-                    "filter": "datum.name != 'Toolbar_First'"
-                },
-                {
-                    "filter": "datum.name != 'Tablet_First'"
-                },
-                {
-                    "filter": "datum.name != 'Participant ID'"
-                }
-            ],
-            "mark": {
-                "color": "#6eb4fd",
-                "type": "circle"
+    "datasets": {
+        "medians": [
+            {
+                "hi": "Hard",
+                "lo": "Easy",
+                "median": 1.999976,
+                "name": "Identify Errors:"
             },
-            "data": {
-                "name": "values"
+            {
+                "hi": "Hard",
+                "lo": "Easy",
+                "median": 2,
+                "name": "Fix Errors:"
             },
-            "encoding": {
-                "size": {
-                    "aggregate": "count",
-                    "type": "quantitative",
-                    "legend": {
-                        "offset": 75,
-                        "title": "Number of Ratings"
-                    }
-                },
-                "x": {
-                    "field": "value",
-                    "scale": {
-                        "domain": [
-                            0,
-                            6
-                        ]
-                    },
-                    "type": "quantitative",
-                    "axis": {
-                        "values": [
-                            1,
-                            2,
-                            3,
-                            4,
-                            5
-                        ],
-                        "grid": false
-                    }
-                }
-            }
-        },
-        {
-            "mark": {
-                "color": "black",
-                "type": "tick"
+            {
+                "hi": "Gesture",
+                "lo": "Toolbar",
+                "median": 1.999969,
+                "name": "Easier to Fix:"
             },
-            "encoding": {
-                "x": {
-                    "field": "median",
-                    "scale": {
-                        "domain": [
-                            0,
-                            6
-                        ]
-                    },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
-                }
-            }
-        },
-        {
-            "mark": {
-                "align": "right",
-                "x": -5,
-                "type": "text"
+            {
+                "hi": "Gesture",
+                "lo": "Toolbar",
+                "median": 2.500045,
+                "name": "Faster to Fix:"
             },
-            "encoding": {
-                "text": {
-                    "field": "lo",
-                    "type": "nominal"
-                }
-            }
-        },
-        {
-            "mark": {
-                "align": "left",
-                "x": 255,
-                "type": "text"
+            {
+                "hi": "Gesture",
+                "lo": "Toolbar",
+                "median": 1.500022,
+                "name": "Easier on Phone:"
             },
-            "encoding": {
-                "text": {
-                    "field": "hi",
-                    "type": "nominal"
-                }
-            }
-        }
-    ],
-    "encoding": {
-        "y": {
-            "field": "name",
-            "sort": null,
-            "type": "nominal",
-            "axis": {
-                "offset": 50,
-                "domain": false,
-                "labelFontWeight": "bold",
-                "grid": true,
-                "title": null,
-                "ticks": false
+            {
+                "hi": "Gesture",
+                "lo": "Toolbar",
+                "median": 2.99998,
+                "name": "Easier on Tablet:"
+            },
+            {
+                "hi": "Tablet",
+                "lo": "Phone",
+                "median": 4.500007,
+                "name": "Device Preference:"
             }
-        }
-    },
-    "datasets": {
+        ],
         "values": [
             {
-                "value": "P1",
+                "id": "P1",
                 "name": "Participant ID",
-                "id": "P1"
+                "value": "P1"
             },
             {
-                "value": "2",
+                "id": "P1",
                 "name": "Identify Errors:",
-                "id": "P1"
+                "value": "2"
             },
             {
-                "value": "2",
+                "id": "P1",
                 "name": "Fix Errors:",
-                "id": "P1"
+                "value": "2"
             },
             {
-                "value": "3",
+                "id": "P1",
                 "name": "Easier to Fix:",
-                "id": "P1"
+                "value": "3"
             },
             {
-                "value": "4",
+                "id": "P1",
                 "name": "Faster to Fix:",
-                "id": "P1"
+                "value": "4"
             },
             {
-                "value": "2",
+                "id": "P1",
                 "name": "Easier on Phone:",
-                "id": "P1"
+                "value": "2"
             },
             {
-                "value": "5",
+                "id": "P1",
                 "name": "Easier on Tablet:",
-                "id": "P1"
+                "value": "5"
             },
             {
-                "value": "5",
+                "id": "P1",
                 "name": "Device Preference:",
-                "id": "P1"
+                "value": "5"
             },
             {
-                "value": "1",
+                "id": "P1",
                 "name": "Tablet_First",
-                "id": "P1"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P1",
                 "name": "Toolbar_First",
-                "id": "P1"
+                "value": "1"
             },
             {
-                "value": "P2",
+                "id": "P2",
                 "name": "Participant ID",
-                "id": "P2"
+                "value": "P2"
             },
             {
-                "value": "2",
+                "id": "P2",
                 "name": "Identify Errors:",
-                "id": "P2"
+                "value": "2"
             },
             {
-                "value": "3",
+                "id": "P2",
                 "name": "Fix Errors:",
-                "id": "P2"
+                "value": "3"
             },
             {
-                "value": "4",
+                "id": "P2",
                 "name": "Easier to Fix:",
-                "id": "P2"
+                "value": "4"
             },
             {
-                "value": "5",
+                "id": "P2",
                 "name": "Faster to Fix:",
-                "id": "P2"
+                "value": "5"
             },
             {
-                "value": "5",
+                "id": "P2",
                 "name": "Easier on Phone:",
-                "id": "P2"
+                "value": "5"
             },
             {
-                "value": "5",
+                "id": "P2",
                 "name": "Easier on Tablet:",
-                "id": "P2"
+                "value": "5"
             },
             {
-                "value": "5",
+                "id": "P2",
                 "name": "Device Preference:",
-                "id": "P2"
+                "value": "5"
             },
             {
-                "value": "1",
+                "id": "P2",
                 "name": "Tablet_First",
-                "id": "P2"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P2",
                 "name": "Toolbar_First",
-                "id": "P2"
+                "value": "1"
             },
             {
-                "value": "P3",
+                "id": "P3",
                 "name": "Participant ID",
-                "id": "P3"
+                "value": "P3"
             },
             {
-                "value": "2",
+                "id": "P3",
                 "name": "Identify Errors:",
-                "id": "P3"
+                "value": "2"
             },
             {
-                "value": "2",
+                "id": "P3",
                 "name": "Fix Errors:",
-                "id": "P3"
+                "value": "2"
             },
             {
-                "value": "2",
+                "id": "P3",
                 "name": "Easier to Fix:",
-                "id": "P3"
+                "value": "2"
             },
             {
-                "value": "1",
+                "id": "P3",
                 "name": "Faster to Fix:",
-                "id": "P3"
+                "value": "1"
             },
             {
-                "value": "2",
+                "id": "P3",
                 "name": "Easier on Phone:",
-                "id": "P3"
+                "value": "2"
             },
             {
-                "value": "1",
+                "id": "P3",
                 "name": "Easier on Tablet:",
-                "id": "P3"
+                "value": "1"
             },
             {
-                "value": "5",
+                "id": "P3",
                 "name": "Device Preference:",
-                "id": "P3"
+                "value": "5"
             },
             {
-                "value": "1",
+                "id": "P3",
                 "name": "Tablet_First",
-                "id": "P3"
+                "value": "1"
             },
             {
-                "value": "0",
+                "id": "P3",
                 "name": "Toolbar_First",
-                "id": "P3"
+                "value": "0"
             },
             {
-                "value": "P4",
+                "id": "P4",
                 "name": "Participant ID",
-                "id": "P4"
+                "value": "P4"
             },
             {
-                "value": "3",
+                "id": "P4",
                 "name": "Identify Errors:",
-                "id": "P4"
+                "value": "3"
             },
             {
-                "value": "3",
+                "id": "P4",
                 "name": "Fix Errors:",
-                "id": "P4"
+                "value": "3"
             },
             {
-                "value": "2",
+                "id": "P4",
                 "name": "Easier to Fix:",
-                "id": "P4"
+                "value": "2"
             },
             {
-                "value": "2",
+                "id": "P4",
                 "name": "Faster to Fix:",
-                "id": "P4"
+                "value": "2"
             },
             {
-                "value": "4",
+                "id": "P4",
                 "name": "Easier on Phone:",
-                "id": "P4"
+                "value": "4"
             },
             {
-                "value": "1",
+                "id": "P4",
                 "name": "Easier on Tablet:",
-                "id": "P4"
+                "value": "1"
             },
             {
-                "value": "5",
+                "id": "P4",
                 "name": "Device Preference:",
-                "id": "P4"
+                "value": "5"
             },
             {
-                "value": "1",
+                "id": "P4",
                 "name": "Tablet_First",
-                "id": "P4"
+                "value": "1"
             },
             {
-                "value": "0",
+                "id": "P4",
                 "name": "Toolbar_First",
-                "id": "P4"
+                "value": "0"
             },
             {
-                "value": "P5",
+                "id": "P5",
                 "name": "Participant ID",
-                "id": "P5"
+                "value": "P5"
             },
             {
-                "value": "2",
+                "id": "P5",
                 "name": "Identify Errors:",
-                "id": "P5"
+                "value": "2"
             },
             {
-                "value": "2",
+                "id": "P5",
                 "name": "Fix Errors:",
-                "id": "P5"
+                "value": "2"
             },
             {
-                "value": "4",
+                "id": "P5",
                 "name": "Easier to Fix:",
-                "id": "P5"
+                "value": "4"
             },
             {
-                "value": "4",
+                "id": "P5",
                 "name": "Faster to Fix:",
-                "id": "P5"
+                "value": "4"
             },
             {
-                "value": "4",
+                "id": "P5",
                 "name": "Easier on Phone:",
-                "id": "P5"
+                "value": "4"
             },
             {
-                "value": "5",
+                "id": "P5",
                 "name": "Easier on Tablet:",
-                "id": "P5"
+                "value": "5"
             },
             {
-                "value": "5",
+                "id": "P5",
                 "name": "Device Preference:",
-                "id": "P5"
+                "value": "5"
             },
             {
-                "value": "0",
+                "id": "P5",
                 "name": "Tablet_First",
-                "id": "P5"
+                "value": "0"
             },
             {
-                "value": "1",
+                "id": "P5",
                 "name": "Toolbar_First",
-                "id": "P5"
+                "value": "1"
             },
             {
-                "value": "P6",
+                "id": "P6",
                 "name": "Participant ID",
-                "id": "P6"
+                "value": "P6"
             },
             {
-                "value": "1",
+                "id": "P6",
                 "name": "Identify Errors:",
-                "id": "P6"
+                "value": "1"
             },
             {
-                "value": "3",
+                "id": "P6",
                 "name": "Fix Errors:",
-                "id": "P6"
+                "value": "3"
             },
             {
-                "value": "3",
+                "id": "P6",
                 "name": "Easier to Fix:",
-                "id": "P6"
+                "value": "3"
             },
             {
-                "value": "4",
+                "id": "P6",
                 "name": "Faster to Fix:",
-                "id": "P6"
+                "value": "4"
             },
             {
-                "value": "4",
+                "id": "P6",
                 "name": "Easier on Phone:",
-                "id": "P6"
+                "value": "4"
             },
             {
-                "value": "4",
+                "id": "P6",
                 "name": "Easier on Tablet:",
-                "id": "P6"
+                "value": "4"
             },
             {
-                "value": "4",
+                "id": "P6",
                 "name": "Device Preference:",
-                "id": "P6"
+                "value": "4"
             },
             {
-                "value": "0",
+                "id": "P6",
                 "name": "Tablet_First",
-                "id": "P6"
+                "value": "0"
             },
             {
-                "value": "1",
+                "id": "P6",
                 "name": "Toolbar_First",
-                "id": "P6"
+                "value": "1"
             },
             {
-                "value": "P7",
+                "id": "P7",
                 "name": "Participant ID",
-                "id": "P7"
+                "value": "P7"
             },
             {
-                "value": "2",
+                "id": "P7",
                 "name": "Identify Errors:",
-                "id": "P7"
+                "value": "2"
             },
             {
-                "value": "3",
+                "id": "P7",
                 "name": "Fix Errors:",
-                "id": "P7"
+                "value": "3"
             },
             {
-                "value": "4",
+                "id": "P7",
                 "name": "Easier to Fix:",
-                "id": "P7"
+                "value": "4"
             },
             {
-                "value": "5",
+                "id": "P7",
                 "name": "Faster to Fix:",
-                "id": "P7"
+                "value": "5"
             },
             {
-                "value": "3",
+                "id": "P7",
                 "name": "Easier on Phone:",
-                "id": "P7"
+                "value": "3"
             },
             {
-                "value": "2",
+                "id": "P7",
                 "name": "Easier on Tablet:",
-                "id": "P7"
+                "value": "2"
             },
             {
-                "value": "4",
+                "id": "P7",
                 "name": "Device Preference:",
-                "id": "P7"
+                "value": "4"
             },
             {
-                "value": "0",
+                "id": "P7",
                 "name": "Tablet_First",
-                "id": "P7"
+                "value": "0"
             },
             {
-                "value": "0",
+                "id": "P7",
                 "name": "Toolbar_First",
-                "id": "P7"
+                "value": "0"
             },
             {
-                "value": "P8",
+                "id": "P8",
                 "name": "Participant ID",
-                "id": "P8"
+                "value": "P8"
             },
             {
-                "value": "3",
+                "id": "P8",
                 "name": "Identify Errors:",
-                "id": "P8"
+                "value": "3"
             },
             {
-                "value": "1",
+                "id": "P8",
                 "name": "Fix Errors:",
-                "id": "P8"
+                "value": "1"
             },
             {
-                "value": "2",
+                "id": "P8",
                 "name": "Easier to Fix:",
-                "id": "P8"
+                "value": "2"
             },
             {
-                "value": "4",
+                "id": "P8",
                 "name": "Faster to Fix:",
-                "id": "P8"
+                "value": "4"
             },
             {
-                "value": "2",
+                "id": "P8",
                 "name": "Easier on Phone:",
-                "id": "P8"
+                "value": "2"
             },
             {
-                "value": "5",
+                "id": "P8",
                 "name": "Easier on Tablet:",
-                "id": "P8"
+                "value": "5"
             },
             {
-                "value": "5",
+                "id": "P8",
                 "name": "Device Preference:",
-                "id": "P8"
+                "value": "5"
             },
             {
-                "value": "0",
+                "id": "P8",
                 "name": "Tablet_First",
-                "id": "P8"
+                "value": "0"
             },
             {
-                "value": "0",
+                "id": "P8",
                 "name": "Toolbar_First",
-                "id": "P8"
+                "value": "0"
             },
             {
-                "value": "P9",
+                "id": "P9",
                 "name": "Participant ID",
-                "id": "P9"
+                "value": "P9"
             },
             {
-                "value": "2",
+                "id": "P9",
                 "name": "Identify Errors:",
-                "id": "P9"
+                "value": "2"
             },
             {
-                "value": "3",
+                "id": "P9",
                 "name": "Fix Errors:",
-                "id": "P9"
+                "value": "3"
             },
             {
-                "value": "2",
+                "id": "P9",
                 "name": "Easier to Fix:",
-                "id": "P9"
+                "value": "2"
             },
             {
-                "value": "4",
+                "id": "P9",
                 "name": "Faster to Fix:",
-                "id": "P9"
+                "value": "4"
             },
             {
-                "value": "1",
+                "id": "P9",
                 "name": "Easier on Phone:",
-                "id": "P9"
+                "value": "1"
             },
             {
-                "value": "4",
+                "id": "P9",
                 "name": "Easier on Tablet:",
-                "id": "P9"
+                "value": "4"
             },
             {
-                "value": "4",
+                "id": "P9",
                 "name": "Device Preference:",
-                "id": "P9"
+                "value": "4"
             },
             {
-                "value": "1",
+                "id": "P9",
                 "name": "Tablet_First",
-                "id": "P9"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P9",
                 "name": "Toolbar_First",
-                "id": "P9"
+                "value": "1"
             },
             {
-                "value": "P10",
+                "id": "P10",
                 "name": "Participant ID",
-                "id": "P10"
+                "value": "P10"
             },
             {
-                "value": "2",
+                "id": "P10",
                 "name": "Identify Errors:",
-                "id": "P10"
+                "value": "2"
             },
             {
-                "value": "2",
+                "id": "P10",
                 "name": "Fix Errors:",
-                "id": "P10"
+                "value": "2"
             },
             {
-                "value": "1",
+                "id": "P10",
                 "name": "Easier to Fix:",
-                "id": "P10"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P10",
                 "name": "Faster to Fix:",
-                "id": "P10"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P10",
                 "name": "Easier on Phone:",
-                "id": "P10"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P10",
                 "name": "Easier on Tablet:",
-                "id": "P10"
+                "value": "1"
             },
             {
-                "value": "5",
+                "id": "P10",
                 "name": "Device Preference:",
-                "id": "P10"
+                "value": "5"
             },
             {
-                "value": "1",
+                "id": "P10",
                 "name": "Tablet_First",
-                "id": "P10"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P10",
                 "name": "Toolbar_First",
-                "id": "P10"
+                "value": "1"
             },
             {
-                "value": "P11",
+                "id": "P11",
                 "name": "Participant ID",
-                "id": "P11"
+                "value": "P11"
             },
             {
-                "value": "2",
+                "id": "P11",
                 "name": "Identify Errors:",
-                "id": "P11"
+                "value": "2"
             },
             {
-                "value": "2",
+                "id": "P11",
                 "name": "Fix Errors:",
-                "id": "P11"
+                "value": "2"
             },
             {
-                "value": "1",
+                "id": "P11",
                 "name": "Easier to Fix:",
-                "id": "P11"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P11",
                 "name": "Faster to Fix:",
-                "id": "P11"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P11",
                 "name": "Easier on Phone:",
-                "id": "P11"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P11",
                 "name": "Easier on Tablet:",
-                "id": "P11"
+                "value": "1"
             },
             {
-                "value": "4",
+                "id": "P11",
                 "name": "Device Preference:",
-                "id": "P11"
+                "value": "4"
             },
             {
-                "value": "1",
+                "id": "P11",
                 "name": "Tablet_First",
-                "id": "P11"
+                "value": "1"
             },
             {
-                "value": "0",
+                "id": "P11",
                 "name": "Toolbar_First",
-                "id": "P11"
+                "value": "0"
             },
             {
-                "value": "P12",
+                "id": "P12",
                 "name": "Participant ID",
-                "id": "P12"
+                "value": "P12"
             },
             {
-                "value": "1",
+                "id": "P12",
                 "name": "Identify Errors:",
-                "id": "P12"
+                "value": "1"
             },
             {
-                "value": "3",
+                "id": "P12",
                 "name": "Fix Errors:",
-                "id": "P12"
+                "value": "3"
             },
             {
-                "value": "2",
+                "id": "P12",
                 "name": "Easier to Fix:",
-                "id": "P12"
+                "value": "2"
             },
             {
-                "value": "3",
+                "id": "P12",
                 "name": "Faster to Fix:",
-                "id": "P12"
+                "value": "3"
             },
             {
-                "value": "1",
+                "id": "P12",
                 "name": "Easier on Phone:",
-                "id": "P12"
+                "value": "1"
             },
             {
-                "value": "3",
+                "id": "P12",
                 "name": "Easier on Tablet:",
-                "id": "P12"
+                "value": "3"
             },
             {
-                "value": "3",
+                "id": "P12",
                 "name": "Device Preference:",
-                "id": "P12"
+                "value": "3"
             },
             {
-                "value": "0",
+                "id": "P12",
                 "name": "Tablet_First",
-                "id": "P12"
+                "value": "0"
             },
             {
-                "value": "1",
+                "id": "P12",
                 "name": "Toolbar_First",
-                "id": "P12"
+                "value": "1"
             },
             {
-                "value": "P13",
+                "id": "P13",
                 "name": "Participant ID",
-                "id": "P13"
+                "value": "P13"
             },
             {
-                "value": "2",
+                "id": "P13",
                 "name": "Identify Errors:",
-                "id": "P13"
+                "value": "2"
             },
             {
-                "value": "2",
+                "id": "P13",
                 "name": "Fix Errors:",
-                "id": "P13"
+                "value": "2"
             },
             {
-                "value": "1",
+                "id": "P13",
                 "name": "Easier to Fix:",
-                "id": "P13"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P13",
                 "name": "Faster to Fix:",
-                "id": "P13"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P13",
                 "name": "Easier on Phone:",
-                "id": "P13"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P13",
                 "name": "Easier on Tablet:",
-                "id": "P13"
+                "value": "1"
             },
             {
-                "value": "5",
+                "id": "P13",
                 "name": "Device Preference:",
-                "id": "P13"
+                "value": "5"
             },
             {
-                "value": "0",
+                "id": "P13",
                 "name": "Tablet_First",
-                "id": "P13"
+                "value": "0"
             },
             {
-                "value": "0",
+                "id": "P13",
                 "name": "Toolbar_First",
-                "id": "P13"
+                "value": "0"
             },
             {
-                "value": "P14",
+                "id": "P14",
                 "name": "Participant ID",
-                "id": "P14"
+                "value": "P14"
             },
             {
-                "value": "3",
+                "id": "P14",
                 "name": "Identify Errors:",
-                "id": "P14"
+                "value": "3"
             },
             {
-                "value": "3",
+                "id": "P14",
                 "name": "Fix Errors:",
-                "id": "P14"
+                "value": "3"
             },
             {
-                "value": "2",
+                "id": "P14",
                 "name": "Easier to Fix:",
-                "id": "P14"
+                "value": "2"
             },
             {
-                "value": "2",
+                "id": "P14",
                 "name": "Faster to Fix:",
-                "id": "P14"
+                "value": "2"
             },
             {
-                "value": "1",
+                "id": "P14",
                 "name": "Easier on Phone:",
-                "id": "P14"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P14",
                 "name": "Easier on Tablet:",
-                "id": "P14"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P14",
                 "name": "Device Preference:",
-                "id": "P14"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P14",
                 "name": "Tablet_First",
-                "id": "P14"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P14",
                 "name": "Toolbar_First",
-                "id": "P14"
+                "value": "1"
             },
             {
-                "value": "P15",
+                "id": "P15",
                 "name": "Participant ID",
-                "id": "P15"
+                "value": "P15"
             },
             {
-                "value": "4",
+                "id": "P15",
                 "name": "Identify Errors:",
-                "id": "P15"
+                "value": "4"
             },
             {
-                "value": "5",
+                "id": "P15",
                 "name": "Fix Errors:",
-                "id": "P15"
+                "value": "5"
             },
             {
-                "value": "1",
+                "id": "P15",
                 "name": "Easier to Fix:",
-                "id": "P15"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P15",
                 "name": "Faster to Fix:",
-                "id": "P15"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P15",
                 "name": "Easier on Phone:",
-                "id": "P15"
+                "value": "1"
             },
             {
-                "value": "1",
+                "id": "P15",
                 "name": "Easier on Tablet:",
-                "id": "P15"
+                "value": "1"
             },
             {
-                "value": "5",
+                "id": "P15",
                 "name": "Device Preference:",
-                "id": "P15"
+                "value": "5"
             },
             {
-                "value": "1",
+                "id": "P15",
                 "name": "Tablet_First",
-                "id": "P15"
+                "value": "1"
             },
             {
-                "value": "0",
+                "id": "P15",
                 "name": "Toolbar_First",
-                "id": "P15"
+                "value": "0"
             },
             {
-                "value": "P16",
+                "id": "P16",
                 "name": "Participant ID",
-                "id": "P16"
+                "value": "P16"
             },
             {
-                "value": "1",
+                "id": "P16",
                 "name": "Identify Errors:",
-                "id": "P16"
+                "value": "1"
             },
             {
-                "value": "3",
+                "id": "P16",
                 "name": "Fix Errors:",
-                "id": "P16"
+                "value": "3"
             },
             {
-                "value": "2",
+                "id": "P16",
                 "name": "Easier to Fix:",
-                "id": "P16"
+                "value": "2"
             },
             {
-                "value": "2",
+                "id": "P16",
                 "name": "Faster to Fix:",
-                "id": "P16"
+                "value": "2"
             },
             {
-                "value": "1",
+                "id": "P16",
                 "name": "Easier on Phone:",
-                "id": "P16"
+                "value": "1"
             },
             {
-                "value": "4",
+                "id": "P16",
                 "name": "Easier on Tablet:",
-                "id": "P16"
+                "value": "4"
             },
             {
-                "value": "5",
+                "id": "P16",
                 "name": "Device Preference:",
-                "id": "P16"
+                "value": "5"
             },
             {
-                "value": "0",
+                "id": "P16",
                 "name": "Tablet_First",
-                "id": "P16"
+                "value": "0"
             },
             {
-                "value": "1",
+                "id": "P16",
                 "name": "Toolbar_First",
-                "id": "P16"
+                "value": "1"
             },
             {
-                "value": "P17",
+                "id": "P17",
                 "name": "Participant ID",
-                "id": "P17"
+                "value": "P17"
             },
             {
-                "value": "3",
+                "id": "P17",
                 "name": "Identify Errors:",
-                "id": "P17"
+                "value": "3"
             },
             {
-                "value": "2",
+                "id": "P17",
                 "name": "Fix Errors:",
-                "id": "P17"
+                "value": "2"
             },
             {
-                "value": "2",
+                "id": "P17",
                 "name": "Easier to Fix:",
-                "id": "P17"
+                "value": "2"
             },
             {
-                "value": "2",
+                "id": "P17",
                 "name": "Faster to Fix:",
-                "id": "P17"
+                "value": "2"
             },
             {
-                "value": "1",
+                "id": "P17",
                 "name": "Easier on Phone:",
-                "id": "P17"
+                "value": "1"
             },
             {
-                "value": "3",
+                "id": "P17",
                 "name": "Easier on Tablet:",
-                "id": "P17"
+                "value": "3"
             },
             {
-                "value": "2",
+                "id": "P17",
                 "name": "Device Preference:",
-                "id": "P17"
+                "value": "2"
             },
             {
-                "value": "0",
+                "id": "P17",
                 "name": "Tablet_First",
-                "id": "P17"
+                "value": "0"
             },
             {
-                "value": "0",
+                "id": "P17",
                 "name": "Toolbar_First",
-                "id": "P17"
+                "value": "0"
             }
-        ],
-        "medians": [
-            {
-                "median": 1.999976,
-                "hi": "Hard",
-                "name": "Identify Errors:",
-                "lo": "Easy"
+        ]
+    },
+    "encoding": {
+        "y": {
+            "axis": {
+                "domain": false,
+                "grid": true,
+                "labelFontWeight": "bold",
+                "offset": 50,
+                "ticks": false,
+                "title": null
             },
-            {
-                "median": 2,
-                "hi": "Hard",
-                "name": "Fix Errors:",
-                "lo": "Easy"
+            "field": "name",
+            "sort": null,
+            "type": "nominal"
+        }
+    },
+    "height": 175,
+    "layer": [
+        {
+            "data": {
+                "name": "values"
             },
-            {
-                "median": 1.999969,
-                "hi": "Gesture",
-                "name": "Easier to Fix:",
-                "lo": "Toolbar"
+            "encoding": {
+                "size": {
+                    "aggregate": "count",
+                    "legend": {
+                        "offset": 75,
+                        "title": "Number of Ratings"
+                    },
+                    "type": "quantitative"
+                },
+                "x": {
+                    "axis": {
+                        "grid": false,
+                        "values": [
+                            1,
+                            2,
+                            3,
+                            4,
+                            5
+                        ]
+                    },
+                    "field": "value",
+                    "scale": {
+                        "domain": [
+                            0,
+                            6
+                        ]
+                    },
+                    "type": "quantitative"
+                }
             },
-            {
-                "median": 2.500045,
-                "hi": "Gesture",
-                "name": "Faster to Fix:",
-                "lo": "Toolbar"
+            "mark": {
+                "color": "#6eb4fd",
+                "type": "circle"
             },
-            {
-                "median": 1.500022,
-                "hi": "Gesture",
-                "name": "Easier on Phone:",
-                "lo": "Toolbar"
+            "transform": [
+                {
+                    "filter": "datum.name != 'Toolbar_First'"
+                },
+                {
+                    "filter": "datum.name != 'Tablet_First'"
+                },
+                {
+                    "filter": "datum.name != 'Participant ID'"
+                }
+            ]
+        },
+        {
+            "encoding": {
+                "x": {
+                    "axis": {
+                        "title": null
+                    },
+                    "field": "median",
+                    "scale": {
+                        "domain": [
+                            0,
+                            6
+                        ]
+                    },
+                    "type": "quantitative"
+                }
             },
-            {
-                "median": 2.99998,
-                "hi": "Gesture",
-                "name": "Easier on Tablet:",
-                "lo": "Toolbar"
+            "mark": {
+                "color": "black",
+                "type": "tick"
+            }
+        },
+        {
+            "encoding": {
+                "text": {
+                    "field": "lo",
+                    "type": "nominal"
+                }
             },
-            {
-                "median": 4.500007,
-                "hi": "Tablet",
-                "name": "Device Preference:",
-                "lo": "Phone"
+            "mark": {
+                "align": "right",
+                "type": "text",
+                "x": -5
             }
-        ]
-    }
+        },
+        {
+            "encoding": {
+                "text": {
+                    "field": "hi",
+                    "type": "nominal"
+                }
+            },
+            "mark": {
+                "align": "left",
+                "type": "text",
+                "x": 255
+            }
+        }
+    ],
+    "title": "Questionnaire Ratings",
+    "width": 250
 }
diff --git a/tests/specs/gallery/label/label9.vl b/tests/specs/gallery/label/label9.vl
--- a/tests/specs/gallery/label/label9.vl
+++ b/tests/specs/gallery/label/label9.vl
@@ -1,68 +1,90 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "style": {
-            "arrow-label2": {
-                "dy": 24,
-                "fontSize": 9.5
-            },
             "arrow-label": {
                 "dy": 12,
                 "fontSize": 9.5
+            },
+            "arrow-label2": {
+                "dy": 24,
+                "fontSize": 9.5
             }
         },
-        "view": {
-            "stroke": null
-        },
         "title": {
             "fontSize": 12
+        },
+        "view": {
+            "stroke": null
         }
     },
     "data": {
         "values": [
             {
-                "mean": 1.81,
                 "hi": 2.37,
-                "study": "PoleStar vs Voyager",
+                "lo": 1.26,
+                "mean": 1.81,
                 "measure": "Open Exploration",
-                "lo": 1.26
+                "study": "PoleStar vs Voyager"
             },
             {
-                "mean": -1.69,
                 "hi": -1.05,
-                "study": "PoleStar vs Voyager",
+                "lo": -2.33,
+                "mean": -1.69,
                 "measure": "Focused Question Answering",
-                "lo": -2.33
+                "study": "PoleStar vs Voyager"
             },
             {
-                "mean": 2.19,
                 "hi": 2.71,
-                "study": "PoleStar vs Voyager 2",
+                "lo": 1.67,
+                "mean": 2.19,
                 "measure": "Open Exploration",
-                "lo": 1.67
+                "study": "PoleStar vs Voyager 2"
             },
             {
-                "mean": -6.0e-2,
                 "hi": 0.35,
-                "study": "PoleStar vs Voyager 2",
+                "lo": -0.47,
+                "mean": -6.0e-2,
                 "measure": "Focused Question Answering",
-                "lo": -0.47
+                "study": "PoleStar vs Voyager 2"
             }
         ]
     },
+    "description": "Comparing Likert scale ratings between two conditions.",
+    "spacing": 10,
     "vconcat": [
         {
-            "title": {
-                "text": "Mean of Subject Ratings (95% CIs)",
-                "frame": "bounds"
+            "encoding": {
+                "y": {
+                    "axis": {
+                        "domain": false,
+                        "grid": false,
+                        "labelPadding": 5,
+                        "ticks": false,
+                        "title": null
+                    },
+                    "field": "study",
+                    "type": "nominal"
+                }
             },
             "layer": [
                 {
-                    "mark": "rule",
                     "encoding": {
-                        "x2": {
-                            "field": "hi"
-                        },
                         "x": {
+                            "axis": {
+                                "gridColor": {
+                                    "condition": {
+                                        "test": "datum.value === 0",
+                                        "value": "#666"
+                                    },
+                                    "value": "#ccc"
+                                },
+                                "gridDash": [
+                                    3,
+                                    3
+                                ],
+                                "title": null
+                            },
                             "field": "lo",
                             "scale": {
                                 "domain": [
@@ -70,211 +92,189 @@
                                     3
                                 ]
                             },
-                            "type": "quantitative",
-                            "axis": {
-                                "gridDash": [
-                                    3,
-                                    3
-                                ],
-                                "gridColor": {
-                                    "value": "#ccc",
-                                    "condition": {
-                                        "value": "#666",
-                                        "test": "datum.value === 0"
-                                    }
-                                },
-                                "title": null
-                            }
+                            "type": "quantitative"
+                        },
+                        "x2": {
+                            "field": "hi"
                         }
-                    }
+                    },
+                    "mark": "rule"
                 },
                 {
-                    "mark": {
-                        "opacity": 1,
-                        "stroke": "black",
-                        "type": "circle"
-                    },
                     "encoding": {
                         "color": {
                             "field": "measure",
+                            "legend": null,
                             "scale": {
                                 "range": [
                                     "black",
                                     "white"
                                 ]
                             },
-                            "type": "nominal",
-                            "legend": null
+                            "type": "nominal"
                         },
                         "x": {
                             "field": "mean",
                             "type": "quantitative"
                         }
+                    },
+                    "mark": {
+                        "opacity": 1,
+                        "stroke": "black",
+                        "type": "circle"
                     }
                 }
             ],
-            "encoding": {
-                "y": {
-                    "field": "study",
-                    "type": "nominal",
-                    "axis": {
-                        "domain": false,
-                        "labelPadding": 5,
-                        "grid": false,
-                        "title": null,
-                        "ticks": false
-                    }
-                }
+            "title": {
+                "frame": "bounds",
+                "text": "Mean of Subject Ratings (95% CIs)"
             }
         },
         {
             "data": {
                 "values": [
                     {
-                        "to": -2.9,
                         "from": -0.25,
-                        "label": "PoleStar"
+                        "label": "PoleStar",
+                        "to": -2.9
                     },
                     {
-                        "to": 2.9,
                         "from": 0.25,
-                        "label": "Voyager / Voyager 2"
+                        "label": "Voyager / Voyager 2",
+                        "to": 2.9
                     }
                 ]
             },
             "layer": [
                 {
-                    "mark": "rule",
                     "encoding": {
-                        "x2": {
-                            "field": "to"
-                        },
                         "x": {
+                            "axis": null,
                             "field": "from",
                             "scale": {
                                 "zero": false
                             },
-                            "type": "quantitative",
-                            "axis": null
+                            "type": "quantitative"
+                        },
+                        "x2": {
+                            "field": "to"
                         }
-                    }
+                    },
+                    "mark": "rule"
                 },
                 {
-                    "mark": {
-                        "size": 60,
-                        "fill": "black",
-                        "type": "point",
-                        "filled": true
-                    },
                     "encoding": {
                         "shape": {
-                            "value": "triangle-left",
                             "condition": {
-                                "value": "triangle-right",
-                                "test": "datum.to > 0"
-                            }
+                                "test": "datum.to > 0",
+                                "value": "triangle-right"
+                            },
+                            "value": "triangle-left"
                         },
                         "x": {
+                            "axis": null,
                             "field": "to",
-                            "type": "quantitative",
-                            "axis": null
+                            "type": "quantitative"
                         }
+                    },
+                    "mark": {
+                        "fill": "black",
+                        "filled": true,
+                        "size": 60,
+                        "type": "point"
                     }
                 },
                 {
-                    "transform": [
-                        {
-                            "filter": "datum.label === 'PoleStar'"
-                        }
-                    ],
-                    "mark": {
-                        "style": "arrow-label",
-                        "align": "right",
-                        "type": "text"
-                    },
                     "encoding": {
                         "text": {
                             "field": "label",
                             "type": "nominal"
                         },
                         "x": {
+                            "axis": null,
                             "field": "from",
-                            "type": "quantitative",
-                            "axis": null
-                        }
-                    }
-                },
-                {
-                    "transform": [
-                        {
-                            "filter": "datum.label !== 'PoleStar'"
+                            "type": "quantitative"
                         }
-                    ],
+                    },
                     "mark": {
+                        "align": "right",
                         "style": "arrow-label",
-                        "align": "left",
                         "type": "text"
                     },
+                    "transform": [
+                        {
+                            "filter": "datum.label === 'PoleStar'"
+                        }
+                    ]
+                },
+                {
                     "encoding": {
                         "text": {
                             "field": "label",
                             "type": "nominal"
                         },
                         "x": {
+                            "axis": null,
                             "field": "from",
-                            "type": "quantitative",
-                            "axis": null
-                        }
-                    }
-                },
-                {
-                    "transform": [
-                        {
-                            "filter": "datum.label === 'PoleStar'"
+                            "type": "quantitative"
                         }
-                    ],
+                    },
                     "mark": {
-                        "style": "arrow-label2",
-                        "align": "right",
+                        "align": "left",
+                        "style": "arrow-label",
                         "type": "text"
                     },
+                    "transform": [
+                        {
+                            "filter": "datum.label !== 'PoleStar'"
+                        }
+                    ]
+                },
+                {
                     "encoding": {
                         "text": {
                             "value": "more valuable"
                         },
                         "x": {
+                            "axis": null,
                             "field": "from",
-                            "type": "quantitative",
-                            "axis": null
-                        }
-                    }
-                },
-                {
-                    "transform": [
-                        {
-                            "filter": "datum.label !== 'PoleStar'"
+                            "type": "quantitative"
                         }
-                    ],
+                    },
                     "mark": {
+                        "align": "right",
                         "style": "arrow-label2",
-                        "align": "left",
                         "type": "text"
                     },
+                    "transform": [
+                        {
+                            "filter": "datum.label === 'PoleStar'"
+                        }
+                    ]
+                },
+                {
                     "encoding": {
                         "text": {
                             "value": "more valuable"
                         },
                         "x": {
+                            "axis": null,
                             "field": "from",
-                            "type": "quantitative",
-                            "axis": null
+                            "type": "quantitative"
                         }
-                    }
+                    },
+                    "mark": {
+                        "align": "left",
+                        "style": "arrow-label2",
+                        "type": "text"
+                    },
+                    "transform": [
+                        {
+                            "filter": "datum.label !== 'PoleStar'"
+                        }
+                    ]
                 }
             ]
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "Comparing Likert scale ratings between two conditions.",
-    "spacing": 10
+    ]
 }
diff --git a/tests/specs/gallery/label/voyager.vl b/tests/specs/gallery/label/voyager.vl
--- a/tests/specs/gallery/label/voyager.vl
+++ b/tests/specs/gallery/label/voyager.vl
@@ -1,68 +1,89 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "style": {
-            "arrow-label2": {
-                "dy": 24,
-                "fontSize": 9.5
-            },
             "arrow-label": {
                 "dy": 12,
                 "fontSize": 9.5
+            },
+            "arrow-label2": {
+                "dy": 24,
+                "fontSize": 9.5
             }
         },
-        "view": {
-            "stroke": "transparent"
-        },
         "title": {
             "fontSize": 12
+        },
+        "view": {
+            "stroke": "transparent"
         }
     },
     "data": {
         "values": [
             {
-                "mean": 1.813,
                 "hi": 2.37,
-                "study": "PoleStar vs Voyager",
+                "lo": 1.255,
+                "mean": 1.813,
                 "measure": "Open Exploration",
-                "lo": 1.255
+                "study": "PoleStar vs Voyager"
             },
             {
-                "mean": -1.688,
                 "hi": -1.05,
-                "study": "PoleStar vs Voyager",
+                "lo": -2.325,
+                "mean": -1.688,
                 "measure": "Focused Question Answering",
-                "lo": -2.325
+                "study": "PoleStar vs Voyager"
             },
             {
-                "mean": 2.1875,
                 "hi": 2.71,
-                "study": "PoleStar vs Voyager 2",
+                "lo": 1.665,
+                "mean": 2.1875,
                 "measure": "Open Exploration",
-                "lo": 1.665
+                "study": "PoleStar vs Voyager 2"
             },
             {
-                "mean": -6.25e-2,
                 "hi": 0.349,
-                "study": "PoleStar vs Voyager 2",
+                "lo": -0.474,
+                "mean": -6.25e-2,
                 "measure": "Focused Question Answering",
-                "lo": -0.474
+                "study": "PoleStar vs Voyager 2"
             }
         ]
     },
+    "spacing": 10,
     "vconcat": [
         {
-            "title": {
-                "text": "Mean of Subject Ratings (95% CIs)",
-                "frame": "bounds"
+            "encoding": {
+                "y": {
+                    "axis": {
+                        "domain": false,
+                        "grid": false,
+                        "labelPadding": 5,
+                        "ticks": false,
+                        "title": null
+                    },
+                    "field": "study",
+                    "type": "nominal"
+                }
             },
             "layer": [
                 {
-                    "mark": "rule",
                     "encoding": {
-                        "x2": {
-                            "field": "hi"
-                        },
                         "x": {
+                            "axis": {
+                                "gridColor": {
+                                    "condition": {
+                                        "test": "datum.value === 0",
+                                        "value": "#666"
+                                    },
+                                    "value": "#CCC"
+                                },
+                                "gridDash": [
+                                    3,
+                                    3
+                                ],
+                                "title": ""
+                            },
                             "field": "lo",
                             "scale": {
                                 "domain": [
@@ -70,166 +91,145 @@
                                     3
                                 ]
                             },
-                            "type": "quantitative",
-                            "axis": {
-                                "gridDash": [
-                                    3,
-                                    3
-                                ],
-                                "gridColor": {
-                                    "value": "#CCC",
-                                    "condition": {
-                                        "value": "#666",
-                                        "test": "datum.value === 0"
-                                    }
-                                },
-                                "title": ""
-                            }
+                            "type": "quantitative"
+                        },
+                        "x2": {
+                            "field": "hi"
                         }
-                    }
+                    },
+                    "mark": "rule"
                 },
                 {
-                    "mark": {
-                        "opacity": 1,
-                        "stroke": "black",
-                        "type": "circle"
-                    },
                     "encoding": {
                         "color": {
                             "field": "measure",
+                            "legend": null,
                             "scale": {
                                 "range": [
                                     "black",
                                     "white"
                                 ]
                             },
-                            "type": "nominal",
-                            "legend": null
+                            "type": "nominal"
                         },
                         "x": {
                             "field": "mean",
                             "type": "quantitative"
                         }
+                    },
+                    "mark": {
+                        "opacity": 1,
+                        "stroke": "black",
+                        "type": "circle"
                     }
                 }
             ],
-            "encoding": {
-                "y": {
-                    "field": "study",
-                    "type": "nominal",
-                    "axis": {
-                        "domain": false,
-                        "labelPadding": 5,
-                        "grid": false,
-                        "title": null,
-                        "ticks": false
-                    }
-                }
+            "title": {
+                "frame": "bounds",
+                "text": "Mean of Subject Ratings (95% CIs)"
             }
         },
         {
             "data": {
                 "values": [
                     {
-                        "to": -2.9,
                         "from": -0.25,
-                        "label": "PoleStar"
+                        "label": "PoleStar",
+                        "to": -2.9
                     },
                     {
-                        "to": 2.9,
                         "from": 0.25,
-                        "label": "Voyager / Voyager 2"
+                        "label": "Voyager / Voyager 2",
+                        "to": 2.9
                     }
                 ]
             },
             "layer": [
                 {
-                    "mark": "rule",
                     "encoding": {
-                        "x2": {
-                            "field": "to"
-                        },
                         "x": {
+                            "axis": null,
                             "field": "from",
                             "scale": {
                                 "zero": false
                             },
-                            "type": "quantitative",
-                            "axis": null
+                            "type": "quantitative"
+                        },
+                        "x2": {
+                            "field": "to"
                         }
-                    }
+                    },
+                    "mark": "rule"
                 },
                 {
-                    "mark": {
-                        "size": 60,
-                        "fill": "black",
-                        "type": "point",
-                        "filled": true
-                    },
                     "encoding": {
                         "shape": {
-                            "value": "triangle-left",
                             "condition": {
-                                "value": "triangle-right",
-                                "test": "datum.to > 0"
-                            }
+                                "test": "datum.to > 0",
+                                "value": "triangle-right"
+                            },
+                            "value": "triangle-left"
                         },
                         "x": {
+                            "axis": null,
                             "field": "to",
-                            "type": "quantitative",
-                            "axis": null
+                            "type": "quantitative"
                         }
+                    },
+                    "mark": {
+                        "fill": "black",
+                        "filled": true,
+                        "size": 60,
+                        "type": "point"
                     }
                 },
                 {
-                    "transform": [
-                        {
-                            "filter": "datum.label === 'PoleStar'"
+                    "encoding": {
+                        "x": {
+                            "axis": null,
+                            "field": "from",
+                            "type": "quantitative"
                         }
-                    ],
+                    },
                     "mark": {
+                        "align": "right",
                         "style": "arrow-label",
                         "text": [
                             "Polestar",
                             "More Valuable"
                         ],
-                        "align": "right",
                         "type": "text"
                     },
-                    "encoding": {
-                        "x": {
-                            "field": "from",
-                            "type": "quantitative",
-                            "axis": null
+                    "transform": [
+                        {
+                            "filter": "datum.label === 'PoleStar'"
                         }
-                    }
+                    ]
                 },
                 {
-                    "transform": [
-                        {
-                            "filter": "datum.label !== 'PoleStar'"
+                    "encoding": {
+                        "x": {
+                            "axis": null,
+                            "field": "from",
+                            "type": "quantitative"
                         }
-                    ],
+                    },
                     "mark": {
+                        "align": "left",
                         "style": "arrow-label",
                         "text": [
                             "Voyager / Voyager 2",
                             "More Valuable"
                         ],
-                        "align": "left",
                         "type": "text"
                     },
-                    "encoding": {
-                        "x": {
-                            "field": "from",
-                            "type": "quantitative",
-                            "axis": null
+                    "transform": [
+                        {
+                            "filter": "datum.label !== 'PoleStar'"
                         }
-                    }
+                    ]
                 }
             ]
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "spacing": 10
+    ]
 }
diff --git a/tests/specs/gallery/layer/layer1.vl b/tests/specs/gallery/layer/layer1.vl
--- a/tests/specs/gallery/layer/layer1.vl
+++ b/tests/specs/gallery/layer/layer1.vl
@@ -1,254 +1,244 @@
 {
-    "transform": [
-        {
-            "as": "isIncrease",
-            "calculate": "datum.open > datum.close"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "low": 28.45,
-                "ret": -4.89396411092985,
                 "close": 30.04,
                 "date": "01-Jun-2009",
-                "open": 28.7,
                 "high": 30.05,
+                "low": 28.45,
+                "open": 28.7,
+                "ret": -4.89396411092985,
                 "signal": "short"
             },
             {
-                "low": 28.3,
-                "ret": -0.322580645161295,
                 "close": 29.63,
                 "date": "02-Jun-2009",
-                "open": 30.04,
                 "high": 30.13,
+                "low": 28.3,
+                "open": 30.04,
+                "ret": -0.322580645161295,
                 "signal": "short"
             },
             {
-                "low": 29.62,
-                "ret": 3.68663594470045,
                 "close": 31.02,
                 "date": "03-Jun-2009",
-                "open": 29.62,
                 "high": 31.79,
+                "low": 29.62,
+                "open": 29.62,
+                "ret": 3.68663594470045,
                 "signal": "short"
             },
             {
-                "low": 29.92,
-                "ret": 4.51010886469673,
                 "close": 30.18,
                 "date": "04-Jun-2009",
-                "open": 31.02,
                 "high": 31.02,
+                "low": 29.92,
+                "open": 31.02,
+                "ret": 4.51010886469673,
                 "signal": "short"
             },
             {
-                "low": 28.85,
-                "ret": 6.08424336973478,
                 "close": 29.62,
                 "date": "05-Jun-2009",
-                "open": 29.39,
                 "high": 30.81,
+                "low": 28.85,
+                "open": 29.39,
+                "ret": 6.08424336973478,
                 "signal": "short"
             },
             {
-                "low": 26.41,
-                "ret": 1.2539184952978,
                 "close": 29.77,
                 "date": "08-Jun-2009",
-                "open": 30.84,
                 "high": 31.82,
+                "low": 26.41,
+                "open": 30.84,
+                "ret": 1.2539184952978,
                 "signal": "short"
             },
             {
-                "low": 27.79,
-                "ret": -5.02431118314424,
                 "close": 28.27,
                 "date": "09-Jun-2009",
-                "open": 29.77,
                 "high": 29.77,
+                "low": 27.79,
+                "open": 29.77,
+                "ret": -5.02431118314424,
                 "signal": "short"
             },
             {
-                "low": 26.9,
-                "ret": -5.46623794212217,
                 "close": 28.46,
                 "date": "10-Jun-2009",
-                "open": 26.9,
                 "high": 29.74,
+                "low": 26.9,
+                "open": 26.9,
+                "ret": -5.46623794212217,
                 "signal": "short"
             },
             {
-                "low": 26.81,
-                "ret": -8.3743842364532,
                 "close": 28.11,
                 "date": "11-Jun-2009",
-                "open": 27.36,
                 "high": 28.11,
+                "low": 26.81,
+                "open": 27.36,
+                "ret": -8.3743842364532,
                 "signal": "short"
             },
             {
-                "low": 27.73,
-                "ret": -5.52763819095477,
                 "close": 28.15,
                 "date": "12-Jun-2009",
-                "open": 28.08,
                 "high": 28.5,
+                "low": 27.73,
+                "open": 28.08,
+                "ret": -5.52763819095477,
                 "signal": "short"
             },
             {
-                "low": 29.64,
-                "ret": 3.4920634920635,
                 "close": 30.81,
                 "date": "15-Jun-2009",
-                "open": 29.7,
                 "high": 31.09,
+                "low": 29.64,
+                "open": 29.7,
+                "ret": 3.4920634920635,
                 "signal": "long"
             },
             {
-                "low": 30.07,
-                "ret": 0.155038759689914,
                 "close": 32.68,
                 "date": "16-Jun-2009",
-                "open": 30.81,
                 "high": 32.75,
+                "low": 30.07,
+                "open": 30.81,
+                "ret": 0.155038759689914,
                 "signal": "short"
             },
             {
-                "low": 30.64,
-                "ret": 5.82822085889571,
                 "close": 31.54,
                 "date": "17-Jun-2009",
-                "open": 31.19,
                 "high": 32.77,
+                "low": 30.64,
+                "open": 31.19,
+                "ret": 5.82822085889571,
                 "signal": "short"
             },
             {
-                "low": 29.6,
-                "ret": 8.17610062893082,
                 "close": 30.03,
                 "date": "18-Jun-2009",
-                "open": 31.54,
                 "high": 31.54,
+                "low": 29.6,
+                "open": 31.54,
+                "ret": 8.17610062893082,
                 "signal": "short"
             },
             {
-                "low": 27.56,
-                "ret": 8.59872611464968,
                 "close": 27.99,
                 "date": "19-Jun-2009",
-                "open": 29.16,
                 "high": 29.32,
+                "low": 27.56,
+                "open": 29.16,
+                "ret": 8.59872611464968,
                 "signal": "short"
             },
             {
-                "low": 30.3,
-                "ret": 15.4907975460123,
                 "close": 31.17,
                 "date": "22-Jun-2009",
-                "open": 30.4,
                 "high": 32.05,
+                "low": 30.3,
+                "open": 30.4,
+                "ret": 15.4907975460123,
                 "signal": "short"
             },
             {
-                "low": 27.83,
-                "ret": 11.7370892018779,
                 "close": 30.58,
                 "date": "23-Jun-2009",
-                "open": 31.3,
                 "high": 31.54,
+                "low": 27.83,
+                "open": 31.3,
+                "ret": 11.7370892018779,
                 "signal": "short"
             },
             {
-                "low": 28.79,
-                "ret": -10.4234527687296,
                 "close": 29.05,
                 "date": "24-Jun-2009",
-                "open": 30.58,
                 "high": 30.58,
+                "low": 28.79,
+                "open": 30.58,
+                "ret": -10.4234527687296,
                 "signal": "long"
             },
             {
-                "low": 26.3,
-                "ret": 0,
                 "close": 26.36,
                 "date": "25-Jun-2009",
-                "open": 29.45,
                 "high": 29.56,
+                "low": 26.3,
+                "open": 29.45,
+                "ret": 0,
                 "signal": "long"
             },
             {
-                "low": 25.76,
-                "ret": 0,
                 "close": 25.93,
                 "date": "26-Jun-2009",
-                "open": 27.09,
                 "high": 27.22,
+                "low": 25.76,
+                "open": 27.09,
+                "ret": 0,
                 "signal": "long"
             },
             {
-                "low": 25.29,
-                "ret": 5.26315789473684,
                 "close": 25.35,
                 "date": "29-Jun-2009",
-                "open": 25.93,
                 "high": 27.18,
+                "low": 25.29,
+                "open": 25.93,
+                "ret": 5.26315789473684,
                 "signal": "long"
             },
             {
-                "low": 25.02,
-                "ret": 6.73758865248228,
                 "close": 26.35,
                 "date": "30-Jun-2009",
-                "open": 25.36,
                 "high": 27.38,
+                "low": 25.02,
+                "open": 25.36,
+                "ret": 6.73758865248228,
                 "signal": "long"
             }
         ]
     },
-    "width": 320,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A candlestick chart inspired by Protovis (http://mbostock.github.io/protovis/ex/candlestick.html)",
     "layer": [
         {
-            "mark": "rule",
             "encoding": {
                 "color": {
                     "field": "isIncrease",
+                    "legend": null,
                     "scale": {
                         "range": [
                             "#ae1325",
                             "#06982d"
                         ]
                     },
-                    "type": "nominal",
-                    "legend": null
+                    "type": "nominal"
                 },
                 "x": {
+                    "axis": {
+                        "format": "%m/%d",
+                        "title": "Date in 2009"
+                    },
                     "field": "date",
                     "scale": {
                         "domain": [
                             {
                                 "date": 31,
-                                "year": 2009,
-                                "month": "May"
+                                "month": "May",
+                                "year": 2009
                             },
                             {
                                 "date": 1,
-                                "year": 2009,
-                                "month": "Jul"
+                                "month": "Jul",
+                                "year": 2009
                             }
                         ]
                     },
                     "timeUnit": "yearmonthdate",
-                    "type": "temporal",
-                    "axis": {
-                        "format": "%m/%d",
-                        "title": "Date in 2009"
-                    }
-                },
-                "y2": {
-                    "field": "high"
+                    "type": "temporal"
                 },
                 "y": {
                     "field": "low",
@@ -256,16 +246,19 @@
                         "zero": false
                     },
                     "type": "quantitative"
+                },
+                "y2": {
+                    "field": "high"
                 }
-            }
+            },
+            "mark": "rule"
         },
         {
-            "mark": "bar",
             "encoding": {
                 "color": {
                     "field": "isIncrease",
-                    "type": "nominal",
-                    "legend": null
+                    "legend": null,
+                    "type": "nominal"
                 },
                 "size": {
                     "value": 5
@@ -275,15 +268,22 @@
                     "timeUnit": "yearmonthdate",
                     "type": "temporal"
                 },
-                "y2": {
-                    "field": "close"
-                },
                 "y": {
                     "field": "open",
                     "type": "quantitative"
+                },
+                "y2": {
+                    "field": "close"
                 }
-            }
+            },
+            "mark": "bar"
         }
     ],
-    "description": "A candlestick chart inspired by Protovis (http://mbostock.github.io/protovis/ex/candlestick.html)"
+    "transform": [
+        {
+            "as": "isIncrease",
+            "calculate": "datum.open > datum.close"
+        }
+    ],
+    "width": 320
 }
diff --git a/tests/specs/gallery/layer/layer2.vl b/tests/specs/gallery/layer/layer2.vl
--- a/tests/specs/gallery/layer/layer2.vl
+++ b/tests/specs/gallery/layer/layer2.vl
@@ -1,56 +1,46 @@
 {
-    "transform": [
-        {
-            "filter": {
-                "field": "country",
-                "oneOf": [
-                    "China",
-                    "India",
-                    "United States",
-                    "Indonesia",
-                    "Brazil"
-                ]
-            }
-        },
-        {
-            "filter": {
-                "field": "year",
-                "oneOf": [
-                    1955,
-                    2000
-                ]
-            }
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/countries.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A ranged dot plot that uses 'layer' to convey changing life expectancy for the five most populous countries (between 1955 and 2000).",
+    "encoding": {
+        "y": {
+            "axis": {
+                "domain": false,
+                "minExtent": 70,
+                "offset": 5,
+                "ticks": false,
+                "title": "Country"
+            },
+            "field": "country",
+            "type": "nominal"
+        }
+    },
     "layer": [
         {
-            "mark": "line",
             "encoding": {
                 "color": {
                     "value": "#db646f"
                 },
-                "x": {
-                    "field": "life_expect",
-                    "type": "quantitative"
-                },
                 "detail": {
                     "field": "country",
                     "type": "nominal"
+                },
+                "x": {
+                    "field": "life_expect",
+                    "type": "quantitative"
                 }
-            }
+            },
+            "mark": "line"
         },
         {
-            "mark": {
-                "type": "point",
-                "filled": true
-            },
             "encoding": {
                 "color": {
                     "field": "year",
+                    "legend": {
+                        "title": "Year"
+                    },
                     "scale": {
                         "domain": [
                             1955,
@@ -61,39 +51,49 @@
                             "#911a24"
                         ]
                     },
-                    "type": "ordinal",
-                    "legend": {
-                        "title": "Year"
-                    }
-                },
-                "size": {
-                    "value": 100
+                    "type": "ordinal"
                 },
                 "opacity": {
                     "value": 1
                 },
+                "size": {
+                    "value": 100
+                },
                 "x": {
-                    "field": "life_expect",
-                    "type": "quantitative",
                     "axis": {
                         "title": "Life Expectancy (years)"
-                    }
+                    },
+                    "field": "life_expect",
+                    "type": "quantitative"
                 }
+            },
+            "mark": {
+                "filled": true,
+                "type": "point"
             }
         }
     ],
-    "encoding": {
-        "y": {
-            "field": "country",
-            "type": "nominal",
-            "axis": {
-                "minExtent": 70,
-                "offset": 5,
-                "domain": false,
-                "title": "Country",
-                "ticks": false
+    "transform": [
+        {
+            "filter": {
+                "field": "country",
+                "oneOf": [
+                    "China",
+                    "India",
+                    "United States",
+                    "Indonesia",
+                    "Brazil"
+                ]
             }
+        },
+        {
+            "filter": {
+                "field": "year",
+                "oneOf": [
+                    1955,
+                    2000
+                ]
+            }
         }
-    },
-    "description": "A ranged dot plot that uses 'layer' to convey changing life expectancy for the five most populous countries (between 1955 and 2000)."
+    ]
 }
diff --git a/tests/specs/gallery/layer/layer3.vl b/tests/specs/gallery/layer/layer3.vl
--- a/tests/specs/gallery/layer/layer3.vl
+++ b/tests/specs/gallery/layer/layer3.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "tick": {
             "thickness": 2
@@ -7,13 +8,13 @@
     "data": {
         "values": [
             {
+                "markers": [
+                    250
+                ],
                 "measures": [
                     220,
                     270
                 ],
-                "markers": [
-                    250
-                ],
                 "ranges": [
                     150,
                     225,
@@ -22,13 +23,13 @@
                 "title": "Revenue"
             },
             {
+                "markers": [
+                    26
+                ],
                 "measures": [
                     21,
                     23
                 ],
-                "markers": [
-                    26
-                ],
                 "ranges": [
                     20,
                     25,
@@ -37,13 +38,13 @@
                 "title": "Profit"
             },
             {
+                "markers": [
+                    550
+                ],
                 "measures": [
                     100,
                     320
                 ],
-                "markers": [
-                    550
-                ],
                 "ranges": [
                     350,
                     500,
@@ -52,13 +53,13 @@
                 "title": "Order size"
             },
             {
+                "markers": [
+                    2100
+                ],
                 "measures": [
                     1000,
                     1650
                 ],
-                "markers": [
-                    2100
-                ],
                 "ranges": [
                     1400,
                     2000,
@@ -67,13 +68,13 @@
                 "title": "New customers"
             },
             {
+                "markers": [
+                    4.4
+                ],
                 "measures": [
                     3.2,
                     4.7
                 ],
-                "markers": [
-                    4.4
-                ],
                 "ranges": [
                     3.5,
                     4.25,
@@ -83,6 +84,17 @@
             }
         ]
     },
+    "description": "Bullet chart",
+    "facet": {
+        "row": {
+            "field": "title",
+            "header": {
+                "labelAngle": 30,
+                "title": null
+            },
+            "type": "ordinal"
+        }
+    },
     "resolve": {
         "scale": {
             "x": "independent"
@@ -91,97 +103,85 @@
     "spec": {
         "layer": [
             {
-                "mark": {
-                    "color": "#eee",
-                    "type": "bar"
-                },
                 "encoding": {
                     "x": {
+                        "axis": {
+                            "title": null
+                        },
                         "field": "ranges[2]",
                         "scale": {
                             "nice": false
                         },
-                        "type": "quantitative",
-                        "axis": {
-                            "title": null
-                        }
+                        "type": "quantitative"
                     }
+                },
+                "mark": {
+                    "color": "#eee",
+                    "type": "bar"
                 }
             },
             {
-                "mark": {
-                    "color": "#ddd",
-                    "type": "bar"
-                },
                 "encoding": {
                     "x": {
                         "field": "ranges[1]",
                         "type": "quantitative"
                     }
+                },
+                "mark": {
+                    "color": "#ddd",
+                    "type": "bar"
                 }
             },
             {
-                "mark": {
-                    "color": "#ccc",
-                    "type": "bar"
-                },
                 "encoding": {
                     "x": {
                         "field": "ranges[0]",
                         "type": "quantitative"
                     }
+                },
+                "mark": {
+                    "color": "#ccc",
+                    "type": "bar"
                 }
             },
             {
-                "mark": {
-                    "color": "lightsteelblue",
-                    "size": 10,
-                    "type": "bar"
-                },
                 "encoding": {
                     "x": {
                         "field": "measures[1]",
                         "type": "quantitative"
                     }
-                }
-            },
-            {
+                },
                 "mark": {
-                    "color": "steelblue",
+                    "color": "lightsteelblue",
                     "size": 10,
                     "type": "bar"
-                },
+                }
+            },
+            {
                 "encoding": {
                     "x": {
                         "field": "measures[0]",
                         "type": "quantitative"
                     }
+                },
+                "mark": {
+                    "color": "steelblue",
+                    "size": 10,
+                    "type": "bar"
                 }
             },
             {
-                "mark": {
-                    "color": "black",
-                    "type": "tick"
-                },
                 "encoding": {
                     "x": {
                         "field": "markers[0]",
                         "type": "quantitative"
                     }
+                },
+                "mark": {
+                    "color": "black",
+                    "type": "tick"
                 }
             }
         ]
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "facet": {
-        "row": {
-            "field": "title",
-            "header": {
-                "labelAngle": 30,
-                "title": null
-            },
-            "type": "ordinal"
-        }
-    },
-    "description": "Bullet chart"
+    }
 }
diff --git a/tests/specs/gallery/layer/layer4.vl b/tests/specs/gallery/layer/layer4.vl
--- a/tests/specs/gallery/layer/layer4.vl
+++ b/tests/specs/gallery/layer/layer4.vl
@@ -1,53 +1,53 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
     },
-    "resolve": {
-        "scale": {
-            "y": "independent"
+    "description": "Layered bar/line chart with dual axes",
+    "encoding": {
+        "x": {
+            "field": "date",
+            "timeUnit": "month",
+            "type": "ordinal"
         }
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": "bar",
             "encoding": {
                 "y": {
-                    "field": "precipitation",
                     "aggregate": "mean",
-                    "type": "quantitative",
                     "axis": {
                         "grid": false
-                    }
+                    },
+                    "field": "precipitation",
+                    "type": "quantitative"
                 }
-            }
+            },
+            "mark": "bar"
         },
         {
-            "mark": "line",
             "encoding": {
                 "color": {
                     "value": "firebrick"
                 },
                 "y": {
+                    "aggregate": "mean",
+                    "axis": {
+                        "grid": false
+                    },
                     "field": "temp_max",
                     "scale": {
                         "zero": false
                     },
-                    "aggregate": "mean",
-                    "type": "quantitative",
-                    "axis": {
-                        "grid": false
-                    }
+                    "type": "quantitative"
                 }
-            }
+            },
+            "mark": "line"
         }
     ],
-    "encoding": {
-        "x": {
-            "field": "date",
-            "timeUnit": "month",
-            "type": "ordinal"
+    "resolve": {
+        "scale": {
+            "y": "independent"
         }
-    },
-    "description": "Layered bar/line chart with dual axes"
+    }
 }
diff --git a/tests/specs/gallery/layer/layer5.vl b/tests/specs/gallery/layer/layer5.vl
--- a/tests/specs/gallery/layer/layer5.vl
+++ b/tests/specs/gallery/layer/layer5.vl
@@ -1,9 +1,9 @@
 {
-    "height": 50,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "area": {
-            "orient": "vertical",
-            "interpolate": "monotone"
+            "interpolate": "monotone",
+            "orient": "vertical"
         }
     },
     "data": {
@@ -90,14 +90,20 @@
             }
         ]
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Horizon chart with 2 layers. (See https://idl.cs.washington.edu/papers/horizon/ for more details on horizon charts.)",
+    "encoding": {
+        "x": {
+            "field": "x",
+            "scale": {
+                "nice": false,
+                "zero": false
+            },
+            "type": "quantitative"
+        }
+    },
+    "height": 50,
     "layer": [
         {
-            "mark": {
-                "type": "area",
-                "clip": true
-            },
             "encoding": {
                 "opacity": {
                     "value": 0.6
@@ -112,24 +118,21 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "clip": true,
+                "type": "area"
             }
         },
         {
-            "transform": [
-                {
-                    "as": "ny",
-                    "calculate": "datum.y - 50"
-                }
-            ],
-            "mark": {
-                "type": "area",
-                "clip": true
-            },
             "encoding": {
                 "opacity": {
                     "value": 0.3
                 },
                 "y": {
+                    "axis": {
+                        "title": "y"
+                    },
                     "field": "ny",
                     "scale": {
                         "domain": [
@@ -137,23 +140,20 @@
                             50
                         ]
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": "y"
-                    }
+                    "type": "quantitative"
                 }
-            }
-        }
-    ],
-    "encoding": {
-        "x": {
-            "field": "x",
-            "scale": {
-                "zero": false,
-                "nice": false
             },
-            "type": "quantitative"
+            "mark": {
+                "clip": true,
+                "type": "area"
+            },
+            "transform": [
+                {
+                    "as": "ny",
+                    "calculate": "datum.y - 50"
+                }
+            ]
         }
-    },
-    "description": "Horizon chart with 2 layers. (See https://idl.cs.washington.edu/papers/horizon/ for more details on horizon charts.)"
+    ],
+    "width": 300
 }
diff --git a/tests/specs/gallery/layer/layer6.vl b/tests/specs/gallery/layer/layer6.vl
--- a/tests/specs/gallery/layer/layer6.vl
+++ b/tests/specs/gallery/layer/layer6.vl
@@ -1,23 +1,26 @@
 {
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/weather.json"
     },
-    "width": 250,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": {
-        "text": [
-            "Weekly Weather",
-            "Observations and Predictions"
-        ],
-        "frame": "group"
+    "description": "A layered bar chart with floating bars representing weekly weather data",
+    "encoding": {
+        "x": {
+            "axis": {
+                "domain": false,
+                "labels": false,
+                "orient": "top",
+                "ticks": false,
+                "title": null,
+                "titlePadding": 25
+            },
+            "field": "id",
+            "type": "ordinal"
+        }
     },
+    "height": 200,
     "layer": [
         {
-            "mark": {
-                "style": "box",
-                "type": "bar"
-            },
             "encoding": {
                 "color": {
                     "value": "#ccc"
@@ -25,10 +28,10 @@
                 "size": {
                     "value": 20
                 },
-                "y2": {
-                    "field": "record.high"
-                },
                 "y": {
+                    "axis": {
+                        "title": "Temperature (F)"
+                    },
                     "field": "record.low",
                     "scale": {
                         "domain": [
@@ -36,18 +39,18 @@
                             70
                         ]
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": "Temperature (F)"
-                    }
+                    "type": "quantitative"
+                },
+                "y2": {
+                    "field": "record.high"
                 }
-            }
-        },
-        {
+            },
             "mark": {
                 "style": "box",
                 "type": "bar"
-            },
+            }
+        },
+        {
             "encoding": {
                 "color": {
                     "value": "#999"
@@ -55,20 +58,20 @@
                 "size": {
                     "value": 20
                 },
-                "y2": {
-                    "field": "normal.high"
-                },
                 "y": {
                     "field": "normal.low",
                     "type": "quantitative"
+                },
+                "y2": {
+                    "field": "normal.high"
                 }
-            }
-        },
-        {
+            },
             "mark": {
                 "style": "box",
                 "type": "bar"
-            },
+            }
+        },
+        {
             "encoding": {
                 "color": {
                     "value": "#000"
@@ -76,20 +79,20 @@
                 "size": {
                     "value": 12
                 },
-                "y2": {
-                    "field": "actual.high"
-                },
                 "y": {
                     "field": "actual.low",
                     "type": "quantitative"
+                },
+                "y2": {
+                    "field": "actual.high"
                 }
-            }
-        },
-        {
+            },
             "mark": {
                 "style": "box",
                 "type": "bar"
-            },
+            }
+        },
+        {
             "encoding": {
                 "color": {
                     "value": "#000"
@@ -97,20 +100,20 @@
                 "size": {
                     "value": 12
                 },
-                "y2": {
-                    "field": "forecast.low.high"
-                },
                 "y": {
                     "field": "forecast.low.low",
                     "type": "quantitative"
+                },
+                "y2": {
+                    "field": "forecast.low.high"
                 }
-            }
-        },
-        {
+            },
             "mark": {
                 "style": "box",
                 "type": "bar"
-            },
+            }
+        },
+        {
             "encoding": {
                 "color": {
                     "value": "#000"
@@ -118,20 +121,20 @@
                 "size": {
                     "value": 3
                 },
-                "y2": {
-                    "field": "forecast.high.low"
-                },
                 "y": {
                     "field": "forecast.low.high",
                     "type": "quantitative"
+                },
+                "y2": {
+                    "field": "forecast.high.low"
                 }
-            }
-        },
-        {
+            },
             "mark": {
                 "style": "box",
                 "type": "bar"
-            },
+            }
+        },
+        {
             "encoding": {
                 "color": {
                     "value": "#000"
@@ -139,43 +142,40 @@
                 "size": {
                     "value": 12
                 },
-                "y2": {
-                    "field": "forecast.high.high"
-                },
                 "y": {
                     "field": "forecast.high.low",
                     "type": "quantitative"
+                },
+                "y2": {
+                    "field": "forecast.high.high"
                 }
+            },
+            "mark": {
+                "style": "box",
+                "type": "bar"
             }
         },
         {
-            "mark": {
-                "align": "center",
-                "type": "text",
-                "baseline": "bottom",
-                "y": -5
-            },
             "encoding": {
                 "text": {
                     "field": "day",
                     "type": "nominal"
                 }
+            },
+            "mark": {
+                "align": "center",
+                "baseline": "bottom",
+                "type": "text",
+                "y": -5
             }
         }
     ],
-    "encoding": {
-        "x": {
-            "field": "id",
-            "type": "ordinal",
-            "axis": {
-                "domain": false,
-                "orient": "top",
-                "titlePadding": 25,
-                "labels": false,
-                "title": null,
-                "ticks": false
-            }
-        }
+    "title": {
+        "frame": "group",
+        "text": [
+            "Weekly Weather",
+            "Observations and Predictions"
+        ]
     },
-    "description": "A layered bar chart with floating bars representing weekly weather data"
+    "width": 250
 }
diff --git a/tests/specs/gallery/layer/layer7.vl b/tests/specs/gallery/layer/layer7.vl
--- a/tests/specs/gallery/layer/layer7.vl
+++ b/tests/specs/gallery/layer/layer7.vl
@@ -1,55 +1,35 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "mean",
-                    "as": "rolling_mean",
-                    "field": "temp_max"
-                }
-            ],
-            "frame": [
-                -15,
-                15
-            ]
-        }
-    ],
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Plot showing a 30 day rolling average with raw values in the background.",
+    "height": 300,
     "layer": [
         {
-            "mark": {
-                "opacity": 0.3,
-                "type": "point"
-            },
             "encoding": {
                 "x": {
-                    "field": "date",
-                    "title": "Date",
-                    "type": "temporal",
                     "axis": {
-                        "zindex": 1,
                         "gridColor": "orange",
-                        "gridOpacity": 0.8
-                    }
+                        "gridOpacity": 0.8,
+                        "zindex": 1
+                    },
+                    "field": "date",
+                    "title": "Date",
+                    "type": "temporal"
                 },
                 "y": {
                     "field": "temp_max",
                     "title": "Max Temperature",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "opacity": 0.3,
+                "type": "point"
             }
         },
         {
-            "mark": {
-                "color": "red",
-                "size": 3,
-                "type": "line"
-            },
             "encoding": {
                 "x": {
                     "field": "date",
@@ -59,8 +39,28 @@
                     "field": "rolling_mean",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "size": 3,
+                "type": "line"
             }
         }
     ],
-    "description": "Plot showing a 30 day rolling average with raw values in the background."
+    "transform": [
+        {
+            "frame": [
+                -15,
+                15
+            ],
+            "window": [
+                {
+                    "as": "rolling_mean",
+                    "field": "temp_max",
+                    "op": "mean"
+                }
+            ]
+        }
+    ],
+    "width": 400
 }
diff --git a/tests/specs/gallery/layer/layer_bar_fruit.vl b/tests/specs/gallery/layer/layer_bar_fruit.vl
--- a/tests/specs/gallery/layer/layer_bar_fruit.vl
+++ b/tests/specs/gallery/layer/layer_bar_fruit.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -35,59 +36,58 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Vega-Lite version of bar chart from https://observablehq.com/@d3/learn-d3-scales.",
+    "encoding": {
+        "x": {
+            "field": "count",
+            "title": null,
+            "type": "quantitative"
+        },
+        "y": {
+            "field": "name",
+            "sort": {
+                "encoding": "x",
+                "order": "descending"
+            },
+            "title": null,
+            "type": "ordinal"
+        }
+    },
     "layer": [
         {
-            "mark": "bar",
             "encoding": {
                 "color": {
                     "field": "count",
                     "title": "Number of fruit",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "bar"
         },
         {
-            "mark": {
-                "aria": false,
-                "align": "right",
-                "xOffset": -4,
-                "type": "text"
-            },
             "encoding": {
                 "color": {
-                    "value": "black",
                     "condition": {
-                        "value": "white",
                         "test": {
                             "field": "count",
                             "gt": 10
-                        }
-                    }
+                        },
+                        "value": "white"
+                    },
+                    "value": "black"
                 },
                 "text": {
                     "field": "count",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "align": "right",
+                "aria": false,
+                "type": "text",
+                "xOffset": -4
             }
         }
     ],
-    "encoding": {
-        "x": {
-            "field": "count",
-            "title": null,
-            "type": "quantitative"
-        },
-        "y": {
-            "field": "name",
-            "sort": {
-                "encoding": "x",
-                "order": "descending"
-            },
-            "title": null,
-            "type": "ordinal"
-        }
-    },
-    "description": "Vega-Lite version of bar chart from https://observablehq.com/@d3/learn-d3-scales."
+    "width": 400
 }
diff --git a/tests/specs/gallery/layer/layertimeunitrect.vl b/tests/specs/gallery/layer/layertimeunitrect.vl
--- a/tests/specs/gallery/layer/layertimeunitrect.vl
+++ b/tests/specs/gallery/layer/layertimeunitrect.vl
@@ -1,55 +1,55 @@
 {
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Drawing rect bin from the beginning of May to end of July",
     "layer": [
         {
-            "mark": "bar",
             "data": {
                 "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
             },
             "encoding": {
                 "x": {
+                    "axis": {
+                        "labelAlign": "left",
+                        "labelExpr": "datum.label[0]"
+                    },
                     "field": "date",
                     "timeUnit": "month",
                     "title": "month",
-                    "type": "temporal",
-                    "axis": {
-                        "labelExpr": "datum.label[0]",
-                        "labelAlign": "left"
-                    }
+                    "type": "temporal"
                 },
                 "y": {
-                    "field": "precipitation",
                     "aggregate": "mean",
+                    "field": "precipitation",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "bar"
         },
         {
-            "mark": {
-                "color": "grey",
-                "opacity": 0.5,
-                "type": "rect"
-            },
             "data": {
                 "values": [
                     {
-                        "date_end": "July 15, 2010",
-                        "date": "May 1, 2010"
+                        "date": "May 1, 2010",
+                        "date_end": "July 15, 2010"
                     }
                 ]
             },
             "encoding": {
-                "x2": {
-                    "field": "date_end",
-                    "timeUnit": "month"
-                },
                 "x": {
                     "field": "date",
                     "timeUnit": "month",
                     "type": "temporal"
+                },
+                "x2": {
+                    "field": "date_end",
+                    "timeUnit": "month"
                 }
+            },
+            "mark": {
+                "color": "grey",
+                "opacity": 0.5,
+                "type": "rect"
             }
         }
-    ],
-    "description": "Drawing rect bin from the beginning of May to end of July"
+    ]
 }
diff --git a/tests/specs/gallery/line/conditionalaxis.vl b/tests/specs/gallery/line/conditionalaxis.vl
--- a/tests/specs/gallery/line/conditionalaxis.vl
+++ b/tests/specs/gallery/line/conditionalaxis.vl
@@ -1,76 +1,76 @@
 {
-    "transform": [
-        {
-            "filter": "datum.symbol === 'GOOG'"
-        },
-        {
-            "filter": {
-                "field": "date",
-                "timeUnit": "year",
-                "range": [
-                    2006,
-                    2007
-                ]
-            }
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "axis": {
             "domainColor": "#ddd",
             "tickColor": "#ddd"
         }
     },
-    "mark": "line",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Line chart with conditional axis ticks, labels, and grid.",
     "encoding": {
         "x": {
-            "field": "date",
-            "type": "temporal",
             "axis": {
-                "tickSize": 30,
-                "labelOffset": 4,
-                "tickDash": {
-                    "value": [
-                        2,
-                        2
-                    ],
+                "gridDash": {
                     "condition": {
-                        "value": [],
                         "test": {
                             "equal": 1,
                             "field": "value",
                             "timeUnit": "month"
-                        }
-                    }
-                },
-                "tickCount": 8,
-                "gridDash": {
+                        },
+                        "value": []
+                    },
                     "value": [
                         2,
                         2
-                    ],
+                    ]
+                },
+                "labelAlign": "left",
+                "labelExpr": "[timeFormat(datum.value, '%b'), timeFormat(datum.value, '%m') == '01' ? timeFormat(datum.value, '%Y') : '']",
+                "labelOffset": 4,
+                "labelPadding": -24,
+                "tickCount": 8,
+                "tickDash": {
                     "condition": {
-                        "value": [],
                         "test": {
                             "equal": 1,
                             "field": "value",
                             "timeUnit": "month"
-                        }
-                    }
+                        },
+                        "value": []
+                    },
+                    "value": [
+                        2,
+                        2
+                    ]
                 },
-                "labelExpr": "[timeFormat(datum.value, '%b'), timeFormat(datum.value, '%m') == '01' ? timeFormat(datum.value, '%Y') : '']",
-                "labelPadding": -24,
-                "labelAlign": "left"
-            }
+                "tickSize": 30
+            },
+            "field": "date",
+            "type": "temporal"
         },
         "y": {
             "field": "price",
             "type": "quantitative"
         }
     },
-    "description": "Line chart with conditional axis ticks, labels, and grid."
+    "mark": "line",
+    "transform": [
+        {
+            "filter": "datum.symbol === 'GOOG'"
+        },
+        {
+            "filter": {
+                "field": "date",
+                "range": [
+                    2006,
+                    2007
+                ],
+                "timeUnit": "year"
+            }
+        }
+    ],
+    "width": 400
 }
diff --git a/tests/specs/gallery/line/line1.vl b/tests/specs/gallery/line/line1.vl
--- a/tests/specs/gallery/line/line1.vl
+++ b/tests/specs/gallery/line/line1.vl
@@ -1,26 +1,26 @@
 {
-    "transform": [
-        {
-            "filter": "datum.symbol === 'GOOG'"
-        }
-    ],
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Google's stock price over time.",
     "encoding": {
         "x": {
-            "field": "date",
-            "type": "temporal",
             "axis": {
                 "format": "%Y"
-            }
+            },
+            "field": "date",
+            "type": "temporal"
         },
         "y": {
             "field": "price",
             "type": "quantitative"
         }
     },
-    "description": "Google's stock price over time."
+    "mark": "line",
+    "transform": [
+        {
+            "filter": "datum.symbol === 'GOOG'"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/line/line10.vl b/tests/specs/gallery/line/line10.vl
--- a/tests/specs/gallery/line/line10.vl
+++ b/tests/specs/gallery/line/line10.vl
@@ -1,64 +1,90 @@
 {
-    "transform": [
-        {
-            "as": "year",
-            "calculate": "year(datum.Date)"
-        },
-        {
-            "as": "month",
-            "calculate": "month(datum.Date)"
-        },
-        {
-            "as": "decade",
-            "calculate": "floor(datum.year / 10)"
-        },
-        {
-            "as": "scaled_date",
-            "calculate": "(datum.year % 10) + (datum.month / 12)"
-        }
-    ],
-    "height": 500,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/co2-concentration.csv",
         "format": {
             "parse": {
                 "Date": "utc:'%Y-%m-%d'"
             }
+        },
+        "url": "https://vega.github.io/vega-lite/data/co2-concentration.csv"
+    },
+    "description": "Carbon dioxide in the atmosphere.",
+    "encoding": {
+        "x": {
+            "axis": {
+                "tickCount": 10,
+                "title": "Year into decade",
+                "values": [
+                    1,
+                    2,
+                    3,
+                    4,
+                    5,
+                    6,
+                    7,
+                    8,
+                    9
+                ]
+            },
+            "field": "scaled_date",
+            "type": "quantitative"
+        },
+        "y": {
+            "axis": {
+                "title": "CO2 concentration in ppm"
+            },
+            "field": "CO2",
+            "scale": {
+                "zero": false
+            },
+            "type": "quantitative"
         }
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 500,
     "layer": [
         {
-            "mark": {
-                "orient": "vertical",
-                "type": "line"
-            },
             "encoding": {
                 "color": {
                     "field": "decade",
-                    "type": "nominal",
-                    "legend": null
+                    "legend": null,
+                    "type": "nominal"
                 }
+            },
+            "mark": {
+                "orient": "vertical",
+                "type": "line"
             }
         },
         {
+            "encoding": {
+                "text": {
+                    "field": "aggregated.year",
+                    "type": "nominal"
+                }
+            },
+            "mark": {
+                "align": "left",
+                "baseline": "top",
+                "dx": 3,
+                "dy": 1,
+                "type": "text"
+            },
             "transform": [
                 {
-                    "groupby": [
-                        "decade"
-                    ],
                     "aggregate": [
                         {
-                            "op": "argmin",
                             "as": "aggregated",
-                            "field": "scaled_date"
+                            "field": "scaled_date",
+                            "op": "argmin"
                         }
+                    ],
+                    "groupby": [
+                        "decade"
                     ]
                 },
                 {
@@ -69,33 +95,33 @@
                     "as": "CO2",
                     "calculate": "datum.aggregated.CO2"
                 }
-            ],
-            "mark": {
-                "dx": 3,
-                "dy": 1,
-                "align": "left",
-                "type": "text",
-                "baseline": "top"
-            },
+            ]
+        },
+        {
             "encoding": {
                 "text": {
                     "field": "aggregated.year",
                     "type": "nominal"
                 }
-            }
-        },
-        {
+            },
+            "mark": {
+                "align": "left",
+                "baseline": "bottom",
+                "dx": 3,
+                "dy": 1,
+                "type": "text"
+            },
             "transform": [
                 {
-                    "groupby": [
-                        "decade"
-                    ],
                     "aggregate": [
                         {
-                            "op": "argmax",
                             "as": "aggregated",
-                            "field": "scaled_date"
+                            "field": "scaled_date",
+                            "op": "argmax"
                         }
+                    ],
+                    "groupby": [
+                        "decade"
                     ]
                 },
                 {
@@ -106,52 +132,26 @@
                     "as": "CO2",
                     "calculate": "datum.aggregated.CO2"
                 }
-            ],
-            "mark": {
-                "dx": 3,
-                "dy": 1,
-                "align": "left",
-                "type": "text",
-                "baseline": "bottom"
-            },
-            "encoding": {
-                "text": {
-                    "field": "aggregated.year",
-                    "type": "nominal"
-                }
-            }
+            ]
         }
     ],
-    "encoding": {
-        "x": {
-            "field": "scaled_date",
-            "type": "quantitative",
-            "axis": {
-                "values": [
-                    1,
-                    2,
-                    3,
-                    4,
-                    5,
-                    6,
-                    7,
-                    8,
-                    9
-                ],
-                "tickCount": 10,
-                "title": "Year into decade"
-            }
+    "transform": [
+        {
+            "as": "year",
+            "calculate": "year(datum.Date)"
         },
-        "y": {
-            "field": "CO2",
-            "scale": {
-                "zero": false
-            },
-            "type": "quantitative",
-            "axis": {
-                "title": "CO2 concentration in ppm"
-            }
+        {
+            "as": "month",
+            "calculate": "month(datum.Date)"
+        },
+        {
+            "as": "decade",
+            "calculate": "floor(datum.year / 10)"
+        },
+        {
+            "as": "scaled_date",
+            "calculate": "(datum.year % 10) + (datum.month / 12)"
         }
-    },
-    "description": "Carbon dioxide in the atmosphere."
+    ],
+    "width": 800
 }
diff --git a/tests/specs/gallery/line/line11.vl b/tests/specs/gallery/line/line11.vl
--- a/tests/specs/gallery/line/line11.vl
+++ b/tests/specs/gallery/line/line11.vl
@@ -1,108 +1,82 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "rank",
-                    "as": "rank"
-                }
-            ],
-            "groupby": [
-                "matchday"
-            ],
-            "sort": [
-                {
-                    "field": "point",
-                    "order": "descending"
-                },
-                {
-                    "field": "diff",
-                    "order": "descending"
-                }
-            ]
-        }
-    ],
-    "mark": {
-        "orient": "vertical",
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "diff": -1,
-                "point": 0,
                 "matchday": 1,
+                "point": 0,
                 "team": "Germany"
             },
             {
                 "diff": 1,
-                "point": 3,
                 "matchday": 1,
+                "point": 3,
                 "team": "Mexico"
             },
             {
                 "diff": -1,
-                "point": 0,
                 "matchday": 1,
+                "point": 0,
                 "team": "South Korea"
             },
             {
                 "diff": 1,
-                "point": 3,
                 "matchday": 1,
+                "point": 3,
                 "team": "Sweden"
             },
             {
                 "diff": 0,
-                "point": 3,
                 "matchday": 2,
+                "point": 3,
                 "team": "Germany"
             },
             {
                 "diff": 2,
-                "point": 6,
                 "matchday": 2,
+                "point": 6,
                 "team": "Mexico"
             },
             {
                 "diff": -2,
-                "point": 0,
                 "matchday": 2,
+                "point": 0,
                 "team": "South Korea"
             },
             {
                 "diff": 0,
-                "point": 3,
                 "matchday": 2,
+                "point": 3,
                 "team": "Sweden"
             },
             {
                 "diff": -2,
-                "point": 3,
                 "matchday": 3,
+                "point": 3,
                 "team": "Germany"
             },
             {
                 "diff": -1,
-                "point": 6,
                 "matchday": 3,
+                "point": 6,
                 "team": "Mexico"
             },
             {
                 "diff": 0,
-                "point": 3,
                 "matchday": 3,
+                "point": 3,
                 "team": "South Korea"
             },
             {
                 "diff": 3,
-                "point": 6,
                 "matchday": 3,
+                "point": 6,
                 "team": "Sweden"
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Line chart showing ranks over time for thw World Cup 2018 Group F teams",
     "encoding": {
         "color": {
             "field": "team",
@@ -131,5 +105,31 @@
             "type": "ordinal"
         }
     },
-    "description": "Line chart showing ranks over time for thw World Cup 2018 Group F teams"
+    "mark": {
+        "orient": "vertical",
+        "type": "line"
+    },
+    "transform": [
+        {
+            "groupby": [
+                "matchday"
+            ],
+            "sort": [
+                {
+                    "field": "point",
+                    "order": "descending"
+                },
+                {
+                    "field": "diff",
+                    "order": "descending"
+                }
+            ],
+            "window": [
+                {
+                    "as": "rank",
+                    "op": "rank"
+                }
+            ]
+        }
+    ]
 }
diff --git a/tests/specs/gallery/line/line12.vl b/tests/specs/gallery/line/line12.vl
--- a/tests/specs/gallery/line/line12.vl
+++ b/tests/specs/gallery/line/line12.vl
@@ -1,15 +1,5 @@
 {
-    "transform": [
-        {
-            "as": "v",
-            "calculate": "sin(datum.u)"
-        },
-        {
-            "as": "w",
-            "calculate": "cos(datum.u)"
-        }
-    ],
-    "height": 150,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "sequence": {
             "as": "u",
@@ -18,11 +8,10 @@
             "stop": 12.7
         }
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Plots a function using a generated sequence",
+    "height": 150,
     "layer": [
         {
-            "mark": "line",
             "encoding": {
                 "x": {
                     "field": "u",
@@ -34,13 +23,10 @@
                     "title": "sin(x)",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "line"
         },
         {
-            "mark": {
-                "stroke": "firebrick",
-                "type": "line"
-            },
             "encoding": {
                 "x": {
                     "field": "u",
@@ -52,8 +38,22 @@
                     "title": "cos(x)",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "stroke": "firebrick",
+                "type": "line"
             }
         }
     ],
-    "description": "Plots a function using a generated sequence"
+    "transform": [
+        {
+            "as": "v",
+            "calculate": "sin(datum.u)"
+        },
+        {
+            "as": "w",
+            "calculate": "cos(datum.u)"
+        }
+    ],
+    "width": 300
 }
diff --git a/tests/specs/gallery/line/line2.vl b/tests/specs/gallery/line/line2.vl
--- a/tests/specs/gallery/line/line2.vl
+++ b/tests/specs/gallery/line/line2.vl
@@ -1,32 +1,32 @@
 {
-    "transform": [
-        {
-            "filter": "datum.symbol === 'GOOG'"
-        }
-    ],
-    "mark": {
-        "color": "green",
-        "point": {
-            "color": "purple"
-        },
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Google's stock price over time with point markers.",
     "encoding": {
         "x": {
-            "field": "date",
-            "type": "temporal",
             "axis": {
                 "format": "%Y"
-            }
+            },
+            "field": "date",
+            "type": "temporal"
         },
         "y": {
             "field": "price",
             "type": "quantitative"
         }
     },
-    "description": "Google's stock price over time with point markers."
+    "mark": {
+        "color": "green",
+        "point": {
+            "color": "purple"
+        },
+        "type": "line"
+    },
+    "transform": [
+        {
+            "filter": "datum.symbol === 'GOOG'"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/line/line3.vl b/tests/specs/gallery/line/line3.vl
--- a/tests/specs/gallery/line/line3.vl
+++ b/tests/specs/gallery/line/line3.vl
@@ -1,25 +1,25 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Stock prices of 5 tech companies over time.",
     "encoding": {
         "color": {
             "field": "symbol",
             "type": "nominal"
         },
         "x": {
-            "field": "date",
-            "type": "temporal",
             "axis": {
                 "format": "%Y"
-            }
+            },
+            "field": "date",
+            "type": "temporal"
         },
         "y": {
             "field": "price",
             "type": "quantitative"
         }
     },
-    "description": "Stock prices of 5 tech companies over time."
+    "mark": "line"
 }
diff --git a/tests/specs/gallery/line/line4.vl b/tests/specs/gallery/line/line4.vl
--- a/tests/specs/gallery/line/line4.vl
+++ b/tests/specs/gallery/line/line4.vl
@@ -1,12 +1,9 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/barley.json"
     },
-    "width": {
-        "step": 50
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Slope graph showing the change in yield for different barley sites. It shows the error in the year labels for the Morris site.",
     "encoding": {
         "color": {
             "field": "site",
@@ -20,10 +17,13 @@
             "type": "ordinal"
         },
         "y": {
-            "field": "yield",
             "aggregate": "median",
+            "field": "yield",
             "type": "quantitative"
         }
     },
-    "description": "Slope graph showing the change in yield for different barley sites. It shows the error in the year labels for the Morris site."
+    "mark": "line",
+    "width": {
+        "step": 50
+    }
 }
diff --git a/tests/specs/gallery/line/line5.vl b/tests/specs/gallery/line/line5.vl
--- a/tests/specs/gallery/line/line5.vl
+++ b/tests/specs/gallery/line/line5.vl
@@ -1,29 +1,29 @@
 {
-    "transform": [
-        {
-            "filter": "datum.symbol === 'GOOG'"
-        }
-    ],
-    "mark": {
-        "interpolate": "step-after",
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Google's stock price over time (quantized as a step-chart).",
     "encoding": {
         "x": {
-            "field": "date",
-            "type": "temporal",
             "axis": {
                 "format": "%Y"
-            }
+            },
+            "field": "date",
+            "type": "temporal"
         },
         "y": {
             "field": "price",
             "type": "quantitative"
         }
     },
-    "description": "Google's stock price over time (quantized as a step-chart)."
+    "mark": {
+        "interpolate": "step-after",
+        "type": "line"
+    },
+    "transform": [
+        {
+            "filter": "datum.symbol === 'GOOG'"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/line/line6.vl b/tests/specs/gallery/line/line6.vl
--- a/tests/specs/gallery/line/line6.vl
+++ b/tests/specs/gallery/line/line6.vl
@@ -1,29 +1,29 @@
 {
-    "transform": [
-        {
-            "filter": "datum.symbol === 'GOOG'"
-        }
-    ],
-    "mark": {
-        "interpolate": "monotone",
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Google's stock price over time (smoothed with monotonic interpolation).",
     "encoding": {
         "x": {
-            "field": "date",
-            "type": "temporal",
             "axis": {
                 "format": "%Y"
-            }
+            },
+            "field": "date",
+            "type": "temporal"
         },
         "y": {
             "field": "price",
             "type": "quantitative"
         }
     },
-    "description": "Google's stock price over time (smoothed with monotonic interpolation)."
+    "mark": {
+        "interpolate": "monotone",
+        "type": "line"
+    },
+    "transform": [
+        {
+            "filter": "datum.symbol === 'GOOG'"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/line/line7.vl b/tests/specs/gallery/line/line7.vl
--- a/tests/specs/gallery/line/line7.vl
+++ b/tests/specs/gallery/line/line7.vl
@@ -1,13 +1,13 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/driving.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A connected scatterplot can be created by customizing line order and adding point marker in the line mark definition.",
     "encoding": {
+        "order": {
+            "field": "year"
+        },
         "x": {
             "field": "miles",
             "scale": {
@@ -15,10 +15,6 @@
             },
             "type": "quantitative"
         },
-        "order": {
-            "field": "year",
-            "type": "temporal"
-        },
         "y": {
             "field": "gas",
             "scale": {
@@ -27,5 +23,8 @@
             "type": "quantitative"
         }
     },
-    "description": "A connected scatterplot can be created by customizing line order and adding point marker in the line mark definition."
+    "mark": {
+        "point": true,
+        "type": "line"
+    }
 }
diff --git a/tests/specs/gallery/line/line8.vl b/tests/specs/gallery/line/line8.vl
--- a/tests/specs/gallery/line/line8.vl
+++ b/tests/specs/gallery/line/line8.vl
@@ -1,9 +1,9 @@
 {
-    "mark": "trail",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Stock prices of five tech companies over time double encoding price with vertical position and line thickness.",
     "encoding": {
         "color": {
             "field": "symbol",
@@ -14,16 +14,16 @@
             "type": "quantitative"
         },
         "x": {
-            "field": "date",
-            "type": "temporal",
             "axis": {
                 "format": "%Y"
-            }
+            },
+            "field": "date",
+            "type": "temporal"
         },
         "y": {
             "field": "price",
             "type": "quantitative"
         }
     },
-    "description": "Stock prices of five tech companies over time double encoding price with vertical position and line thickness."
+    "mark": "trail"
 }
diff --git a/tests/specs/gallery/line/line9.vl b/tests/specs/gallery/line/line9.vl
--- a/tests/specs/gallery/line/line9.vl
+++ b/tests/specs/gallery/line/line9.vl
@@ -1,8 +1,5 @@
 {
-    "mark": {
-        "point": true,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -35,7 +32,7 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Line chart with markers and invalid values.",
     "encoding": {
         "x": {
             "field": "x",
@@ -46,5 +43,8 @@
             "type": "quantitative"
         }
     },
-    "description": "Line chart with markers and invalid values."
+    "mark": {
+        "point": true,
+        "type": "line"
+    }
 }
diff --git a/tests/specs/gallery/line/linecolorhalo.vl b/tests/specs/gallery/line/linecolorhalo.vl
--- a/tests/specs/gallery/line/linecolorhalo.vl
+++ b/tests/specs/gallery/line/linecolorhalo.vl
@@ -1,16 +1,9 @@
 {
-    "transform": [
-        {
-            "groupby": [
-                "date"
-            ],
-            "value": "price",
-            "pivot": "symbol"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
+    "description": "Multi-series Line Chart with Halo. Use pivot and repeat-layer as a workaround to facet groups of lines and their halo strokes. See https://github.com/vega/vega-lite/issues/6192 for more discussion.",
     "repeat": {
         "layer": [
             "AAPL",
@@ -23,11 +16,6 @@
     "spec": {
         "layer": [
             {
-                "mark": {
-                    "strokeWidth": 4,
-                    "stroke": "white",
-                    "type": "line"
-                },
                 "encoding": {
                     "x": {
                         "field": "date",
@@ -40,16 +28,20 @@
                         "title": "price",
                         "type": "quantitative"
                     }
+                },
+                "mark": {
+                    "stroke": "white",
+                    "strokeWidth": 4,
+                    "type": "line"
                 }
             },
             {
-                "mark": "line",
                 "encoding": {
                     "stroke": {
-                        "type": "nominal",
                         "datum": {
                             "repeat": "layer"
-                        }
+                        },
+                        "type": "nominal"
                     },
                     "x": {
                         "field": "date",
@@ -62,10 +54,18 @@
                         "title": "price",
                         "type": "quantitative"
                     }
-                }
+                },
+                "mark": "line"
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "Multi-series Line Chart with Halo. Use pivot and repeat-layer as a workaround to facet groups of lines and their halo strokes. See https://github.com/vega/vega-lite/issues/6192 for more discussion."
+    "transform": [
+        {
+            "groupby": [
+                "date"
+            ],
+            "pivot": "symbol",
+            "value": "price"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/multi/multi1.vl b/tests/specs/gallery/multi/multi1.vl
--- a/tests/specs/gallery/multi/multi1.vl
+++ b/tests/specs/gallery/multi/multi1.vl
@@ -1,34 +1,52 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/sp500.csv"
     },
+    "description": "Overview and detail.",
     "vconcat": [
         {
-            "mark": "area",
-            "width": 500,
             "encoding": {
                 "x": {
+                    "axis": {
+                        "title": null
+                    },
                     "field": "date",
                     "scale": {
                         "domain": {
                             "selection": "myBrush"
                         }
                     },
-                    "type": "temporal",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "temporal"
                 },
                 "y": {
                     "field": "price",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "area",
+            "width": 500
         },
         {
+            "encoding": {
+                "x": {
+                    "axis": {
+                        "format": "%Y"
+                    },
+                    "field": "date",
+                    "type": "temporal"
+                },
+                "y": {
+                    "axis": {
+                        "grid": false,
+                        "tickCount": 3
+                    },
+                    "field": "price",
+                    "type": "quantitative"
+                }
+            },
             "height": 60,
             "mark": "area",
-            "width": 480,
             "selection": {
                 "myBrush": {
                     "encodings": [
@@ -37,25 +55,7 @@
                     "type": "interval"
                 }
             },
-            "encoding": {
-                "x": {
-                    "field": "date",
-                    "type": "temporal",
-                    "axis": {
-                        "format": "%Y"
-                    }
-                },
-                "y": {
-                    "field": "price",
-                    "type": "quantitative",
-                    "axis": {
-                        "tickCount": 3,
-                        "grid": false
-                    }
-                }
-            }
+            "width": 480
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "Overview and detail."
+    ]
 }
diff --git a/tests/specs/gallery/multi/multi2.vl b/tests/specs/gallery/multi/multi2.vl
--- a/tests/specs/gallery/multi/multi2.vl
+++ b/tests/specs/gallery/multi/multi2.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "repeat": {
         "column": [
             "distance",
@@ -7,18 +8,28 @@
         ]
     },
     "spec": {
-        "transform": [
-            {
-                "as": "time",
-                "calculate": "hours(datum.date)"
-            }
-        ],
         "data": {
-            "url": "https://vega.github.io/vega-lite/data/flights-2k.json",
             "format": {
                 "parse": {
                     "date": "date"
                 }
+            },
+            "url": "https://vega.github.io/vega-lite/data/flights-2k.json"
+        },
+        "description": "Cross-filter.",
+        "encoding": {
+            "x": {
+                "bin": {
+                    "maxbins": 20
+                },
+                "field": {
+                    "repeat": "column"
+                },
+                "type": "quantitative"
+            },
+            "y": {
+                "aggregate": "count",
+                "type": "quantitative"
             }
         },
         "layer": [
@@ -34,37 +45,26 @@
                 }
             },
             {
+                "encoding": {
+                    "color": {
+                        "value": "goldenrod"
+                    }
+                },
+                "mark": "bar",
                 "transform": [
                     {
                         "filter": {
                             "selection": "myBrush"
                         }
                     }
-                ],
-                "mark": "bar",
-                "encoding": {
-                    "color": {
-                        "value": "goldenrod"
-                    }
-                }
+                ]
             }
         ],
-        "encoding": {
-            "x": {
-                "field": {
-                    "repeat": "column"
-                },
-                "bin": {
-                    "maxbins": 20
-                },
-                "type": "quantitative"
-            },
-            "y": {
-                "aggregate": "count",
-                "type": "quantitative"
+        "transform": [
+            {
+                "as": "time",
+                "calculate": "hours(datum.date)"
             }
-        },
-        "description": "Cross-filter."
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+        ]
+    }
 }
diff --git a/tests/specs/gallery/multi/multi3.vl b/tests/specs/gallery/multi/multi3.vl
--- a/tests/specs/gallery/multi/multi3.vl
+++ b/tests/specs/gallery/multi/multi3.vl
@@ -1,45 +1,30 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Scatterplot matrix",
     "repeat": {
-        "row": [
-            "Horsepower",
-            "Acceleration",
-            "Miles_per_Gallon"
-        ],
         "column": [
             "Miles_per_Gallon",
             "Acceleration",
             "Horsepower"
+        ],
+        "row": [
+            "Horsepower",
+            "Acceleration",
+            "Miles_per_Gallon"
         ]
     },
     "spec": {
-        "mark": "point",
         "data": {
             "url": "https://vega.github.io/vega-lite/data/cars.json"
         },
-        "selection": {
-            "myBrush": {
-                "resolve": "union",
-                "zoom": "wheel![event.shiftKey]",
-                "type": "interval",
-                "translate": "[mousedown[event.shiftKey], window:mouseup] > window:mousemove!",
-                "on": "[mousedown[event.shiftKey], window:mouseup] > window:mousemove!"
-            },
-            "grid": {
-                "bind": "scales",
-                "resolve": "global",
-                "zoom": "wheel![event.shiftKey]",
-                "type": "interval",
-                "translate": "[mousedown[!event.shiftKey], window:mouseup] > window:mousemove!"
-            }
-        },
         "encoding": {
             "color": {
-                "value": "grey",
                 "condition": {
                     "field": "Origin",
                     "selection": "myBrush",
                     "type": "nominal"
-                }
+                },
+                "value": "grey"
             },
             "x": {
                 "field": {
@@ -53,8 +38,23 @@
                 },
                 "type": "quantitative"
             }
+        },
+        "mark": "point",
+        "selection": {
+            "grid": {
+                "bind": "scales",
+                "resolve": "global",
+                "translate": "[mousedown[!event.shiftKey], window:mouseup] > window:mousemove!",
+                "type": "interval",
+                "zoom": "wheel![event.shiftKey]"
+            },
+            "myBrush": {
+                "on": "[mousedown[event.shiftKey], window:mouseup] > window:mousemove!",
+                "resolve": "union",
+                "translate": "[mousedown[event.shiftKey], window:mouseup] > window:mousemove!",
+                "type": "interval",
+                "zoom": "wheel![event.shiftKey]"
+            }
         }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "Scatterplot matrix"
+    }
 }
diff --git a/tests/specs/gallery/multi/multi4.vl b/tests/specs/gallery/multi/multi4.vl
--- a/tests/specs/gallery/multi/multi4.vl
+++ b/tests/specs/gallery/multi/multi4.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "range": {
             "heatmap": {
@@ -9,6 +10,7 @@
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
+    "description": "A dashboard with cross-highlighting",
     "resolve": {
         "legend": {
             "color": "independent",
@@ -17,65 +19,84 @@
     },
     "vconcat": [
         {
+            "encoding": {
+                "x": {
+                    "bin": {
+                        "maxbins": 10
+                    },
+                    "field": "IMDB_Rating",
+                    "type": "quantitative"
+                },
+                "y": {
+                    "bin": {
+                        "maxbins": 10
+                    },
+                    "field": "Rotten_Tomatoes_Rating",
+                    "type": "quantitative"
+                }
+            },
             "layer": [
                 {
-                    "mark": "rect",
                     "encoding": {
                         "color": {
                             "aggregate": "count",
-                            "type": "quantitative",
                             "legend": {
                                 "direction": "horizontal",
                                 "gradientLength": 120,
                                 "title": "All Movies"
-                            }
+                            },
+                            "type": "quantitative"
                         }
-                    }
+                    },
+                    "mark": "rect"
                 },
                 {
-                    "transform": [
-                        {
-                            "filter": {
-                                "selection": "myPts"
-                            }
-                        }
-                    ],
-                    "mark": "point",
                     "encoding": {
                         "color": {
                             "value": "#666"
                         },
                         "size": {
                             "aggregate": "count",
-                            "type": "quantitative",
                             "legend": {
                                 "title": "In Selected Category"
+                            },
+                            "type": "quantitative"
+                        }
+                    },
+                    "mark": "point",
+                    "transform": [
+                        {
+                            "filter": {
+                                "selection": "myPts"
                             }
                         }
-                    }
+                    ]
                 }
-            ],
+            ]
+        },
+        {
             "encoding": {
+                "color": {
+                    "condition": {
+                        "selection": "myPts",
+                        "value": "steelblue"
+                    },
+                    "value": "grey"
+                },
                 "x": {
-                    "field": "IMDB_Rating",
-                    "bin": {
-                        "maxbins": 10
+                    "axis": {
+                        "labelAngle": -40
                     },
-                    "type": "quantitative"
+                    "field": "Major_Genre",
+                    "type": "nominal"
                 },
                 "y": {
-                    "field": "Rotten_Tomatoes_Rating",
-                    "bin": {
-                        "maxbins": 10
-                    },
+                    "aggregate": "count",
                     "type": "quantitative"
                 }
-            }
-        },
-        {
+            },
             "height": 120,
             "mark": "bar",
-            "width": 330,
             "selection": {
                 "myPts": {
                     "encodings": [
@@ -84,28 +105,7 @@
                     "type": "single"
                 }
             },
-            "encoding": {
-                "color": {
-                    "value": "grey",
-                    "condition": {
-                        "value": "steelblue",
-                        "selection": "myPts"
-                    }
-                },
-                "x": {
-                    "field": "Major_Genre",
-                    "type": "nominal",
-                    "axis": {
-                        "labelAngle": -40
-                    }
-                },
-                "y": {
-                    "aggregate": "count",
-                    "type": "quantitative"
-                }
-            }
+            "width": 330
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "A dashboard with cross-highlighting"
+    ]
 }
diff --git a/tests/specs/gallery/multi/multi5.vl b/tests/specs/gallery/multi/multi5.vl
--- a/tests/specs/gallery/multi/multi5.vl
+++ b/tests/specs/gallery/multi/multi5.vl
@@ -1,30 +1,14 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
     },
+    "description": "A dashboard with cross-highlighting",
+    "title": "Seattle Weather, 2012-2015",
     "vconcat": [
         {
-            "transform": [
-                {
-                    "filter": {
-                        "selection": "myClick"
-                    }
-                }
-            ],
-            "height": 300,
-            "mark": "point",
-            "width": 600,
-            "selection": {
-                "myBrush": {
-                    "encodings": [
-                        "x"
-                    ],
-                    "type": "interval"
-                }
-            },
             "encoding": {
                 "color": {
-                    "value": "#cfdebe",
                     "condition": {
                         "field": "weather",
                         "scale": {
@@ -46,7 +30,8 @@
                         "selection": "myBrush",
                         "title": "Weather",
                         "type": "nominal"
-                    }
+                    },
+                    "value": "#cfdebe"
                 },
                 "size": {
                     "field": "precipitation",
@@ -59,15 +44,18 @@
                     "type": "quantitative"
                 },
                 "x": {
-                    "field": "date",
-                    "timeUnit": "monthdate",
-                    "type": "temporal",
                     "axis": {
                         "format": "%b",
                         "title": "Date"
-                    }
+                    },
+                    "field": "date",
+                    "timeUnit": "monthdate",
+                    "type": "temporal"
                 },
                 "y": {
+                    "axis": {
+                        "title": "Maximum Daily Temperature (C)"
+                    },
                     "field": "temp_max",
                     "scale": {
                         "domain": [
@@ -75,34 +63,31 @@
                             40
                         ]
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "title": "Maximum Daily Temperature (C)"
-                    }
+                    "type": "quantitative"
                 }
-            }
-        },
-        {
+            },
+            "height": 300,
+            "mark": "point",
+            "selection": {
+                "myBrush": {
+                    "encodings": [
+                        "x"
+                    ],
+                    "type": "interval"
+                }
+            },
             "transform": [
                 {
                     "filter": {
-                        "selection": "myBrush"
+                        "selection": "myClick"
                     }
                 }
             ],
-            "mark": "bar",
-            "width": 600,
-            "selection": {
-                "myClick": {
-                    "encodings": [
-                        "color"
-                    ],
-                    "type": "multi"
-                }
-            },
+            "width": 600
+        },
+        {
             "encoding": {
                 "color": {
-                    "value": "#acbf98",
                     "condition": {
                         "field": "weather",
                         "scale": {
@@ -123,7 +108,8 @@
                         },
                         "selection": "myClick",
                         "type": "nominal"
-                    }
+                    },
+                    "value": "#acbf98"
                 },
                 "x": {
                     "aggregate": "count",
@@ -133,10 +119,24 @@
                     "field": "weather",
                     "type": "nominal"
                 }
-            }
+            },
+            "mark": "bar",
+            "selection": {
+                "myClick": {
+                    "encodings": [
+                        "color"
+                    ],
+                    "type": "multi"
+                }
+            },
+            "transform": [
+                {
+                    "filter": {
+                        "selection": "myBrush"
+                    }
+                }
+            ],
+            "width": 600
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Seattle Weather, 2012-2015",
-    "description": "A dashboard with cross-highlighting"
+    ]
 }
diff --git a/tests/specs/gallery/multi/multi6.vl b/tests/specs/gallery/multi/multi6.vl
--- a/tests/specs/gallery/multi/multi6.vl
+++ b/tests/specs/gallery/multi/multi6.vl
@@ -1,30 +1,24 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "row_number",
-                    "as": "rowNumber"
-                }
-            ]
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "config": {
+        "view": {
+            "stroke": null
         }
-    ],
+    },
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/cars.json"
+    },
+    "description": "Drag a rectangular brush to show (first 20) selected points in a table.",
     "hconcat": [
         {
-            "mark": "point",
-            "selection": {
-                "brush": {
-                    "type": "interval"
-                }
-            },
             "encoding": {
                 "color": {
-                    "value": "grey",
                     "condition": {
                         "field": "Cylinders",
                         "selection": "brush",
                         "type": "ordinal"
-                    }
+                    },
+                    "value": "grey"
                 },
                 "x": {
                     "field": "Horsepower",
@@ -34,9 +28,28 @@
                     "field": "Miles_per_Gallon",
                     "type": "quantitative"
                 }
+            },
+            "mark": "point",
+            "selection": {
+                "brush": {
+                    "type": "interval"
+                }
             }
         },
         {
+            "encoding": {
+                "text": {
+                    "field": "Horsepower",
+                    "type": "nominal"
+                },
+                "y": {
+                    "axis": null,
+                    "field": "rowNumber",
+                    "type": "ordinal"
+                }
+            },
+            "mark": "text",
+            "title": "Engine power",
             "transform": [
                 {
                     "filter": {
@@ -46,8 +59,8 @@
                 {
                     "window": [
                         {
-                            "op": "rank",
-                            "as": "rank"
+                            "as": "rank",
+                            "op": "rank"
                         }
                     ]
                 },
@@ -57,22 +70,22 @@
                         "lt": 20
                     }
                 }
-            ],
-            "mark": "text",
-            "title": "Engine power",
+            ]
+        },
+        {
             "encoding": {
                 "text": {
-                    "field": "Horsepower",
+                    "field": "Miles_per_Gallon",
                     "type": "nominal"
                 },
                 "y": {
+                    "axis": null,
                     "field": "rowNumber",
-                    "type": "ordinal",
-                    "axis": null
+                    "type": "ordinal"
                 }
-            }
-        },
-        {
+            },
+            "mark": "text",
+            "title": "Efficiency (mpg)",
             "transform": [
                 {
                     "filter": {
@@ -82,8 +95,8 @@
                 {
                     "window": [
                         {
-                            "op": "rank",
-                            "as": "rank"
+                            "as": "rank",
+                            "op": "rank"
                         }
                     ]
                 },
@@ -93,22 +106,22 @@
                         "lt": 20
                     }
                 }
-            ],
-            "mark": "text",
-            "title": "Efficiency (mpg)",
+            ]
+        },
+        {
             "encoding": {
                 "text": {
-                    "field": "Miles_per_Gallon",
+                    "field": "Origin",
                     "type": "nominal"
                 },
                 "y": {
+                    "axis": null,
                     "field": "rowNumber",
-                    "type": "ordinal",
-                    "axis": null
+                    "type": "ordinal"
                 }
-            }
-        },
-        {
+            },
+            "mark": "text",
+            "title": "Country of origin",
             "transform": [
                 {
                     "filter": {
@@ -118,8 +131,8 @@
                 {
                     "window": [
                         {
-                            "op": "rank",
-                            "as": "rank"
+                            "as": "rank",
+                            "op": "rank"
                         }
                     ]
                 },
@@ -129,35 +142,22 @@
                         "lt": 20
                     }
                 }
-            ],
-            "mark": "text",
-            "title": "Country of origin",
-            "encoding": {
-                "text": {
-                    "field": "Origin",
-                    "type": "nominal"
-                },
-                "y": {
-                    "field": "rowNumber",
-                    "type": "ordinal",
-                    "axis": null
-                }
-            }
+            ]
         }
     ],
-    "config": {
-        "view": {
-            "stroke": null
-        }
-    },
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/cars.json"
-    },
     "resolve": {
         "legend": {
             "color": "independent"
         }
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "Drag a rectangular brush to show (first 20) selected points in a table."
+    "transform": [
+        {
+            "window": [
+                {
+                    "as": "rowNumber",
+                    "op": "row_number"
+                }
+            ]
+        }
+    ]
 }
diff --git a/tests/specs/gallery/multi/multi7.vl b/tests/specs/gallery/multi/multi7.vl
--- a/tests/specs/gallery/multi/multi7.vl
+++ b/tests/specs/gallery/multi/multi7.vl
@@ -1,31 +1,52 @@
 {
-    "height": 500,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "width": 900,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
-    },
+    "description": "One dot per airport in the US overlayed on geoshape",
+    "height": 500,
     "layer": [
         {
-            "mark": {
-                "stroke": "#fff",
-                "fill": "#ddd",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/us-10m.json",
                 "format": {
                     "feature": "states",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/us-10m.json"
+            },
+            "mark": {
+                "fill": "#ddd",
+                "stroke": "#fff",
+                "type": "geoshape"
             }
         },
         {
+            "data": {
+                "url": "https://vega.github.io/vega-lite/data/flights-airport.csv"
+            },
+            "encoding": {
+                "latitude": {
+                    "field": "o.latitude",
+                    "type": "quantitative"
+                },
+                "latitude2": {
+                    "field": "d.latitude"
+                },
+                "longitude": {
+                    "field": "o.longitude",
+                    "type": "quantitative"
+                },
+                "longitude2": {
+                    "field": "d.longitude"
+                }
+            },
+            "mark": {
+                "color": "black",
+                "opacity": 0.35,
+                "type": "rule"
+            },
             "transform": [
                 {
                     "filter": {
@@ -52,43 +73,64 @@
                     },
                     "lookup": "destination"
                 }
-            ],
-            "mark": {
-                "color": "black",
-                "opacity": 0.35,
-                "type": "rule"
-            },
+            ]
+        },
+        {
             "data": {
                 "url": "https://vega.github.io/vega-lite/data/flights-airport.csv"
             },
             "encoding": {
                 "latitude": {
-                    "field": "o.latitude",
+                    "field": "latitude",
                     "type": "quantitative"
                 },
-                "latitude2": {
-                    "field": "d.latitude"
-                },
                 "longitude": {
-                    "field": "o.longitude",
+                    "field": "longitude",
                     "type": "quantitative"
                 },
-                "longitude2": {
-                    "field": "d.longitude"
+                "order": {
+                    "field": "routes",
+                    "sort": "descending",
+                    "type": "quantitative"
+                },
+                "size": {
+                    "field": "routes",
+                    "legend": null,
+                    "scale": {
+                        "range": [
+                            0,
+                            1000
+                        ]
+                    },
+                    "type": "quantitative"
+                },
+                "tooltip": {
+                    "field": "name",
+                    "type": "nominal"
                 }
-            }
-        },
-        {
-            "transform": [
-                {
-                    "groupby": [
+            },
+            "mark": "circle",
+            "selection": {
+                "mySelection": {
+                    "empty": "none",
+                    "fields": [
                         "origin"
                     ],
+                    "nearest": true,
+                    "on": "mouseover",
+                    "type": "single"
+                }
+            },
+            "transform": [
+                {
                     "aggregate": [
                         {
-                            "op": "count",
-                            "as": "routes"
+                            "as": "routes",
+                            "op": "count"
                         }
+                    ],
+                    "groupby": [
+                        "origin"
                     ]
                 },
                 {
@@ -96,66 +138,24 @@
                         "data": {
                             "url": "https://vega.github.io/vega-lite/data/airports.csv"
                         },
-                        "key": "iata",
                         "fields": [
                             "name",
                             "state",
                             "latitude",
                             "longitude"
-                        ]
+                        ],
+                        "key": "iata"
                     },
                     "lookup": "origin"
                 },
                 {
                     "filter": "datum.state !== 'PR' && datum.state !== 'VI'"
                 }
-            ],
-            "mark": "circle",
-            "data": {
-                "url": "https://vega.github.io/vega-lite/data/flights-airport.csv"
-            },
-            "selection": {
-                "mySelection": {
-                    "nearest": true,
-                    "empty": "none",
-                    "type": "single",
-                    "on": "mouseover",
-                    "fields": [
-                        "origin"
-                    ]
-                }
-            },
-            "encoding": {
-                "size": {
-                    "field": "routes",
-                    "scale": {
-                        "range": [
-                            0,
-                            1000
-                        ]
-                    },
-                    "type": "quantitative",
-                    "legend": null
-                },
-                "latitude": {
-                    "field": "latitude",
-                    "type": "quantitative"
-                },
-                "tooltip": {
-                    "field": "name",
-                    "type": "nominal"
-                },
-                "longitude": {
-                    "field": "longitude",
-                    "type": "quantitative"
-                },
-                "order": {
-                    "field": "routes",
-                    "sort": "descending",
-                    "type": "quantitative"
-                }
-            }
+            ]
         }
     ],
-    "description": "One dot per airport in the US overlayed on geoshape"
+    "projection": {
+        "type": "albersUsa"
+    },
+    "width": 900
 }
diff --git a/tests/specs/gallery/multi/multi8.vl b/tests/specs/gallery/multi/multi8.vl
--- a/tests/specs/gallery/multi/multi8.vl
+++ b/tests/specs/gallery/multi/multi8.vl
@@ -1,72 +1,72 @@
 {
-    "transform": [
-        {
-            "as": "time",
-            "calculate": "hours(datum.date) + minutes(datum.date) / 60"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/flights-5k.json",
         "format": {
             "parse": {
                 "date": "date"
             }
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/flights-5k.json"
     },
+    "transform": [
+        {
+            "as": "time",
+            "calculate": "hours(datum.date) + minutes(datum.date) / 60"
+        }
+    ],
     "vconcat": [
         {
+            "encoding": {
+                "x": {
+                    "bin": {
+                        "maxbins": 30
+                    },
+                    "field": "time",
+                    "type": "quantitative"
+                },
+                "y": {
+                    "aggregate": "count",
+                    "type": "quantitative"
+                }
+            },
             "height": 100,
             "mark": "bar",
-            "width": 963,
             "selection": {
                 "brush": {
+                    "encodings": [
+                        "x"
+                    ],
                     "init": {
                         "x": [
                             6,
                             12
                         ]
                     },
-                    "encodings": [
-                        "x"
-                    ],
                     "type": "interval"
                 }
             },
-            "encoding": {
-                "x": {
-                    "field": "time",
-                    "bin": {
-                        "maxbins": 30
-                    },
-                    "type": "quantitative"
-                },
-                "y": {
-                    "aggregate": "count",
-                    "type": "quantitative"
-                }
-            }
+            "width": 963
         },
         {
-            "height": 100,
-            "mark": "bar",
-            "width": 963,
             "encoding": {
                 "x": {
-                    "field": "time",
                     "bin": {
-                        "maxbins": 30,
                         "extent": {
                             "selection": "brush"
-                        }
+                        },
+                        "maxbins": 30
                     },
+                    "field": "time",
                     "type": "quantitative"
                 },
                 "y": {
                     "aggregate": "count",
                     "type": "quantitative"
                 }
-            }
+            },
+            "height": 100,
+            "mark": "bar",
+            "width": 963
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    ]
 }
diff --git a/tests/specs/gallery/multi/selectandzoom.vl b/tests/specs/gallery/multi/selectandzoom.vl
--- a/tests/specs/gallery/multi/selectandzoom.vl
+++ b/tests/specs/gallery/multi/selectandzoom.vl
@@ -1,10 +1,5 @@
 {
-    "transform": [
-        {
-            "as": "y",
-            "calculate": "cos(datum.theta)"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "sequence": {
             "as": "theta",
@@ -13,11 +8,33 @@
             "stop": 6.28
         }
     },
+    "transform": [
+        {
+            "as": "y",
+            "calculate": "cos(datum.theta)"
+        }
+    ],
     "vconcat": [
         {
+            "encoding": {
+                "x": {
+                    "axis": null,
+                    "field": "theta",
+                    "type": "quantitative"
+                },
+                "y": {
+                    "axis": null,
+                    "field": "y",
+                    "type": "quantitative"
+                }
+            },
             "mark": "line",
             "selection": {
                 "brush": {
+                    "encodings": [
+                        "x",
+                        "y"
+                    ],
                     "init": {
                         "x": [
                             0.2,
@@ -28,28 +45,11 @@
                             0.8
                         ]
                     },
-                    "encodings": [
-                        "x",
-                        "y"
-                    ],
                     "type": "interval"
                 }
-            },
-            "encoding": {
-                "x": {
-                    "field": "theta",
-                    "type": "quantitative",
-                    "axis": null
-                },
-                "y": {
-                    "field": "y",
-                    "type": "quantitative",
-                    "axis": null
-                }
             }
         },
         {
-            "mark": "circle",
             "encoding": {
                 "x": {
                     "field": "theta",
@@ -65,14 +65,14 @@
                     "field": "y",
                     "scale": {
                         "domain": {
-                            "selection": "brush",
-                            "encoding": "y"
+                            "encoding": "y",
+                            "selection": "brush"
                         }
                     },
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "circle"
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    ]
 }
diff --git a/tests/specs/gallery/repeat/nested_concat_align.vl b/tests/specs/gallery/repeat/nested_concat_align.vl
--- a/tests/specs/gallery/repeat/nested_concat_align.vl
+++ b/tests/specs/gallery/repeat/nested_concat_align.vl
@@ -1,16 +1,18 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
-        "countTitle": "Count",
+        "axisX": {
+            "titleLimit": 150
+        },
         "axisY": {
             "minExtent": 40
         },
-        "axisX": {
-            "titleLimit": 150
-        }
+        "countTitle": "Count"
     },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
+    "description": "Nested concatenation aligned by setting axis minExtent",
     "vconcat": [
         {
             "repeat": {
@@ -20,24 +22,24 @@
                 ]
             },
             "spec": {
-                "height": 50,
-                "mark": "bar",
-                "width": 150,
                 "encoding": {
                     "x": {
-                        "field": {
-                            "repeat": "column"
-                        },
                         "bin": {
                             "maxbins": 20
                         },
+                        "field": {
+                            "repeat": "column"
+                        },
                         "type": "quantitative"
                     },
                     "y": {
                         "aggregate": "count",
                         "type": "quantitative"
                     }
-                }
+                },
+                "height": 50,
+                "mark": "bar",
+                "width": 150
             },
             "title": "Ratings"
         },
@@ -49,28 +51,26 @@
                 ]
             },
             "spec": {
-                "height": 50,
-                "mark": "bar",
-                "width": 150,
                 "encoding": {
                     "x": {
-                        "field": {
-                            "repeat": "column"
-                        },
                         "bin": {
                             "maxbins": 20
                         },
+                        "field": {
+                            "repeat": "column"
+                        },
                         "type": "quantitative"
                     },
                     "y": {
                         "aggregate": "count",
                         "type": "quantitative"
                     }
-                }
+                },
+                "height": 50,
+                "mark": "bar",
+                "width": 150
             },
             "title": "Gross"
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "Nested concatenation aligned by setting axis minExtent"
+    ]
 }
diff --git a/tests/specs/gallery/repeat/repeat1.vl b/tests/specs/gallery/repeat/repeat1.vl
--- a/tests/specs/gallery/repeat/repeat1.vl
+++ b/tests/specs/gallery/repeat/repeat1.vl
@@ -1,7 +1,9 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/weather.csv"
     },
+    "description": "Monthly weather information for individual years and overall average for Seatle and New York",
     "repeat": {
         "column": [
             "temp_max",
@@ -12,12 +14,16 @@
     "spec": {
         "layer": [
             {
-                "mark": "line",
                 "encoding": {
                     "color": {
                         "field": "location",
                         "type": "nominal"
                     },
+                    "detail": {
+                        "field": "date",
+                        "timeUnit": "year",
+                        "type": "temporal"
+                    },
                     "opacity": {
                         "value": 0.2
                     },
@@ -26,22 +32,17 @@
                         "timeUnit": "month",
                         "type": "ordinal"
                     },
-                    "detail": {
-                        "field": "date",
-                        "timeUnit": "year",
-                        "type": "temporal"
-                    },
                     "y": {
+                        "aggregate": "mean",
                         "field": {
                             "repeat": "column"
                         },
-                        "aggregate": "mean",
                         "type": "quantitative"
                     }
-                }
+                },
+                "mark": "line"
             },
             {
-                "mark": "line",
                 "encoding": {
                     "color": {
                         "field": "location",
@@ -53,16 +54,15 @@
                         "type": "ordinal"
                     },
                     "y": {
+                        "aggregate": "mean",
                         "field": {
                             "repeat": "column"
                         },
-                        "aggregate": "mean",
                         "type": "quantitative"
                     }
-                }
+                },
+                "mark": "line"
             }
         ]
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "Monthly weather information for individual years and overall average for Seatle and New York"
+    }
 }
diff --git a/tests/specs/gallery/repeat/repeat2.vl b/tests/specs/gallery/repeat/repeat2.vl
--- a/tests/specs/gallery/repeat/repeat2.vl
+++ b/tests/specs/gallery/repeat/repeat2.vl
@@ -1,15 +1,16 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/weather.csv"
+    },
+    "description": "Two vertically concatenated charts that show a histogram of precipitation in Seattle and the relationship between min and max temperature",
     "transform": [
         {
             "filter": "datum.location === 'Seattle'"
         }
     ],
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/weather.csv"
-    },
     "vconcat": [
         {
-            "mark": "bar",
             "encoding": {
                 "x": {
                     "field": "date",
@@ -17,32 +18,31 @@
                     "type": "ordinal"
                 },
                 "y": {
-                    "field": "precipitation",
                     "aggregate": "mean",
+                    "field": "precipitation",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "bar"
         },
         {
-            "mark": "point",
             "encoding": {
                 "size": {
                     "aggregate": "count",
                     "type": "quantitative"
                 },
                 "x": {
-                    "field": "temp_min",
                     "bin": true,
+                    "field": "temp_min",
                     "type": "quantitative"
                 },
                 "y": {
-                    "field": "temp_max",
                     "bin": true,
+                    "field": "temp_max",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "point"
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "Two vertically concatenated charts that show a histogram of precipitation in Seattle and the relationship between min and max temperature"
+    ]
 }
diff --git a/tests/specs/gallery/repeat/repeat3.vl b/tests/specs/gallery/repeat/repeat3.vl
--- a/tests/specs/gallery/repeat/repeat3.vl
+++ b/tests/specs/gallery/repeat/repeat3.vl
@@ -1,4 +1,6 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Horizontally repeated charts that show the histograms of different parameters of cars in different countries",
     "repeat": {
         "column": [
             "Horsepower",
@@ -7,7 +9,6 @@
         ]
     },
     "spec": {
-        "mark": "bar",
         "data": {
             "url": "https://vega.github.io/vega-lite/data/cars.json"
         },
@@ -17,18 +18,17 @@
                 "type": "nominal"
             },
             "x": {
+                "bin": true,
                 "field": {
                     "repeat": "column"
                 },
-                "bin": true,
                 "type": "quantitative"
             },
             "y": {
                 "aggregate": "count",
                 "type": "quantitative"
             }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "Horizontally repeated charts that show the histograms of different parameters of cars in different countries"
+        },
+        "mark": "bar"
+    }
 }
diff --git a/tests/specs/gallery/repeat/repeat4.vl b/tests/specs/gallery/repeat/repeat4.vl
--- a/tests/specs/gallery/repeat/repeat4.vl
+++ b/tests/specs/gallery/repeat/repeat4.vl
@@ -1,45 +1,30 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Scatterplot matrix",
     "repeat": {
-        "row": [
-            "Horsepower",
-            "Acceleration",
-            "Miles_per_Gallon"
-        ],
         "column": [
             "Miles_per_Gallon",
             "Acceleration",
             "Horsepower"
+        ],
+        "row": [
+            "Horsepower",
+            "Acceleration",
+            "Miles_per_Gallon"
         ]
     },
     "spec": {
-        "mark": "point",
         "data": {
             "url": "https://vega.github.io/vega-lite/data/cars.json"
         },
-        "selection": {
-            "myBrush": {
-                "resolve": "union",
-                "zoom": "wheel![event.shiftKey]",
-                "type": "interval",
-                "translate": "[mousedown[event.shiftKey], window:mouseup] > window:mousemove!",
-                "on": "[mousedown[event.shiftKey], window:mouseup] > window:mousemove!"
-            },
-            "grid": {
-                "bind": "scales",
-                "resolve": "global",
-                "zoom": "wheel![event.shiftKey]",
-                "type": "interval",
-                "translate": "[mousedown[!event.shiftKey], window:mouseup] > window:mousemove!"
-            }
-        },
         "encoding": {
             "color": {
-                "value": "grey",
                 "condition": {
                     "field": "Origin",
                     "selection": "myBrush",
                     "type": "nominal"
-                }
+                },
+                "value": "grey"
             },
             "x": {
                 "field": {
@@ -53,8 +38,23 @@
                 },
                 "type": "quantitative"
             }
+        },
+        "mark": "point",
+        "selection": {
+            "grid": {
+                "bind": "scales",
+                "resolve": "global",
+                "translate": "[mousedown[!event.shiftKey], window:mouseup] > window:mousemove!",
+                "type": "interval",
+                "zoom": "wheel![event.shiftKey]"
+            },
+            "myBrush": {
+                "on": "[mousedown[event.shiftKey], window:mouseup] > window:mousemove!",
+                "resolve": "union",
+                "translate": "[mousedown[event.shiftKey], window:mouseup] > window:mousemove!",
+                "type": "interval",
+                "zoom": "wheel![event.shiftKey]"
+            }
         }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "Scatterplot matrix"
+    }
 }
diff --git a/tests/specs/gallery/repeat/repeat5.vl b/tests/specs/gallery/repeat/repeat5.vl
--- a/tests/specs/gallery/repeat/repeat5.vl
+++ b/tests/specs/gallery/repeat/repeat5.vl
@@ -1,4 +1,6 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "bounds": "flush",
     "config": {
         "range": {
             "heatmap": {
@@ -12,85 +14,83 @@
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
+    "description": "Marginal histograms show the counts along the x and y dimension",
+    "spacing": 15,
     "vconcat": [
         {
-            "height": 60,
-            "mark": "bar",
             "encoding": {
                 "x": {
-                    "field": "IMDB_Rating",
+                    "axis": null,
                     "bin": true,
-                    "type": "quantitative",
-                    "axis": null
+                    "field": "IMDB_Rating",
+                    "type": "quantitative"
                 },
                 "y": {
+                    "aggregate": "count",
+                    "axis": {
+                        "title": null
+                    },
                     "scale": {
                         "domain": [
                             0,
                             1000
                         ]
                     },
-                    "aggregate": "count",
-                    "type": "quantitative",
-                    "axis": {
-                        "title": null
-                    }
+                    "type": "quantitative"
                 }
-            }
+            },
+            "height": 60,
+            "mark": "bar"
         },
         {
+            "bounds": "flush",
             "hconcat": [
                 {
-                    "mark": "rect",
                     "encoding": {
                         "color": {
                             "aggregate": "count",
                             "type": "quantitative"
                         },
                         "x": {
-                            "field": "IMDB_Rating",
                             "bin": true,
+                            "field": "IMDB_Rating",
                             "type": "quantitative"
                         },
                         "y": {
-                            "field": "Rotten_Tomatoes_Rating",
                             "bin": true,
+                            "field": "Rotten_Tomatoes_Rating",
                             "type": "quantitative"
                         }
-                    }
+                    },
+                    "mark": "rect"
                 },
                 {
-                    "mark": "bar",
-                    "width": 60,
                     "encoding": {
                         "x": {
+                            "aggregate": "count",
+                            "axis": {
+                                "title": null
+                            },
                             "scale": {
                                 "domain": [
                                     0,
                                     1000
                                 ]
                             },
-                            "aggregate": "count",
-                            "type": "quantitative",
-                            "axis": {
-                                "title": null
-                            }
+                            "type": "quantitative"
                         },
                         "y": {
-                            "field": "Rotten_Tomatoes_Rating",
+                            "axis": null,
                             "bin": true,
-                            "type": "quantitative",
-                            "axis": null
+                            "field": "Rotten_Tomatoes_Rating",
+                            "type": "quantitative"
                         }
-                    }
+                    },
+                    "mark": "bar",
+                    "width": 60
                 }
             ],
-            "spacing": 15,
-            "bounds": "flush"
+            "spacing": 15
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "description": "Marginal histograms show the counts along the x and y dimension",
-    "spacing": 15,
-    "bounds": "flush"
+    ]
 }
diff --git a/tests/specs/gallery/scatter/scatter1.vl b/tests/specs/gallery/scatter/scatter1.vl
--- a/tests/specs/gallery/scatter/scatter1.vl
+++ b/tests/specs/gallery/scatter/scatter1.vl
@@ -1,14 +1,9 @@
 {
-    "mark": {
-        "tooltip": {
-            "content": "data"
-        },
-        "type": "point"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A scatterplot showing horsepower and miles per gallon for various cars (via point marks).",
     "encoding": {
         "x": {
             "field": "Horsepower",
@@ -19,5 +14,10 @@
             "type": "quantitative"
         }
     },
-    "description": "A scatterplot showing horsepower and miles per gallon for various cars (via point marks)."
+    "mark": {
+        "tooltip": {
+            "content": "data"
+        },
+        "type": "point"
+    }
 }
diff --git a/tests/specs/gallery/scatter/scatter10.vl b/tests/specs/gallery/scatter/scatter10.vl
--- a/tests/specs/gallery/scatter/scatter10.vl
+++ b/tests/specs/gallery/scatter/scatter10.vl
@@ -1,54 +1,54 @@
 {
-    "transform": [
-        {
-            "filter": "datum.Entity !== 'All natural disasters'"
-        }
-    ],
-    "height": 400,
-    "mark": {
-        "strokeWidth": 1,
-        "opacity": 0.8,
-        "stroke": "black",
-        "type": "circle"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/disasters.csv"
     },
-    "width": 600,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Visualization of global deaths from natural disasters. Copy of chart from https://ourworldindata.org/natural-catastrophes",
     "encoding": {
         "color": {
             "field": "Entity",
-            "type": "nominal",
-            "legend": null
+            "legend": null,
+            "type": "nominal"
         },
         "size": {
             "field": "Deaths",
+            "legend": {
+                "title": "Annual Global Deaths"
+            },
             "scale": {
                 "range": [
                     0,
                     5000
                 ]
             },
-            "type": "quantitative",
-            "legend": {
-                "title": "Annual Global Deaths"
-            }
+            "type": "quantitative"
         },
         "x": {
-            "field": "Year",
-            "type": "ordinal",
             "axis": {
                 "labelAngle": 0
-            }
+            },
+            "field": "Year",
+            "type": "ordinal"
         },
         "y": {
-            "field": "Entity",
-            "type": "nominal",
             "axis": {
                 "title": null
-            }
+            },
+            "field": "Entity",
+            "type": "nominal"
         }
     },
-    "description": "Visualization of global deaths from natural disasters. Copy of chart from https://ourworldindata.org/natural-catastrophes"
+    "height": 400,
+    "mark": {
+        "opacity": 0.8,
+        "stroke": "black",
+        "strokeWidth": 1,
+        "type": "circle"
+    },
+    "transform": [
+        {
+            "filter": "datum.Entity !== 'All natural disasters'"
+        }
+    ],
+    "width": 600
 }
diff --git a/tests/specs/gallery/scatter/scatter11.vl b/tests/specs/gallery/scatter/scatter11.vl
--- a/tests/specs/gallery/scatter/scatter11.vl
+++ b/tests/specs/gallery/scatter/scatter11.vl
@@ -1,15 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "OriginInitial",
-            "calculate": "datum.Origin[0]"
-        }
-    ],
-    "mark": "text",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A scatterplot showing horsepower and miles per gallon with country of origin double encoded by colour and text symbol.",
     "encoding": {
         "color": {
             "field": "Origin",
@@ -28,5 +22,11 @@
             "type": "quantitative"
         }
     },
-    "description": "A scatterplot showing horsepower and miles per gallon with country of origin double encoded by colour and text symbol."
+    "mark": "text",
+    "transform": [
+        {
+            "as": "OriginInitial",
+            "calculate": "datum.Origin[0]"
+        }
+    ]
 }
diff --git a/tests/specs/gallery/scatter/scatter2.vl b/tests/specs/gallery/scatter/scatter2.vl
--- a/tests/specs/gallery/scatter/scatter2.vl
+++ b/tests/specs/gallery/scatter/scatter2.vl
@@ -1,14 +1,14 @@
 {
-    "mark": "tick",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Shows the distribution of a single variable (precipitation) using tick marks.",
     "encoding": {
         "x": {
             "field": "precipitation",
             "type": "quantitative"
         }
     },
-    "description": "Shows the distribution of a single variable (precipitation) using tick marks."
+    "mark": "tick"
 }
diff --git a/tests/specs/gallery/scatter/scatter3.vl b/tests/specs/gallery/scatter/scatter3.vl
--- a/tests/specs/gallery/scatter/scatter3.vl
+++ b/tests/specs/gallery/scatter/scatter3.vl
@@ -1,9 +1,9 @@
 {
-    "mark": "tick",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Shows the relationship between horsepower and the number of cylinders using tick marks.",
     "encoding": {
         "x": {
             "field": "Horsepower",
@@ -14,5 +14,5 @@
             "type": "ordinal"
         }
     },
-    "description": "Shows the relationship between horsepower and the number of cylinders using tick marks."
+    "mark": "tick"
 }
diff --git a/tests/specs/gallery/scatter/scatter4.vl b/tests/specs/gallery/scatter/scatter4.vl
--- a/tests/specs/gallery/scatter/scatter4.vl
+++ b/tests/specs/gallery/scatter/scatter4.vl
@@ -1,9 +1,9 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A scatterplot showing horsepower and miles per gallon with country of origin double encoded by colour and shape.",
     "encoding": {
         "color": {
             "field": "Origin",
@@ -22,5 +22,5 @@
             "type": "quantitative"
         }
     },
-    "description": "A scatterplot showing horsepower and miles per gallon with country of origin double encoded by colour and shape."
+    "mark": "point"
 }
diff --git a/tests/specs/gallery/scatter/scatter5.vl b/tests/specs/gallery/scatter/scatter5.vl
--- a/tests/specs/gallery/scatter/scatter5.vl
+++ b/tests/specs/gallery/scatter/scatter5.vl
@@ -1,28 +1,28 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A binned scatterplot comparing IMDB and Rotten Tomatoes rating with marks sized by number of reviews.",
     "encoding": {
         "size": {
             "aggregate": "count",
             "type": "quantitative"
         },
         "x": {
-            "field": "IMDB_Rating",
             "bin": {
                 "maxbins": 10
             },
+            "field": "IMDB_Rating",
             "type": "quantitative"
         },
         "y": {
-            "field": "Rotten_Tomatoes_Rating",
             "bin": {
                 "maxbins": 10
             },
+            "field": "Rotten_Tomatoes_Rating",
             "type": "quantitative"
         }
     },
-    "description": "A binned scatterplot comparing IMDB and Rotten Tomatoes rating with marks sized by number of reviews."
+    "mark": "circle"
 }
diff --git a/tests/specs/gallery/scatter/scatter6.vl b/tests/specs/gallery/scatter/scatter6.vl
--- a/tests/specs/gallery/scatter/scatter6.vl
+++ b/tests/specs/gallery/scatter/scatter6.vl
@@ -1,9 +1,9 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A bubbleplot showing horsepower on x, miles per gallons on y, and acceleration on size.",
     "encoding": {
         "size": {
             "field": "Acceleration",
@@ -18,5 +18,5 @@
             "type": "quantitative"
         }
     },
-    "description": "A bubbleplot showing horsepower on x, miles per gallons on y, and acceleration on size."
+    "mark": "point"
 }
diff --git a/tests/specs/gallery/scatter/scatter7.vl b/tests/specs/gallery/scatter/scatter7.vl
--- a/tests/specs/gallery/scatter/scatter7.vl
+++ b/tests/specs/gallery/scatter/scatter7.vl
@@ -1,21 +1,21 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "mark": {
             "invalid": null
         }
     },
-    "mark": "point",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Scatterplot with Null values in grey",
     "encoding": {
         "color": {
-            "value": "rgb(76,120,168)",
             "condition": {
-                "value": "#ddd",
-                "test": "datum.IMDB_Rating === null || datum.Rotten_Tomatoes_Rating === null"
-            }
+                "test": "datum.IMDB_Rating === null || datum.Rotten_Tomatoes_Rating === null",
+                "value": "#ddd"
+            },
+            "value": "rgb(76,120,168)"
         },
         "x": {
             "field": "IMDB_Rating",
@@ -26,5 +26,5 @@
             "type": "quantitative"
         }
     },
-    "description": "Scatterplot with Null values in grey"
+    "mark": "point"
 }
diff --git a/tests/specs/gallery/scatter/scatter8.vl b/tests/specs/gallery/scatter/scatter8.vl
--- a/tests/specs/gallery/scatter/scatter8.vl
+++ b/tests/specs/gallery/scatter/scatter8.vl
@@ -1,9 +1,9 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "A scatterplot showing horsepower and miles per gallon for various cars (via circle marks).",
     "encoding": {
         "x": {
             "field": "Horsepower",
@@ -14,5 +14,5 @@
             "type": "quantitative"
         }
     },
-    "description": "A scatterplot showing horsepower and miles per gallon for various cars (via circle marks)."
+    "mark": "circle"
 }
diff --git a/tests/specs/gallery/scatter/scatter9.vl b/tests/specs/gallery/scatter/scatter9.vl
--- a/tests/specs/gallery/scatter/scatter9.vl
+++ b/tests/specs/gallery/scatter/scatter9.vl
@@ -1,17 +1,9 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/gapminder-health-income.csv"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "view": {
-            "bind": "scales",
-            "type": "interval"
-        }
-    },
+    "description": "A bubble plot showing the correlation between health and income for 187 countries in the world (modified from an example in Lisa Charlotte Rost's blog post 'One Chart, Twelve Charting Libraries' --http://lisacharlotterost.github.io/2016/05/17/one-chart-code/).",
     "encoding": {
         "color": {
             "value": "#000"
@@ -35,5 +27,13 @@
             "type": "quantitative"
         }
     },
-    "description": "A bubble plot showing the correlation between health and income for 187 countries in the world (modified from an example in Lisa Charlotte Rost's blog post 'One Chart, Twelve Charting Libraries' --http://lisacharlotterost.github.io/2016/05/17/one-chart-code/)."
+    "height": 300,
+    "mark": "circle",
+    "selection": {
+        "view": {
+            "bind": "scales",
+            "type": "interval"
+        }
+    },
+    "width": 500
 }
diff --git a/tests/specs/gallery/scatter/smoothing1.vl b/tests/specs/gallery/scatter/smoothing1.vl
--- a/tests/specs/gallery/scatter/smoothing1.vl
+++ b/tests/specs/gallery/scatter/smoothing1.vl
@@ -1,32 +1,46 @@
 {
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "How can we 'smooth' data?",
+    "encoding": {
+        "x": {
+            "field": "Rotten_Tomatoes_Rating",
+            "type": "quantitative"
+        },
+        "y": {
+            "field": "IMDB_Rating",
+            "type": "quantitative"
+        }
+    },
+    "height": 300,
     "layer": [
         {
             "mark": {
+                "filled": true,
                 "opacity": 0.3,
-                "type": "point",
-                "filled": true
+                "type": "point"
             }
         },
         {
+            "mark": {
+                "color": "firebrick",
+                "type": "line"
+            },
             "transform": [
                 {
                     "bandwidth": 0.1,
                     "loess": "IMDB_Rating",
                     "on": "Rotten_Tomatoes_Rating"
                 }
-            ],
-            "mark": {
-                "color": "firebrick",
-                "type": "line"
-            }
+            ]
         },
         {
+            "mark": {
+                "color": "orange",
+                "type": "line"
+            },
             "transform": [
                 {
                     "extent": [
@@ -34,26 +48,12 @@
                         90
                     ],
                     "method": "poly",
-                    "regression": "IMDB_Rating",
+                    "on": "Rotten_Tomatoes_Rating",
                     "order": 3,
-                    "on": "Rotten_Tomatoes_Rating"
+                    "regression": "IMDB_Rating"
                 }
-            ],
-            "mark": {
-                "color": "orange",
-                "type": "line"
-            }
+            ]
         }
     ],
-    "encoding": {
-        "x": {
-            "field": "Rotten_Tomatoes_Rating",
-            "type": "quantitative"
-        },
-        "y": {
-            "field": "IMDB_Rating",
-            "type": "quantitative"
-        }
-    },
-    "description": "How can we 'smooth' data?"
+    "width": 300
 }
diff --git a/tests/specs/gallery/scatter/smoothing2.vl b/tests/specs/gallery/scatter/smoothing2.vl
--- a/tests/specs/gallery/scatter/smoothing2.vl
+++ b/tests/specs/gallery/scatter/smoothing2.vl
@@ -1,17 +1,12 @@
 {
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "How can we 'smooth' and rename data?",
+    "height": 300,
     "layer": [
         {
-            "mark": {
-                "opacity": 0.3,
-                "type": "point",
-                "filled": true
-            },
             "encoding": {
                 "x": {
                     "field": "Rotten_Tomatoes_Rating",
@@ -21,23 +16,14 @@
                     "field": "IMDB_Rating",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "filled": true,
+                "opacity": 0.3,
+                "type": "point"
             }
         },
         {
-            "transform": [
-                {
-                    "as": [
-                        "Rotten_Tomatoes_Rating",
-                        "ly"
-                    ],
-                    "loess": "IMDB_Rating",
-                    "on": "Rotten_Tomatoes_Rating"
-                }
-            ],
-            "mark": {
-                "color": "firebrick",
-                "type": "line"
-            },
             "encoding": {
                 "x": {
                     "field": "Rotten_Tomatoes_Rating",
@@ -47,23 +33,23 @@
                     "field": "ly",
                     "type": "quantitative"
                 }
-            }
-        },
-        {
+            },
+            "mark": {
+                "color": "firebrick",
+                "type": "line"
+            },
             "transform": [
                 {
                     "as": [
                         "Rotten_Tomatoes_Rating",
-                        "ry"
+                        "ly"
                     ],
-                    "regression": "IMDB_Rating",
+                    "loess": "IMDB_Rating",
                     "on": "Rotten_Tomatoes_Rating"
                 }
-            ],
-            "mark": {
-                "color": "orange",
-                "type": "line"
-            },
+            ]
+        },
+        {
             "encoding": {
                 "x": {
                     "field": "Rotten_Tomatoes_Rating",
@@ -73,8 +59,22 @@
                     "field": "ry",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": {
+                "color": "orange",
+                "type": "line"
+            },
+            "transform": [
+                {
+                    "as": [
+                        "Rotten_Tomatoes_Rating",
+                        "ry"
+                    ],
+                    "on": "Rotten_Tomatoes_Rating",
+                    "regression": "IMDB_Rating"
+                }
+            ]
         }
     ],
-    "description": "How can we 'smooth' and rename data?"
+    "width": 300
 }
diff --git a/tests/specs/gallery/table/table1.vl b/tests/specs/gallery/table/table1.vl
--- a/tests/specs/gallery/table/table1.vl
+++ b/tests/specs/gallery/table/table1.vl
@@ -1,13 +1,13 @@
 {
-    "mark": "rect",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "'Table heatmap' showing engine size/power for three countries.",
     "encoding": {
         "color": {
-            "field": "Horsepower",
             "aggregate": "mean",
+            "field": "Horsepower",
             "type": "quantitative"
         },
         "x": {
@@ -19,5 +19,5 @@
             "type": "nominal"
         }
     },
-    "description": "'Table heatmap' showing engine size/power for three countries."
+    "mark": "rect"
 }
diff --git a/tests/specs/gallery/table/table2.vl b/tests/specs/gallery/table/table2.vl
--- a/tests/specs/gallery/table/table2.vl
+++ b/tests/specs/gallery/table/table2.vl
@@ -1,45 +1,45 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
-        "view": {
-            "strokeWidth": 0,
-            "step": 13
-        },
         "axis": {
             "domain": false
+        },
+        "view": {
+            "step": 13,
+            "strokeWidth": 0
         }
     },
-    "mark": "rect",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-temps.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Annual weather 'heatmap'",
     "encoding": {
         "color": {
-            "field": "temp",
             "aggregate": "max",
-            "type": "quantitative",
+            "field": "temp",
             "legend": {
                 "title": null
-            }
+            },
+            "type": "quantitative"
         },
         "x": {
-            "field": "date",
-            "timeUnit": "date",
-            "type": "ordinal",
             "axis": {
-                "labelAngle": 0,
                 "format": "%e",
+                "labelAngle": 0,
                 "title": "Day"
-            }
+            },
+            "field": "date",
+            "timeUnit": "date",
+            "type": "ordinal"
         },
         "y": {
-            "field": "date",
-            "timeUnit": "month",
-            "type": "ordinal",
             "axis": {
                 "title": "Month"
-            }
+            },
+            "field": "date",
+            "timeUnit": "month",
+            "type": "ordinal"
         }
     },
-    "description": "Annual weather 'heatmap'"
+    "mark": "rect"
 }
diff --git a/tests/specs/gallery/table/table3.vl b/tests/specs/gallery/table/table3.vl
--- a/tests/specs/gallery/table/table3.vl
+++ b/tests/specs/gallery/table/table3.vl
@@ -1,21 +1,5 @@
 {
-    "transform": [
-        {
-            "filter": {
-                "and": [
-                    {
-                        "field": "IMDB_Rating",
-                        "valid": true
-                    },
-                    {
-                        "field": "Rotten_Tomatoes_Rating",
-                        "valid": true
-                    }
-                ]
-            }
-        }
-    ],
-    "height": 200,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "range": {
             "heatmap": {
@@ -26,31 +10,47 @@
             "stroke": null
         }
     },
-    "mark": "rect",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "'Binned heatmap' comparing movie ratings.",
     "encoding": {
         "color": {
             "aggregate": "count",
             "type": "quantitative"
         },
         "x": {
-            "field": "IMDB_Rating",
             "bin": {
                 "maxbins": 60
             },
+            "field": "IMDB_Rating",
             "type": "quantitative"
         },
         "y": {
-            "field": "Rotten_Tomatoes_Rating",
             "bin": {
                 "maxbins": 40
             },
+            "field": "Rotten_Tomatoes_Rating",
             "type": "quantitative"
         }
     },
-    "description": "'Binned heatmap' comparing movie ratings."
+    "height": 200,
+    "mark": "rect",
+    "transform": [
+        {
+            "filter": {
+                "and": [
+                    {
+                        "field": "IMDB_Rating",
+                        "valid": true
+                    },
+                    {
+                        "field": "Rotten_Tomatoes_Rating",
+                        "valid": true
+                    }
+                ]
+            }
+        }
+    ],
+    "width": 300
 }
diff --git a/tests/specs/gallery/table/table4.vl b/tests/specs/gallery/table/table4.vl
--- a/tests/specs/gallery/table/table4.vl
+++ b/tests/specs/gallery/table/table4.vl
@@ -1,13 +1,13 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/github.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Table bubble plot in the style of a Github punched card.",
     "encoding": {
         "size": {
-            "field": "count",
             "aggregate": "sum",
+            "field": "count",
             "type": "quantitative"
         },
         "x": {
@@ -21,5 +21,5 @@
             "type": "ordinal"
         }
     },
-    "description": "Table bubble plot in the style of a Github punched card."
+    "mark": "circle"
 }
diff --git a/tests/specs/gallery/table/table5.vl b/tests/specs/gallery/table/table5.vl
--- a/tests/specs/gallery/table/table5.vl
+++ b/tests/specs/gallery/table/table5.vl
@@ -1,51 +1,51 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
-        "text": {
-            "baseline": "middle"
-        },
         "scale": {
             "bandPaddingInner": 0,
             "bandPaddingOuter": 0
+        },
+        "text": {
+            "baseline": "middle"
         }
     },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Layering text over 'heatmap'.",
+    "encoding": {
+        "x": {
+            "field": "Cylinders",
+            "type": "ordinal"
+        },
+        "y": {
+            "field": "Origin",
+            "type": "ordinal"
+        }
+    },
     "layer": [
         {
-            "mark": "rect",
             "encoding": {
                 "color": {
-                    "field": "*",
                     "aggregate": "count",
+                    "field": "*",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "rect"
         },
         {
-            "mark": "text",
             "encoding": {
                 "color": {
                     "value": "white"
                 },
                 "text": {
-                    "field": "*",
                     "aggregate": "count",
+                    "field": "*",
                     "type": "quantitative"
                 }
-            }
-        }
-    ],
-    "encoding": {
-        "x": {
-            "field": "Cylinders",
-            "type": "ordinal"
-        },
-        "y": {
-            "field": "Origin",
-            "type": "ordinal"
+            },
+            "mark": "text"
         }
-    },
-    "description": "Layering text over 'heatmap'."
+    ]
 }
diff --git a/tests/specs/geo/choropleth1.vl b/tests/specs/geo/choropleth1.vl
--- a/tests/specs/geo/choropleth1.vl
+++ b/tests/specs/geo/choropleth1.vl
@@ -1,27 +1,27 @@
 {
-    "height": 500,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "mark": {
-        "strokeOpacity": 0,
-        "type": "geoshape"
-    },
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/londonBoroughs.json",
         "format": {
             "feature": "boroughs",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/londonBoroughs.json"
     },
-    "width": 900,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "id",
             "type": "nominal"
         }
-    }
+    },
+    "height": 500,
+    "mark": {
+        "strokeOpacity": 0,
+        "type": "geoshape"
+    },
+    "width": 900
 }
diff --git a/tests/specs/geo/choropleth2.vl b/tests/specs/geo/choropleth2.vl
--- a/tests/specs/geo/choropleth2.vl
+++ b/tests/specs/geo/choropleth2.vl
@@ -1,29 +1,24 @@
 {
-    "height": 700,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "width": 1200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 700,
     "layer": [
         {
-            "mark": {
-                "strokeWidth": 2,
-                "stroke": "rgb(251,247,238)",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/londonBoroughs.json",
                 "format": {
                     "feature": "boroughs",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/londonBoroughs.json"
             },
             "encoding": {
                 "color": {
                     "field": "id",
+                    "legend": null,
                     "scale": {
                         "domain": [
                             "Kingston upon Thames",
@@ -96,30 +91,23 @@
                             "#c7bfad"
                         ]
                     },
-                    "type": "nominal",
-                    "legend": null
+                    "type": "nominal"
                 },
                 "opacity": {
                     "value": 1
                 }
+            },
+            "mark": {
+                "stroke": "rgb(251,247,238)",
+                "strokeWidth": 2,
+                "type": "geoshape"
             }
         },
         {
-            "transform": [
-                {
-                    "as": "bLabel",
-                    "calculate": "indexof (datum.name,' ') > 0  ? substring(datum.name,0,indexof(datum.name, ' ')) : datum.name"
-                }
-            ],
-            "mark": "text",
             "data": {
                 "url": "https://vega.github.io/vega-lite/data/londonCentroids.json"
             },
             "encoding": {
-                "text": {
-                    "field": "bLabel",
-                    "type": "nominal"
-                },
                 "latitude": {
                     "field": "cy",
                     "type": "quantitative"
@@ -127,8 +115,20 @@
                 "longitude": {
                     "field": "cx",
                     "type": "quantitative"
+                },
+                "text": {
+                    "field": "bLabel",
+                    "type": "nominal"
                 }
-            }
+            },
+            "mark": "text",
+            "transform": [
+                {
+                    "as": "bLabel",
+                    "calculate": "indexof (datum.name,' ') > 0  ? substring(datum.name,0,indexof(datum.name, ' ')) : datum.name"
+                }
+            ]
         }
-    ]
+    ],
+    "width": 1200
 }
diff --git a/tests/specs/geo/defaultSize1.vl b/tests/specs/geo/defaultSize1.vl
--- a/tests/specs/geo/defaultSize1.vl
+++ b/tests/specs/geo/defaultSize1.vl
@@ -1,20 +1,20 @@
 {
-    "mark": "geoshape",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/us-10m.json",
         "format": {
             "feature": "counties",
             "type": "topojson"
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
+        },
+        "url": "https://vega.github.io/vega-lite/data/us-10m.json"
     },
+    "description": "Default map size",
     "encoding": {
         "color": {
             "value": "black"
         }
     },
-    "description": "Default map size"
+    "mark": "geoshape",
+    "projection": {
+        "type": "albersUsa"
+    }
 }
diff --git a/tests/specs/geo/defaultSize2.vl b/tests/specs/geo/defaultSize2.vl
--- a/tests/specs/geo/defaultSize2.vl
+++ b/tests/specs/geo/defaultSize2.vl
@@ -1,26 +1,26 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "continuousHeight": 300,
             "continuousWidth": 500
         }
     },
-    "mark": "geoshape",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/us-10m.json",
         "format": {
             "feature": "counties",
             "type": "topojson"
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
+        },
+        "url": "https://vega.github.io/vega-lite/data/us-10m.json"
     },
+    "description": "Default map size with view width and height specified in config.",
     "encoding": {
         "color": {
             "value": "black"
         }
     },
-    "description": "Default map size with view width and height specified in config."
+    "mark": "geoshape",
+    "projection": {
+        "type": "albersUsa"
+    }
 }
diff --git a/tests/specs/geo/dotMap1.vl b/tests/specs/geo/dotMap1.vl
--- a/tests/specs/geo/dotMap1.vl
+++ b/tests/specs/geo/dotMap1.vl
@@ -1,28 +1,14 @@
 {
-    "transform": [
-        {
-            "as": "digit",
-            "calculate": "substring(datum.zip_code, 0, 1)"
-        }
-    ],
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/zipcodes.csv"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
-    },
+    "description": "US zip codes: One dot per zipcode colored by first digit",
     "encoding": {
         "color": {
             "field": "digit",
             "type": "nominal"
         },
-        "size": {
-            "value": 1
-        },
         "latitude": {
             "field": "latitude",
             "type": "quantitative"
@@ -30,7 +16,21 @@
         "longitude": {
             "field": "longitude",
             "type": "quantitative"
+        },
+        "size": {
+            "value": 1
         }
     },
-    "description": "US zip codes: One dot per zipcode colored by first digit"
+    "height": 300,
+    "mark": "circle",
+    "projection": {
+        "type": "albersUsa"
+    },
+    "transform": [
+        {
+            "as": "digit",
+            "calculate": "substring(datum.zip_code, 0, 1)"
+        }
+    ],
+    "width": 500
 }
diff --git a/tests/specs/geo/geo_constant_value.vl b/tests/specs/geo/geo_constant_value.vl
--- a/tests/specs/geo/geo_constant_value.vl
+++ b/tests/specs/geo/geo_constant_value.vl
@@ -1,23 +1,15 @@
 {
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/airports.csv"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
-    },
+    "height": 300,
     "layer": [
         {
-            "mark": "square",
             "encoding": {
                 "color": {
                     "value": "gray"
                 },
-                "size": {
-                    "value": 1
-                },
                 "latitude": {
                     "field": "latitude",
                     "type": "quantitative"
@@ -25,44 +17,52 @@
                 "longitude": {
                     "field": "longitude",
                     "type": "quantitative"
+                },
+                "size": {
+                    "value": 1
                 }
-            }
+            },
+            "mark": "square"
         },
         {
-            "mark": "square",
             "encoding": {
                 "color": {
                     "value": "steelblue"
                 },
-                "size": {
-                    "value": 1
-                },
                 "latitude": {
                     "field": "latitude",
                     "type": "quantitative"
                 },
                 "longitude": {
                     "datum": -122.335167
+                },
+                "size": {
+                    "value": 1
                 }
-            }
+            },
+            "mark": "square"
         },
         {
-            "mark": "square",
             "encoding": {
                 "color": {
                     "value": "firebrick"
                 },
-                "size": {
-                    "value": 1
-                },
                 "latitude": {
                     "datum": 47.608013
                 },
                 "longitude": {
                     "field": "longitude",
                     "type": "quantitative"
+                },
+                "size": {
+                    "value": 1
                 }
-            }
+            },
+            "mark": "square"
         }
-    ]
+    ],
+    "projection": {
+        "type": "albersUsa"
+    },
+    "width": 500
 }
diff --git a/tests/specs/geo/graticule1.vl b/tests/specs/geo/graticule1.vl
--- a/tests/specs/geo/graticule1.vl
+++ b/tests/specs/geo/graticule1.vl
@@ -1,34 +1,34 @@
 {
-    "height": 300,
-    "width": 300,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "orthographic",
-        "rotate": [
-            -42,
-            -30,
-            0
-        ]
-    },
+    "height": 300,
     "layer": [
         {
+            "data": {
+                "sphere": true
+            },
             "mark": {
                 "fill": "aliceblue",
                 "type": "geoshape"
-            },
-            "data": {
-                "sphere": true
             }
         },
         {
-            "mark": {
-                "strokeWidth": 0.3,
-                "type": "geoshape",
-                "filled": false
-            },
             "data": {
                 "graticule": true
+            },
+            "mark": {
+                "filled": false,
+                "strokeWidth": 0.3,
+                "type": "geoshape"
             }
         }
-    ]
+    ],
+    "projection": {
+        "rotate": [
+            -42,
+            -30,
+            0
+        ],
+        "type": "orthographic"
+    },
+    "width": 300
 }
diff --git a/tests/specs/geo/graticule2.vl b/tests/specs/geo/graticule2.vl
--- a/tests/specs/geo/graticule2.vl
+++ b/tests/specs/geo/graticule2.vl
@@ -1,34 +1,19 @@
 {
-    "height": 300,
-    "width": 300,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "orthographic",
-        "rotate": [
-            -42,
-            -30,
-            0
-        ]
-    },
+    "height": 300,
     "layer": [
         {
+            "data": {
+                "sphere": true
+            },
             "mark": {
                 "fill": "aliceblue",
                 "type": "geoshape"
-            },
-            "data": {
-                "sphere": true
             }
         },
         {
-            "mark": {
-                "strokeWidth": 0.3,
-                "type": "geoshape",
-                "filled": false
-            },
             "data": {
                 "graticule": {
-                    "precision": 2,
                     "extent": [
                         [
                             0,
@@ -39,12 +24,27 @@
                             90
                         ]
                     ],
+                    "precision": 2,
                     "step": [
                         2,
                         2
                     ]
                 }
+            },
+            "mark": {
+                "filled": false,
+                "strokeWidth": 0.3,
+                "type": "geoshape"
             }
         }
-    ]
+    ],
+    "projection": {
+        "rotate": [
+            -42,
+            -30,
+            0
+        ],
+        "type": "orthographic"
+    },
+    "width": 300
 }
diff --git a/tests/specs/geo/graticule3.vl b/tests/specs/geo/graticule3.vl
--- a/tests/specs/geo/graticule3.vl
+++ b/tests/specs/geo/graticule3.vl
@@ -1,37 +1,19 @@
 {
-    "height": 300,
-    "width": 300,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "orthographic",
-        "rotate": [
-            -42,
-            -30,
-            0
-        ]
-    },
+    "height": 300,
     "layer": [
         {
+            "data": {
+                "sphere": true
+            },
             "mark": {
                 "fill": "aliceblue",
                 "type": "geoshape"
-            },
-            "data": {
-                "sphere": true
             }
         },
         {
-            "mark": {
-                "strokeWidth": 0.3,
-                "type": "geoshape",
-                "filled": false
-            },
             "data": {
                 "graticule": {
-                    "stepMinor": [
-                        2,
-                        2
-                    ],
                     "extentMajor": [
                         [
                             0,
@@ -51,9 +33,27 @@
                             90,
                             75.01
                         ]
+                    ],
+                    "stepMinor": [
+                        2,
+                        2
                     ]
                 }
+            },
+            "mark": {
+                "filled": false,
+                "strokeWidth": 0.3,
+                "type": "geoshape"
             }
         }
-    ]
+    ],
+    "projection": {
+        "rotate": [
+            -42,
+            -30,
+            0
+        ],
+        "type": "orthographic"
+    },
+    "width": 300
 }
diff --git a/tests/specs/geo/graticule4.vl b/tests/specs/geo/graticule4.vl
--- a/tests/specs/geo/graticule4.vl
+++ b/tests/specs/geo/graticule4.vl
@@ -1,31 +1,17 @@
 {
-    "height": 300,
-    "width": 300,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "orthographic",
-        "rotate": [
-            -42,
-            -30,
-            0
-        ]
-    },
+    "height": 300,
     "layer": [
         {
+            "data": {
+                "sphere": true
+            },
             "mark": {
                 "fill": "aliceblue",
                 "type": "geoshape"
-            },
-            "data": {
-                "sphere": true
             }
         },
         {
-            "mark": {
-                "strokeWidth": 0.3,
-                "type": "geoshape",
-                "filled": false
-            },
             "data": {
                 "graticule": {
                     "stepMinor": [
@@ -33,7 +19,21 @@
                         30
                     ]
                 }
+            },
+            "mark": {
+                "filled": false,
+                "strokeWidth": 0.3,
+                "type": "geoshape"
             }
         }
-    ]
+    ],
+    "projection": {
+        "rotate": [
+            -42,
+            -30,
+            0
+        ],
+        "type": "orthographic"
+    },
+    "width": 300
 }
diff --git a/tests/specs/geo/linear1.vl b/tests/specs/geo/linear1.vl
--- a/tests/specs/geo/linear1.vl
+++ b/tests/specs/geo/linear1.vl
@@ -1,22 +1,22 @@
 {
-    "height": 500,
-    "mark": {
-        "type": "geoshape",
-        "filled": false
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/londonTubeLines.json",
         "format": {
             "feature": "line",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/londonTubeLines.json"
     },
-    "width": 700,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "id",
             "type": "nominal"
         }
-    }
+    },
+    "height": 500,
+    "mark": {
+        "filled": false,
+        "type": "geoshape"
+    },
+    "width": 700
 }
diff --git a/tests/specs/geo/linear2.vl b/tests/specs/geo/linear2.vl
--- a/tests/specs/geo/linear2.vl
+++ b/tests/specs/geo/linear2.vl
@@ -1,27 +1,24 @@
 {
-    "height": 500,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "mark": {
-        "strokeWidth": 2,
-        "type": "geoshape",
-        "filled": false
-    },
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/londonTubeLines.json",
         "format": {
             "feature": "line",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/londonTubeLines.json"
     },
-    "width": 700,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "id",
+            "legend": {
+                "orient": "bottom-right",
+                "title": null
+            },
             "scale": {
                 "domain": [
                     "Bakerloo",
@@ -52,11 +49,14 @@
                     "rgb(106,187,170)"
                 ]
             },
-            "type": "nominal",
-            "legend": {
-                "orient": "bottom-right",
-                "title": null
-            }
+            "type": "nominal"
         }
-    }
+    },
+    "height": 500,
+    "mark": {
+        "filled": false,
+        "strokeWidth": 2,
+        "type": "geoshape"
+    },
+    "width": 700
 }
diff --git a/tests/specs/geo/linear3.vl b/tests/specs/geo/linear3.vl
--- a/tests/specs/geo/linear3.vl
+++ b/tests/specs/geo/linear3.vl
@@ -1,80 +1,79 @@
 {
-    "height": 500,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "stroke": null
         }
     },
-    "width": 700,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 500,
     "layer": [
         {
-            "mark": {
-                "strokeWidth": 2,
-                "stroke": "rgb(251,247,238)",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/londonBoroughs.json",
                 "format": {
                     "feature": "boroughs",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/londonBoroughs.json"
             },
             "encoding": {
                 "color": {
                     "value": "#ddc"
                 }
+            },
+            "mark": {
+                "stroke": "rgb(251,247,238)",
+                "strokeWidth": 2,
+                "type": "geoshape"
             }
         },
         {
-            "transform": [
-                {
-                    "as": "bLabel",
-                    "calculate": "indexof (datum.name,' ') > 0  ? substring(datum.name,0,indexof(datum.name, ' ')) : datum.name"
-                }
-            ],
-            "mark": "text",
             "data": {
                 "url": "https://vega.github.io/vega-lite/data/londonCentroids.json"
             },
             "encoding": {
-                "size": {
-                    "value": 8
-                },
-                "text": {
-                    "field": "bLabel",
-                    "type": "nominal"
-                },
                 "latitude": {
                     "field": "cy",
                     "type": "quantitative"
                 },
-                "opacity": {
-                    "value": 0.6
-                },
                 "longitude": {
                     "field": "cx",
                     "type": "quantitative"
+                },
+                "opacity": {
+                    "value": 0.6
+                },
+                "size": {
+                    "value": 8
+                },
+                "text": {
+                    "field": "bLabel",
+                    "type": "nominal"
                 }
-            }
+            },
+            "mark": "text",
+            "transform": [
+                {
+                    "as": "bLabel",
+                    "calculate": "indexof (datum.name,' ') > 0  ? substring(datum.name,0,indexof(datum.name, ' ')) : datum.name"
+                }
+            ]
         },
         {
-            "mark": {
-                "strokeWidth": 2,
-                "type": "geoshape",
-                "filled": false
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/londonTubeLines.json",
                 "format": {
                     "feature": "line",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/londonTubeLines.json"
             },
             "encoding": {
                 "color": {
                     "field": "id",
+                    "legend": {
+                        "offset": 0,
+                        "orient": "bottom-right",
+                        "title": null
+                    },
                     "scale": {
                         "domain": [
                             "Bakerloo",
@@ -105,14 +104,15 @@
                             "rgb(106,187,170)"
                         ]
                     },
-                    "type": "nominal",
-                    "legend": {
-                        "offset": 0,
-                        "orient": "bottom-right",
-                        "title": null
-                    }
+                    "type": "nominal"
                 }
+            },
+            "mark": {
+                "filled": false,
+                "strokeWidth": 2,
+                "type": "geoshape"
             }
         }
-    ]
+    ],
+    "width": 700
 }
diff --git a/tests/specs/geo/map1d.vl b/tests/specs/geo/map1d.vl
--- a/tests/specs/geo/map1d.vl
+++ b/tests/specs/geo/map1d.vl
@@ -1,24 +1,22 @@
 {
-    "height": 400,
-    "width": 500,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 400,
     "layer": [
         {
-            "mark": {
-                "stroke": "white",
-                "fill": "lightgrey",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://gicentre.github.io/data/geoTutorials/londonBoroughs.json",
                 "format": {
                     "feature": "boroughs",
                     "type": "topojson"
-                }
+                },
+                "url": "https://gicentre.github.io/data/geoTutorials/londonBoroughs.json"
+            },
+            "mark": {
+                "fill": "lightgrey",
+                "stroke": "white",
+                "type": "geoshape"
             }
         },
         {
-            "mark": "circle",
             "data": {
                 "url": "https://gicentre.github.io/data/geoTutorials/londonCentroids.csv"
             },
@@ -31,10 +29,10 @@
                     "field": "cx",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "circle"
         },
         {
-            "mark": "circle",
             "data": {
                 "url": "https://gicentre.github.io/data/geoTutorials/londonCentroids.csv"
             },
@@ -46,10 +44,10 @@
                     "field": "cx",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "circle"
         },
         {
-            "mark": "circle",
             "data": {
                 "url": "https://gicentre.github.io/data/geoTutorials/londonCentroids.csv"
             },
@@ -61,7 +59,9 @@
                 "longitude": {
                     "value": -0.52
                 }
-            }
+            },
+            "mark": "circle"
         }
-    ]
+    ],
+    "width": 500
 }
diff --git a/tests/specs/geo/mapComp1.vl b/tests/specs/geo/mapComp1.vl
--- a/tests/specs/geo/mapComp1.vl
+++ b/tests/specs/geo/mapComp1.vl
@@ -1,59 +1,59 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "hconcat": [
         {
-            "height": 300,
-            "mark": {
-                "type": "geoshape",
-                "filled": false
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/graticule.json",
                 "format": {
                     "feature": "graticule",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/graticule.json"
             },
-            "width": 300,
+            "height": 300,
+            "mark": {
+                "filled": false,
+                "type": "geoshape"
+            },
             "projection": {
                 "type": "orthographic"
-            }
+            },
+            "width": 300
         },
         {
-            "height": 300,
-            "mark": {
-                "type": "geoshape",
-                "filled": false
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/graticule.json",
                 "format": {
                     "feature": "graticule",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/graticule.json"
             },
-            "width": 300,
+            "height": 300,
+            "mark": {
+                "filled": false,
+                "type": "geoshape"
+            },
             "projection": {
                 "type": "orthographic"
-            }
+            },
+            "width": 300
         },
         {
-            "height": 300,
-            "mark": {
-                "type": "geoshape",
-                "filled": false
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/graticule.json",
                 "format": {
                     "feature": "graticule",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/graticule.json"
             },
-            "width": 300,
+            "height": 300,
+            "mark": {
+                "filled": false,
+                "type": "geoshape"
+            },
             "projection": {
                 "type": "orthographic"
-            }
+            },
+            "width": 300
         }
-    ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    ]
 }
diff --git a/tests/specs/geo/mapComp2.vl b/tests/specs/geo/mapComp2.vl
--- a/tests/specs/geo/mapComp2.vl
+++ b/tests/specs/geo/mapComp2.vl
@@ -1,124 +1,124 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "config": {
+        "view": {
+            "stroke": null
+        }
+    },
     "hconcat": [
         {
             "height": 300,
-            "width": 300,
-            "projection": {
-                "type": "orthographic"
-            },
             "layer": [
                 {
-                    "mark": {
-                        "strokeWidth": 0.1,
-                        "stroke": "#411",
-                        "type": "geoshape",
-                        "filled": false
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/graticule.json",
                         "format": {
                             "feature": "graticule",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/graticule.json"
+                    },
+                    "mark": {
+                        "filled": false,
+                        "stroke": "#411",
+                        "strokeWidth": 0.1,
+                        "type": "geoshape"
                     }
                 },
                 {
-                    "mark": {
-                        "fill": "black",
-                        "type": "geoshape",
-                        "fillOpacity": 0.7
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                         "format": {
                             "feature": "land",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/world-110m.json"
+                    },
+                    "mark": {
+                        "fill": "black",
+                        "fillOpacity": 0.7,
+                        "type": "geoshape"
                     }
                 }
-            ]
-        },
-        {
-            "height": 300,
-            "width": 300,
+            ],
             "projection": {
                 "type": "orthographic"
             },
+            "width": 300
+        },
+        {
+            "height": 300,
             "layer": [
                 {
-                    "mark": {
-                        "strokeWidth": 0.1,
-                        "stroke": "#411",
-                        "type": "geoshape",
-                        "filled": false
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/graticule.json",
                         "format": {
                             "feature": "graticule",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/graticule.json"
+                    },
+                    "mark": {
+                        "filled": false,
+                        "stroke": "#411",
+                        "strokeWidth": 0.1,
+                        "type": "geoshape"
                     }
                 },
                 {
-                    "mark": {
-                        "fill": "black",
-                        "type": "geoshape",
-                        "fillOpacity": 0.7
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                         "format": {
                             "feature": "land",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/world-110m.json"
+                    },
+                    "mark": {
+                        "fill": "black",
+                        "fillOpacity": 0.7,
+                        "type": "geoshape"
                     }
                 }
-            ]
-        },
-        {
-            "height": 300,
-            "width": 300,
+            ],
             "projection": {
                 "type": "orthographic"
             },
+            "width": 300
+        },
+        {
+            "height": 300,
             "layer": [
                 {
-                    "mark": {
-                        "strokeWidth": 0.1,
-                        "stroke": "#411",
-                        "type": "geoshape",
-                        "filled": false
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/graticule.json",
                         "format": {
                             "feature": "graticule",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/graticule.json"
+                    },
+                    "mark": {
+                        "filled": false,
+                        "stroke": "#411",
+                        "strokeWidth": 0.1,
+                        "type": "geoshape"
                     }
                 },
                 {
-                    "mark": {
-                        "fill": "black",
-                        "type": "geoshape",
-                        "fillOpacity": 0.7
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                         "format": {
                             "feature": "land",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/world-110m.json"
+                    },
+                    "mark": {
+                        "fill": "black",
+                        "fillOpacity": 0.7,
+                        "type": "geoshape"
                     }
                 }
-            ]
-        }
-    ],
-    "config": {
-        "view": {
-            "stroke": null
+            ],
+            "projection": {
+                "type": "orthographic"
+            },
+            "width": 300
         }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    ]
 }
diff --git a/tests/specs/geo/mapComp3.vl b/tests/specs/geo/mapComp3.vl
--- a/tests/specs/geo/mapComp3.vl
+++ b/tests/specs/geo/mapComp3.vl
@@ -1,166 +1,166 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "config": {
+        "view": {
+            "stroke": null
+        }
+    },
     "hconcat": [
         {
             "height": 300,
-            "width": 300,
             "layer": [
                 {
-                    "mark": {
-                        "strokeWidth": 0.1,
-                        "stroke": "#411",
-                        "type": "geoshape",
-                        "filled": false
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/graticule.json",
                         "format": {
                             "feature": "graticule",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/graticule.json"
                     },
+                    "mark": {
+                        "filled": false,
+                        "stroke": "#411",
+                        "strokeWidth": 0.1,
+                        "type": "geoshape"
+                    },
                     "projection": {
-                        "type": "orthographic",
                         "rotate": [
                             -65,
                             0,
                             0
-                        ]
+                        ],
+                        "type": "orthographic"
                     }
                 },
                 {
-                    "mark": {
-                        "strokeWidth": 0.5,
-                        "stroke": "white",
-                        "fill": "black",
-                        "type": "geoshape"
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                         "format": {
                             "feature": "countries",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/world-110m.json"
                     },
+                    "mark": {
+                        "fill": "black",
+                        "stroke": "white",
+                        "strokeWidth": 0.5,
+                        "type": "geoshape"
+                    },
                     "projection": {
-                        "type": "orthographic",
                         "rotate": [
                             -65,
                             0,
                             0
-                        ]
+                        ],
+                        "type": "orthographic"
                     }
                 }
-            ]
+            ],
+            "width": 300
         },
         {
             "height": 300,
-            "width": 300,
             "layer": [
                 {
-                    "mark": {
-                        "strokeWidth": 0.1,
-                        "stroke": "#411",
-                        "type": "geoshape",
-                        "filled": false
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/graticule.json",
                         "format": {
                             "feature": "graticule",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/graticule.json"
                     },
+                    "mark": {
+                        "filled": false,
+                        "stroke": "#411",
+                        "strokeWidth": 0.1,
+                        "type": "geoshape"
+                    },
                     "projection": {
-                        "type": "orthographic",
                         "rotate": [
                             115,
                             0,
                             0
-                        ]
+                        ],
+                        "type": "orthographic"
                     }
                 },
                 {
-                    "mark": {
-                        "strokeWidth": 0.5,
-                        "stroke": "white",
-                        "fill": "black",
-                        "type": "geoshape"
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                         "format": {
                             "feature": "countries",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/world-110m.json"
                     },
+                    "mark": {
+                        "fill": "black",
+                        "stroke": "white",
+                        "strokeWidth": 0.5,
+                        "type": "geoshape"
+                    },
                     "projection": {
-                        "type": "orthographic",
                         "rotate": [
                             115,
                             0,
                             0
-                        ]
+                        ],
+                        "type": "orthographic"
                     }
                 }
-            ]
+            ],
+            "width": 300
         },
         {
             "height": 300,
-            "width": 300,
             "layer": [
                 {
-                    "mark": {
-                        "strokeWidth": 0.1,
-                        "stroke": "#411",
-                        "type": "geoshape",
-                        "filled": false
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/graticule.json",
                         "format": {
                             "feature": "graticule",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/graticule.json"
                     },
+                    "mark": {
+                        "filled": false,
+                        "stroke": "#411",
+                        "strokeWidth": 0.1,
+                        "type": "geoshape"
+                    },
                     "projection": {
-                        "type": "orthographic",
                         "rotate": [
                             10,
                             0,
                             0
-                        ]
+                        ],
+                        "type": "orthographic"
                     }
                 },
                 {
-                    "mark": {
-                        "strokeWidth": 0.5,
-                        "stroke": "white",
-                        "fill": "black",
-                        "type": "geoshape"
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                         "format": {
                             "feature": "countries",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/world-110m.json"
                     },
+                    "mark": {
+                        "fill": "black",
+                        "stroke": "white",
+                        "strokeWidth": 0.5,
+                        "type": "geoshape"
+                    },
                     "projection": {
-                        "type": "orthographic",
                         "rotate": [
                             10,
                             0,
                             0
-                        ]
+                        ],
+                        "type": "orthographic"
                     }
                 }
-            ]
-        }
-    ],
-    "config": {
-        "view": {
-            "stroke": null
+            ],
+            "width": 300
         }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    ]
 }
diff --git a/tests/specs/geo/mapComp4.vl b/tests/specs/geo/mapComp4.vl
--- a/tests/specs/geo/mapComp4.vl
+++ b/tests/specs/geo/mapComp4.vl
@@ -1,158 +1,158 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "config": {
+        "view": {
+            "stroke": null
+        }
+    },
     "hconcat": [
         {
             "height": 300,
-            "width": 300,
             "layer": [
                 {
-                    "mark": {
-                        "fill": "#c1e7f5",
-                        "strokeOpacity": 0,
-                        "type": "geoshape"
-                    },
                     "data": {
-                        "url": "data/globe.json",
                         "format": {
                             "feature": "globe",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "data/globe.json"
                     },
+                    "mark": {
+                        "fill": "#c1e7f5",
+                        "strokeOpacity": 0,
+                        "type": "geoshape"
+                    },
                     "projection": {
-                        "type": "orthographic",
                         "rotate": [
                             0,
                             0,
                             0
-                        ]
+                        ],
+                        "type": "orthographic"
                     }
                 },
                 {
-                    "mark": {
-                        "strokeWidth": 0.1,
-                        "stroke": "#411",
-                        "type": "geoshape",
-                        "filled": false
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/graticule.json",
                         "format": {
                             "feature": "graticule",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/graticule.json"
                     },
+                    "mark": {
+                        "filled": false,
+                        "stroke": "#411",
+                        "strokeWidth": 0.1,
+                        "type": "geoshape"
+                    },
                     "projection": {
-                        "type": "orthographic",
                         "rotate": [
                             0,
                             0,
                             0
-                        ]
+                        ],
+                        "type": "orthographic"
                     }
                 },
                 {
-                    "mark": {
-                        "strokeWidth": 0.1,
-                        "stroke": "white",
-                        "fill": "#242",
-                        "type": "geoshape"
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                         "format": {
                             "feature": "countries",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/world-110m.json"
                     },
+                    "mark": {
+                        "fill": "#242",
+                        "stroke": "white",
+                        "strokeWidth": 0.1,
+                        "type": "geoshape"
+                    },
                     "projection": {
-                        "type": "orthographic",
                         "rotate": [
                             0,
                             0,
                             0
-                        ]
+                        ],
+                        "type": "orthographic"
                     }
                 }
-            ]
+            ],
+            "width": 300
         },
         {
             "height": 300,
-            "width": 300,
             "layer": [
                 {
-                    "mark": {
-                        "fill": "#c1e7f5",
-                        "strokeOpacity": 0,
-                        "type": "geoshape"
-                    },
                     "data": {
-                        "url": "data/globe.json",
                         "format": {
                             "feature": "globe",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "data/globe.json"
                     },
+                    "mark": {
+                        "fill": "#c1e7f5",
+                        "strokeOpacity": 0,
+                        "type": "geoshape"
+                    },
                     "projection": {
-                        "type": "orthographic",
                         "rotate": [
                             0,
                             0,
                             0
-                        ]
+                        ],
+                        "type": "orthographic"
                     }
                 },
                 {
-                    "mark": {
-                        "strokeWidth": 0.1,
-                        "stroke": "#411",
-                        "type": "geoshape",
-                        "filled": false
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/graticule.json",
                         "format": {
                             "feature": "graticule",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/graticule.json"
                     },
+                    "mark": {
+                        "filled": false,
+                        "stroke": "#411",
+                        "strokeWidth": 0.1,
+                        "type": "geoshape"
+                    },
                     "projection": {
-                        "type": "orthographic",
                         "rotate": [
                             -40,
                             0,
                             0
-                        ]
+                        ],
+                        "type": "orthographic"
                     }
                 },
                 {
-                    "mark": {
-                        "strokeWidth": 0.1,
-                        "stroke": "white",
-                        "fill": "#242",
-                        "type": "geoshape"
-                    },
                     "data": {
-                        "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                         "format": {
                             "feature": "countries",
                             "type": "topojson"
-                        }
+                        },
+                        "url": "https://vega.github.io/vega-lite/data/world-110m.json"
                     },
+                    "mark": {
+                        "fill": "#242",
+                        "stroke": "white",
+                        "strokeWidth": 0.1,
+                        "type": "geoshape"
+                    },
                     "projection": {
-                        "type": "orthographic",
                         "rotate": [
                             -40,
                             0,
                             0
-                        ]
+                        ],
+                        "type": "orthographic"
                     }
                 }
-            ]
-        }
-    ],
-    "config": {
-        "view": {
-            "stroke": null
+            ],
+            "width": 300
         }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    ]
 }
diff --git a/tests/specs/geo/scale1.vl b/tests/specs/geo/scale1.vl
--- a/tests/specs/geo/scale1.vl
+++ b/tests/specs/geo/scale1.vl
@@ -1,31 +1,21 @@
 {
-    "height": 300,
-    "width": 300,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "scale": 470,
-        "type": "orthographic"
-    },
+    "height": 300,
     "layer": [
         {
-            "mark": {
-                "fill": "rgb(149,181,146)",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://gicentre.github.io/data/geoTutorials/world-110m.json",
                 "format": {
                     "feature": "countries1",
                     "type": "topojson"
-                }
+                },
+                "url": "https://gicentre.github.io/data/geoTutorials/world-110m.json"
+            },
+            "mark": {
+                "fill": "rgb(149,181,146)",
+                "type": "geoshape"
             }
         },
         {
-            "mark": {
-                "strokeWidth": 0.3,
-                "type": "geoshape",
-                "filled": false
-            },
             "data": {
                 "graticule": {
                     "stepMinor": [
@@ -33,7 +23,17 @@
                         5
                     ]
                 }
+            },
+            "mark": {
+                "filled": false,
+                "strokeWidth": 0.3,
+                "type": "geoshape"
             }
         }
-    ]
+    ],
+    "projection": {
+        "scale": 470,
+        "type": "orthographic"
+    },
+    "width": 300
 }
diff --git a/tests/specs/geo/scribbleMap1.vl b/tests/specs/geo/scribbleMap1.vl
--- a/tests/specs/geo/scribbleMap1.vl
+++ b/tests/specs/geo/scribbleMap1.vl
@@ -1,42 +1,26 @@
 {
-    "transform": [
-        {
-            "filter": "datum.latitude != '' && datum.county != 'Honolulu' && datum.state !='AS'&& datum.state !='FM'&& datum.state !='PW'&& datum.state !='MH'&& datum.state !='GU'&& datum.state !='MP'&& datum.state !='VI'&& datum.state !='PR'"
-        },
-        {
-            "as": "conterminous",
-            "calculate": "datum.state == 'HI' ? 'hi' : (datum.state == 'AK' ? 'ak' : 'continent')"
-        }
-    ],
-    "height": 600,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
-        "view": {
-            "stroke": null
-        },
         "title": {
-            "fontSize": 28,
             "font": "Roboto",
+            "fontSize": 28,
             "fontWeight": 300
+        },
+        "view": {
+            "stroke": null
         }
     },
-    "mark": {
-        "strokeWidth": 0.2,
-        "interpolate": "monotone",
-        "type": "line"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/zipcodes.csv"
     },
-    "width": 1000,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
-    },
-    "title": "US connected zip codes",
     "encoding": {
         "color": {
             "value": "#666"
         },
+        "detail": {
+            "field": "conterminous",
+            "type": "nominal"
+        },
         "latitude": {
             "field": "latitude",
             "type": "quantitative"
@@ -48,10 +32,26 @@
         "order": {
             "field": "zip_code",
             "type": "quantitative"
+        }
+    },
+    "height": 600,
+    "mark": {
+        "interpolate": "monotone",
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "projection": {
+        "type": "albersUsa"
+    },
+    "title": "US connected zip codes",
+    "transform": [
+        {
+            "filter": "datum.latitude != '' && datum.county != 'Honolulu' && datum.state !='AS'&& datum.state !='FM'&& datum.state !='PW'&& datum.state !='MH'&& datum.state !='GU'&& datum.state !='MP'&& datum.state !='VI'&& datum.state !='PR'"
         },
-        "detail": {
-            "field": "conterminous",
-            "type": "nominal"
+        {
+            "as": "conterminous",
+            "calculate": "datum.state == 'HI' ? 'hi' : (datum.state == 'AK' ? 'ak' : 'continent')"
         }
-    }
+    ],
+    "width": 1000
 }
diff --git a/tests/specs/geo/scribbleMap2.vl b/tests/specs/geo/scribbleMap2.vl
--- a/tests/specs/geo/scribbleMap2.vl
+++ b/tests/specs/geo/scribbleMap2.vl
@@ -1,48 +1,28 @@
 {
-    "transform": [
-        {
-            "filter": "datum.latitude != '' && datum.county != 'Honolulu' && datum.state !='AS'&& datum.state !='FM'&& datum.state !='PW'&& datum.state !='MH'&& datum.state !='GU'&& datum.state !='MP'&& datum.state !='VI'&& datum.state !='PR'"
-        },
-        {
-            "as": "digit3",
-            "calculate": "substring(datum.zip_code, 0, 3)"
-        },
-        {
-            "as": "ziplen",
-            "calculate": "length(datum.zip_code+' ')"
-        }
-    ],
-    "height": 600,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
-        "view": {
-            "stroke": null
-        },
         "title": {
-            "fontSize": 28,
             "font": "Roboto",
+            "fontSize": 28,
             "fontWeight": 300
+        },
+        "view": {
+            "stroke": null
         }
     },
-    "mark": {
-        "strokeWidth": 0.2,
-        "interpolate": "monotone",
-        "type": "line"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/zipcodes.csv"
     },
-    "width": 1000,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "albersUsa"
-    },
-    "title": "US connected zip codes, coloured by first three digits",
     "encoding": {
         "color": {
             "field": "digit3",
-            "type": "nominal",
-            "legend": null
+            "legend": null,
+            "type": "nominal"
         },
+        "detail": {
+            "field": "ziplen",
+            "type": "nominal"
+        },
         "latitude": {
             "field": "latitude",
             "type": "quantitative"
@@ -54,10 +34,30 @@
         "order": {
             "field": "zip_code",
             "type": "quantitative"
+        }
+    },
+    "height": 600,
+    "mark": {
+        "interpolate": "monotone",
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "projection": {
+        "type": "albersUsa"
+    },
+    "title": "US connected zip codes, coloured by first three digits",
+    "transform": [
+        {
+            "filter": "datum.latitude != '' && datum.county != 'Honolulu' && datum.state !='AS'&& datum.state !='FM'&& datum.state !='PW'&& datum.state !='MH'&& datum.state !='GU'&& datum.state !='MP'&& datum.state !='VI'&& datum.state !='PR'"
         },
-        "detail": {
-            "field": "ziplen",
-            "type": "nominal"
+        {
+            "as": "digit3",
+            "calculate": "substring(datum.zip_code, 0, 3)"
+        },
+        {
+            "as": "ziplen",
+            "calculate": "length(datum.zip_code+' ')"
         }
-    }
+    ],
+    "width": 1000
 }
diff --git a/tests/specs/geo/sphere1.vl b/tests/specs/geo/sphere1.vl
--- a/tests/specs/geo/sphere1.vl
+++ b/tests/specs/geo/sphere1.vl
@@ -1,19 +1,19 @@
 {
-    "height": 300,
-    "mark": {
-        "fill": "rgb(149,181,146)",
-        "type": "geoshape"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
-        "url": "https://gicentre.github.io/data/geoTutorials/world-110m.json",
         "format": {
             "feature": "countries1",
             "type": "topojson"
-        }
+        },
+        "url": "https://gicentre.github.io/data/geoTutorials/world-110m.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fill": "rgb(149,181,146)",
+        "type": "geoshape"
+    },
     "projection": {
         "type": "orthographic"
-    }
+    },
+    "width": 300
 }
diff --git a/tests/specs/geo/sphere2.vl b/tests/specs/geo/sphere2.vl
--- a/tests/specs/geo/sphere2.vl
+++ b/tests/specs/geo/sphere2.vl
@@ -1,32 +1,32 @@
 {
-    "height": 300,
-    "width": 300,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "orthographic"
-    },
+    "height": 300,
     "layer": [
         {
+            "data": {
+                "sphere": true
+            },
             "mark": {
                 "fill": "aliceblue",
                 "type": "geoshape"
-            },
-            "data": {
-                "sphere": true
             }
         },
         {
-            "mark": {
-                "fill": "rgb(149,181,146)",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://gicentre.github.io/data/geoTutorials/world-110m.json",
                 "format": {
                     "feature": "countries1",
                     "type": "topojson"
-                }
+                },
+                "url": "https://gicentre.github.io/data/geoTutorials/world-110m.json"
+            },
+            "mark": {
+                "fill": "rgb(149,181,146)",
+                "type": "geoshape"
             }
         }
-    ]
+    ],
+    "projection": {
+        "type": "orthographic"
+    },
+    "width": 300
 }
diff --git a/tests/specs/geo/translate1.vl b/tests/specs/geo/translate1.vl
--- a/tests/specs/geo/translate1.vl
+++ b/tests/specs/geo/translate1.vl
@@ -1,34 +1,21 @@
 {
-    "height": 300,
-    "width": 300,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "projection": {
-        "type": "orthographic",
-        "translate": [
-            0,
-            100
-        ]
-    },
+    "height": 300,
     "layer": [
         {
-            "mark": {
-                "fill": "rgb(149,181,146)",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://gicentre.github.io/data/geoTutorials/world-110m.json",
                 "format": {
                     "feature": "countries1",
                     "type": "topojson"
-                }
+                },
+                "url": "https://gicentre.github.io/data/geoTutorials/world-110m.json"
+            },
+            "mark": {
+                "fill": "rgb(149,181,146)",
+                "type": "geoshape"
             }
         },
         {
-            "mark": {
-                "strokeWidth": 0.3,
-                "type": "geoshape",
-                "filled": false
-            },
             "data": {
                 "graticule": {
                     "stepMinor": [
@@ -36,7 +23,20 @@
                         5
                     ]
                 }
+            },
+            "mark": {
+                "filled": false,
+                "strokeWidth": 0.3,
+                "type": "geoshape"
             }
         }
-    ]
+    ],
+    "projection": {
+        "translate": [
+            0,
+            100
+        ],
+        "type": "orthographic"
+    },
+    "width": 300
 }
diff --git a/tests/specs/hyperlink/hyperlink1.vl b/tests/specs/hyperlink/hyperlink1.vl
--- a/tests/specs/hyperlink/hyperlink1.vl
+++ b/tests/specs/hyperlink/hyperlink1.vl
@@ -1,45 +1,44 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "url": "https://vega.github.io/vega",
-                "label": "Vega"
+                "label": "Vega",
+                "url": "https://vega.github.io/vega"
             },
             {
-                "url": "https://vega.github.io/vega-lite",
-                "label": "Vega-Lite"
+                "label": "Vega-Lite",
+                "url": "https://vega.github.io/vega-lite"
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": {
-                "cursor": "pointer",
-                "type": "circle"
-            },
             "encoding": {
                 "color": {
                     "field": "label",
-                    "type": "nominal",
-                    "legend": null
-                },
-                "size": {
-                    "value": 8000
+                    "legend": null,
+                    "type": "nominal"
                 },
                 "href": {
                     "field": "url",
                     "type": "nominal"
                 },
+                "size": {
+                    "value": 8000
+                },
                 "x": {
+                    "axis": null,
                     "field": "label",
-                    "type": "nominal",
-                    "axis": null
+                    "type": "nominal"
                 }
+            },
+            "mark": {
+                "cursor": "pointer",
+                "type": "circle"
             }
         },
         {
-            "mark": "text",
             "encoding": {
                 "color": {
                     "value": "white"
@@ -52,11 +51,12 @@
                     "type": "nominal"
                 },
                 "x": {
+                    "axis": null,
                     "field": "label",
-                    "type": "nominal",
-                    "axis": null
+                    "type": "nominal"
                 }
-            }
+            },
+            "mark": "text"
         }
     ]
 }
diff --git a/tests/specs/hyperlink/hyperlink2.vl b/tests/specs/hyperlink/hyperlink2.vl
--- a/tests/specs/hyperlink/hyperlink2.vl
+++ b/tests/specs/hyperlink/hyperlink2.vl
@@ -1,12 +1,8 @@
 {
-    "mark": {
-        "cursor": "pointer",
-        "type": "point"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "href": {
             "value": "http://www.imdb.com"
@@ -19,5 +15,9 @@
             "field": "Rotten_Tomatoes_Rating",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "cursor": "pointer",
+        "type": "point"
     }
 }
diff --git a/tests/specs/hyperlink/hyperlink3.vl b/tests/specs/hyperlink/hyperlink3.vl
--- a/tests/specs/hyperlink/hyperlink3.vl
+++ b/tests/specs/hyperlink/hyperlink3.vl
@@ -1,26 +1,22 @@
 {
-    "mark": {
-        "cursor": "pointer",
-        "type": "point"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
-            "value": "red",
             "condition": {
-                "value": "steelblue",
-                "test": "datum.IMDB_Rating*10 > datum.Rotten_Tomatoes_Rating"
-            }
+                "test": "datum.IMDB_Rating*10 > datum.Rotten_Tomatoes_Rating",
+                "value": "steelblue"
+            },
+            "value": "red"
         },
         "href": {
-            "value": "https://www.rottentomatoes.com",
             "condition": {
-                "value": "http://www.imdb.com",
-                "test": "datum.IMDB_Rating*10 > datum.Rotten_Tomatoes_Rating"
-            }
+                "test": "datum.IMDB_Rating*10 > datum.Rotten_Tomatoes_Rating",
+                "value": "http://www.imdb.com"
+            },
+            "value": "https://www.rottentomatoes.com"
         },
         "x": {
             "field": "IMDB_Rating",
@@ -30,5 +26,9 @@
             "field": "Rotten_Tomatoes_Rating",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "cursor": "pointer",
+        "type": "point"
     }
 }
diff --git a/tests/specs/image/image1.vl b/tests/specs/image/image1.vl
--- a/tests/specs/image/image1.vl
+++ b/tests/specs/image/image1.vl
@@ -1,9 +1,5 @@
 {
-    "mark": {
-        "height": 25,
-        "width": 25,
-        "type": "image"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -20,7 +16,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "url": {
             "value": "https://vega.github.io/vega-lite/data/ffox.png"
@@ -33,5 +28,10 @@
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "height": 25,
+        "type": "image",
+        "width": 25
     }
 }
diff --git a/tests/specs/image/image10.vl b/tests/specs/image/image10.vl
--- a/tests/specs/image/image10.vl
+++ b/tests/specs/image/image10.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -7,15 +8,8 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": {
-                "height": 61,
-                "width": 100,
-                "type": "image",
-                "baseline": "bottom"
-            },
             "encoding": {
                 "url": {
                     "value": "https://gicentre.github.io/data/images/LillyTarn.jpg"
@@ -40,15 +34,15 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "baseline": "bottom",
+                "height": 61,
+                "type": "image",
+                "width": 100
             }
         },
         {
-            "mark": {
-                "color": "red",
-                "size": 100,
-                "opacity": 0.5,
-                "type": "circle"
-            },
             "encoding": {
                 "x": {
                     "field": "x",
@@ -70,6 +64,12 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "opacity": 0.5,
+                "size": 100,
+                "type": "circle"
             }
         }
     ]
diff --git a/tests/specs/image/image2.vl b/tests/specs/image/image2.vl
--- a/tests/specs/image/image2.vl
+++ b/tests/specs/image/image2.vl
@@ -1,9 +1,5 @@
 {
-    "mark": {
-        "height": 25,
-        "width": 25,
-        "type": "image"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -23,7 +19,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "url": {
             "field": "img",
@@ -37,5 +32,10 @@
             "field": "y",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "height": 25,
+        "type": "image",
+        "width": 25
     }
 }
diff --git a/tests/specs/image/image3.vl b/tests/specs/image/image3.vl
--- a/tests/specs/image/image3.vl
+++ b/tests/specs/image/image3.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -7,14 +8,8 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": {
-                "aspect": true,
-                "width": 100,
-                "type": "image"
-            },
             "encoding": {
                 "url": {
                     "value": "https://gicentre.github.io/data/images/LillyTarn.jpg"
@@ -39,15 +34,14 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "aspect": true,
+                "type": "image",
+                "width": 100
             }
         },
         {
-            "mark": {
-                "color": "red",
-                "size": 100,
-                "opacity": 0.5,
-                "type": "circle"
-            },
             "encoding": {
                 "x": {
                     "field": "x",
@@ -69,6 +63,12 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "opacity": 0.5,
+                "size": 100,
+                "type": "circle"
             }
         }
     ]
diff --git a/tests/specs/image/image4.vl b/tests/specs/image/image4.vl
--- a/tests/specs/image/image4.vl
+++ b/tests/specs/image/image4.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -7,15 +8,8 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": {
-                "height": 100,
-                "aspect": false,
-                "width": 100,
-                "type": "image"
-            },
             "encoding": {
                 "url": {
                     "value": "https://gicentre.github.io/data/images/LillyTarn.jpg"
@@ -40,15 +34,15 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "aspect": false,
+                "height": 100,
+                "type": "image",
+                "width": 100
             }
         },
         {
-            "mark": {
-                "color": "red",
-                "size": 100,
-                "opacity": 0.5,
-                "type": "circle"
-            },
             "encoding": {
                 "x": {
                     "field": "x",
@@ -70,6 +64,12 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "opacity": 0.5,
+                "size": 100,
+                "type": "circle"
             }
         }
     ]
diff --git a/tests/specs/image/image5.vl b/tests/specs/image/image5.vl
--- a/tests/specs/image/image5.vl
+++ b/tests/specs/image/image5.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -7,15 +8,8 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": {
-                "height": 61,
-                "width": 100,
-                "align": "left",
-                "type": "image"
-            },
             "encoding": {
                 "url": {
                     "value": "https://gicentre.github.io/data/images/LillyTarn.jpg"
@@ -40,15 +34,15 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "align": "left",
+                "height": 61,
+                "type": "image",
+                "width": 100
             }
         },
         {
-            "mark": {
-                "color": "red",
-                "size": 100,
-                "opacity": 0.5,
-                "type": "circle"
-            },
             "encoding": {
                 "x": {
                     "field": "x",
@@ -70,6 +64,12 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "opacity": 0.5,
+                "size": 100,
+                "type": "circle"
             }
         }
     ]
diff --git a/tests/specs/image/image6.vl b/tests/specs/image/image6.vl
--- a/tests/specs/image/image6.vl
+++ b/tests/specs/image/image6.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -7,15 +8,8 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": {
-                "height": 61,
-                "width": 100,
-                "align": "center",
-                "type": "image"
-            },
             "encoding": {
                 "url": {
                     "value": "https://gicentre.github.io/data/images/LillyTarn.jpg"
@@ -40,15 +34,15 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "align": "center",
+                "height": 61,
+                "type": "image",
+                "width": 100
             }
         },
         {
-            "mark": {
-                "color": "red",
-                "size": 100,
-                "opacity": 0.5,
-                "type": "circle"
-            },
             "encoding": {
                 "x": {
                     "field": "x",
@@ -70,6 +64,12 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "opacity": 0.5,
+                "size": 100,
+                "type": "circle"
             }
         }
     ]
diff --git a/tests/specs/image/image7.vl b/tests/specs/image/image7.vl
--- a/tests/specs/image/image7.vl
+++ b/tests/specs/image/image7.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -7,15 +8,8 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": {
-                "height": 61,
-                "width": 100,
-                "align": "right",
-                "type": "image"
-            },
             "encoding": {
                 "url": {
                     "value": "https://gicentre.github.io/data/images/LillyTarn.jpg"
@@ -40,15 +34,15 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "align": "right",
+                "height": 61,
+                "type": "image",
+                "width": 100
             }
         },
         {
-            "mark": {
-                "color": "red",
-                "size": 100,
-                "opacity": 0.5,
-                "type": "circle"
-            },
             "encoding": {
                 "x": {
                     "field": "x",
@@ -70,6 +64,12 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "opacity": 0.5,
+                "size": 100,
+                "type": "circle"
             }
         }
     ]
diff --git a/tests/specs/image/image8.vl b/tests/specs/image/image8.vl
--- a/tests/specs/image/image8.vl
+++ b/tests/specs/image/image8.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -7,15 +8,8 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": {
-                "height": 61,
-                "width": 100,
-                "type": "image",
-                "baseline": "top"
-            },
             "encoding": {
                 "url": {
                     "value": "https://gicentre.github.io/data/images/LillyTarn.jpg"
@@ -40,15 +34,15 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "baseline": "top",
+                "height": 61,
+                "type": "image",
+                "width": 100
             }
         },
         {
-            "mark": {
-                "color": "red",
-                "size": 100,
-                "opacity": 0.5,
-                "type": "circle"
-            },
             "encoding": {
                 "x": {
                     "field": "x",
@@ -70,6 +64,12 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "opacity": 0.5,
+                "size": 100,
+                "type": "circle"
             }
         }
     ]
diff --git a/tests/specs/image/image9.vl b/tests/specs/image/image9.vl
--- a/tests/specs/image/image9.vl
+++ b/tests/specs/image/image9.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -7,15 +8,8 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": {
-                "height": 61,
-                "width": 100,
-                "type": "image",
-                "baseline": "middle"
-            },
             "encoding": {
                 "url": {
                     "value": "https://gicentre.github.io/data/images/LillyTarn.jpg"
@@ -40,15 +34,15 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "baseline": "middle",
+                "height": 61,
+                "type": "image",
+                "width": 100
             }
         },
         {
-            "mark": {
-                "color": "red",
-                "size": 100,
-                "opacity": 0.5,
-                "type": "circle"
-            },
             "encoding": {
                 "x": {
                     "field": "x",
@@ -70,6 +64,12 @@
                     },
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "opacity": 0.5,
+                "size": 100,
+                "type": "circle"
             }
         }
     ]
diff --git a/tests/specs/interaction/bindlegend.vl b/tests/specs/interaction/bindlegend.vl
--- a/tests/specs/interaction/bindlegend.vl
+++ b/tests/specs/interaction/bindlegend.vl
@@ -1,22 +1,10 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "bind": "legend",
-            "type": "single",
-            "fields": [
-                "crimeType"
-            ]
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -39,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -58,5 +47,16 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "mySelection": {
+            "bind": "legend",
+            "fields": [
+                "crimeType"
+            ],
+            "type": "single"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/bindlegend2.vl b/tests/specs/interaction/bindlegend2.vl
--- a/tests/specs/interaction/bindlegend2.vl
+++ b/tests/specs/interaction/bindlegend2.vl
@@ -1,24 +1,10 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "bind": {
-                "legend": "dblclick"
-            },
-            "encodings": [
-                "color"
-            ],
-            "type": "single"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -41,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -60,5 +47,18 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "mySelection": {
+            "bind": {
+                "legend": "dblclick"
+            },
+            "encodings": [
+                "color"
+            ],
+            "type": "single"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/bindlegendboth.vl b/tests/specs/interaction/bindlegendboth.vl
--- a/tests/specs/interaction/bindlegendboth.vl
+++ b/tests/specs/interaction/bindlegendboth.vl
@@ -1,25 +1,10 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "bind": {
-                "legend": "dblclick"
-            },
-            "type": "multi",
-            "on": "click",
-            "fields": [
-                "crimeType"
-            ]
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -42,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -61,5 +47,19 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "mySelection": {
+            "bind": {
+                "legend": "dblclick"
+            },
+            "fields": [
+                "crimeType"
+            ],
+            "on": "click",
+            "type": "multi"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/curhelp.vl b/tests/specs/interaction/curhelp.vl
--- a/tests/specs/interaction/curhelp.vl
+++ b/tests/specs/interaction/curhelp.vl
@@ -1,45 +1,45 @@
 {
-    "transform": [
-        {
-            "filter": "datum.symbol==='GOOG'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "cursor": "text"
         }
     },
-    "mark": "line",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/stocks.csv",
         "format": {
             "parse": {
                 "date": "date"
             },
             "type": "csv"
+        },
+        "url": "https://vega.github.io/vega-lite/data/stocks.csv"
+    },
+    "encoding": {
+        "x": {
+            "field": "date",
+            "type": "temporal"
+        },
+        "y": {
+            "field": "price",
+            "type": "quantitative"
         }
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "mark": "line",
     "selection": {
         "myBrush": {
-            "mark": {
-                "cursor": "help"
-            },
             "encodings": [
                 "x"
             ],
+            "mark": {
+                "cursor": "help"
+            },
             "type": "interval"
         }
     },
-    "encoding": {
-        "x": {
-            "field": "date",
-            "type": "temporal"
-        },
-        "y": {
-            "field": "price",
-            "type": "quantitative"
+    "transform": [
+        {
+            "filter": "datum.symbol==='GOOG'"
         }
-    }
+    ],
+    "width": 400
 }
diff --git a/tests/specs/interaction/curpointer.vl b/tests/specs/interaction/curpointer.vl
--- a/tests/specs/interaction/curpointer.vl
+++ b/tests/specs/interaction/curpointer.vl
@@ -1,45 +1,45 @@
 {
-    "transform": [
-        {
-            "filter": "datum.symbol==='GOOG'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "cursor": "text"
         }
     },
-    "mark": "line",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/stocks.csv",
         "format": {
             "parse": {
                 "date": "date"
             },
             "type": "csv"
+        },
+        "url": "https://vega.github.io/vega-lite/data/stocks.csv"
+    },
+    "encoding": {
+        "x": {
+            "field": "date",
+            "type": "temporal"
+        },
+        "y": {
+            "field": "price",
+            "type": "quantitative"
         }
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "mark": "line",
     "selection": {
         "myBrush": {
-            "mark": {
-                "cursor": "pointer"
-            },
             "encodings": [
                 "x"
             ],
+            "mark": {
+                "cursor": "pointer"
+            },
             "type": "interval"
         }
     },
-    "encoding": {
-        "x": {
-            "field": "date",
-            "type": "temporal"
-        },
-        "y": {
-            "field": "price",
-            "type": "quantitative"
+    "transform": [
+        {
+            "filter": "datum.symbol==='GOOG'"
         }
-    }
+    ],
+    "width": 400
 }
diff --git a/tests/specs/interaction/initinterval.vl b/tests/specs/interaction/initinterval.vl
--- a/tests/specs/interaction/initinterval.vl
+++ b/tests/specs/interaction/initinterval.vl
@@ -1,18 +1,10 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "type": "interval"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -35,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -54,5 +47,12 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "mySelection": {
+            "type": "interval"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/initintervalx.vl b/tests/specs/interaction/initintervalx.vl
--- a/tests/specs/interaction/initintervalx.vl
+++ b/tests/specs/interaction/initintervalx.vl
@@ -1,31 +1,10 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "init": {
-                "x": [
-                    {
-                        "year": 2013
-                    },
-                    {
-                        "year": 2015
-                    }
-                ]
-            },
-            "encodings": [
-                "x"
-            ],
-            "type": "interval"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -48,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -67,5 +47,25 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "mySelection": {
+            "encodings": [
+                "x"
+            ],
+            "init": {
+                "x": [
+                    {
+                        "year": 2013
+                    },
+                    {
+                        "year": 2015
+                    }
+                ]
+            },
+            "type": "interval"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/initintervalxy.vl b/tests/specs/interaction/initintervalxy.vl
--- a/tests/specs/interaction/initintervalxy.vl
+++ b/tests/specs/interaction/initintervalxy.vl
@@ -1,32 +1,10 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "init": {
-                "x": [
-                    {
-                        "year": 2013
-                    },
-                    {
-                        "year": 2015
-                    }
-                ],
-                "y": [
-                    4000,
-                    8000
-                ]
-            },
-            "type": "interval"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -49,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -68,5 +47,26 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "mySelection": {
+            "init": {
+                "x": [
+                    {
+                        "year": 2013
+                    },
+                    {
+                        "year": 2015
+                    }
+                ],
+                "y": [
+                    4000,
+                    8000
+                ]
+            },
+            "type": "interval"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/initintervaly.vl b/tests/specs/interaction/initintervaly.vl
--- a/tests/specs/interaction/initintervaly.vl
+++ b/tests/specs/interaction/initintervaly.vl
@@ -1,24 +1,10 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "init": {
-                "y": [
-                    4000,
-                    8000
-                ]
-            },
-            "type": "interval"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -41,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -60,5 +47,18 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "mySelection": {
+            "init": {
+                "y": [
+                    4000,
+                    8000
+                ]
+            },
+            "type": "interval"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/interaction1.vl b/tests/specs/interaction/interaction1.vl
--- a/tests/specs/interaction/interaction1.vl
+++ b/tests/specs/interaction/interaction1.vl
@@ -1,18 +1,10 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "type": "single"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -35,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -54,5 +47,12 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line",
+    "selection": {
+        "mySelection": {
+            "type": "single"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/interaction2.vl b/tests/specs/interaction/interaction2.vl
--- a/tests/specs/interaction/interaction2.vl
+++ b/tests/specs/interaction/interaction2.vl
@@ -1,18 +1,10 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "type": "multi"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -35,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -54,5 +47,12 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line",
+    "selection": {
+        "mySelection": {
+            "type": "multi"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/interaction3.vl b/tests/specs/interaction/interaction3.vl
--- a/tests/specs/interaction/interaction3.vl
+++ b/tests/specs/interaction/interaction3.vl
@@ -1,22 +1,10 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "nearest": true,
-            "type": "single",
-            "fields": [
-                "crimeType"
-            ]
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -39,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -58,5 +47,16 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "mySelection": {
+            "fields": [
+                "crimeType"
+            ],
+            "nearest": true,
+            "type": "single"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/interaction4.vl b/tests/specs/interaction/interaction4.vl
--- a/tests/specs/interaction/interaction4.vl
+++ b/tests/specs/interaction/interaction4.vl
@@ -1,22 +1,10 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "empty": "none",
-            "encodings": [
-                "x"
-            ],
-            "type": "interval"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -39,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -58,5 +47,16 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "mySelection": {
+            "empty": "none",
+            "encodings": [
+                "x"
+            ],
+            "type": "interval"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/interaction5.vl b/tests/specs/interaction/interaction5.vl
--- a/tests/specs/interaction/interaction5.vl
+++ b/tests/specs/interaction/interaction5.vl
@@ -1,22 +1,10 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "bind": "scales",
-            "encodings": [
-                "x"
-            ],
-            "type": "interval"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -39,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -58,5 +47,16 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "mySelection": {
+            "bind": "scales",
+            "encodings": [
+                "x"
+            ],
+            "type": "interval"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/interaction6.vl b/tests/specs/interaction/interaction6.vl
--- a/tests/specs/interaction/interaction6.vl
+++ b/tests/specs/interaction/interaction6.vl
@@ -1,19 +1,10 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "bind": "scales",
-            "type": "interval"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -36,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -55,5 +47,13 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "mySelection": {
+            "bind": "scales",
+            "type": "interval"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/interaction7.vl b/tests/specs/interaction/interaction7.vl
--- a/tests/specs/interaction/interaction7.vl
+++ b/tests/specs/interaction/interaction7.vl
@@ -1,35 +1,10 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "mySelection": {
-            "nearest": true,
-            "bind": {
-                "crimeType": {
-                    "input": "radio",
-                    "name": " ",
-                    "options": [
-                        "Anti-social behaviour",
-                        "Criminal damage and arson",
-                        "Drugs",
-                        "Robbery",
-                        "Vehicle crime"
-                    ]
-                }
-            },
-            "type": "single",
-            "fields": [
-                "crimeType"
-            ]
-        }
-    },
     "encoding": {
         "color": {
-            "value": "black",
             "condition": {
                 "field": "crimeType",
                 "scale": {
@@ -52,14 +27,15 @@
                 },
                 "selection": "mySelection",
                 "type": "nominal"
-            }
+            },
+            "value": "black"
         },
         "opacity": {
-            "value": 0.1,
             "condition": {
-                "value": 1,
-                "selection": "mySelection"
-            }
+                "selection": "mySelection",
+                "value": 1
+            },
+            "value": 0.1
         },
         "x": {
             "field": "month",
@@ -71,5 +47,29 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "mySelection": {
+            "bind": {
+                "crimeType": {
+                    "input": "radio",
+                    "name": " ",
+                    "options": [
+                        "Anti-social behaviour",
+                        "Criminal damage and arson",
+                        "Drugs",
+                        "Robbery",
+                        "Vehicle crime"
+                    ]
+                }
+            },
+            "fields": [
+                "crimeType"
+            ],
+            "nearest": true,
+            "type": "single"
+        }
+    },
+    "width": 540
 }
diff --git a/tests/specs/interaction/interaction8.vl b/tests/specs/interaction/interaction8.vl
--- a/tests/specs/interaction/interaction8.vl
+++ b/tests/specs/interaction/interaction8.vl
@@ -1,44 +1,8 @@
 {
-    "transform": [
-        {
-            "filter": "datum.reportedCrimes >= minSlider_minReported && maxSlider_maxReported >= datum.reportedCrimes"
-        }
-    ],
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 540,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "maxSlider": {
-            "init": {
-                "maxReported": 14000
-            },
-            "bind": {
-                "maxReported": {
-                    "max": 14000,
-                    "input": "range",
-                    "name": "Max",
-                    "min": 400
-                }
-            },
-            "type": "single"
-        },
-        "minSlider": {
-            "init": {
-                "minReported": 0
-            },
-            "bind": {
-                "minReported": {
-                    "max": 12800,
-                    "input": "range",
-                    "name": "Min"
-                }
-            },
-            "type": "single"
-        }
-    },
     "encoding": {
         "color": {
             "field": "crimeType",
@@ -72,5 +36,41 @@
             "title": "Reported crimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "selection": {
+        "maxSlider": {
+            "bind": {
+                "maxReported": {
+                    "input": "range",
+                    "max": 14000,
+                    "min": 400,
+                    "name": "Max"
+                }
+            },
+            "init": {
+                "maxReported": 14000
+            },
+            "type": "single"
+        },
+        "minSlider": {
+            "bind": {
+                "minReported": {
+                    "input": "range",
+                    "max": 12800,
+                    "name": "Min"
+                }
+            },
+            "init": {
+                "minReported": 0
+            },
+            "type": "single"
+        }
+    },
+    "transform": [
+        {
+            "filter": "datum.reportedCrimes >= minSlider_minReported && maxSlider_maxReported >= datum.reportedCrimes"
+        }
+    ],
+    "width": 540
 }
diff --git a/tests/specs/interaction/lookupSelection1.vl b/tests/specs/interaction/lookupSelection1.vl
--- a/tests/specs/interaction/lookupSelection1.vl
+++ b/tests/specs/interaction/lookupSelection1.vl
@@ -1,48 +1,66 @@
 {
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/stocks.csv",
         "format": {
             "parse": {
                 "date": "date"
             },
             "type": "csv"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "width": 650,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
     "layer": [
         {
+            "encoding": {
+                "opacity": {
+                    "value": 0
+                },
+                "x": {
+                    "axis": null,
+                    "field": "date",
+                    "type": "temporal"
+                }
+            },
             "mark": "point",
             "selection": {
                 "index": {
-                    "nearest": true,
+                    "encodings": [
+                        "x"
+                    ],
                     "init": {
                         "x": {
                             "date": 1,
-                            "year": 2005,
-                            "month": 1
+                            "month": 1,
+                            "year": 2005
                         }
                     },
-                    "encodings": [
-                        "x"
-                    ],
-                    "type": "single",
-                    "on": "mouseover"
+                    "nearest": true,
+                    "on": "mouseover",
+                    "type": "single"
                 }
-            },
+            }
+        },
+        {
             "encoding": {
-                "opacity": {
-                    "value": 0
+                "color": {
+                    "field": "symbol",
+                    "type": "nominal"
                 },
                 "x": {
+                    "axis": null,
                     "field": "date",
-                    "type": "temporal",
-                    "axis": null
+                    "type": "temporal"
+                },
+                "y": {
+                    "axis": {
+                        "format": "%"
+                    },
+                    "field": "indexed_price",
+                    "type": "quantitative"
                 }
-            }
-        },
-        {
+            },
+            "mark": "line",
             "transform": [
                 {
                     "from": {
@@ -55,35 +73,19 @@
                     "as": "indexed_price",
                     "calculate": "datum.index && datum.index.price > 0 ? (datum.price - datum.index.price)/datum.index.price : 0"
                 }
-            ],
-            "mark": "line",
+            ]
+        },
+        {
             "encoding": {
                 "color": {
-                    "field": "symbol",
-                    "type": "nominal"
+                    "value": "firebrick"
                 },
                 "x": {
+                    "axis": null,
                     "field": "date",
-                    "type": "temporal",
-                    "axis": null
-                },
-                "y": {
-                    "field": "indexed_price",
-                    "type": "quantitative",
-                    "axis": {
-                        "format": "%"
-                    }
-                }
-            }
-        },
-        {
-            "transform": [
-                {
-                    "filter": {
-                        "selection": "index"
-                    }
+                    "type": "temporal"
                 }
-            ],
+            },
             "layer": [
                 {
                     "mark": {
@@ -92,11 +94,6 @@
                     }
                 },
                 {
-                    "mark": {
-                        "align": "center",
-                        "type": "text",
-                        "fontWeight": 100
-                    },
                     "encoding": {
                         "text": {
                             "field": "date",
@@ -106,19 +103,22 @@
                         "y": {
                             "value": 310
                         }
+                    },
+                    "mark": {
+                        "align": "center",
+                        "fontWeight": 100,
+                        "type": "text"
                     }
                 }
             ],
-            "encoding": {
-                "color": {
-                    "value": "firebrick"
-                },
-                "x": {
-                    "field": "date",
-                    "type": "temporal",
-                    "axis": null
+            "transform": [
+                {
+                    "filter": {
+                        "selection": "index"
+                    }
                 }
-            }
+            ]
         }
-    ]
+    ],
+    "width": 650
 }
diff --git a/tests/specs/legend/corners1.vl b/tests/specs/legend/corners1.vl
--- a/tests/specs/legend/corners1.vl
+++ b/tests/specs/legend/corners1.vl
@@ -1,50 +1,47 @@
 {
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "legend": {
-            "labelOpacity": 0.6,
             "cornerRadius": 5,
-            "symbolStrokeColor": null,
-            "strokeWidth": 2,
             "fillColor": "pink",
+            "labelAlign": "right",
+            "labelBaseline": "top",
+            "labelColor": "fireBrick",
+            "labelFontSize": 20,
+            "labelFontWeight": 600,
+            "labelOpacity": 0.6,
             "labelOverlap": "greedy",
+            "padding": 30,
             "rowPadding": 15,
-            "labelColor": "fireBrick",
-            "titlePadding": 20,
-            "symbolStrokeWidth": 1,
+            "strokeColor": "orange",
             "strokeDash": [
                 4,
                 2,
                 6,
                 1
             ],
-            "labelFontWeight": 600,
-            "labelBaseline": "top",
-            "labelFontSize": 20,
-            "labelAlign": "right",
-            "padding": 30,
-            "strokeColor": "orange"
+            "strokeWidth": 2,
+            "symbolStrokeColor": null,
+            "symbolStrokeWidth": 1,
+            "titlePadding": 20
         }
     },
-    "mark": "circle",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
             "type": "nominal"
         },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative"
-        },
         "opacity": {
             "field": "Weight_in_lbs",
             "type": "quantitative"
         },
+        "size": {
+            "field": "Horsepower",
+            "type": "quantitative"
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -53,5 +50,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/corners2.vl b/tests/specs/legend/corners2.vl
--- a/tests/specs/legend/corners2.vl
+++ b/tests/specs/legend/corners2.vl
@@ -1,80 +1,77 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
             "legend": {
-                "labelOpacity": 0.6,
                 "cornerRadius": 5,
-                "symbolStrokeColor": null,
                 "fillColor": "pink",
-                "labelOverlap": "greedy",
-                "rowPadding": 15,
-                "symbolLimit": 5,
+                "labelAlign": "right",
+                "labelBaseline": "top",
                 "labelColor": "fireBrick",
                 "labelExpr": "'<' + datum.label + '>'",
-                "titlePadding": 20,
-                "symbolStrokeWidth": 1,
-                "labelFontWeight": 600,
-                "labelBaseline": "top",
                 "labelFontSize": 20,
-                "labelAlign": "right",
-                "padding": 30,
-                "strokeColor": "orange"
-            }
-        },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative",
-            "legend": {
+                "labelFontWeight": 600,
                 "labelOpacity": 0.6,
-                "cornerRadius": 5,
-                "symbolStrokeColor": null,
-                "fillColor": "pink",
                 "labelOverlap": "greedy",
+                "padding": 30,
                 "rowPadding": 15,
+                "strokeColor": "orange",
                 "symbolLimit": 5,
-                "labelColor": "fireBrick",
-                "labelExpr": "'<' + datum.label + '>'",
-                "titlePadding": 20,
+                "symbolStrokeColor": null,
                 "symbolStrokeWidth": 1,
-                "labelFontWeight": 600,
-                "labelBaseline": "top",
-                "labelFontSize": 20,
-                "labelAlign": "right",
-                "padding": 30,
-                "strokeColor": "orange"
-            }
+                "titlePadding": 20
+            },
+            "type": "nominal"
         },
         "opacity": {
             "field": "Weight_in_lbs",
-            "type": "quantitative",
             "legend": {
-                "labelOpacity": 0.6,
                 "cornerRadius": 5,
-                "symbolStrokeColor": null,
                 "fillColor": "pink",
+                "labelAlign": "right",
+                "labelBaseline": "top",
+                "labelColor": "fireBrick",
+                "labelExpr": "'<' + datum.label + '>'",
+                "labelFontSize": 20,
+                "labelFontWeight": 600,
+                "labelOpacity": 0.6,
                 "labelOverlap": "greedy",
+                "padding": 30,
                 "rowPadding": 15,
+                "strokeColor": "orange",
                 "symbolLimit": 5,
-                "labelColor": "fireBrick",
-                "labelExpr": "'<' + datum.label + '>'",
-                "titlePadding": 20,
+                "symbolStrokeColor": null,
                 "symbolStrokeWidth": 1,
-                "labelFontWeight": 600,
+                "titlePadding": 20
+            },
+            "type": "quantitative"
+        },
+        "size": {
+            "field": "Horsepower",
+            "legend": {
+                "cornerRadius": 5,
+                "fillColor": "pink",
+                "labelAlign": "right",
                 "labelBaseline": "top",
+                "labelColor": "fireBrick",
+                "labelExpr": "'<' + datum.label + '>'",
                 "labelFontSize": 20,
-                "labelAlign": "right",
+                "labelFontWeight": 600,
+                "labelOpacity": 0.6,
+                "labelOverlap": "greedy",
                 "padding": 30,
-                "strokeColor": "orange"
-            }
+                "rowPadding": 15,
+                "strokeColor": "orange",
+                "symbolLimit": 5,
+                "symbolStrokeColor": null,
+                "symbolStrokeWidth": 1,
+                "titlePadding": 20
+            },
+            "type": "quantitative"
         },
         "x": {
             "field": "Horsepower",
@@ -84,5 +81,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/disablelegend.vl b/tests/specs/legend/disablelegend.vl
--- a/tests/specs/legend/disablelegend.vl
+++ b/tests/specs/legend/disablelegend.vl
@@ -1,29 +1,26 @@
 {
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "legend": {
             "disable": true
         }
     },
-    "mark": "circle",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
             "type": "nominal"
         },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative"
-        },
         "opacity": {
             "field": "Weight_in_lbs",
             "type": "quantitative"
         },
+        "size": {
+            "field": "Horsepower",
+            "type": "quantitative"
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -32,5 +29,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/legend1.vl b/tests/specs/legend/legend1.vl
--- a/tests/specs/legend/legend1.vl
+++ b/tests/specs/legend/legend1.vl
@@ -1,27 +1,24 @@
 {
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "legend": {}
     },
-    "mark": "circle",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
             "type": "nominal"
         },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative"
-        },
         "opacity": {
             "field": "Weight_in_lbs",
             "type": "quantitative"
         },
+        "size": {
+            "field": "Horsepower",
+            "type": "quantitative"
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -30,5 +27,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/legend10.vl b/tests/specs/legend/legend10.vl
--- a/tests/specs/legend/legend10.vl
+++ b/tests/specs/legend/legend10.vl
@@ -1,20 +1,17 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
             "legend": {
-                "orient": "none",
+                "legendX": 232,
                 "legendY": 5,
-                "legendX": 232
-            }
+                "orient": "none"
+            },
+            "type": "nominal"
         },
         "x": {
             "field": "Horsepower",
@@ -24,5 +21,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/legend11.vl b/tests/specs/legend/legend11.vl
--- a/tests/specs/legend/legend11.vl
+++ b/tests/specs/legend/legend11.vl
@@ -1,41 +1,38 @@
 {
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "legend": {
-            "symbolStrokeColor": "black",
-            "strokeWidth": 5,
+            "padding": 30,
             "rowPadding": 15,
-            "titlePadding": 20,
-            "symbolStrokeWidth": 3,
+            "strokeColor": "lightgrey",
             "strokeDash": [
                 4,
                 2,
                 6,
                 1
             ],
-            "padding": 30,
-            "strokeColor": "lightgrey"
+            "strokeWidth": 5,
+            "symbolStrokeColor": "black",
+            "symbolStrokeWidth": 3,
+            "titlePadding": 20
         }
     },
-    "mark": "circle",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
             "type": "nominal"
         },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative"
-        },
         "opacity": {
             "field": "Weight_in_lbs",
             "type": "quantitative"
         },
+        "size": {
+            "field": "Horsepower",
+            "type": "quantitative"
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -44,5 +41,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/legend11d.vl b/tests/specs/legend/legend11d.vl
--- a/tests/specs/legend/legend11d.vl
+++ b/tests/specs/legend/legend11d.vl
@@ -1,47 +1,44 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
             "legend": {
-                "symbolStrokeColor": "black",
-                "rowPadding": 15,
-                "titlePadding": 20,
-                "symbolStrokeWidth": 3,
                 "padding": 30,
-                "strokeColor": "lightgrey"
-            }
-        },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative",
-            "legend": {
-                "symbolStrokeColor": "black",
                 "rowPadding": 15,
-                "titlePadding": 20,
+                "strokeColor": "lightgrey",
+                "symbolStrokeColor": "black",
                 "symbolStrokeWidth": 3,
-                "padding": 30,
-                "strokeColor": "lightgrey"
-            }
+                "titlePadding": 20
+            },
+            "type": "nominal"
         },
         "opacity": {
             "field": "Weight_in_lbs",
-            "type": "quantitative",
             "legend": {
-                "symbolStrokeColor": "black",
+                "padding": 30,
                 "rowPadding": 15,
-                "titlePadding": 20,
+                "strokeColor": "lightgrey",
+                "symbolStrokeColor": "black",
                 "symbolStrokeWidth": 3,
+                "titlePadding": 20
+            },
+            "type": "quantitative"
+        },
+        "size": {
+            "field": "Horsepower",
+            "legend": {
                 "padding": 30,
-                "strokeColor": "lightgrey"
-            }
+                "rowPadding": 15,
+                "strokeColor": "lightgrey",
+                "symbolStrokeColor": "black",
+                "symbolStrokeWidth": 3,
+                "titlePadding": 20
+            },
+            "type": "quantitative"
         },
         "x": {
             "field": "Horsepower",
@@ -51,5 +48,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/legend2.vl b/tests/specs/legend/legend2.vl
--- a/tests/specs/legend/legend2.vl
+++ b/tests/specs/legend/legend2.vl
@@ -1,32 +1,29 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
             "legend": {
                 "orient": "top"
-            }
+            },
+            "type": "nominal"
         },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative",
+        "opacity": {
+            "field": "Weight_in_lbs",
             "legend": {
                 "orient": "top"
-            }
+            },
+            "type": "quantitative"
         },
-        "opacity": {
-            "field": "Weight_in_lbs",
-            "type": "quantitative",
+        "size": {
+            "field": "Horsepower",
             "legend": {
                 "orient": "top"
-            }
+            },
+            "type": "quantitative"
         },
         "x": {
             "field": "Horsepower",
@@ -36,5 +33,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/legend3.vl b/tests/specs/legend/legend3.vl
--- a/tests/specs/legend/legend3.vl
+++ b/tests/specs/legend/legend3.vl
@@ -1,32 +1,29 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
             "legend": {
                 "orient": "top-right"
-            }
+            },
+            "type": "nominal"
         },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative",
+        "opacity": {
+            "field": "Weight_in_lbs",
             "legend": {
                 "orient": "top-right"
-            }
+            },
+            "type": "quantitative"
         },
-        "opacity": {
-            "field": "Weight_in_lbs",
-            "type": "quantitative",
+        "size": {
+            "field": "Horsepower",
             "legend": {
                 "orient": "top-right"
-            }
+            },
+            "type": "quantitative"
         },
         "x": {
             "field": "Horsepower",
@@ -36,5 +33,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/legend4.vl b/tests/specs/legend/legend4.vl
--- a/tests/specs/legend/legend4.vl
+++ b/tests/specs/legend/legend4.vl
@@ -1,32 +1,29 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
             "legend": {
                 "orient": "right"
-            }
+            },
+            "type": "nominal"
         },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative",
+        "opacity": {
+            "field": "Weight_in_lbs",
             "legend": {
                 "orient": "right"
-            }
+            },
+            "type": "quantitative"
         },
-        "opacity": {
-            "field": "Weight_in_lbs",
-            "type": "quantitative",
+        "size": {
+            "field": "Horsepower",
             "legend": {
                 "orient": "right"
-            }
+            },
+            "type": "quantitative"
         },
         "x": {
             "field": "Horsepower",
@@ -36,5 +33,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/legend5.vl b/tests/specs/legend/legend5.vl
--- a/tests/specs/legend/legend5.vl
+++ b/tests/specs/legend/legend5.vl
@@ -1,32 +1,29 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
             "legend": {
                 "orient": "bottom-right"
-            }
+            },
+            "type": "nominal"
         },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative",
+        "opacity": {
+            "field": "Weight_in_lbs",
             "legend": {
                 "orient": "bottom-right"
-            }
+            },
+            "type": "quantitative"
         },
-        "opacity": {
-            "field": "Weight_in_lbs",
-            "type": "quantitative",
+        "size": {
+            "field": "Horsepower",
             "legend": {
                 "orient": "bottom-right"
-            }
+            },
+            "type": "quantitative"
         },
         "x": {
             "field": "Horsepower",
@@ -36,5 +33,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/legend6.vl b/tests/specs/legend/legend6.vl
--- a/tests/specs/legend/legend6.vl
+++ b/tests/specs/legend/legend6.vl
@@ -1,32 +1,29 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
             "legend": {
                 "orient": "bottom"
-            }
+            },
+            "type": "nominal"
         },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative",
+        "opacity": {
+            "field": "Weight_in_lbs",
             "legend": {
                 "orient": "bottom"
-            }
+            },
+            "type": "quantitative"
         },
-        "opacity": {
-            "field": "Weight_in_lbs",
-            "type": "quantitative",
+        "size": {
+            "field": "Horsepower",
             "legend": {
                 "orient": "bottom"
-            }
+            },
+            "type": "quantitative"
         },
         "x": {
             "field": "Horsepower",
@@ -36,5 +33,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/legend7.vl b/tests/specs/legend/legend7.vl
--- a/tests/specs/legend/legend7.vl
+++ b/tests/specs/legend/legend7.vl
@@ -1,32 +1,29 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
             "legend": {
                 "orient": "bottom-left"
-            }
+            },
+            "type": "nominal"
         },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative",
+        "opacity": {
+            "field": "Weight_in_lbs",
             "legend": {
                 "orient": "bottom-left"
-            }
+            },
+            "type": "quantitative"
         },
-        "opacity": {
-            "field": "Weight_in_lbs",
-            "type": "quantitative",
+        "size": {
+            "field": "Horsepower",
             "legend": {
                 "orient": "bottom-left"
-            }
+            },
+            "type": "quantitative"
         },
         "x": {
             "field": "Horsepower",
@@ -36,5 +33,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/legend8.vl b/tests/specs/legend/legend8.vl
--- a/tests/specs/legend/legend8.vl
+++ b/tests/specs/legend/legend8.vl
@@ -1,32 +1,29 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
             "legend": {
                 "orient": "left"
-            }
+            },
+            "type": "nominal"
         },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative",
+        "opacity": {
+            "field": "Weight_in_lbs",
             "legend": {
                 "orient": "left"
-            }
+            },
+            "type": "quantitative"
         },
-        "opacity": {
-            "field": "Weight_in_lbs",
-            "type": "quantitative",
+        "size": {
+            "field": "Horsepower",
             "legend": {
                 "orient": "left"
-            }
+            },
+            "type": "quantitative"
         },
         "x": {
             "field": "Horsepower",
@@ -36,5 +33,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/legend9.vl b/tests/specs/legend/legend9.vl
--- a/tests/specs/legend/legend9.vl
+++ b/tests/specs/legend/legend9.vl
@@ -1,32 +1,29 @@
 {
-    "height": 300,
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
             "legend": {
                 "orient": "top-left"
-            }
+            },
+            "type": "nominal"
         },
-        "size": {
-            "field": "Horsepower",
-            "type": "quantitative",
+        "opacity": {
+            "field": "Weight_in_lbs",
             "legend": {
                 "orient": "top-left"
-            }
+            },
+            "type": "quantitative"
         },
-        "opacity": {
-            "field": "Weight_in_lbs",
-            "type": "quantitative",
+        "size": {
+            "field": "Horsepower",
             "legend": {
                 "orient": "top-left"
-            }
+            },
+            "type": "quantitative"
         },
         "x": {
             "field": "Horsepower",
@@ -36,5 +33,8 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": "circle",
+    "width": 300
 }
diff --git a/tests/specs/legend/limits1.vl b/tests/specs/legend/limits1.vl
--- a/tests/specs/legend/limits1.vl
+++ b/tests/specs/legend/limits1.vl
@@ -1,48 +1,30 @@
 {
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "legend": {
             "symbolLimit": 1,
             "unselectedOpacity": 0.1
         }
     },
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "sel": {
-            "bind": {
-                "legend": "dblclick"
-            },
-            "type": "multi",
-            "on": "click",
-            "fields": [
-                "Origin"
-            ]
-        }
-    },
     "encoding": {
         "color": {
             "field": "Origin",
             "type": "nominal"
         },
-        "size": {
-            "value": 20,
-            "condition": {
-                "value": 100,
-                "selection": "sel"
-            }
-        },
         "shape": {
             "field": "Origin",
             "type": "nominal"
         },
+        "size": {
+            "condition": {
+                "selection": "sel",
+                "value": 100
+            },
+            "value": 20
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -51,5 +33,23 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "selection": {
+        "sel": {
+            "bind": {
+                "legend": "dblclick"
+            },
+            "fields": [
+                "Origin"
+            ],
+            "on": "click",
+            "type": "multi"
+        }
+    },
+    "width": 300
 }
diff --git a/tests/specs/legend/limits2.vl b/tests/specs/legend/limits2.vl
--- a/tests/specs/legend/limits2.vl
+++ b/tests/specs/legend/limits2.vl
@@ -1,48 +1,30 @@
 {
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "legend": {
             "symbolLimit": 2,
             "unselectedOpacity": 0.1
         }
     },
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "sel": {
-            "bind": {
-                "legend": "dblclick"
-            },
-            "type": "multi",
-            "on": "click",
-            "fields": [
-                "Origin"
-            ]
-        }
-    },
     "encoding": {
         "color": {
             "field": "Origin",
             "type": "nominal"
         },
-        "size": {
-            "value": 20,
-            "condition": {
-                "value": 100,
-                "selection": "sel"
-            }
-        },
         "shape": {
             "field": "Origin",
             "type": "nominal"
         },
+        "size": {
+            "condition": {
+                "selection": "sel",
+                "value": 100
+            },
+            "value": 20
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -51,5 +33,23 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "selection": {
+        "sel": {
+            "bind": {
+                "legend": "dblclick"
+            },
+            "fields": [
+                "Origin"
+            ],
+            "on": "click",
+            "type": "multi"
+        }
+    },
+    "width": 300
 }
diff --git a/tests/specs/legend/limits3.vl b/tests/specs/legend/limits3.vl
--- a/tests/specs/legend/limits3.vl
+++ b/tests/specs/legend/limits3.vl
@@ -1,48 +1,30 @@
 {
-    "height": 300,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "legend": {
             "symbolLimit": 3,
             "unselectedOpacity": 0.1
         }
     },
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "sel": {
-            "bind": {
-                "legend": "dblclick"
-            },
-            "type": "multi",
-            "on": "click",
-            "fields": [
-                "Origin"
-            ]
-        }
-    },
     "encoding": {
         "color": {
             "field": "Origin",
             "type": "nominal"
         },
-        "size": {
-            "value": 20,
-            "condition": {
-                "value": 100,
-                "selection": "sel"
-            }
-        },
         "shape": {
             "field": "Origin",
             "type": "nominal"
         },
+        "size": {
+            "condition": {
+                "selection": "sel",
+                "value": 100
+            },
+            "value": 20
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -51,5 +33,23 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 300,
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "selection": {
+        "sel": {
+            "bind": {
+                "legend": "dblclick"
+            },
+            "fields": [
+                "Origin"
+            ],
+            "on": "click",
+            "type": "multi"
+        }
+    },
+    "width": 300
 }
diff --git a/tests/specs/null/axis1.vl b/tests/specs/null/axis1.vl
--- a/tests/specs/null/axis1.vl
+++ b/tests/specs/null/axis1.vl
@@ -1,54 +1,54 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "x": 0,
                 "order": 1,
+                "x": 0,
                 "y": 1000
             },
             {
-                "x": 1000,
                 "order": 2,
+                "x": 1000,
                 "y": 1000
             },
             {
-                "x": 1000,
                 "order": 3,
+                "x": 1000,
                 "y": 0
             },
             {
-                "x": 0,
                 "order": 4,
+                "x": 0,
                 "y": 0
             },
             {
-                "x": 0,
                 "order": 5,
+                "x": 0,
                 "y": 1000
             },
             {
-                "x": 1000,
                 "order": 6,
+                "x": 1000,
                 "y": 0
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
-        "x": {
-            "field": "x",
-            "type": "quantitative",
-            "axis": null
-        },
         "order": {
             "field": "order",
             "type": "ordinal"
         },
+        "x": {
+            "axis": null,
+            "field": "x",
+            "type": "quantitative"
+        },
         "y": {
+            "axis": null,
             "field": "y",
-            "type": "quantitative",
-            "axis": null
+            "type": "quantitative"
         }
-    }
+    },
+    "mark": "line"
 }
diff --git a/tests/specs/null/filter1.vl b/tests/specs/null/filter1.vl
--- a/tests/specs/null/filter1.vl
+++ b/tests/specs/null/filter1.vl
@@ -1,21 +1,20 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "mark": {
             "invalid": null
         }
     },
-    "mark": "point",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
-            "value": "rgb(76,120,168)",
             "condition": {
-                "value": "#ddd",
-                "test": "datum.IMDB_Rating === null || datum.Rotten_Tomatoes_Rating === null"
-            }
+                "test": "datum.IMDB_Rating === null || datum.Rotten_Tomatoes_Rating === null",
+                "value": "#ddd"
+            },
+            "value": "rgb(76,120,168)"
         },
         "x": {
             "field": "IMDB_Rating",
@@ -25,5 +24,6 @@
             "field": "Rotten_Tomatoes_Rating",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/null/filter2.vl b/tests/specs/null/filter2.vl
--- a/tests/specs/null/filter2.vl
+++ b/tests/specs/null/filter2.vl
@@ -1,35 +1,20 @@
 {
-    "transform": [
-        {
-            "filter": {
-                "field": "IMDB_Rating",
-                "valid": true
-            }
-        },
-        {
-            "filter": {
-                "field": "Rotten_Tomatoes_Rating",
-                "valid": true
-            }
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "mark": {
             "invalid": "filter"
         }
     },
-    "mark": "point",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
-            "value": "rgb(76,120,168)",
             "condition": {
-                "value": "#ddd",
-                "test": "datum.IMDB_Rating === null || datum.Rotten_Tomatoes_Rating === null"
-            }
+                "test": "datum.IMDB_Rating === null || datum.Rotten_Tomatoes_Rating === null",
+                "value": "#ddd"
+            },
+            "value": "rgb(76,120,168)"
         },
         "x": {
             "field": "IMDB_Rating",
@@ -39,5 +24,20 @@
             "field": "Rotten_Tomatoes_Rating",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "point",
+    "transform": [
+        {
+            "filter": {
+                "field": "IMDB_Rating",
+                "valid": true
+            }
+        },
+        {
+            "filter": {
+                "field": "Rotten_Tomatoes_Rating",
+                "valid": true
+            }
+        }
+    ]
 }
diff --git a/tests/specs/null/scale0.vl b/tests/specs/null/scale0.vl
--- a/tests/specs/null/scale0.vl
+++ b/tests/specs/null/scale0.vl
@@ -1,85 +1,82 @@
 {
-    "height": 400,
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 40,
                 "val": 4,
+                "x": 40,
                 "y": 4
             },
             {
                 "cat": "e",
-                "x": 50,
                 "val": 5,
+                "x": 50,
                 "y": 5
             },
             {
                 "cat": "f",
-                "x": 60,
                 "val": 6,
+                "x": 60,
                 "y": 6
             },
             {
                 "cat": "g",
-                "x": 70,
                 "val": 7,
+                "x": 70,
                 "y": 7
             },
             {
                 "cat": "h",
-                "x": 80,
                 "val": 8,
+                "x": 80,
                 "y": 8
             },
             {
                 "cat": "i",
-                "x": 90,
                 "val": 9,
+                "x": 90,
                 "y": 9
             },
             {
                 "cat": "j",
-                "x": 100,
                 "val": 10,
+                "x": 100,
                 "y": 10
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "val",
             "type": "ordinal"
         },
-        "size": {
-            "field": "val",
-            "type": "quantitative"
-        },
         "shape": {
             "field": "cat",
             "type": "nominal"
         },
+        "size": {
+            "field": "val",
+            "type": "quantitative"
+        },
         "x": {
             "field": "x",
             "type": "quantitative"
@@ -88,5 +85,8 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 400,
+    "mark": "point",
+    "width": 400
 }
diff --git a/tests/specs/null/scale1.vl b/tests/specs/null/scale1.vl
--- a/tests/specs/null/scale1.vl
+++ b/tests/specs/null/scale1.vl
@@ -1,85 +1,82 @@
 {
-    "height": 400,
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 40,
                 "val": 4,
+                "x": 40,
                 "y": 4
             },
             {
                 "cat": "e",
-                "x": 50,
                 "val": 5,
+                "x": 50,
                 "y": 5
             },
             {
                 "cat": "f",
-                "x": 60,
                 "val": 6,
+                "x": 60,
                 "y": 6
             },
             {
                 "cat": "g",
-                "x": 70,
                 "val": 7,
+                "x": 70,
                 "y": 7
             },
             {
                 "cat": "h",
-                "x": 80,
                 "val": 8,
+                "x": 80,
                 "y": 8
             },
             {
                 "cat": "i",
-                "x": 90,
                 "val": 9,
+                "x": 90,
                 "y": 9
             },
             {
                 "cat": "j",
-                "x": 100,
                 "val": 10,
+                "x": 100,
                 "y": 10
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "val",
             "type": "ordinal"
         },
-        "size": {
-            "field": "val",
-            "type": "quantitative"
-        },
         "shape": {
             "field": "cat",
             "type": "nominal"
         },
+        "size": {
+            "field": "val",
+            "type": "quantitative"
+        },
         "x": {
             "field": "x",
             "scale": null,
@@ -89,5 +86,8 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 400,
+    "mark": "point",
+    "width": 400
 }
diff --git a/tests/specs/null/scale2.vl b/tests/specs/null/scale2.vl
--- a/tests/specs/null/scale2.vl
+++ b/tests/specs/null/scale2.vl
@@ -1,85 +1,82 @@
 {
-    "height": 400,
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 40,
                 "val": 4,
+                "x": 40,
                 "y": 4
             },
             {
                 "cat": "e",
-                "x": 50,
                 "val": 5,
+                "x": 50,
                 "y": 5
             },
             {
                 "cat": "f",
-                "x": 60,
                 "val": 6,
+                "x": 60,
                 "y": 6
             },
             {
                 "cat": "g",
-                "x": 70,
                 "val": 7,
+                "x": 70,
                 "y": 7
             },
             {
                 "cat": "h",
-                "x": 80,
                 "val": 8,
+                "x": 80,
                 "y": 8
             },
             {
                 "cat": "i",
-                "x": 90,
                 "val": 9,
+                "x": 90,
                 "y": 9
             },
             {
                 "cat": "j",
-                "x": 100,
                 "val": 10,
+                "x": 100,
                 "y": 10
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "val",
             "type": "ordinal"
         },
-        "size": {
-            "field": "val",
-            "type": "quantitative"
-        },
         "shape": {
             "field": "cat",
             "type": "nominal"
         },
+        "size": {
+            "field": "val",
+            "type": "quantitative"
+        },
         "x": {
             "field": "x",
             "type": "quantitative"
@@ -89,5 +86,8 @@
             "scale": null,
             "type": "quantitative"
         }
-    }
+    },
+    "height": 400,
+    "mark": "point",
+    "width": 400
 }
diff --git a/tests/specs/null/scale3.vl b/tests/specs/null/scale3.vl
--- a/tests/specs/null/scale3.vl
+++ b/tests/specs/null/scale3.vl
@@ -1,86 +1,83 @@
 {
-    "height": 400,
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 40,
                 "val": 4,
+                "x": 40,
                 "y": 4
             },
             {
                 "cat": "e",
-                "x": 50,
                 "val": 5,
+                "x": 50,
                 "y": 5
             },
             {
                 "cat": "f",
-                "x": 60,
                 "val": 6,
+                "x": 60,
                 "y": 6
             },
             {
                 "cat": "g",
-                "x": 70,
                 "val": 7,
+                "x": 70,
                 "y": 7
             },
             {
                 "cat": "h",
-                "x": 80,
                 "val": 8,
+                "x": 80,
                 "y": 8
             },
             {
                 "cat": "i",
-                "x": 90,
                 "val": 9,
+                "x": 90,
                 "y": 9
             },
             {
                 "cat": "j",
-                "x": 100,
                 "val": 10,
+                "x": 100,
                 "y": 10
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "val",
             "scale": null,
             "type": "ordinal"
         },
-        "size": {
-            "field": "val",
-            "type": "quantitative"
-        },
         "shape": {
             "field": "cat",
             "type": "nominal"
         },
+        "size": {
+            "field": "val",
+            "type": "quantitative"
+        },
         "x": {
             "field": "x",
             "type": "quantitative"
@@ -89,5 +86,8 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 400,
+    "mark": "point",
+    "width": 400
 }
diff --git a/tests/specs/null/scale4.vl b/tests/specs/null/scale4.vl
--- a/tests/specs/null/scale4.vl
+++ b/tests/specs/null/scale4.vl
@@ -1,86 +1,83 @@
 {
-    "height": 400,
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 40,
                 "val": 4,
+                "x": 40,
                 "y": 4
             },
             {
                 "cat": "e",
-                "x": 50,
                 "val": 5,
+                "x": 50,
                 "y": 5
             },
             {
                 "cat": "f",
-                "x": 60,
                 "val": 6,
+                "x": 60,
                 "y": 6
             },
             {
                 "cat": "g",
-                "x": 70,
                 "val": 7,
+                "x": 70,
                 "y": 7
             },
             {
                 "cat": "h",
-                "x": 80,
                 "val": 8,
+                "x": 80,
                 "y": 8
             },
             {
                 "cat": "i",
-                "x": 90,
                 "val": 9,
+                "x": 90,
                 "y": 9
             },
             {
                 "cat": "j",
-                "x": 100,
                 "val": 10,
+                "x": 100,
                 "y": 10
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "val",
             "type": "ordinal"
         },
+        "shape": {
+            "field": "cat",
+            "type": "nominal"
+        },
         "size": {
             "field": "val",
             "scale": null,
             "type": "quantitative"
         },
-        "shape": {
-            "field": "cat",
-            "type": "nominal"
-        },
         "x": {
             "field": "x",
             "type": "quantitative"
@@ -89,5 +86,8 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 400,
+    "mark": "point",
+    "width": 400
 }
diff --git a/tests/specs/null/scale5.vl b/tests/specs/null/scale5.vl
--- a/tests/specs/null/scale5.vl
+++ b/tests/specs/null/scale5.vl
@@ -1,86 +1,83 @@
 {
-    "height": 400,
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
                 "cat": "a",
-                "x": 10,
                 "val": 1,
+                "x": 10,
                 "y": 1
             },
             {
                 "cat": "b",
-                "x": 20,
                 "val": 2,
+                "x": 20,
                 "y": 2
             },
             {
                 "cat": "c",
-                "x": 30,
                 "val": 3,
+                "x": 30,
                 "y": 3
             },
             {
                 "cat": "d",
-                "x": 40,
                 "val": 4,
+                "x": 40,
                 "y": 4
             },
             {
                 "cat": "e",
-                "x": 50,
                 "val": 5,
+                "x": 50,
                 "y": 5
             },
             {
                 "cat": "f",
-                "x": 60,
                 "val": 6,
+                "x": 60,
                 "y": 6
             },
             {
                 "cat": "g",
-                "x": 70,
                 "val": 7,
+                "x": 70,
                 "y": 7
             },
             {
                 "cat": "h",
-                "x": 80,
                 "val": 8,
+                "x": 80,
                 "y": 8
             },
             {
                 "cat": "i",
-                "x": 90,
                 "val": 9,
+                "x": 90,
                 "y": 9
             },
             {
                 "cat": "j",
-                "x": 100,
                 "val": 10,
+                "x": 100,
                 "y": 10
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "val",
             "type": "ordinal"
         },
-        "size": {
-            "field": "val",
-            "type": "quantitative"
-        },
         "shape": {
             "field": "cat",
             "scale": null,
             "type": "nominal"
         },
+        "size": {
+            "field": "val",
+            "type": "quantitative"
+        },
         "x": {
             "field": "x",
             "type": "quantitative"
@@ -89,5 +86,8 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 400,
+    "mark": "point",
+    "width": 400
 }
diff --git a/tests/specs/position/position1.vl b/tests/specs/position/position1.vl
--- a/tests/specs/position/position1.vl
+++ b/tests/specs/position/position1.vl
@@ -1,10 +1,5 @@
 {
-    "mark": {
-        "size": 200,
-        "x": 150,
-        "type": "circle",
-        "y": 150
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -12,5 +7,10 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    "mark": {
+        "size": 200,
+        "type": "circle",
+        "x": 150,
+        "y": 150
+    }
 }
diff --git a/tests/specs/position/position10.vl b/tests/specs/position/position10.vl
--- a/tests/specs/position/position10.vl
+++ b/tests/specs/position/position10.vl
@@ -1,10 +1,10 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "empty": 0,
                 "cat": 1,
+                "empty": 0,
                 "val": 10
             },
             {
@@ -25,14 +25,12 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
             "scale": {
-                "paddingInner": 0.5,
-                "align": 0.5
+                "align": 0.5,
+                "paddingInner": 0.5
             },
             "type": "ordinal"
         },
@@ -40,5 +38,7 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "width": 400
 }
diff --git a/tests/specs/position/position10r.vl b/tests/specs/position/position10r.vl
--- a/tests/specs/position/position10r.vl
+++ b/tests/specs/position/position10r.vl
@@ -1,10 +1,10 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "empty": 0,
                 "cat": 1,
+                "empty": 0,
                 "val": 10
             },
             {
@@ -25,14 +25,12 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
             "scale": {
-                "paddingInner": 0.5,
                 "align": 0.5,
+                "paddingInner": 0.5,
                 "reverse": true
             },
             "type": "ordinal"
@@ -41,5 +39,7 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "width": 400
 }
diff --git a/tests/specs/position/position11.vl b/tests/specs/position/position11.vl
--- a/tests/specs/position/position11.vl
+++ b/tests/specs/position/position11.vl
@@ -1,10 +1,10 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "empty": 0,
                 "cat": 1,
+                "empty": 0,
                 "val": 10
             },
             {
@@ -25,14 +25,12 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
             "scale": {
-                "paddingInner": 0.5,
-                "align": 0.7
+                "align": 0.7,
+                "paddingInner": 0.5
             },
             "type": "ordinal"
         },
@@ -40,5 +38,7 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "width": 400
 }
diff --git a/tests/specs/position/position11r.vl b/tests/specs/position/position11r.vl
--- a/tests/specs/position/position11r.vl
+++ b/tests/specs/position/position11r.vl
@@ -1,10 +1,10 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "empty": 0,
                 "cat": 1,
+                "empty": 0,
                 "val": 10
             },
             {
@@ -25,14 +25,12 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
             "scale": {
-                "paddingInner": 0.5,
                 "align": 0.7,
+                "paddingInner": 0.5,
                 "reverse": true
             },
             "type": "ordinal"
@@ -41,5 +39,7 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "width": 400
 }
diff --git a/tests/specs/position/position12.vl b/tests/specs/position/position12.vl
--- a/tests/specs/position/position12.vl
+++ b/tests/specs/position/position12.vl
@@ -1,10 +1,10 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "empty": 0,
                 "cat": 1,
+                "empty": 0,
                 "val": 10
             },
             {
@@ -25,14 +25,12 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
             "scale": {
-                "paddingInner": 0.5,
-                "align": 1
+                "align": 1,
+                "paddingInner": 0.5
             },
             "type": "ordinal"
         },
@@ -40,5 +38,7 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "width": 400
 }
diff --git a/tests/specs/position/position12r.vl b/tests/specs/position/position12r.vl
--- a/tests/specs/position/position12r.vl
+++ b/tests/specs/position/position12r.vl
@@ -1,10 +1,10 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "empty": 0,
                 "cat": 1,
+                "empty": 0,
                 "val": 10
             },
             {
@@ -25,14 +25,12 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
             "scale": {
-                "paddingInner": 0.5,
                 "align": 1,
+                "paddingInner": 0.5,
                 "reverse": true
             },
             "type": "ordinal"
@@ -41,5 +39,7 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "width": 400
 }
diff --git a/tests/specs/position/position2.vl b/tests/specs/position/position2.vl
--- a/tests/specs/position/position2.vl
+++ b/tests/specs/position/position2.vl
@@ -1,9 +1,5 @@
 {
-    "mark": {
-        "x": 150,
-        "type": "bar",
-        "y": 150
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -11,5 +7,9 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    "mark": {
+        "type": "bar",
+        "x": 150,
+        "y": 150
+    }
 }
diff --git a/tests/specs/position/position3.vl b/tests/specs/position/position3.vl
--- a/tests/specs/position/position3.vl
+++ b/tests/specs/position/position3.vl
@@ -1,10 +1,5 @@
 {
-    "mark": {
-        "x2": 200,
-        "x": 150,
-        "type": "bar",
-        "y": 150
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -12,5 +7,10 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    "mark": {
+        "type": "bar",
+        "x": 150,
+        "x2": 200,
+        "y": 150
+    }
 }
diff --git a/tests/specs/position/position4.vl b/tests/specs/position/position4.vl
--- a/tests/specs/position/position4.vl
+++ b/tests/specs/position/position4.vl
@@ -1,10 +1,5 @@
 {
-    "mark": {
-        "x": 150,
-        "type": "bar",
-        "y2": 200,
-        "y": 150
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -12,5 +7,10 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    "mark": {
+        "type": "bar",
+        "x": 150,
+        "y": 150,
+        "y2": 200
+    }
 }
diff --git a/tests/specs/position/position5.vl b/tests/specs/position/position5.vl
--- a/tests/specs/position/position5.vl
+++ b/tests/specs/position/position5.vl
@@ -1,11 +1,5 @@
 {
-    "mark": {
-        "x2": 200,
-        "x": 150,
-        "type": "bar",
-        "y2": 200,
-        "y": 150
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -13,5 +7,11 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+    "mark": {
+        "type": "bar",
+        "x": 150,
+        "x2": 200,
+        "y": 150,
+        "y2": 200
+    }
 }
diff --git a/tests/specs/position/position6.vl b/tests/specs/position/position6.vl
--- a/tests/specs/position/position6.vl
+++ b/tests/specs/position/position6.vl
@@ -1,13 +1,10 @@
 {
-    "mark": {
-        "width": 20,
-        "type": "bar"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "empty": 0,
                 "cat": 1,
+                "empty": 0,
                 "val": 10
             },
             {
@@ -28,8 +25,6 @@
             }
         ]
     },
-    "width": 300,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
@@ -39,5 +34,10 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "type": "bar",
+        "width": 20
+    },
+    "width": 300
 }
diff --git a/tests/specs/position/position7.vl b/tests/specs/position/position7.vl
--- a/tests/specs/position/position7.vl
+++ b/tests/specs/position/position7.vl
@@ -1,14 +1,10 @@
 {
-    "height": 300,
-    "mark": {
-        "height": 20,
-        "type": "bar"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "empty": 0,
                 "cat": 1,
+                "empty": 0,
                 "val": 10
             },
             {
@@ -29,7 +25,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "val",
@@ -39,5 +34,10 @@
             "field": "cat",
             "type": "ordinal"
         }
+    },
+    "height": 300,
+    "mark": {
+        "height": 20,
+        "type": "bar"
     }
 }
diff --git a/tests/specs/position/position8.vl b/tests/specs/position/position8.vl
--- a/tests/specs/position/position8.vl
+++ b/tests/specs/position/position8.vl
@@ -1,10 +1,10 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "empty": 0,
                 "cat": 1,
+                "empty": 0,
                 "val": 10
             },
             {
@@ -25,14 +25,12 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
             "scale": {
-                "paddingInner": 0.5,
-                "align": 0
+                "align": 0,
+                "paddingInner": 0.5
             },
             "type": "ordinal"
         },
@@ -40,5 +38,7 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "width": 400
 }
diff --git a/tests/specs/position/position8r.vl b/tests/specs/position/position8r.vl
--- a/tests/specs/position/position8r.vl
+++ b/tests/specs/position/position8r.vl
@@ -1,10 +1,10 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "empty": 0,
                 "cat": 1,
+                "empty": 0,
                 "val": 10
             },
             {
@@ -25,14 +25,12 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
             "scale": {
-                "paddingInner": 0.5,
                 "align": 0,
+                "paddingInner": 0.5,
                 "reverse": true
             },
             "type": "ordinal"
@@ -41,5 +39,7 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "width": 400
 }
diff --git a/tests/specs/position/position9.vl b/tests/specs/position/position9.vl
--- a/tests/specs/position/position9.vl
+++ b/tests/specs/position/position9.vl
@@ -1,10 +1,10 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "empty": 0,
                 "cat": 1,
+                "empty": 0,
                 "val": 10
             },
             {
@@ -25,14 +25,12 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
             "scale": {
-                "paddingInner": 0.5,
-                "align": 0.3
+                "align": 0.3,
+                "paddingInner": 0.5
             },
             "type": "ordinal"
         },
@@ -40,5 +38,7 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "width": 400
 }
diff --git a/tests/specs/position/position9r.vl b/tests/specs/position/position9r.vl
--- a/tests/specs/position/position9r.vl
+++ b/tests/specs/position/position9r.vl
@@ -1,10 +1,10 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "empty": 0,
                 "cat": 1,
+                "empty": 0,
                 "val": 10
             },
             {
@@ -25,14 +25,12 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "cat",
             "scale": {
-                "paddingInner": 0.5,
                 "align": 0.3,
+                "paddingInner": 0.5,
                 "reverse": true
             },
             "type": "ordinal"
@@ -41,5 +39,7 @@
             "field": "val",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "width": 400
 }
diff --git a/tests/specs/projection/Albers.vl b/tests/specs/projection/Albers.vl
--- a/tests/specs/projection/Albers.vl
+++ b/tests/specs/projection/Albers.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "albers"
     },
     "title": "Albers",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/AzimuthalEqualArea.vl b/tests/specs/projection/AzimuthalEqualArea.vl
--- a/tests/specs/projection/AzimuthalEqualArea.vl
+++ b/tests/specs/projection/AzimuthalEqualArea.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "azimuthalEqualArea"
     },
     "title": "AzimuthalEqualArea",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/AzimuthalEquidistant.vl b/tests/specs/projection/AzimuthalEquidistant.vl
--- a/tests/specs/projection/AzimuthalEquidistant.vl
+++ b/tests/specs/projection/AzimuthalEquidistant.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "azimuthalEquidistant"
     },
     "title": "AzimuthalEquidistant",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/ConicConformal.vl b/tests/specs/projection/ConicConformal.vl
--- a/tests/specs/projection/ConicConformal.vl
+++ b/tests/specs/projection/ConicConformal.vl
@@ -1,24 +1,24 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 65,
         "type": "conicConformal"
     },
     "title": "ConicConformal",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/ConicEqualArea.vl b/tests/specs/projection/ConicEqualArea.vl
--- a/tests/specs/projection/ConicEqualArea.vl
+++ b/tests/specs/projection/ConicEqualArea.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "conicEqualarea"
     },
     "title": "ConicEqualArea",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/ConicEquidistant.vl b/tests/specs/projection/ConicEquidistant.vl
--- a/tests/specs/projection/ConicEquidistant.vl
+++ b/tests/specs/projection/ConicEquidistant.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "conicEquidistant"
     },
     "title": "ConicEquidistant",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/EqualEarth.vl b/tests/specs/projection/EqualEarth.vl
--- a/tests/specs/projection/EqualEarth.vl
+++ b/tests/specs/projection/EqualEarth.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "equalEarth"
     },
     "title": "EqualEarth",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/Equirectangular.vl b/tests/specs/projection/Equirectangular.vl
--- a/tests/specs/projection/Equirectangular.vl
+++ b/tests/specs/projection/Equirectangular.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "equirectangular"
     },
     "title": "Equirectangular",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/Gnomonic.vl b/tests/specs/projection/Gnomonic.vl
--- a/tests/specs/projection/Gnomonic.vl
+++ b/tests/specs/projection/Gnomonic.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "gnomonic"
     },
     "title": "Gnomonic",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/Identity.vl b/tests/specs/projection/Identity.vl
--- a/tests/specs/projection/Identity.vl
+++ b/tests/specs/projection/Identity.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "identity"
     },
     "title": "Identity",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/Mercator.vl b/tests/specs/projection/Mercator.vl
--- a/tests/specs/projection/Mercator.vl
+++ b/tests/specs/projection/Mercator.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "mercator"
     },
     "title": "Mercator",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/NaturalEarth1.vl b/tests/specs/projection/NaturalEarth1.vl
--- a/tests/specs/projection/NaturalEarth1.vl
+++ b/tests/specs/projection/NaturalEarth1.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "naturalEarth1"
     },
     "title": "NaturalEarth1",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/Orthographic.vl b/tests/specs/projection/Orthographic.vl
--- a/tests/specs/projection/Orthographic.vl
+++ b/tests/specs/projection/Orthographic.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "orthographic"
     },
     "title": "Orthographic",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/Stereographic.vl b/tests/specs/projection/Stereographic.vl
--- a/tests/specs/projection/Stereographic.vl
+++ b/tests/specs/projection/Stereographic.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "stereographic"
     },
     "title": "Stereographic",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/TransverseMercator.vl b/tests/specs/projection/TransverseMercator.vl
--- a/tests/specs/projection/TransverseMercator.vl
+++ b/tests/specs/projection/TransverseMercator.vl
@@ -1,23 +1,23 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "type": "transverseMercator"
     },
     "title": "TransverseMercator",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/airy.vl b/tests/specs/projection/airy.vl
--- a/tests/specs/projection/airy.vl
+++ b/tests/specs/projection/airy.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "airy",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "airy"
     },
     "title": "airy",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/aitoff.vl b/tests/specs/projection/aitoff.vl
--- a/tests/specs/projection/aitoff.vl
+++ b/tests/specs/projection/aitoff.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "aitoff",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "aitoff"
     },
     "title": "aitoff",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/armadillo.vl b/tests/specs/projection/armadillo.vl
--- a/tests/specs/projection/armadillo.vl
+++ b/tests/specs/projection/armadillo.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "armadillo",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "armadillo"
     },
     "title": "armadillo",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/august.vl b/tests/specs/projection/august.vl
--- a/tests/specs/projection/august.vl
+++ b/tests/specs/projection/august.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "august",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "august"
     },
     "title": "august",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/baker.vl b/tests/specs/projection/baker.vl
--- a/tests/specs/projection/baker.vl
+++ b/tests/specs/projection/baker.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "baker",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "baker"
     },
     "title": "baker",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/berghaus.vl b/tests/specs/projection/berghaus.vl
--- a/tests/specs/projection/berghaus.vl
+++ b/tests/specs/projection/berghaus.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "berghaus",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "berghaus"
     },
     "title": "berghaus",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/bertin1953.vl b/tests/specs/projection/bertin1953.vl
--- a/tests/specs/projection/bertin1953.vl
+++ b/tests/specs/projection/bertin1953.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "bertin1953",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "bertin1953"
     },
     "title": "bertin1953",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/boggs.vl b/tests/specs/projection/boggs.vl
--- a/tests/specs/projection/boggs.vl
+++ b/tests/specs/projection/boggs.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "boggs",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "boggs"
     },
     "title": "boggs",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/bonne.vl b/tests/specs/projection/bonne.vl
--- a/tests/specs/projection/bonne.vl
+++ b/tests/specs/projection/bonne.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "bonne",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "bonne"
     },
     "title": "bonne",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/bottomley.vl b/tests/specs/projection/bottomley.vl
--- a/tests/specs/projection/bottomley.vl
+++ b/tests/specs/projection/bottomley.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "bottomley",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "bottomley"
     },
     "title": "bottomley",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/collignon.vl b/tests/specs/projection/collignon.vl
--- a/tests/specs/projection/collignon.vl
+++ b/tests/specs/projection/collignon.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "collignon",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "collignon"
     },
     "title": "collignon",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/configExample.vl b/tests/specs/projection/configExample.vl
--- a/tests/specs/projection/configExample.vl
+++ b/tests/specs/projection/configExample.vl
@@ -1,71 +1,71 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "autosize": {
             "type": "fit"
         },
-        "view": {
-            "continuousHeight": 300,
-            "continuousWidth": 500,
-            "stroke": null
-        },
+        "background": "rgb(251,247,238)",
         "projection": {
-            "type": "orthographic",
             "rotate": [
                 0,
                 0,
                 0
-            ]
+            ],
+            "type": "orthographic"
         },
         "title": {
-            "fontSize": 18,
             "font": "Roboto",
+            "fontSize": 18,
             "fontWeight": 600
         },
-        "background": "rgb(251,247,238)"
+        "view": {
+            "continuousHeight": 300,
+            "continuousWidth": 500,
+            "stroke": null
+        }
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "title": "Hello, World!",
     "layer": [
         {
-            "mark": {
-                "color": "#c1e7f5",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "data/globe.json",
                 "format": {
                     "feature": "globe",
                     "type": "topojson"
-                }
+                },
+                "url": "data/globe.json"
+            },
+            "mark": {
+                "color": "#c1e7f5",
+                "type": "geoshape"
             }
         },
         {
-            "mark": {
-                "strokeWidth": 0.1,
-                "stroke": "#411",
-                "type": "geoshape",
-                "fillOpacity": 1.0e-2
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/graticule.json",
                 "format": {
                     "feature": "graticule",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/graticule.json"
+            },
+            "mark": {
+                "fillOpacity": 1.0e-2,
+                "stroke": "#411",
+                "strokeWidth": 0.1,
+                "type": "geoshape"
             }
         },
         {
-            "mark": {
-                "color": "#708E71",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                 "format": {
                     "feature": "countries",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/world-110m.json"
+            },
+            "mark": {
+                "color": "#708E71",
+                "type": "geoshape"
             }
         }
-    ]
+    ],
+    "title": "Hello, World!"
 }
diff --git a/tests/specs/projection/craig.vl b/tests/specs/projection/craig.vl
--- a/tests/specs/projection/craig.vl
+++ b/tests/specs/projection/craig.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "craig",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "craig"
     },
     "title": "craig",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/craster.vl b/tests/specs/projection/craster.vl
--- a/tests/specs/projection/craster.vl
+++ b/tests/specs/projection/craster.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "craster",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "craster"
     },
     "title": "craster",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/cylindricalequalarea.vl b/tests/specs/projection/cylindricalequalarea.vl
--- a/tests/specs/projection/cylindricalequalarea.vl
+++ b/tests/specs/projection/cylindricalequalarea.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "cylindricalequalarea",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "cylindricalequalarea"
     },
     "title": "cylindricalequalarea",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/cylindricalstereographic.vl b/tests/specs/projection/cylindricalstereographic.vl
--- a/tests/specs/projection/cylindricalstereographic.vl
+++ b/tests/specs/projection/cylindricalstereographic.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "cylindricalstereographic",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "cylindricalstereographic"
     },
     "title": "cylindricalstereographic",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/eckert1.vl b/tests/specs/projection/eckert1.vl
--- a/tests/specs/projection/eckert1.vl
+++ b/tests/specs/projection/eckert1.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "eckert1",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "eckert1"
     },
     "title": "eckert1",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/eckert2.vl b/tests/specs/projection/eckert2.vl
--- a/tests/specs/projection/eckert2.vl
+++ b/tests/specs/projection/eckert2.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "eckert2",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "eckert2"
     },
     "title": "eckert2",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/eckert3.vl b/tests/specs/projection/eckert3.vl
--- a/tests/specs/projection/eckert3.vl
+++ b/tests/specs/projection/eckert3.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "eckert3",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "eckert3"
     },
     "title": "eckert3",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/eckert4.vl b/tests/specs/projection/eckert4.vl
--- a/tests/specs/projection/eckert4.vl
+++ b/tests/specs/projection/eckert4.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "eckert4",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "eckert4"
     },
     "title": "eckert4",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/eckert5.vl b/tests/specs/projection/eckert5.vl
--- a/tests/specs/projection/eckert5.vl
+++ b/tests/specs/projection/eckert5.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "eckert5",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "eckert5"
     },
     "title": "eckert5",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/eckert6.vl b/tests/specs/projection/eckert6.vl
--- a/tests/specs/projection/eckert6.vl
+++ b/tests/specs/projection/eckert6.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "eckert6",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "eckert6"
     },
     "title": "eckert6",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/eisenlohr.vl b/tests/specs/projection/eisenlohr.vl
--- a/tests/specs/projection/eisenlohr.vl
+++ b/tests/specs/projection/eisenlohr.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "eisenlohr",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "eisenlohr"
     },
     "title": "eisenlohr",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/fahey.vl b/tests/specs/projection/fahey.vl
--- a/tests/specs/projection/fahey.vl
+++ b/tests/specs/projection/fahey.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "fahey",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "fahey"
     },
     "title": "fahey",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/foucaut.vl b/tests/specs/projection/foucaut.vl
--- a/tests/specs/projection/foucaut.vl
+++ b/tests/specs/projection/foucaut.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "foucaut",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "foucaut"
     },
     "title": "foucaut",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/gingery.vl b/tests/specs/projection/gingery.vl
--- a/tests/specs/projection/gingery.vl
+++ b/tests/specs/projection/gingery.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "gingery",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "gingery"
     },
     "title": "gingery",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/projection/identityExample.vl b/tests/specs/projection/identityExample.vl
--- a/tests/specs/projection/identityExample.vl
+++ b/tests/specs/projection/identityExample.vl
@@ -1,63 +1,63 @@
 {
-    "height": 250,
-    "width": 500,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 250,
     "layer": [
         {
-            "mark": {
-                "color": "#c1e7f5",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "data/globe.json",
                 "format": {
                     "feature": "globe",
                     "type": "topojson"
-                }
+                },
+                "url": "data/globe.json"
             },
+            "mark": {
+                "color": "#c1e7f5",
+                "type": "geoshape"
+            },
             "projection": {
-                "reflectY": false,
                 "reflectX": false,
+                "reflectY": false,
                 "type": "identity"
             }
         },
         {
-            "mark": {
-                "strokeWidth": 0.1,
-                "stroke": "#411",
-                "type": "geoshape",
-                "fillOpacity": 1.0e-2
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/graticule.json",
                 "format": {
                     "feature": "graticule",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/graticule.json"
             },
+            "mark": {
+                "fillOpacity": 1.0e-2,
+                "stroke": "#411",
+                "strokeWidth": 0.1,
+                "type": "geoshape"
+            },
             "projection": {
-                "reflectY": false,
                 "reflectX": false,
+                "reflectY": false,
                 "type": "identity"
             }
         },
         {
-            "mark": {
-                "color": "#708E71",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                 "format": {
                     "feature": "countries",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/world-110m.json"
             },
+            "mark": {
+                "color": "#708E71",
+                "type": "geoshape"
+            },
             "projection": {
-                "reflectY": false,
                 "reflectX": false,
+                "reflectY": false,
                 "type": "identity"
             }
         }
-    ]
+    ],
+    "width": 500
 }
diff --git a/tests/specs/projection/reflectXExample.vl b/tests/specs/projection/reflectXExample.vl
--- a/tests/specs/projection/reflectXExample.vl
+++ b/tests/specs/projection/reflectXExample.vl
@@ -1,63 +1,63 @@
 {
-    "height": 250,
-    "width": 500,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 250,
     "layer": [
         {
-            "mark": {
-                "color": "#c1e7f5",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "data/globe.json",
                 "format": {
                     "feature": "globe",
                     "type": "topojson"
-                }
+                },
+                "url": "data/globe.json"
             },
+            "mark": {
+                "color": "#c1e7f5",
+                "type": "geoshape"
+            },
             "projection": {
-                "reflectY": false,
                 "reflectX": true,
+                "reflectY": false,
                 "type": "identity"
             }
         },
         {
-            "mark": {
-                "strokeWidth": 0.1,
-                "stroke": "#411",
-                "type": "geoshape",
-                "fillOpacity": 1.0e-2
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/graticule.json",
                 "format": {
                     "feature": "graticule",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/graticule.json"
             },
+            "mark": {
+                "fillOpacity": 1.0e-2,
+                "stroke": "#411",
+                "strokeWidth": 0.1,
+                "type": "geoshape"
+            },
             "projection": {
-                "reflectY": false,
                 "reflectX": true,
+                "reflectY": false,
                 "type": "identity"
             }
         },
         {
-            "mark": {
-                "color": "#708E71",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                 "format": {
                     "feature": "countries",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/world-110m.json"
             },
+            "mark": {
+                "color": "#708E71",
+                "type": "geoshape"
+            },
             "projection": {
-                "reflectY": false,
                 "reflectX": true,
+                "reflectY": false,
                 "type": "identity"
             }
         }
-    ]
+    ],
+    "width": 500
 }
diff --git a/tests/specs/projection/reflectXYExample.vl b/tests/specs/projection/reflectXYExample.vl
--- a/tests/specs/projection/reflectXYExample.vl
+++ b/tests/specs/projection/reflectXYExample.vl
@@ -1,63 +1,63 @@
 {
-    "height": 250,
-    "width": 500,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 250,
     "layer": [
         {
-            "mark": {
-                "color": "#c1e7f5",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "data/globe.json",
                 "format": {
                     "feature": "globe",
                     "type": "topojson"
-                }
+                },
+                "url": "data/globe.json"
             },
+            "mark": {
+                "color": "#c1e7f5",
+                "type": "geoshape"
+            },
             "projection": {
-                "reflectY": true,
                 "reflectX": true,
+                "reflectY": true,
                 "type": "identity"
             }
         },
         {
-            "mark": {
-                "strokeWidth": 0.1,
-                "stroke": "#411",
-                "type": "geoshape",
-                "fillOpacity": 1.0e-2
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/graticule.json",
                 "format": {
                     "feature": "graticule",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/graticule.json"
             },
+            "mark": {
+                "fillOpacity": 1.0e-2,
+                "stroke": "#411",
+                "strokeWidth": 0.1,
+                "type": "geoshape"
+            },
             "projection": {
-                "reflectY": true,
                 "reflectX": true,
+                "reflectY": true,
                 "type": "identity"
             }
         },
         {
-            "mark": {
-                "color": "#708E71",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                 "format": {
                     "feature": "countries",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/world-110m.json"
             },
+            "mark": {
+                "color": "#708E71",
+                "type": "geoshape"
+            },
             "projection": {
-                "reflectY": true,
                 "reflectX": true,
+                "reflectY": true,
                 "type": "identity"
             }
         }
-    ]
+    ],
+    "width": 500
 }
diff --git a/tests/specs/projection/reflectYExample.vl b/tests/specs/projection/reflectYExample.vl
--- a/tests/specs/projection/reflectYExample.vl
+++ b/tests/specs/projection/reflectYExample.vl
@@ -1,63 +1,63 @@
 {
-    "height": 250,
-    "width": 500,
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 250,
     "layer": [
         {
-            "mark": {
-                "color": "#c1e7f5",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "data/globe.json",
                 "format": {
                     "feature": "globe",
                     "type": "topojson"
-                }
+                },
+                "url": "data/globe.json"
             },
+            "mark": {
+                "color": "#c1e7f5",
+                "type": "geoshape"
+            },
             "projection": {
-                "reflectY": true,
                 "reflectX": false,
+                "reflectY": true,
                 "type": "identity"
             }
         },
         {
-            "mark": {
-                "strokeWidth": 0.1,
-                "stroke": "#411",
-                "type": "geoshape",
-                "fillOpacity": 1.0e-2
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/graticule.json",
                 "format": {
                     "feature": "graticule",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/graticule.json"
             },
+            "mark": {
+                "fillOpacity": 1.0e-2,
+                "stroke": "#411",
+                "strokeWidth": 0.1,
+                "type": "geoshape"
+            },
             "projection": {
-                "reflectY": true,
                 "reflectX": false,
+                "reflectY": true,
                 "type": "identity"
             }
         },
         {
-            "mark": {
-                "color": "#708E71",
-                "type": "geoshape"
-            },
             "data": {
-                "url": "https://vega.github.io/vega-lite/data/world-110m.json",
                 "format": {
                     "feature": "countries",
                     "type": "topojson"
-                }
+                },
+                "url": "https://vega.github.io/vega-lite/data/world-110m.json"
             },
+            "mark": {
+                "color": "#708E71",
+                "type": "geoshape"
+            },
             "projection": {
-                "reflectY": true,
                 "reflectX": false,
+                "reflectY": true,
                 "type": "identity"
             }
         }
-    ]
+    ],
+    "width": 500
 }
diff --git a/tests/specs/projection/winkel3.vl b/tests/specs/projection/winkel3.vl
--- a/tests/specs/projection/winkel3.vl
+++ b/tests/specs/projection/winkel3.vl
@@ -1,30 +1,30 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "stroke": "#411",
-        "type": "geoshape",
-        "fillOpacity": 1.0e-2
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "background": "#c1e7f5",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/graticule.json",
         "format": {
             "feature": "graticule",
             "type": "topojson"
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/graticule.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 300,
+    "mark": {
+        "fillOpacity": 1.0e-2,
+        "stroke": "#411",
+        "strokeWidth": 0.5,
+        "type": "geoshape"
+    },
     "projection": {
         "clipAngle": 179.999,
         "precision": 0.1,
-        "type": "winkel3",
         "rotate": [
             20,
             -90,
             0
-        ]
+        ],
+        "type": "winkel3"
     },
     "title": "winkel3",
-    "background": "#c1e7f5"
+    "width": 500
 }
diff --git a/tests/specs/scale/axislimit.vl b/tests/specs/scale/axislimit.vl
new file mode 100644
--- /dev/null
+++ b/tests/specs/scale/axislimit.vl
@@ -0,0 +1,40 @@
+{
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/cars.json"
+    },
+    "encoding": {
+        "opacity": {
+            "bin": true,
+            "field": "Acceleration",
+            "type": "quantitative"
+        },
+        "size": {
+            "bin": true,
+            "field": "Acceleration",
+            "type": "quantitative"
+        },
+        "x": {
+            "field": "Horsepower",
+            "scale": {
+                "domainMax": 300,
+                "domainMin": -10
+            },
+            "type": "quantitative"
+        },
+        "y": {
+            "field": "Miles_per_Gallon",
+            "scale": {
+                "rangeMax": 10,
+                "rangeMin": 220
+            },
+            "type": "quantitative"
+        }
+    },
+    "mark": {
+        "filled": true,
+        "stroke": "white",
+        "strokeWidth": 0.4,
+        "type": "point"
+    }
+}
diff --git a/tests/specs/scale/axisrange.vl b/tests/specs/scale/axisrange.vl
--- a/tests/specs/scale/axisrange.vl
+++ b/tests/specs/scale/axisrange.vl
@@ -1,23 +1,17 @@
 {
-    "mark": {
-        "strokeWidth": 0.4,
-        "stroke": "white",
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
-        "size": {
-            "field": "Acceleration",
+        "opacity": {
             "bin": true,
+            "field": "Acceleration",
             "type": "quantitative"
         },
-        "opacity": {
-            "field": "Acceleration",
+        "size": {
             "bin": true,
+            "field": "Acceleration",
             "type": "quantitative"
         },
         "x": {
@@ -40,5 +34,11 @@
             },
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "filled": true,
+        "stroke": "white",
+        "strokeWidth": 0.4,
+        "type": "point"
     }
 }
diff --git a/tests/specs/scale/diverging1.vl b/tests/specs/scale/diverging1.vl
--- a/tests/specs/scale/diverging1.vl
+++ b/tests/specs/scale/diverging1.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -40,7 +40,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "value",
@@ -50,17 +49,18 @@
             "type": "quantitative"
         },
         "x": {
-            "field": "category",
-            "type": "ordinal",
             "axis": {
-                "labelAngle": 0,
                 "domain": false,
+                "labelAngle": 0,
                 "orient": "top"
-            }
+            },
+            "field": "category",
+            "type": "ordinal"
         },
         "y": {
             "field": "value",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/scale/diverging2.vl b/tests/specs/scale/diverging2.vl
--- a/tests/specs/scale/diverging2.vl
+++ b/tests/specs/scale/diverging2.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -40,28 +40,28 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "value",
             "scale": {
-                "scheme": "redblue",
-                "domainMid": 0
+                "domainMid": 0,
+                "scheme": "redblue"
             },
             "type": "quantitative"
         },
         "x": {
-            "field": "category",
-            "type": "ordinal",
             "axis": {
-                "labelAngle": 0,
                 "domain": false,
+                "labelAngle": 0,
                 "orient": "top"
-            }
+            },
+            "field": "category",
+            "type": "ordinal"
         },
         "y": {
             "field": "value",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/scale/namedaxisrange.vl b/tests/specs/scale/namedaxisrange.vl
new file mode 100644
--- /dev/null
+++ b/tests/specs/scale/namedaxisrange.vl
@@ -0,0 +1,33 @@
+{
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "values": [
+            {
+                "c": "#ff0000",
+                "col": "X",
+                "l": "A"
+            },
+            {
+                "c": "#0000ff",
+                "col": "Y",
+                "l": "B"
+            }
+        ]
+    },
+    "encoding": {
+        "color": {
+            "field": "l",
+            "scale": {
+                "range": {
+                    "field": "c"
+                }
+            },
+            "type": "nominal"
+        },
+        "y": {
+            "field": "col",
+            "type": "nominal"
+        }
+    },
+    "mark": "circle"
+}
diff --git a/tests/specs/scale/scale1.vl b/tests/specs/scale/scale1.vl
--- a/tests/specs/scale/scale1.vl
+++ b/tests/specs/scale/scale1.vl
@@ -1,26 +1,20 @@
 {
-    "mark": {
-        "strokeWidth": 0.4,
-        "stroke": "white",
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "value": "rgb(203,24,29)"
         },
-        "size": {
-            "field": "Acceleration",
+        "opacity": {
             "bin": true,
+            "field": "Acceleration",
             "type": "quantitative"
         },
-        "opacity": {
-            "field": "Acceleration",
+        "size": {
             "bin": true,
+            "field": "Acceleration",
             "type": "quantitative"
         },
         "x": {
@@ -31,5 +25,11 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "filled": true,
+        "stroke": "white",
+        "strokeWidth": 0.4,
+        "type": "point"
     }
 }
diff --git a/tests/specs/scale/scale2.vl b/tests/specs/scale/scale2.vl
--- a/tests/specs/scale/scale2.vl
+++ b/tests/specs/scale/scale2.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "range": {
             "ramp": {
@@ -6,15 +7,13 @@
             }
         }
     },
-    "mark": "point",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
-            "field": "Acceleration",
             "bin": true,
+            "field": "Acceleration",
             "type": "quantitative"
         },
         "x": {
@@ -25,5 +24,6 @@
             "field": "Miles_per_Gallon",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/scale/scale3.vl b/tests/specs/scale/scale3.vl
--- a/tests/specs/scale/scale3.vl
+++ b/tests/specs/scale/scale3.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -31,17 +31,16 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "b",
+            "legend": {
+                "title": "Quantile"
+            },
             "scale": {
                 "type": "quantile"
             },
-            "type": "quantitative",
-            "legend": {
-                "title": "Quantile"
-            }
+            "type": "quantitative"
         },
         "size": {
             "field": "b",
@@ -51,14 +50,15 @@
             "type": "quantitative"
         },
         "y": {
-            "field": "b",
-            "sort": null,
-            "type": "nominal",
             "axis": {
                 "domain": false,
-                "title": null,
-                "ticks": false
-            }
+                "ticks": false,
+                "title": null
+            },
+            "field": "b",
+            "sort": null,
+            "type": "nominal"
         }
-    }
+    },
+    "mark": "circle"
 }
diff --git a/tests/specs/scale/scale4.vl b/tests/specs/scale/scale4.vl
--- a/tests/specs/scale/scale4.vl
+++ b/tests/specs/scale/scale4.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -31,18 +31,17 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "b",
-            "scale": {
-                "zero": true,
-                "type": "quantize"
-            },
-            "type": "quantitative",
             "legend": {
                 "title": "Quantize"
-            }
+            },
+            "scale": {
+                "type": "quantize",
+                "zero": true
+            },
+            "type": "quantitative"
         },
         "size": {
             "field": "b",
@@ -52,14 +51,15 @@
             "type": "quantitative"
         },
         "y": {
-            "field": "b",
-            "sort": null,
-            "type": "nominal",
             "axis": {
                 "domain": false,
-                "title": null,
-                "ticks": false
-            }
+                "ticks": false,
+                "title": null
+            },
+            "field": "b",
+            "sort": null,
+            "type": "nominal"
         }
-    }
+    },
+    "mark": "circle"
 }
diff --git a/tests/specs/scale/scale5.vl b/tests/specs/scale/scale5.vl
--- a/tests/specs/scale/scale5.vl
+++ b/tests/specs/scale/scale5.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -31,10 +31,12 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "b",
+            "legend": {
+                "title": "Threshold"
+            },
             "scale": {
                 "domain": [
                     30,
@@ -43,10 +45,7 @@
                 "scheme": "viridis",
                 "type": "threshold"
             },
-            "type": "quantitative",
-            "legend": {
-                "title": "Threshold"
-            }
+            "type": "quantitative"
         },
         "size": {
             "field": "b",
@@ -65,14 +64,15 @@
             "type": "quantitative"
         },
         "y": {
-            "field": "b",
-            "sort": null,
-            "type": "nominal",
             "axis": {
                 "domain": false,
-                "title": null,
-                "ticks": false
-            }
+                "ticks": false,
+                "title": null
+            },
+            "field": "b",
+            "sort": null,
+            "type": "nominal"
         }
-    }
+    },
+    "mark": "circle"
 }
diff --git a/tests/specs/scale/scale6.vl b/tests/specs/scale/scale6.vl
--- a/tests/specs/scale/scale6.vl
+++ b/tests/specs/scale/scale6.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -34,18 +34,18 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "size": {
             "field": "r",
+            "legend": null,
             "scale": {
                 "range": [
                     0,
                     80000
                 ]
             },
-            "type": "quantitative",
-            "legend": null
+            "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/scale/scale7.vl b/tests/specs/scale/scale7.vl
--- a/tests/specs/scale/scale7.vl
+++ b/tests/specs/scale/scale7.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -34,10 +34,10 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "size": {
             "field": "r",
+            "legend": null,
             "scale": {
                 "exponent": 2,
                 "range": [
@@ -46,8 +46,8 @@
                 ],
                 "type": "pow"
             },
-            "type": "quantitative",
-            "legend": null
+            "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/scale/scale8.vl b/tests/specs/scale/scale8.vl
--- a/tests/specs/scale/scale8.vl
+++ b/tests/specs/scale/scale8.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -34,10 +34,10 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "size": {
             "field": "r",
+            "legend": null,
             "scale": {
                 "exponent": 1.2,
                 "range": [
@@ -46,8 +46,8 @@
                 ],
                 "type": "pow"
             },
-            "type": "quantitative",
-            "legend": null
+            "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/scale/scale9.vl b/tests/specs/scale/scale9.vl
--- a/tests/specs/scale/scale9.vl
+++ b/tests/specs/scale/scale9.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -34,10 +34,10 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "size": {
             "field": "r",
+            "legend": null,
             "scale": {
                 "base": 2.718281828459045,
                 "range": [
@@ -46,8 +46,8 @@
                 ],
                 "type": "log"
             },
-            "type": "quantitative",
-            "legend": null
+            "type": "quantitative"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/shape/custom1.vl b/tests/specs/shape/custom1.vl
--- a/tests/specs/shape/custom1.vl
+++ b/tests/specs/shape/custom1.vl
@@ -1,21 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Custom nominal shape with unit area.",
     "encoding": {
         "opacity": {
             "value": 0.6
@@ -32,5 +20,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Custom nominal shape with unit area."
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/custom2.vl b/tests/specs/shape/custom2.vl
--- a/tests/specs/shape/custom2.vl
+++ b/tests/specs/shape/custom2.vl
@@ -1,32 +1,20 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Custom nominal shape with unit area sized by Cylinders.",
     "encoding": {
-        "size": {
-            "field": "Cylinders",
-            "type": "ordinal"
-        },
         "opacity": {
             "value": 0.6
         },
         "shape": {
             "value": "M -0.5 -0.5 h 1 v 1 h -1z"
         },
+        "size": {
+            "field": "Cylinders",
+            "type": "ordinal"
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -36,5 +24,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Custom nominal shape with unit area sized by Cylinders."
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/custom3.vl b/tests/specs/shape/custom3.vl
--- a/tests/specs/shape/custom3.vl
+++ b/tests/specs/shape/custom3.vl
@@ -1,21 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Custom nominal shape with area of 10x10 pixel units.",
     "encoding": {
         "color": {
             "field": "Origin",
@@ -36,5 +24,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Custom nominal shape with area of 10x10 pixel units."
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/custom4.vl b/tests/specs/shape/custom4.vl
--- a/tests/specs/shape/custom4.vl
+++ b/tests/specs/shape/custom4.vl
@@ -1,21 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Custom shape sets encoding origin.",
     "encoding": {
         "opacity": {
             "value": 0.6
@@ -45,5 +33,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Custom shape sets encoding origin."
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/defNominal.vl b/tests/specs/shape/defNominal.vl
--- a/tests/specs/shape/defNominal.vl
+++ b/tests/specs/shape/defNominal.vl
@@ -1,21 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Default nominal shapes.",
     "encoding": {
         "opacity": {
             "value": 0.6
@@ -33,5 +21,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Default nominal shapes."
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/defOrdinal.vl b/tests/specs/shape/defOrdinal.vl
--- a/tests/specs/shape/defOrdinal.vl
+++ b/tests/specs/shape/defOrdinal.vl
@@ -1,21 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Default ordinal shapes.",
     "encoding": {
         "opacity": {
             "value": 0.6
@@ -33,5 +21,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Default ordinal shapes."
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/isotype1.vl b/tests/specs/shape/isotype1.vl
--- a/tests/specs/shape/isotype1.vl
+++ b/tests/specs/shape/isotype1.vl
@@ -1,27 +1,13 @@
 {
-    "transform": [
-        {
-            "as": "col",
-            "calculate": "ceil (datum.id/10)"
-        },
-        {
-            "as": "row",
-            "calculate": "datum.id - datum.col*10"
-        }
-    ],
-    "height": 400,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
-        "view": {
-            "stroke": null
-        },
         "axis": {
             "disable": true
+        },
+        "view": {
+            "stroke": null
         }
     },
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
     "data": {
         "values": [
             {
@@ -326,27 +312,20 @@
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "selection": {
-        "highlight": {
-            "type": "interval"
-        }
-    },
     "encoding": {
         "color": {
-            "value": "rgb(167,165,156)",
             "condition": {
-                "value": "rgb(194,81,64)",
-                "selection": "highlight"
-            }
-        },
-        "size": {
-            "value": 90
+                "selection": "highlight",
+                "value": "rgb(194,81,64)"
+            },
+            "value": "rgb(167,165,156)"
         },
         "shape": {
             "value": "M1.7 -1.7h-0.8c0.3 -0.2 0.6 -0.5 0.6 -0.9c0 -0.6 -0.4 -1 -1 -1c-0.6 0 -1 0.4 -1 1c0 0.4 0.2 0.7 0.6 0.9h-0.8c-0.4 0 -0.7 0.3 -0.7 0.6v1.9c0 0.3 0.3 0.6 0.6 0.6h0.2c0 0 0 0.1 0 0.1v1.9c0 0.3 0.2 0.6 0.3 0.6h1.3c0.2 0 0.3 -0.3 0.3 -0.6v-1.8c0 0 0 -0.1 0 -0.1h0.2c0.3 0 0.6 -0.3 0.6 -0.6v-2c0.2 -0.3 -0.1 -0.6 -0.4 -0.6z"
         },
+        "size": {
+            "value": 90
+        },
         "x": {
             "field": "col",
             "type": "ordinal"
@@ -355,5 +334,26 @@
             "field": "row",
             "type": "ordinal"
         }
-    }
+    },
+    "height": 400,
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "selection": {
+        "highlight": {
+            "type": "interval"
+        }
+    },
+    "transform": [
+        {
+            "as": "col",
+            "calculate": "ceil (datum.id/10)"
+        },
+        {
+            "as": "row",
+            "calculate": "datum.id - datum.col*10"
+        }
+    ],
+    "width": 400
 }
diff --git a/tests/specs/shape/multi1.vl b/tests/specs/shape/multi1.vl
--- a/tests/specs/shape/multi1.vl
+++ b/tests/specs/shape/multi1.vl
@@ -1,26 +1,10 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Sized by number of cylinders, shape by origin",
     "encoding": {
-        "size": {
-            "field": "Cylinders",
-            "type": "ordinal"
-        },
         "opacity": {
             "value": 0.6
         },
@@ -28,6 +12,10 @@
             "field": "Origin",
             "type": "nominal"
         },
+        "size": {
+            "field": "Cylinders",
+            "type": "ordinal"
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -37,5 +25,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Sized by number of cylinders, shape by origin"
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/multi2.vl b/tests/specs/shape/multi2.vl
--- a/tests/specs/shape/multi2.vl
+++ b/tests/specs/shape/multi2.vl
@@ -1,26 +1,10 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Sized and shaped by number of cylinders (should only have a single set of legend items)",
     "encoding": {
-        "size": {
-            "field": "Cylinders",
-            "type": "ordinal"
-        },
         "opacity": {
             "value": 0.6
         },
@@ -28,6 +12,10 @@
             "field": "Cylinders",
             "type": "ordinal"
         },
+        "size": {
+            "field": "Cylinders",
+            "type": "ordinal"
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -37,5 +25,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Sized and shaped by number of cylinders (should only have a single set of legend items)"
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/multi3.vl b/tests/specs/shape/multi3.vl
--- a/tests/specs/shape/multi3.vl
+++ b/tests/specs/shape/multi3.vl
@@ -1,30 +1,14 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Sized, shaped and coloured by number of cylinders (should only have a single set of legend items)",
     "encoding": {
         "color": {
             "field": "Cylinders",
             "type": "ordinal"
         },
-        "size": {
-            "field": "Cylinders",
-            "type": "ordinal"
-        },
         "opacity": {
             "value": 0.6
         },
@@ -32,6 +16,10 @@
             "field": "Cylinders",
             "type": "ordinal"
         },
+        "size": {
+            "field": "Cylinders",
+            "type": "ordinal"
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -41,5 +29,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Sized, shaped and coloured by number of cylinders (should only have a single set of legend items)"
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/multi4.vl b/tests/specs/shape/multi4.vl
--- a/tests/specs/shape/multi4.vl
+++ b/tests/specs/shape/multi4.vl
@@ -1,21 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Custom-shaped and coloured by origin (should only have a single set of legend items)",
     "encoding": {
         "color": {
             "field": "Origin",
@@ -37,5 +25,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Custom-shaped and coloured by origin (should only have a single set of legend items)"
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/multi5.vl b/tests/specs/shape/multi5.vl
--- a/tests/specs/shape/multi5.vl
+++ b/tests/specs/shape/multi5.vl
@@ -1,21 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Custom-shaped and coloured by origin (should only have a single set of legend items)",
     "encoding": {
         "color": {
             "field": "Origin",
@@ -49,5 +37,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Custom-shaped and coloured by origin (should only have a single set of legend items)"
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/multi6.vl b/tests/specs/shape/multi6.vl
--- a/tests/specs/shape/multi6.vl
+++ b/tests/specs/shape/multi6.vl
@@ -1,30 +1,14 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Sized, shaped and coloured by number of cylinders (should have two sets of legend items)",
     "encoding": {
         "color": {
             "field": "Origin",
             "type": "nominal"
         },
-        "size": {
-            "field": "Cylinders",
-            "type": "ordinal"
-        },
         "opacity": {
             "value": 0.6
         },
@@ -32,6 +16,10 @@
             "field": "Cylinders",
             "type": "ordinal"
         },
+        "size": {
+            "field": "Cylinders",
+            "type": "ordinal"
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -41,5 +29,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Sized, shaped and coloured by number of cylinders (should have two sets of legend items)"
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/point1.vl b/tests/specs/shape/point1.vl
--- a/tests/specs/shape/point1.vl
+++ b/tests/specs/shape/point1.vl
@@ -1,22 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "shape": "square",
-        "type": "point",
-        "filled": false
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "square-unfilled",
     "encoding": {
         "opacity": {
             "value": 0.6
@@ -30,5 +17,18 @@
             "type": "quantitative"
         }
     },
-    "description": "square-unfilled"
+    "mark": {
+        "filled": false,
+        "shape": "square",
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/point2.vl b/tests/specs/shape/point2.vl
--- a/tests/specs/shape/point2.vl
+++ b/tests/specs/shape/point2.vl
@@ -1,22 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "shape": "cross",
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "cross-filled",
     "encoding": {
         "opacity": {
             "value": 0.6
@@ -30,5 +17,18 @@
             "type": "quantitative"
         }
     },
-    "description": "cross-filled"
+    "mark": {
+        "filled": true,
+        "shape": "cross",
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/point3.vl b/tests/specs/shape/point3.vl
--- a/tests/specs/shape/point3.vl
+++ b/tests/specs/shape/point3.vl
@@ -1,22 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "shape": "diamond",
-        "type": "point",
-        "filled": false
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "diamond-unfilled",
     "encoding": {
         "opacity": {
             "value": 0.6
@@ -30,5 +17,18 @@
             "type": "quantitative"
         }
     },
-    "description": "diamond-unfilled"
+    "mark": {
+        "filled": false,
+        "shape": "diamond",
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/point4.vl b/tests/specs/shape/point4.vl
--- a/tests/specs/shape/point4.vl
+++ b/tests/specs/shape/point4.vl
@@ -1,22 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "shape": "triangle",
-        "type": "point",
-        "filled": false
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "triangle-unfilled",
     "encoding": {
         "opacity": {
             "value": 0.6
@@ -30,5 +17,18 @@
             "type": "quantitative"
         }
     },
-    "description": "triangle-unfilled"
+    "mark": {
+        "filled": false,
+        "shape": "triangle",
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/point5.vl b/tests/specs/shape/point5.vl
--- a/tests/specs/shape/point5.vl
+++ b/tests/specs/shape/point5.vl
@@ -1,22 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "shape": "stroke",
-        "type": "point",
-        "filled": false
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "stroke-unfilled",
     "encoding": {
         "opacity": {
             "value": 0.6
@@ -30,5 +17,18 @@
             "type": "quantitative"
         }
     },
-    "description": "stroke-unfilled"
+    "mark": {
+        "filled": false,
+        "shape": "stroke",
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/point6.vl b/tests/specs/shape/point6.vl
--- a/tests/specs/shape/point6.vl
+++ b/tests/specs/shape/point6.vl
@@ -1,22 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "shape": "arrow",
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "arrow-filled",
     "encoding": {
         "opacity": {
             "value": 0.6
@@ -30,5 +17,18 @@
             "type": "quantitative"
         }
     },
-    "description": "arrow-filled"
+    "mark": {
+        "filled": true,
+        "shape": "arrow",
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/point7.vl b/tests/specs/shape/point7.vl
--- a/tests/specs/shape/point7.vl
+++ b/tests/specs/shape/point7.vl
@@ -1,22 +1,9 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "shape": "wedge",
-        "type": "point",
-        "filled": false
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "wedge-unfilled",
     "encoding": {
         "opacity": {
             "value": 0.6
@@ -30,5 +17,18 @@
             "type": "quantitative"
         }
     },
-    "description": "wedge-unfilled"
+    "mark": {
+        "filled": false,
+        "shape": "wedge",
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/rounded1.vl b/tests/specs/shape/rounded1.vl
--- a/tests/specs/shape/rounded1.vl
+++ b/tests/specs/shape/rounded1.vl
@@ -1,16 +1,8 @@
 {
-    "height": 200,
-    "mark": {
-        "cornerRadius": 8,
-        "size": 30,
-        "opacity": 0.6,
-        "type": "rect"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "Origin",
@@ -20,5 +12,13 @@
             "field": "Cylinders",
             "type": "ordinal"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "cornerRadius": 8,
+        "opacity": 0.6,
+        "size": 30,
+        "type": "rect"
+    },
+    "width": 200
 }
diff --git a/tests/specs/shape/rounded2.vl b/tests/specs/shape/rounded2.vl
--- a/tests/specs/shape/rounded2.vl
+++ b/tests/specs/shape/rounded2.vl
@@ -1,16 +1,8 @@
 {
-    "height": 200,
-    "mark": {
-        "cornerRadiusTopLeft": 8,
-        "size": 30,
-        "opacity": 0.6,
-        "type": "rect"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "Origin",
@@ -20,5 +12,13 @@
             "field": "Cylinders",
             "type": "ordinal"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "cornerRadiusTopLeft": 8,
+        "opacity": 0.6,
+        "size": 30,
+        "type": "rect"
+    },
+    "width": 200
 }
diff --git a/tests/specs/shape/rounded3.vl b/tests/specs/shape/rounded3.vl
--- a/tests/specs/shape/rounded3.vl
+++ b/tests/specs/shape/rounded3.vl
@@ -1,16 +1,8 @@
 {
-    "height": 200,
-    "mark": {
-        "size": 30,
-        "opacity": 0.6,
-        "cornerRadiusTopRight": 8,
-        "type": "rect"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "Origin",
@@ -20,5 +12,13 @@
             "field": "Cylinders",
             "type": "ordinal"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "cornerRadiusTopRight": 8,
+        "opacity": 0.6,
+        "size": 30,
+        "type": "rect"
+    },
+    "width": 200
 }
diff --git a/tests/specs/shape/rounded4.vl b/tests/specs/shape/rounded4.vl
--- a/tests/specs/shape/rounded4.vl
+++ b/tests/specs/shape/rounded4.vl
@@ -1,16 +1,8 @@
 {
-    "height": 200,
-    "mark": {
-        "size": 30,
-        "cornerRadiusBottomLeft": 8,
-        "opacity": 0.6,
-        "type": "rect"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "Origin",
@@ -20,5 +12,13 @@
             "field": "Cylinders",
             "type": "ordinal"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "cornerRadiusBottomLeft": 8,
+        "opacity": 0.6,
+        "size": 30,
+        "type": "rect"
+    },
+    "width": 200
 }
diff --git a/tests/specs/shape/rounded5.vl b/tests/specs/shape/rounded5.vl
--- a/tests/specs/shape/rounded5.vl
+++ b/tests/specs/shape/rounded5.vl
@@ -1,16 +1,8 @@
 {
-    "height": 200,
-    "mark": {
-        "size": 30,
-        "opacity": 0.6,
-        "cornerRadiusBottomRight": 8,
-        "type": "rect"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "Origin",
@@ -20,5 +12,13 @@
             "field": "Cylinders",
             "type": "ordinal"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "cornerRadiusBottomRight": 8,
+        "opacity": 0.6,
+        "size": 30,
+        "type": "rect"
+    },
+    "width": 200
 }
diff --git a/tests/specs/shape/rounded6.vl b/tests/specs/shape/rounded6.vl
--- a/tests/specs/shape/rounded6.vl
+++ b/tests/specs/shape/rounded6.vl
@@ -1,18 +1,8 @@
 {
-    "height": 200,
-    "mark": {
-        "cornerRadius": 16,
-        "size": 30,
-        "cornerRadiusBottomLeft": 0,
-        "opacity": 0.6,
-        "cornerRadiusTopRight": 0,
-        "type": "rect"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 200,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "Origin",
@@ -22,5 +12,15 @@
             "field": "Cylinders",
             "type": "ordinal"
         }
-    }
+    },
+    "height": 200,
+    "mark": {
+        "cornerRadius": 16,
+        "cornerRadiusBottomLeft": 0,
+        "cornerRadiusTopRight": 0,
+        "opacity": 0.6,
+        "size": 30,
+        "type": "rect"
+    },
+    "width": 200
 }
diff --git a/tests/specs/shape/size1.vl b/tests/specs/shape/size1.vl
--- a/tests/specs/shape/size1.vl
+++ b/tests/specs/shape/size1.vl
@@ -1,25 +1,10 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Enlarged shapes (but legend shapes should remain same size)",
     "encoding": {
-        "size": {
-            "value": 200
-        },
         "opacity": {
             "value": 0.6
         },
@@ -27,6 +12,9 @@
             "field": "Origin",
             "type": "nominal"
         },
+        "size": {
+            "value": 200
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -36,5 +24,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Enlarged shapes (but legend shapes should remain same size)"
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/size2.vl b/tests/specs/shape/size2.vl
--- a/tests/specs/shape/size2.vl
+++ b/tests/specs/shape/size2.vl
@@ -1,25 +1,10 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Reduced shapes (but legend shapes should remain same size)",
     "encoding": {
-        "size": {
-            "value": 20
-        },
         "opacity": {
             "value": 0.6
         },
@@ -27,6 +12,9 @@
             "field": "Origin",
             "type": "nominal"
         },
+        "size": {
+            "value": 20
+        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -36,5 +24,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Reduced shapes (but legend shapes should remain same size)"
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/size3.vl b/tests/specs/shape/size3.vl
--- a/tests/specs/shape/size3.vl
+++ b/tests/specs/shape/size3.vl
@@ -1,29 +1,17 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Fixed shape, sized by number of cylinder category",
     "encoding": {
+        "opacity": {
+            "value": 0.6
+        },
         "size": {
             "field": "Cylinders",
             "type": "ordinal"
         },
-        "opacity": {
-            "value": 0.6
-        },
         "x": {
             "field": "Horsepower",
             "type": "quantitative"
@@ -33,5 +21,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Fixed shape, sized by number of cylinder category"
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/symbols1.vl b/tests/specs/shape/symbols1.vl
--- a/tests/specs/shape/symbols1.vl
+++ b/tests/specs/shape/symbols1.vl
@@ -1,143 +1,143 @@
 {
-    "data": {
-        "values": [
-            {
-                "x": 0
-            }
-        ]
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "columns": 4,
     "concat": [
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "circle",
                 "size": 400,
                 "stroke": "black",
-                "shape": "circle",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         },
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "square",
                 "size": 400,
                 "stroke": "black",
-                "shape": "square",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         },
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "diamond",
                 "size": 400,
                 "stroke": "black",
-                "shape": "diamond",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         },
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "cross",
                 "size": 400,
                 "stroke": "black",
-                "shape": "cross",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         },
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "triangle-up",
                 "size": 400,
                 "stroke": "black",
-                "shape": "triangle-up",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         },
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "triangle-down",
                 "size": 400,
                 "stroke": "black",
-                "shape": "triangle-down",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         },
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "triangle-left",
                 "size": 400,
                 "stroke": "black",
-                "shape": "triangle-left",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         },
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "triangle-right",
                 "size": 400,
                 "stroke": "black",
-                "shape": "triangle-right",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         },
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "triangle",
                 "size": 400,
                 "stroke": "black",
-                "shape": "triangle",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         },
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "arrow",
                 "size": 400,
                 "stroke": "black",
-                "shape": "arrow",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         },
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "wedge",
                 "size": 400,
                 "stroke": "black",
-                "shape": "wedge",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         },
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "stroke",
                 "size": 400,
                 "stroke": "black",
-                "shape": "stroke",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         },
         {
             "mark": {
-                "strokeWidth": 0.5,
+                "filled": true,
+                "shape": "M -1 -1 L 1 1",
                 "size": 400,
                 "stroke": "black",
-                "shape": "M -1 -1 L 1 1",
-                "type": "point",
-                "filled": true
+                "strokeWidth": 0.5,
+                "type": "point"
             }
         }
     ],
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "columns": 4
+    "data": {
+        "values": [
+            {
+                "x": 0
+            }
+        ]
+    }
 }
diff --git a/tests/specs/shape/symbols2.vl b/tests/specs/shape/symbols2.vl
--- a/tests/specs/shape/symbols2.vl
+++ b/tests/specs/shape/symbols2.vl
@@ -1,30 +1,18 @@
 {
-    "transform": [
-        {
-            "as": "YearOfManufacture",
-            "calculate": "year(datum.Year)"
-        },
-        {
-            "filter": "datum.YearOfManufacture == 1970"
-        }
-    ],
-    "mark": {
-        "type": "point",
-        "filled": true
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Legend using non-default bordered square symbols",
     "encoding": {
         "color": {
             "field": "Origin",
-            "type": "nominal",
             "legend": {
                 "symbolStrokeColor": "black",
                 "symbolStrokeWidth": 0.5,
                 "symbolType": "square"
-            }
+            },
+            "type": "nominal"
         },
         "opacity": {
             "value": 0.6
@@ -38,5 +26,17 @@
             "type": "quantitative"
         }
     },
-    "description": "Legend using non-default bordered square symbols"
+    "mark": {
+        "filled": true,
+        "type": "point"
+    },
+    "transform": [
+        {
+            "as": "YearOfManufacture",
+            "calculate": "year(datum.Year)"
+        },
+        {
+            "filter": "datum.YearOfManufacture == 1970"
+        }
+    ]
 }
diff --git a/tests/specs/shape/windvector.vl b/tests/specs/shape/windvector.vl
--- a/tests/specs/shape/windvector.vl
+++ b/tests/specs/shape/windvector.vl
@@ -1,58 +1,58 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "view": {
             "fill": "black",
             "step": 10
         }
     },
-    "mark": {
-        "shape": "wedge",
-        "type": "point"
-    },
     "data": {
         "url": "https://vega.github.io/vega-lite/data/windvectors.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
-        "color": {
+        "angle": {
             "field": "dir",
             "scale": {
                 "domain": [
                     0,
                     360
                 ],
-                "scheme": "rainbow"
+                "range": [
+                    180,
+                    540
+                ]
             },
-            "type": "quantitative",
-            "legend": null
-        },
-        "size": {
-            "field": "speed",
             "type": "quantitative"
         },
-        "angle": {
+        "color": {
             "field": "dir",
+            "legend": null,
             "scale": {
                 "domain": [
                     0,
                     360
                 ],
-                "range": [
-                    180,
-                    540
-                ]
+                "scheme": "rainbow"
             },
             "type": "quantitative"
         },
+        "size": {
+            "field": "speed",
+            "type": "quantitative"
+        },
         "x": {
+            "axis": null,
             "field": "longitude",
-            "type": "ordinal",
-            "axis": null
+            "type": "ordinal"
         },
         "y": {
+            "axis": null,
             "field": "latitude",
-            "type": "ordinal",
-            "axis": null
+            "type": "ordinal"
         }
+    },
+    "mark": {
+        "shape": "wedge",
+        "type": "point"
     }
 }
diff --git a/tests/specs/sort/ascending.vl b/tests/specs/sort/ascending.vl
--- a/tests/specs/sort/ascending.vl
+++ b/tests/specs/sort/ascending.vl
@@ -1,47 +1,47 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "Weight_in_lbs": 19,
-                "Horsepower": 1
+                "Horsepower": 1,
+                "Weight_in_lbs": 19
             },
             {
-                "Weight_in_lbs": 21,
-                "Horsepower": 5
+                "Horsepower": 5,
+                "Weight_in_lbs": 21
             },
             {
-                "Weight_in_lbs": 58,
-                "Horsepower": 2
+                "Horsepower": 2,
+                "Weight_in_lbs": 58
             },
             {
-                "Weight_in_lbs": 12,
-                "Horsepower": 3
+                "Horsepower": 3,
+                "Weight_in_lbs": 12
             },
             {
-                "Weight_in_lbs": 13,
-                "Horsepower": 4
+                "Horsepower": 4,
+                "Weight_in_lbs": 13
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
+        "order": {
+            "field": "Horsepower",
+            "type": "ordinal"
+        },
         "x": {
             "field": "Horsepower",
             "sort": "ascending",
             "type": "quantitative"
         },
-        "order": {
-            "field": "Horsepower",
-            "type": "ordinal"
-        },
         "y": {
             "field": "Horsepower",
             "type": "quantitative"
         }
+    },
+    "height": 300,
+    "mark": {
+        "strokeWidth": 0.5,
+        "type": "line"
     }
 }
diff --git a/tests/specs/sort/custom.vl b/tests/specs/sort/custom.vl
--- a/tests/specs/sort/custom.vl
+++ b/tests/specs/sort/custom.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -28,7 +28,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "a",
@@ -43,5 +42,6 @@
             "field": "b",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/sort/descending.vl b/tests/specs/sort/descending.vl
--- a/tests/specs/sort/descending.vl
+++ b/tests/specs/sort/descending.vl
@@ -1,47 +1,47 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "Weight_in_lbs": 19,
-                "Horsepower": 1
+                "Horsepower": 1,
+                "Weight_in_lbs": 19
             },
             {
-                "Weight_in_lbs": 21,
-                "Horsepower": 5
+                "Horsepower": 5,
+                "Weight_in_lbs": 21
             },
             {
-                "Weight_in_lbs": 58,
-                "Horsepower": 2
+                "Horsepower": 2,
+                "Weight_in_lbs": 58
             },
             {
-                "Weight_in_lbs": 12,
-                "Horsepower": 3
+                "Horsepower": 3,
+                "Weight_in_lbs": 12
             },
             {
-                "Weight_in_lbs": 13,
-                "Horsepower": 4
+                "Horsepower": 4,
+                "Weight_in_lbs": 13
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
+        "order": {
+            "field": "Horsepower",
+            "type": "ordinal"
+        },
         "x": {
             "field": "Horsepower",
             "sort": "descending",
             "type": "quantitative"
         },
-        "order": {
-            "field": "Horsepower",
-            "type": "ordinal"
-        },
         "y": {
             "field": "Horsepower",
             "type": "quantitative"
         }
+    },
+    "height": 300,
+    "mark": {
+        "strokeWidth": 0.5,
+        "type": "line"
     }
 }
diff --git a/tests/specs/sort/stack1.vl b/tests/specs/sort/stack1.vl
--- a/tests/specs/sort/stack1.vl
+++ b/tests/specs/sort/stack1.vl
@@ -1,23 +1,65 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/cars.json"
+    },
+    "encoding": {
+        "color": {
+            "field": "Origin",
+            "type": "nominal"
+        },
+        "opacity": {
+            "field": "Cylinders",
+            "legend": null,
+            "type": "quantitative"
+        },
+        "tooltip": [
+            {
+                "field": "Origin",
+                "type": "nominal"
+            },
+            {
+                "field": "Cylinders",
+                "type": "quantitative"
+            }
+        ],
+        "x": {
+            "axis": null,
+            "field": "x",
+            "type": "quantitative"
+        },
+        "x2": {
+            "field": "x2"
+        },
+        "y": {
+            "axis": null,
+            "field": "y",
+            "type": "quantitative"
+        },
+        "y2": {
+            "field": "y2"
+        }
+    },
+    "mark": "rect",
     "transform": [
         {
-            "groupby": [
-                "Origin",
-                "Cylinders"
-            ],
             "aggregate": [
                 {
-                    "op": "count",
-                    "as": "count_*"
+                    "as": "count_*",
+                    "op": "count"
                 }
+            ],
+            "groupby": [
+                "Origin",
+                "Cylinders"
             ]
         },
         {
-            "groupby": [],
             "as": [
                 "stack_count_Origin1",
                 "stack_count_Origin2"
             ],
+            "groupby": [],
             "offset": "normalize",
             "sort": [
                 {
@@ -28,34 +70,34 @@
             "stack": "count_*"
         },
         {
+            "frame": [
+                null,
+                null
+            ],
+            "groupby": [
+                "Origin"
+            ],
             "window": [
                 {
-                    "op": "min",
                     "as": "x",
-                    "field": "stack_count_Origin1"
+                    "field": "stack_count_Origin1",
+                    "op": "min"
                 },
                 {
-                    "op": "max",
                     "as": "x2",
-                    "field": "stack_count_Origin2"
+                    "field": "stack_count_Origin2",
+                    "op": "max"
                 }
-            ],
-            "groupby": [
-                "Origin"
-            ],
-            "frame": [
-                null,
-                null
             ]
         },
         {
-            "groupby": [
-                "Origin"
-            ],
             "as": [
                 "y",
                 "y2"
             ],
+            "groupby": [
+                "Origin"
+            ],
             "offset": "normalize",
             "sort": [
                 {
@@ -65,47 +107,5 @@
             ],
             "stack": "count_*"
         }
-    ],
-    "mark": "rect",
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/cars.json"
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "encoding": {
-        "x2": {
-            "field": "x2"
-        },
-        "color": {
-            "field": "Origin",
-            "type": "nominal"
-        },
-        "opacity": {
-            "field": "Cylinders",
-            "type": "quantitative",
-            "legend": null
-        },
-        "tooltip": [
-            {
-                "field": "Origin",
-                "type": "nominal"
-            },
-            {
-                "field": "Cylinders",
-                "type": "quantitative"
-            }
-        ],
-        "x": {
-            "field": "x",
-            "type": "quantitative",
-            "axis": null
-        },
-        "y2": {
-            "field": "y2"
-        },
-        "y": {
-            "field": "y",
-            "type": "quantitative",
-            "axis": null
-        }
-    }
+    ]
 }
diff --git a/tests/specs/sort/weighted.vl b/tests/specs/sort/weighted.vl
--- a/tests/specs/sort/weighted.vl
+++ b/tests/specs/sort/weighted.vl
@@ -1,50 +1,50 @@
 {
-    "height": 300,
-    "mark": {
-        "strokeWidth": 0.5,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "Weight_in_lbs": 19,
-                "Horsepower": 1
+                "Horsepower": 1,
+                "Weight_in_lbs": 19
             },
             {
-                "Weight_in_lbs": 21,
-                "Horsepower": 5
+                "Horsepower": 5,
+                "Weight_in_lbs": 21
             },
             {
-                "Weight_in_lbs": 58,
-                "Horsepower": 2
+                "Horsepower": 2,
+                "Weight_in_lbs": 58
             },
             {
-                "Weight_in_lbs": 12,
-                "Horsepower": 3
+                "Horsepower": 3,
+                "Weight_in_lbs": 12
             },
             {
-                "Weight_in_lbs": 13,
-                "Horsepower": 4
+                "Horsepower": 4,
+                "Weight_in_lbs": 13
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
+        "order": {
+            "field": "Weight_in_lbs",
+            "type": "ordinal"
+        },
         "x": {
             "field": "Horsepower",
             "sort": {
-                "op": "mean",
-                "field": "Weight_in_lbs"
+                "field": "Weight_in_lbs",
+                "op": "mean"
             },
             "type": "quantitative"
         },
-        "order": {
-            "field": "Weight_in_lbs",
-            "type": "ordinal"
-        },
         "y": {
             "field": "Weight_in_lbs",
             "type": "quantitative"
         }
+    },
+    "height": 300,
+    "mark": {
+        "strokeWidth": 0.5,
+        "type": "line"
     }
 }
diff --git a/tests/specs/textformat/textFormat1.vl b/tests/specs/textformat/textFormat1.vl
--- a/tests/specs/textformat/textFormat1.vl
+++ b/tests/specs/textformat/textFormat1.vl
@@ -1,5 +1,5 @@
 {
-    "height": 400,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -88,11 +88,9 @@
             }
         ]
     },
-    "width": 600,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 400,
     "layer": [
         {
-            "mark": "circle",
             "encoding": {
                 "x": {
                     "field": "a",
@@ -102,49 +100,51 @@
                     "field": "b",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "circle"
         },
         {
-            "mark": {
-                "dx": 22,
-                "dy": 4,
-                "type": "text"
-            },
             "encoding": {
                 "color": {
                     "field": "a",
-                    "type": "temporal",
                     "legend": {
                         "format": "%b %Y",
                         "formatType": "time"
-                    }
+                    },
+                    "type": "temporal"
                 },
                 "text": {
                     "field": "a",
                     "format": "%b `%y",
-                    "type": "temporal",
-                    "formatType": "time"
+                    "formatType": "time",
+                    "type": "temporal"
                 },
                 "x": {
-                    "field": "a",
-                    "type": "temporal",
                     "axis": {
                         "format": "%y",
                         "formatType": "time"
-                    }
+                    },
+                    "field": "a",
+                    "type": "temporal"
                 },
                 "y": {
+                    "axis": {
+                        "format": ".2f",
+                        "formatType": "number"
+                    },
                     "field": "b",
                     "scale": {
                         "zero": false
                     },
-                    "type": "quantitative",
-                    "axis": {
-                        "format": ".2f",
-                        "formatType": "number"
-                    }
+                    "type": "quantitative"
                 }
+            },
+            "mark": {
+                "dx": 22,
+                "dy": 4,
+                "type": "text"
             }
         }
-    ]
+    ],
+    "width": 600
 }
diff --git a/tests/specs/textformat/textFormat2.vl b/tests/specs/textformat/textFormat2.vl
--- a/tests/specs/textformat/textFormat2.vl
+++ b/tests/specs/textformat/textFormat2.vl
@@ -1,27 +1,13 @@
 {
-    "transform": [
-        {
-            "filter": "datum.month >= '2016'"
-        }
-    ],
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/westMidlands/westMidsCrimesAggregated.tsv"
     },
-    "width": 100,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "crimeType",
-            "type": "nominal",
-            "legend": null
-        },
-        "x": {
-            "field": "crimeType",
-            "type": "nominal",
-            "axis": {
-                "title": ""
-            }
+            "legend": null,
+            "type": "nominal"
         },
         "column": {
             "field": "month",
@@ -31,10 +17,24 @@
             },
             "type": "temporal"
         },
+        "x": {
+            "axis": {
+                "title": ""
+            },
+            "field": "crimeType",
+            "type": "nominal"
+        },
         "y": {
-            "field": "reportedCrimes",
             "aggregate": "sum",
+            "field": "reportedCrimes",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.month >= '2016'"
+        }
+    ],
+    "width": 100
 }
diff --git a/tests/specs/textformat/tstring.vl b/tests/specs/textformat/tstring.vl
--- a/tests/specs/textformat/tstring.vl
+++ b/tests/specs/textformat/tstring.vl
@@ -1,6 +1,5 @@
 {
-    "height": 100,
-    "mark": "text",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -17,8 +16,6 @@
             }
         ]
     },
-    "width": 100,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "text": {
             "value": "🐕"
@@ -31,5 +28,8 @@
             "field": "y",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 100,
+    "mark": "text",
+    "width": 100
 }
diff --git a/tests/specs/time/customizeStep.vl b/tests/specs/time/customizeStep.vl
--- a/tests/specs/time/customizeStep.vl
+++ b/tests/specs/time/customizeStep.vl
@@ -1,74 +1,73 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "distance": 1,
-                "date": "Sun, 01 Jan 2012 00:00:00"
+                "date": "Sun, 01 Jan 2012 00:00:00",
+                "distance": 1
             },
             {
-                "distance": 1,
-                "date": "Sun, 01 Jan 2012 00:01:00"
+                "date": "Sun, 01 Jan 2012 00:01:00",
+                "distance": 1
             },
             {
-                "distance": 2,
-                "date": "Sun, 01 Jan 2012 00:02:00"
+                "date": "Sun, 01 Jan 2012 00:02:00",
+                "distance": 2
             },
             {
-                "distance": 1,
-                "date": "Sun, 01 Jan 2012 00:03:00"
+                "date": "Sun, 01 Jan 2012 00:03:00",
+                "distance": 1
             },
             {
-                "distance": 4,
-                "date": "Sun, 01 Jan 2012 00:04:00"
+                "date": "Sun, 01 Jan 2012 00:04:00",
+                "distance": 4
             },
             {
-                "distance": 2,
-                "date": "Sun, 01 Jan 2012 00:05:00"
+                "date": "Sun, 01 Jan 2012 00:05:00",
+                "distance": 2
             },
             {
-                "distance": 5,
-                "date": "Sun, 01 Jan 2012 00:06:00"
+                "date": "Sun, 01 Jan 2012 00:06:00",
+                "distance": 5
             },
             {
-                "distance": 2,
-                "date": "Sun, 01 Jan 2012 00:07:00"
+                "date": "Sun, 01 Jan 2012 00:07:00",
+                "distance": 2
             },
             {
-                "distance": 6,
-                "date": "Sun, 01 Jan 2012 00:08:00"
+                "date": "Sun, 01 Jan 2012 00:08:00",
+                "distance": 6
             },
             {
-                "distance": 4,
-                "date": "Sun, 01 Jan 2012 00:09:00"
+                "date": "Sun, 01 Jan 2012 00:09:00",
+                "distance": 4
             },
             {
-                "distance": 1,
-                "date": "Sun, 01 Jan 2012 00:10:00"
+                "date": "Sun, 01 Jan 2012 00:10:00",
+                "distance": 1
             },
             {
-                "distance": 1,
-                "date": "Sun, 01 Jan 2012 00:11:00"
+                "date": "Sun, 01 Jan 2012 00:11:00",
+                "distance": 1
             },
             {
-                "distance": 3,
-                "date": "Sun, 01 Jan 2012 00:12:00"
+                "date": "Sun, 01 Jan 2012 00:12:00",
+                "distance": 3
             },
             {
-                "distance": 0,
-                "date": "Sun, 01 Jan 2012 00:13:00"
+                "date": "Sun, 01 Jan 2012 00:13:00",
+                "distance": 0
             },
             {
-                "distance": 2,
-                "date": "Sun, 01 Jan 2012 00:14:00"
+                "date": "Sun, 01 Jan 2012 00:14:00",
+                "distance": 2
             },
             {
-                "distance": 3,
-                "date": "Sun, 01 Jan 2012 00:15:00"
+                "date": "Sun, 01 Jan 2012 00:15:00",
+                "distance": 3
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -79,9 +78,10 @@
             "type": "temporal"
         },
         "y": {
-            "field": "distance",
             "aggregate": "sum",
+            "field": "distance",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/time/localTime.vl b/tests/specs/time/localTime.vl
--- a/tests/specs/time/localTime.vl
+++ b/tests/specs/time/localTime.vl
@@ -1,62 +1,62 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
+        "format": {
+            "parse": {
+                "date": "date:'%d %b %Y %H:%M'"
+            }
+        },
         "values": [
             {
-                "value": 1,
-                "date": "28 Oct 2017 22:00"
+                "date": "28 Oct 2017 22:00",
+                "value": 1
             },
             {
-                "value": 2,
-                "date": "28 Oct 2017 23:00"
+                "date": "28 Oct 2017 23:00",
+                "value": 2
             },
             {
-                "value": 3,
-                "date": "29 Oct 2017 00:00"
+                "date": "29 Oct 2017 00:00",
+                "value": 3
             },
             {
-                "value": 4,
-                "date": "29 Oct 2017 01:00"
+                "date": "29 Oct 2017 01:00",
+                "value": 4
             },
             {
-                "value": 5,
-                "date": "29 Oct 2017 02:00"
+                "date": "29 Oct 2017 02:00",
+                "value": 5
             },
             {
-                "value": 6,
-                "date": "29 Oct 2017 03:00"
+                "date": "29 Oct 2017 03:00",
+                "value": 6
             },
             {
-                "value": 7,
-                "date": "29 Oct 2017 04:00"
-            }
-        ],
-        "format": {
-            "parse": {
-                "date": "date:'%d %b %Y %H:%M'"
+                "date": "29 Oct 2017 04:00",
+                "value": 7
             }
-        }
+        ]
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "size": {
             "value": 500
         },
         "x": {
+            "axis": {
+                "format": "%d %b %H:%M"
+            },
             "field": "date",
             "scale": {
                 "type": "time"
             },
             "timeUnit": "yearmonthdatehours",
-            "type": "temporal",
-            "axis": {
-                "format": "%d %b %H:%M"
-            }
+            "type": "temporal"
         },
         "y": {
             "field": "value",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "width": 800
 }
diff --git a/tests/specs/time/monthAggregate.vl b/tests/specs/time/monthAggregate.vl
--- a/tests/specs/time/monthAggregate.vl
+++ b/tests/specs/time/monthAggregate.vl
@@ -1,12 +1,8 @@
 {
-    "mark": {
-        "interpolate": "monotone",
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-temps.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -14,9 +10,13 @@
             "type": "temporal"
         },
         "y": {
-            "field": "temp",
             "aggregate": "mean",
+            "field": "temp",
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "interpolate": "monotone",
+        "type": "line"
     }
 }
diff --git a/tests/specs/time/nestedTime1.vl b/tests/specs/time/nestedTime1.vl
--- a/tests/specs/time/nestedTime1.vl
+++ b/tests/specs/time/nestedTime1.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -34,7 +34,7 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Google's stock price over time.",
     "encoding": {
         "x": {
             "field": "histo.date",
@@ -49,5 +49,5 @@
             "type": "quantitative"
         }
     },
-    "description": "Google's stock price over time."
+    "mark": "line"
 }
diff --git a/tests/specs/time/nestedTime2.vl b/tests/specs/time/nestedTime2.vl
--- a/tests/specs/time/nestedTime2.vl
+++ b/tests/specs/time/nestedTime2.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -24,7 +24,7 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "description": "Google's stock price over time.",
     "encoding": {
         "x": {
             "field": "date",
@@ -39,5 +39,5 @@
             "type": "quantitative"
         }
     },
-    "description": "Google's stock price over time."
+    "mark": "line"
 }
diff --git a/tests/specs/time/outputAsUTC.vl b/tests/specs/time/outputAsUTC.vl
--- a/tests/specs/time/outputAsUTC.vl
+++ b/tests/specs/time/outputAsUTC.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -24,19 +24,19 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "date",
-            "timeUnit": "utcyearmonthdatehoursminutes",
-            "type": "temporal",
             "axis": {
                 "labelAngle": 15
-            }
+            },
+            "field": "date",
+            "timeUnit": "utcyearmonthdatehoursminutes",
+            "type": "temporal"
         },
         "y": {
             "field": "price",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line"
 }
diff --git a/tests/specs/time/outputScaledAsUTC.vl b/tests/specs/time/outputScaledAsUTC.vl
--- a/tests/specs/time/outputScaledAsUTC.vl
+++ b/tests/specs/time/outputScaledAsUTC.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -24,22 +24,22 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
+            "axis": {
+                "labelAngle": 15
+            },
             "field": "date",
             "scale": {
                 "type": "utc"
             },
             "timeUnit": "yearmonthdatehoursminutes",
-            "type": "temporal",
-            "axis": {
-                "labelAngle": 15
-            }
+            "type": "temporal"
         },
         "y": {
             "field": "price",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line"
 }
diff --git a/tests/specs/time/parseAsFormat.vl b/tests/specs/time/parseAsFormat.vl
--- a/tests/specs/time/parseAsFormat.vl
+++ b/tests/specs/time/parseAsFormat.vl
@@ -1,6 +1,11 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
+        "format": {
+            "parse": {
+                "date": "utc:'%d %b %Y %H:%M:%S'"
+            }
+        },
         "values": [
             {
                 "date": "10 Oct 2011 22:48:00"
@@ -8,22 +13,17 @@
             {
                 "date": "11 Oct 2022 23:00:00"
             }
-        ],
-        "format": {
-            "parse": {
-                "date": "utc:'%d %b %Y %H:%M:%S'"
-            }
-        }
+        ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "y": {
-            "field": "date",
-            "timeUnit": "hoursminutes",
-            "type": "ordinal",
             "axis": {
                 "title": "time"
-            }
+            },
+            "field": "date",
+            "timeUnit": "hoursminutes",
+            "type": "ordinal"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/time/parseAsLocal.vl b/tests/specs/time/parseAsLocal.vl
--- a/tests/specs/time/parseAsLocal.vl
+++ b/tests/specs/time/parseAsLocal.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -10,15 +10,15 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "y": {
-            "field": "date",
-            "timeUnit": "hoursminutes",
-            "type": "ordinal",
             "axis": {
                 "title": "time"
-            }
+            },
+            "field": "date",
+            "timeUnit": "hoursminutes",
+            "type": "ordinal"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/time/parseAsUTC.vl b/tests/specs/time/parseAsUTC.vl
--- a/tests/specs/time/parseAsUTC.vl
+++ b/tests/specs/time/parseAsUTC.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "point",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -10,15 +10,15 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "y": {
-            "field": "date",
-            "timeUnit": "utchours",
-            "type": "ordinal",
             "axis": {
                 "title": "time"
-            }
+            },
+            "field": "date",
+            "timeUnit": "utchours",
+            "type": "ordinal"
         }
-    }
+    },
+    "mark": "point"
 }
diff --git a/tests/specs/time/timeBand.vl b/tests/specs/time/timeBand.vl
--- a/tests/specs/time/timeBand.vl
+++ b/tests/specs/time/timeBand.vl
@@ -1,26 +1,26 @@
 {
-    "mark": {
-        "point": {
-            "fill": "black"
-        },
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-temps.csv"
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
+            "band": 0.5,
             "field": "date",
             "timeUnit": "month",
-            "type": "temporal",
-            "band": 0.5
+            "type": "temporal"
         },
         "y": {
-            "field": "temp",
             "aggregate": "mean",
+            "field": "temp",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "point": {
+            "fill": "black"
+        },
+        "type": "line"
+    },
+    "width": 400
 }
diff --git a/tests/specs/time/timeDate.vl b/tests/specs/time/timeDate.vl
--- a/tests/specs/time/timeDate.vl
+++ b/tests/specs/time/timeDate.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeDay.vl b/tests/specs/time/timeDay.vl
--- a/tests/specs/time/timeDay.vl
+++ b/tests/specs/time/timeDay.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeHours.vl b/tests/specs/time/timeHours.vl
--- a/tests/specs/time/timeHours.vl
+++ b/tests/specs/time/timeHours.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeHoursMinutes.vl b/tests/specs/time/timeHoursMinutes.vl
--- a/tests/specs/time/timeHoursMinutes.vl
+++ b/tests/specs/time/timeHoursMinutes.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeHoursMinutesSeconds.vl b/tests/specs/time/timeHoursMinutesSeconds.vl
--- a/tests/specs/time/timeHoursMinutesSeconds.vl
+++ b/tests/specs/time/timeHoursMinutesSeconds.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeMinutes.vl b/tests/specs/time/timeMinutes.vl
--- a/tests/specs/time/timeMinutes.vl
+++ b/tests/specs/time/timeMinutes.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeMinutesSeconds.vl b/tests/specs/time/timeMinutesSeconds.vl
--- a/tests/specs/time/timeMinutesSeconds.vl
+++ b/tests/specs/time/timeMinutesSeconds.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeMonth.vl b/tests/specs/time/timeMonth.vl
--- a/tests/specs/time/timeMonth.vl
+++ b/tests/specs/time/timeMonth.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeMonthDate.vl b/tests/specs/time/timeMonthDate.vl
--- a/tests/specs/time/timeMonthDate.vl
+++ b/tests/specs/time/timeMonthDate.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeQuarter.vl b/tests/specs/time/timeQuarter.vl
--- a/tests/specs/time/timeQuarter.vl
+++ b/tests/specs/time/timeQuarter.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeQuarterMonth.vl b/tests/specs/time/timeQuarterMonth.vl
--- a/tests/specs/time/timeQuarterMonth.vl
+++ b/tests/specs/time/timeQuarterMonth.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeUnitTransform.vl b/tests/specs/time/timeUnitTransform.vl
--- a/tests/specs/time/timeUnitTransform.vl
+++ b/tests/specs/time/timeUnitTransform.vl
@@ -1,28 +1,28 @@
 {
-    "transform": [
-        {
-            "as": "month",
-            "field": "date",
-            "timeUnit": "month"
-        }
-    ],
-    "mark": "line",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "month",
-            "type": "temporal",
             "axis": {
                 "format": "%b"
-            }
+            },
+            "field": "month",
+            "type": "temporal"
         },
         "y": {
-            "field": "temp_max",
             "aggregate": "max",
+            "field": "temp_max",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "line",
+    "transform": [
+        {
+            "as": "month",
+            "field": "date",
+            "timeUnit": "month"
+        }
+    ]
 }
diff --git a/tests/specs/time/timeYear.vl b/tests/specs/time/timeYear.vl
--- a/tests/specs/time/timeYear.vl
+++ b/tests/specs/time/timeYear.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeYearMonthDateHours.vl b/tests/specs/time/timeYearMonthDateHours.vl
--- a/tests/specs/time/timeYearMonthDateHours.vl
+++ b/tests/specs/time/timeYearMonthDateHours.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeYearMonthDateHoursMinutes.vl b/tests/specs/time/timeYearMonthDateHoursMinutes.vl
--- a/tests/specs/time/timeYearMonthDateHoursMinutes.vl
+++ b/tests/specs/time/timeYearMonthDateHoursMinutes.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/timeYearMonthDateHoursMinutesSeconds.vl b/tests/specs/time/timeYearMonthDateHoursMinutesSeconds.vl
--- a/tests/specs/time/timeYearMonthDateHoursMinutesSeconds.vl
+++ b/tests/specs/time/timeYearMonthDateHoursMinutesSeconds.vl
@@ -1,13 +1,8 @@
 {
-    "mark": {
-        "strokeWidth": 0.2,
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://gicentre.github.io/data/tests/timeTest.tsv"
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -15,12 +10,17 @@
             "type": "temporal"
         },
         "y": {
+            "aggregate": "mean",
             "field": "temperature",
             "scale": {
                 "zero": false
             },
-            "aggregate": "mean",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": {
+        "strokeWidth": 0.2,
+        "type": "line"
+    },
+    "width": 800
 }
diff --git a/tests/specs/time/utcTime.vl b/tests/specs/time/utcTime.vl
--- a/tests/specs/time/utcTime.vl
+++ b/tests/specs/time/utcTime.vl
@@ -1,62 +1,62 @@
 {
-    "mark": "circle",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
+        "format": {
+            "parse": {
+                "date": "utc:'%d %b %Y %H:%M'"
+            }
+        },
         "values": [
             {
-                "value": 1,
-                "date": "28 Oct 2017 22:00"
+                "date": "28 Oct 2017 22:00",
+                "value": 1
             },
             {
-                "value": 2,
-                "date": "28 Oct 2017 23:00"
+                "date": "28 Oct 2017 23:00",
+                "value": 2
             },
             {
-                "value": 3,
-                "date": "29 Oct 2017 00:00"
+                "date": "29 Oct 2017 00:00",
+                "value": 3
             },
             {
-                "value": 4,
-                "date": "29 Oct 2017 01:00"
+                "date": "29 Oct 2017 01:00",
+                "value": 4
             },
             {
-                "value": 5,
-                "date": "29 Oct 2017 02:00"
+                "date": "29 Oct 2017 02:00",
+                "value": 5
             },
             {
-                "value": 6,
-                "date": "29 Oct 2017 03:00"
+                "date": "29 Oct 2017 03:00",
+                "value": 6
             },
             {
-                "value": 7,
-                "date": "29 Oct 2017 04:00"
-            }
-        ],
-        "format": {
-            "parse": {
-                "date": "utc:'%d %b %Y %H:%M'"
+                "date": "29 Oct 2017 04:00",
+                "value": 7
             }
-        }
+        ]
     },
-    "width": 800,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "size": {
             "value": 500
         },
         "x": {
+            "axis": {
+                "format": "%d %b %H:%M"
+            },
             "field": "date",
             "scale": {
                 "type": "utc"
             },
             "timeUnit": "utcyearmonthdatehours",
-            "type": "temporal",
-            "axis": {
-                "format": "%d %b %H:%M"
-            }
+            "type": "temporal"
         },
         "y": {
             "field": "value",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "circle",
+    "width": 800
 }
diff --git a/tests/specs/time/withBar.vl b/tests/specs/time/withBar.vl
--- a/tests/specs/time/withBar.vl
+++ b/tests/specs/time/withBar.vl
@@ -1,9 +1,8 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -11,9 +10,10 @@
             "type": "temporal"
         },
         "y": {
-            "field": "precipitation",
             "aggregate": "mean",
+            "field": "precipitation",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/time/withBarOrdinal.vl b/tests/specs/time/withBarOrdinal.vl
--- a/tests/specs/time/withBarOrdinal.vl
+++ b/tests/specs/time/withBarOrdinal.vl
@@ -1,9 +1,8 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "date",
@@ -11,9 +10,10 @@
             "type": "ordinal"
         },
         "y": {
-            "field": "precipitation",
             "aggregate": "mean",
+            "field": "precipitation",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/tooltip/notips.vl b/tests/specs/tooltip/notips.vl
--- a/tests/specs/tooltip/notips.vl
+++ b/tests/specs/tooltip/notips.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -40,7 +40,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "tooltip": null,
         "x": {
@@ -51,5 +50,6 @@
             "field": "b",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/tooltip/tooltip1.vl b/tests/specs/tooltip/tooltip1.vl
--- a/tests/specs/tooltip/tooltip1.vl
+++ b/tests/specs/tooltip/tooltip1.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -40,7 +40,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "tooltip": {
             "field": "b",
@@ -54,5 +53,6 @@
             "field": "b",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/tooltip/tooltip2.vl b/tests/specs/tooltip/tooltip2.vl
--- a/tests/specs/tooltip/tooltip2.vl
+++ b/tests/specs/tooltip/tooltip2.vl
@@ -1,5 +1,5 @@
 {
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -40,7 +40,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "tooltip": [
             {
@@ -60,5 +59,6 @@
             "field": "b",
             "type": "quantitative"
         }
-    }
+    },
+    "mark": "bar"
 }
diff --git a/tests/specs/trail/trail1.vl b/tests/specs/trail/trail1.vl
--- a/tests/specs/trail/trail1.vl
+++ b/tests/specs/trail/trail1.vl
@@ -1,11 +1,8 @@
 {
-    "height": 400,
-    "mark": "trail",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/stocks.csv"
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "symbol",
@@ -16,15 +13,18 @@
             "type": "quantitative"
         },
         "x": {
-            "field": "date",
-            "type": "temporal",
             "axis": {
                 "format": "%Y"
-            }
+            },
+            "field": "date",
+            "type": "temporal"
         },
         "y": {
             "field": "price",
             "type": "quantitative"
         }
-    }
+    },
+    "height": 400,
+    "mark": "trail",
+    "width": 400
 }
diff --git a/tests/specs/trail/trail2.vl b/tests/specs/trail/trail2.vl
--- a/tests/specs/trail/trail2.vl
+++ b/tests/specs/trail/trail2.vl
@@ -1,17 +1,13 @@
 {
-    "mark": {
-        "type": "trail",
-        "order": false
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/driving.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "size": {
             "field": "year",
-            "type": "temporal",
-            "legend": null
+            "legend": null,
+            "type": "temporal"
         },
         "x": {
             "field": "miles",
@@ -27,5 +23,9 @@
             },
             "type": "quantitative"
         }
+    },
+    "mark": {
+        "order": false,
+        "type": "trail"
     }
 }
diff --git a/tests/specs/viewcomposition/columns1.vl b/tests/specs/viewcomposition/columns1.vl
--- a/tests/specs/viewcomposition/columns1.vl
+++ b/tests/specs/viewcomposition/columns1.vl
@@ -1,24 +1,11 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {}
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -30,23 +17,36 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {},
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/columns2.vl b/tests/specs/viewcomposition/columns2.vl
--- a/tests/specs/viewcomposition/columns2.vl
+++ b/tests/specs/viewcomposition/columns2.vl
@@ -1,24 +1,11 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {}
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -30,26 +17,39 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {
                 "labelFontSize": 15,
                 "titleFontSize": 20
             },
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/columns3.vl b/tests/specs/viewcomposition/columns3.vl
--- a/tests/specs/viewcomposition/columns3.vl
+++ b/tests/specs/viewcomposition/columns3.vl
@@ -1,27 +1,14 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {
             "labelFontSize": 15,
             "titleFontSize": 20
         }
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -33,23 +20,36 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {},
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/columns4.vl b/tests/specs/viewcomposition/columns4.vl
--- a/tests/specs/viewcomposition/columns4.vl
+++ b/tests/specs/viewcomposition/columns4.vl
@@ -1,24 +1,11 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {}
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -30,32 +17,45 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {
-                "titleFontWeight": "normal",
-                "titlePadding": -27,
-                "labelLineHeight": 14,
-                "labelPadding": 40,
-                "labelFontWeight": "bold",
                 "labelBaseline": "line-bottom",
                 "labelFontSize": 15,
-                "titleFontSize": 20
+                "labelFontWeight": "bold",
+                "labelLineHeight": 14,
+                "labelPadding": 40,
+                "titleFontSize": 20,
+                "titleFontWeight": "normal",
+                "titlePadding": -27
             },
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/grid1.vl b/tests/specs/viewcomposition/grid1.vl
--- a/tests/specs/viewcomposition/grid1.vl
+++ b/tests/specs/viewcomposition/grid1.vl
@@ -1,396 +1,412 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
+        "axis": {
+            "disable": true
+        },
+        "facet": {
+            "columns": 5,
+            "spacing": 80
+        },
         "header": {
             "labelFontSize": 0.1
         },
         "view": {
-            "strokeWidth": 2,
             "continuousHeight": 120,
-            "stroke": "black",
             "fill": "gray",
-            "fillOpacity": 0.2
-        },
-        "facet": {
-            "columns": 5,
-            "spacing": 80
-        },
-        "axis": {
-            "disable": true
+            "fillOpacity": 0.2,
+            "stroke": "black",
+            "strokeWidth": 2
         }
     },
     "data": {
         "values": [
             {
                 "cat": 1,
-                "row": 1,
                 "col": 1,
+                "row": 1,
                 "val": 30
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 1,
+                "row": 1,
                 "val": 15
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 1,
+                "row": 1,
                 "val": 12
             },
             {
                 "cat": 1,
-                "row": 1,
                 "col": 2,
+                "row": 1,
                 "val": 25
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 2,
+                "row": 1,
                 "val": 30
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 2,
+                "row": 1,
                 "val": 25
             },
             {
                 "cat": 1,
-                "row": 1,
                 "col": 3,
+                "row": 1,
                 "val": 10
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 3,
+                "row": 1,
                 "val": 28
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 3,
+                "row": 1,
                 "val": 11
             },
             {
                 "cat": 1,
-                "row": 1,
                 "col": 4,
+                "row": 1,
                 "val": 18
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 4,
+                "row": 1,
                 "val": 24
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 4,
+                "row": 1,
                 "val": 16
             },
             {
                 "cat": 1,
-                "row": 1,
                 "col": 5,
+                "row": 1,
                 "val": 10
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 5,
+                "row": 1,
                 "val": 10
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 5,
+                "row": 1,
                 "val": 10
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 1,
+                "row": 2,
                 "val": 8
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 1,
+                "row": 2,
                 "val": 8
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 1,
+                "row": 2,
                 "val": 29
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 2,
+                "row": 2,
                 "val": 11
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 2,
+                "row": 2,
                 "val": 24
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 2,
+                "row": 2,
                 "val": 12
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 3,
+                "row": 2,
                 "val": 26
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 3,
+                "row": 2,
                 "val": 32
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 3,
+                "row": 2,
                 "val": 9
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 4,
+                "row": 2,
                 "val": 8
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 4,
+                "row": 2,
                 "val": 18
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 4,
+                "row": 2,
                 "val": 28
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 5,
+                "row": 2,
                 "val": 8
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 5,
+                "row": 2,
                 "val": 20
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 5,
+                "row": 2,
                 "val": 24
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 1,
+                "row": 3,
                 "val": 21
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 1,
+                "row": 3,
                 "val": 15
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 1,
+                "row": 3,
                 "val": 20
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 2,
+                "row": 3,
                 "val": 4
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 2,
+                "row": 3,
                 "val": 13
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 2,
+                "row": 3,
                 "val": 12
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 3,
+                "row": 3,
                 "val": 27
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 3,
+                "row": 3,
                 "val": 21
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 3,
+                "row": 3,
                 "val": 14
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 4,
+                "row": 3,
                 "val": 5
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 4,
+                "row": 3,
                 "val": 1
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 4,
+                "row": 3,
                 "val": 2
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 5,
+                "row": 3,
                 "val": 11
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 5,
+                "row": 3,
                 "val": 2
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 5,
+                "row": 3,
                 "val": 5
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 1,
+                "row": 4,
                 "val": 14
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 1,
+                "row": 4,
                 "val": 20
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 1,
+                "row": 4,
                 "val": 24
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 2,
+                "row": 4,
                 "val": 20
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 2,
+                "row": 4,
                 "val": 2
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 2,
+                "row": 4,
                 "val": 9
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 3,
+                "row": 4,
                 "val": 15
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 3,
+                "row": 4,
                 "val": 14
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 3,
+                "row": 4,
                 "val": 13
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 4,
+                "row": 4,
                 "val": 22
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 4,
+                "row": 4,
                 "val": 30
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 4,
+                "row": 4,
                 "val": 30
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 5,
+                "row": 4,
                 "val": 10
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 5,
+                "row": 4,
                 "val": 8
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 5,
+                "row": 4,
                 "val": 12
             }
         ]
     },
+    "facet": {
+        "column": {
+            "field": "col",
+            "header": {
+                "title": null
+            },
+            "type": "ordinal"
+        },
+        "row": {
+            "field": "row",
+            "title": null,
+            "type": "ordinal"
+        }
+    },
+    "spacing": {
+        "column": 30,
+        "row": 10
+    },
     "spec": {
-        "height": 120,
-        "mark": "bar",
-        "width": 120,
         "encoding": {
             "color": {
                 "field": "cat",
-                "type": "nominal",
-                "legend": null
+                "legend": null,
+                "type": "nominal"
             },
             "x": {
                 "field": "cat",
@@ -400,25 +416,9 @@
                 "field": "val",
                 "type": "quantitative"
             }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "facet": {
-        "row": {
-            "field": "row",
-            "title": null,
-            "type": "ordinal"
         },
-        "column": {
-            "field": "col",
-            "header": {
-                "title": null
-            },
-            "type": "ordinal"
-        }
-    },
-    "spacing": {
-        "row": 10,
-        "column": 30
+        "height": 120,
+        "mark": "bar",
+        "width": 120
     }
 }
diff --git a/tests/specs/viewcomposition/grid2.vl b/tests/specs/viewcomposition/grid2.vl
--- a/tests/specs/viewcomposition/grid2.vl
+++ b/tests/specs/viewcomposition/grid2.vl
@@ -1,402 +1,402 @@
 {
-    "transform": [
-        {
-            "as": "index",
-            "calculate": "datum.row * 1000 + datum.col"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "columns": 5,
     "config": {
+        "axis": {
+            "disable": true
+        },
+        "facet": {
+            "columns": 5,
+            "spacing": 80
+        },
         "header": {
             "labelFontSize": 0.1
         },
         "view": {
-            "strokeWidth": 2,
             "continuousHeight": 120,
-            "stroke": "black",
             "fill": "gray",
-            "fillOpacity": 0.2
-        },
-        "facet": {
-            "columns": 5,
-            "spacing": 80
-        },
-        "axis": {
-            "disable": true
+            "fillOpacity": 0.2,
+            "stroke": "black",
+            "strokeWidth": 2
         }
     },
     "data": {
         "values": [
             {
                 "cat": 1,
-                "row": 1,
                 "col": 1,
+                "row": 1,
                 "val": 30
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 1,
+                "row": 1,
                 "val": 15
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 1,
+                "row": 1,
                 "val": 12
             },
             {
                 "cat": 1,
-                "row": 1,
                 "col": 2,
+                "row": 1,
                 "val": 25
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 2,
+                "row": 1,
                 "val": 30
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 2,
+                "row": 1,
                 "val": 25
             },
             {
                 "cat": 1,
-                "row": 1,
                 "col": 3,
+                "row": 1,
                 "val": 10
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 3,
+                "row": 1,
                 "val": 28
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 3,
+                "row": 1,
                 "val": 11
             },
             {
                 "cat": 1,
-                "row": 1,
                 "col": 4,
+                "row": 1,
                 "val": 18
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 4,
+                "row": 1,
                 "val": 24
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 4,
+                "row": 1,
                 "val": 16
             },
             {
                 "cat": 1,
-                "row": 1,
                 "col": 5,
+                "row": 1,
                 "val": 10
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 5,
+                "row": 1,
                 "val": 10
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 5,
+                "row": 1,
                 "val": 10
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 1,
+                "row": 2,
                 "val": 8
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 1,
+                "row": 2,
                 "val": 8
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 1,
+                "row": 2,
                 "val": 29
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 2,
+                "row": 2,
                 "val": 11
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 2,
+                "row": 2,
                 "val": 24
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 2,
+                "row": 2,
                 "val": 12
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 3,
+                "row": 2,
                 "val": 26
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 3,
+                "row": 2,
                 "val": 32
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 3,
+                "row": 2,
                 "val": 9
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 4,
+                "row": 2,
                 "val": 8
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 4,
+                "row": 2,
                 "val": 18
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 4,
+                "row": 2,
                 "val": 28
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 5,
+                "row": 2,
                 "val": 8
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 5,
+                "row": 2,
                 "val": 20
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 5,
+                "row": 2,
                 "val": 24
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 1,
+                "row": 3,
                 "val": 21
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 1,
+                "row": 3,
                 "val": 15
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 1,
+                "row": 3,
                 "val": 20
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 2,
+                "row": 3,
                 "val": 4
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 2,
+                "row": 3,
                 "val": 13
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 2,
+                "row": 3,
                 "val": 12
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 3,
+                "row": 3,
                 "val": 27
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 3,
+                "row": 3,
                 "val": 21
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 3,
+                "row": 3,
                 "val": 14
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 4,
+                "row": 3,
                 "val": 5
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 4,
+                "row": 3,
                 "val": 1
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 4,
+                "row": 3,
                 "val": 2
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 5,
+                "row": 3,
                 "val": 11
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 5,
+                "row": 3,
                 "val": 2
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 5,
+                "row": 3,
                 "val": 5
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 1,
+                "row": 4,
                 "val": 14
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 1,
+                "row": 4,
                 "val": 20
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 1,
+                "row": 4,
                 "val": 24
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 2,
+                "row": 4,
                 "val": 20
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 2,
+                "row": 4,
                 "val": 2
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 2,
+                "row": 4,
                 "val": 9
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 3,
+                "row": 4,
                 "val": 15
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 3,
+                "row": 4,
                 "val": 14
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 3,
+                "row": 4,
                 "val": 13
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 4,
+                "row": 4,
                 "val": 22
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 4,
+                "row": 4,
                 "val": 30
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 4,
+                "row": 4,
                 "val": 30
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 5,
+                "row": 4,
                 "val": 10
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 5,
+                "row": 4,
                 "val": 8
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 5,
+                "row": 4,
                 "val": 12
             }
         ]
     },
+    "facet": {
+        "field": "index",
+        "header": {
+            "title": null
+        },
+        "type": "ordinal"
+    },
     "spec": {
-        "height": 120,
-        "mark": "bar",
-        "width": 120,
         "encoding": {
             "color": {
                 "field": "cat",
-                "type": "nominal",
-                "legend": null
+                "legend": null,
+                "type": "nominal"
             },
             "x": {
                 "field": "cat",
@@ -406,15 +406,15 @@
                 "field": "val",
                 "type": "quantitative"
             }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "columns": 5,
-    "facet": {
-        "field": "index",
-        "header": {
-            "title": null
         },
-        "type": "ordinal"
-    }
+        "height": 120,
+        "mark": "bar",
+        "width": 120
+    },
+    "transform": [
+        {
+            "as": "index",
+            "calculate": "datum.row * 1000 + datum.col"
+        }
+    ]
 }
diff --git a/tests/specs/viewcomposition/grid3.vl b/tests/specs/viewcomposition/grid3.vl
--- a/tests/specs/viewcomposition/grid3.vl
+++ b/tests/specs/viewcomposition/grid3.vl
@@ -1,401 +1,401 @@
 {
-    "transform": [
-        {
-            "as": "index",
-            "calculate": "datum.row * 1000 + datum.col"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "columns": 0,
     "config": {
+        "axis": {
+            "disable": true
+        },
+        "facet": {
+            "spacing": 80
+        },
         "header": {
             "labelFontSize": 0.1
         },
         "view": {
-            "strokeWidth": 2,
             "continuousHeight": 120,
-            "stroke": "black",
             "fill": "gray",
-            "fillOpacity": 0.2
-        },
-        "facet": {
-            "spacing": 80
-        },
-        "axis": {
-            "disable": true
+            "fillOpacity": 0.2,
+            "stroke": "black",
+            "strokeWidth": 2
         }
     },
     "data": {
         "values": [
             {
                 "cat": 1,
-                "row": 1,
                 "col": 1,
+                "row": 1,
                 "val": 30
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 1,
+                "row": 1,
                 "val": 15
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 1,
+                "row": 1,
                 "val": 12
             },
             {
                 "cat": 1,
-                "row": 1,
                 "col": 2,
+                "row": 1,
                 "val": 25
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 2,
+                "row": 1,
                 "val": 30
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 2,
+                "row": 1,
                 "val": 25
             },
             {
                 "cat": 1,
-                "row": 1,
                 "col": 3,
+                "row": 1,
                 "val": 10
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 3,
+                "row": 1,
                 "val": 28
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 3,
+                "row": 1,
                 "val": 11
             },
             {
                 "cat": 1,
-                "row": 1,
                 "col": 4,
+                "row": 1,
                 "val": 18
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 4,
+                "row": 1,
                 "val": 24
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 4,
+                "row": 1,
                 "val": 16
             },
             {
                 "cat": 1,
-                "row": 1,
                 "col": 5,
+                "row": 1,
                 "val": 10
             },
             {
                 "cat": 2,
-                "row": 1,
                 "col": 5,
+                "row": 1,
                 "val": 10
             },
             {
                 "cat": 3,
-                "row": 1,
                 "col": 5,
+                "row": 1,
                 "val": 10
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 1,
+                "row": 2,
                 "val": 8
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 1,
+                "row": 2,
                 "val": 8
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 1,
+                "row": 2,
                 "val": 29
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 2,
+                "row": 2,
                 "val": 11
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 2,
+                "row": 2,
                 "val": 24
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 2,
+                "row": 2,
                 "val": 12
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 3,
+                "row": 2,
                 "val": 26
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 3,
+                "row": 2,
                 "val": 32
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 3,
+                "row": 2,
                 "val": 9
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 4,
+                "row": 2,
                 "val": 8
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 4,
+                "row": 2,
                 "val": 18
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 4,
+                "row": 2,
                 "val": 28
             },
             {
                 "cat": 1,
-                "row": 2,
                 "col": 5,
+                "row": 2,
                 "val": 8
             },
             {
                 "cat": 2,
-                "row": 2,
                 "col": 5,
+                "row": 2,
                 "val": 20
             },
             {
                 "cat": 3,
-                "row": 2,
                 "col": 5,
+                "row": 2,
                 "val": 24
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 1,
+                "row": 3,
                 "val": 21
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 1,
+                "row": 3,
                 "val": 15
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 1,
+                "row": 3,
                 "val": 20
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 2,
+                "row": 3,
                 "val": 4
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 2,
+                "row": 3,
                 "val": 13
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 2,
+                "row": 3,
                 "val": 12
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 3,
+                "row": 3,
                 "val": 27
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 3,
+                "row": 3,
                 "val": 21
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 3,
+                "row": 3,
                 "val": 14
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 4,
+                "row": 3,
                 "val": 5
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 4,
+                "row": 3,
                 "val": 1
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 4,
+                "row": 3,
                 "val": 2
             },
             {
                 "cat": 1,
-                "row": 3,
                 "col": 5,
+                "row": 3,
                 "val": 11
             },
             {
                 "cat": 2,
-                "row": 3,
                 "col": 5,
+                "row": 3,
                 "val": 2
             },
             {
                 "cat": 3,
-                "row": 3,
                 "col": 5,
+                "row": 3,
                 "val": 5
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 1,
+                "row": 4,
                 "val": 14
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 1,
+                "row": 4,
                 "val": 20
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 1,
+                "row": 4,
                 "val": 24
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 2,
+                "row": 4,
                 "val": 20
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 2,
+                "row": 4,
                 "val": 2
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 2,
+                "row": 4,
                 "val": 9
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 3,
+                "row": 4,
                 "val": 15
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 3,
+                "row": 4,
                 "val": 14
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 3,
+                "row": 4,
                 "val": 13
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 4,
+                "row": 4,
                 "val": 22
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 4,
+                "row": 4,
                 "val": 30
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 4,
+                "row": 4,
                 "val": 30
             },
             {
                 "cat": 1,
-                "row": 4,
                 "col": 5,
+                "row": 4,
                 "val": 10
             },
             {
                 "cat": 2,
-                "row": 4,
                 "col": 5,
+                "row": 4,
                 "val": 8
             },
             {
                 "cat": 3,
-                "row": 4,
                 "col": 5,
+                "row": 4,
                 "val": 12
             }
         ]
     },
+    "facet": {
+        "field": "index",
+        "header": {
+            "title": null
+        },
+        "type": "ordinal"
+    },
     "spec": {
-        "height": 120,
-        "mark": "bar",
-        "width": 120,
         "encoding": {
             "color": {
                 "field": "cat",
-                "type": "nominal",
-                "legend": null
+                "legend": null,
+                "type": "nominal"
             },
             "x": {
                 "field": "cat",
@@ -405,15 +405,15 @@
                 "field": "val",
                 "type": "quantitative"
             }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "columns": 0,
-    "facet": {
-        "field": "index",
-        "header": {
-            "title": null
         },
-        "type": "ordinal"
-    }
+        "height": 120,
+        "mark": "bar",
+        "width": 120
+    },
+    "transform": [
+        {
+            "as": "index",
+            "calculate": "datum.row * 1000 + datum.col"
+        }
+    ]
 }
diff --git a/tests/specs/viewcomposition/grid4.vl b/tests/specs/viewcomposition/grid4.vl
--- a/tests/specs/viewcomposition/grid4.vl
+++ b/tests/specs/viewcomposition/grid4.vl
@@ -1,4 +1,6 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "columns": 3,
     "repeat": [
         "Horsepower",
         "Miles_per_Gallon",
@@ -7,7 +9,6 @@
         "Weight_in_lbs"
     ],
     "spec": {
-        "mark": "bar",
         "data": {
             "url": "https://vega.github.io/vega-lite/data/cars.json"
         },
@@ -17,18 +18,17 @@
                 "type": "nominal"
             },
             "x": {
+                "bin": true,
                 "field": {
                     "repeat": "repeat"
                 },
-                "bin": true,
                 "type": "quantitative"
             },
             "y": {
                 "aggregate": "count",
                 "type": "quantitative"
             }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "columns": 3
+        },
+        "mark": "bar"
+    }
 }
diff --git a/tests/specs/viewcomposition/grid5.vl b/tests/specs/viewcomposition/grid5.vl
--- a/tests/specs/viewcomposition/grid5.vl
+++ b/tests/specs/viewcomposition/grid5.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "repeat": {
         "row": [
             "Horsepower",
@@ -9,7 +10,6 @@
         ]
     },
     "spec": {
-        "mark": "bar",
         "data": {
             "url": "https://vega.github.io/vega-lite/data/cars.json"
         },
@@ -19,17 +19,17 @@
                 "type": "nominal"
             },
             "x": {
+                "bin": true,
                 "field": {
                     "repeat": "row"
                 },
-                "bin": true,
                 "type": "quantitative"
             },
             "y": {
                 "aggregate": "count",
                 "type": "quantitative"
             }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+        },
+        "mark": "bar"
+    }
 }
diff --git a/tests/specs/viewcomposition/groupyage.vl b/tests/specs/viewcomposition/groupyage.vl
--- a/tests/specs/viewcomposition/groupyage.vl
+++ b/tests/specs/viewcomposition/groupyage.vl
@@ -1,29 +1,16 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
-        "view": {
-            "stroke": null
-        },
         "axis": {
             "domainWidth": 1
+        },
+        "view": {
+            "stroke": null
         }
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 12
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -35,26 +22,39 @@
             },
             "type": "nominal"
         },
+        "column": {
+            "field": "age",
+            "spacing": 10,
+            "type": "ordinal"
+        },
         "x": {
-            "field": "gender",
-            "type": "nominal",
             "axis": {
                 "title": null
-            }
-        },
-        "column": {
-            "field": "age",
-            "type": "ordinal",
-            "spacing": 10
+            },
+            "field": "gender",
+            "type": "nominal"
         },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "grid": false,
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 12
     }
 }
diff --git a/tests/specs/viewcomposition/highlightDateTime.vl b/tests/specs/viewcomposition/highlightDateTime.vl
--- a/tests/specs/viewcomposition/highlightDateTime.vl
+++ b/tests/specs/viewcomposition/highlightDateTime.vl
@@ -2,7 +2,6 @@
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": "line",
             "data": {
                 "url": "https://vega.github.io/vega-lite/data/stocks.csv"
             },
@@ -19,17 +18,10 @@
                     "field": "price",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "line"
         },
         {
-            "mark": {
-                "size": 2,
-                "strokeDash": [
-                    2,
-                    2
-                ],
-                "type": "rule"
-            },
             "data": {
                 "values": {}
             },
@@ -39,6 +31,14 @@
                         "year": 2006
                     }
                 }
+            },
+            "mark": {
+                "size": 2,
+                "strokeDash": [
+                    2,
+                    2
+                ],
+                "type": "rule"
             }
         }
     ]
diff --git a/tests/specs/viewcomposition/highlightvalue.vl b/tests/specs/viewcomposition/highlightvalue.vl
--- a/tests/specs/viewcomposition/highlightvalue.vl
+++ b/tests/specs/viewcomposition/highlightvalue.vl
@@ -2,7 +2,6 @@
     "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": "line",
             "data": {
                 "url": "https://vega.github.io/vega-lite/data/stocks.csv"
             },
@@ -19,17 +18,10 @@
                     "field": "price",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "line"
         },
         {
-            "mark": {
-                "size": 2,
-                "strokeDash": [
-                    2,
-                    2
-                ],
-                "type": "rule"
-            },
             "data": {
                 "values": {}
             },
@@ -37,6 +29,14 @@
                 "y": {
                     "datum": 300
                 }
+            },
+            "mark": {
+                "size": 2,
+                "strokeDash": [
+                    2,
+                    2
+                ],
+                "type": "rule"
             }
         }
     ]
diff --git a/tests/specs/viewcomposition/lorientbottomcnf.vl b/tests/specs/viewcomposition/lorientbottomcnf.vl
--- a/tests/specs/viewcomposition/lorientbottomcnf.vl
+++ b/tests/specs/viewcomposition/lorientbottomcnf.vl
@@ -1,26 +1,13 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {
             "labelOrient": "bottom"
         }
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -32,23 +19,36 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {},
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/lorientbottomhdr.vl b/tests/specs/viewcomposition/lorientbottomhdr.vl
--- a/tests/specs/viewcomposition/lorientbottomhdr.vl
+++ b/tests/specs/viewcomposition/lorientbottomhdr.vl
@@ -1,24 +1,11 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {}
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -30,25 +17,38 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {
                 "labelOrient": "bottom"
             },
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/lorientrightcnf.vl b/tests/specs/viewcomposition/lorientrightcnf.vl
--- a/tests/specs/viewcomposition/lorientrightcnf.vl
+++ b/tests/specs/viewcomposition/lorientrightcnf.vl
@@ -1,26 +1,13 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {
             "labelOrient": "right"
         }
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -32,23 +19,36 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {},
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/lorientrighthdr.vl b/tests/specs/viewcomposition/lorientrighthdr.vl
--- a/tests/specs/viewcomposition/lorientrighthdr.vl
+++ b/tests/specs/viewcomposition/lorientrighthdr.vl
@@ -1,24 +1,11 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {}
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -30,25 +17,38 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {
                 "labelOrient": "right"
             },
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/orientbottomcnf.vl b/tests/specs/viewcomposition/orientbottomcnf.vl
--- a/tests/specs/viewcomposition/orientbottomcnf.vl
+++ b/tests/specs/viewcomposition/orientbottomcnf.vl
@@ -1,26 +1,13 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {
             "orient": "bottom"
         }
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -32,23 +19,36 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {},
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/orientbottomhdr.vl b/tests/specs/viewcomposition/orientbottomhdr.vl
--- a/tests/specs/viewcomposition/orientbottomhdr.vl
+++ b/tests/specs/viewcomposition/orientbottomhdr.vl
@@ -1,24 +1,11 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {}
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -30,25 +17,38 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {
                 "orient": "bottom"
             },
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/orientrightcnf.vl b/tests/specs/viewcomposition/orientrightcnf.vl
--- a/tests/specs/viewcomposition/orientrightcnf.vl
+++ b/tests/specs/viewcomposition/orientrightcnf.vl
@@ -1,26 +1,13 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {
             "orient": "right"
         }
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -32,23 +19,36 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {},
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/orientrighthdr.vl b/tests/specs/viewcomposition/orientrighthdr.vl
--- a/tests/specs/viewcomposition/orientrighthdr.vl
+++ b/tests/specs/viewcomposition/orientrighthdr.vl
@@ -1,24 +1,11 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {}
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -30,25 +17,38 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {
                 "orient": "right"
             },
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/repeatinglayers.vl b/tests/specs/viewcomposition/repeatinglayers.vl
--- a/tests/specs/viewcomposition/repeatinglayers.vl
+++ b/tests/specs/viewcomposition/repeatinglayers.vl
@@ -1,4 +1,5 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
@@ -9,28 +10,27 @@
         ]
     },
     "spec": {
-        "mark": "line",
         "encoding": {
             "color": {
-                "type": "nominal",
                 "datum": {
                     "repeat": "layer"
-                }
+                },
+                "type": "nominal"
             },
             "x": {
-                "field": "IMDB_Rating",
                 "bin": true,
+                "field": "IMDB_Rating",
                 "type": "quantitative"
             },
             "y": {
+                "aggregate": "mean",
                 "field": {
                     "repeat": "layer"
                 },
-                "aggregate": "mean",
                 "title": "Mean of US and Worldwide Gross",
                 "type": "quantitative"
             }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json"
+        },
+        "mark": "line"
+    }
 }
diff --git a/tests/specs/viewcomposition/torientbottomcnf.vl b/tests/specs/viewcomposition/torientbottomcnf.vl
--- a/tests/specs/viewcomposition/torientbottomcnf.vl
+++ b/tests/specs/viewcomposition/torientbottomcnf.vl
@@ -1,26 +1,13 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {
             "titleOrient": "bottom"
         }
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -32,23 +19,36 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {},
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/torientbottomhdr.vl b/tests/specs/viewcomposition/torientbottomhdr.vl
--- a/tests/specs/viewcomposition/torientbottomhdr.vl
+++ b/tests/specs/viewcomposition/torientbottomhdr.vl
@@ -1,24 +1,11 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {}
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -30,25 +17,38 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {
                 "titleOrient": "bottom"
             },
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/torientrightcnf.vl b/tests/specs/viewcomposition/torientrightcnf.vl
--- a/tests/specs/viewcomposition/torientrightcnf.vl
+++ b/tests/specs/viewcomposition/torientrightcnf.vl
@@ -1,26 +1,13 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {
             "titleOrient": "right"
         }
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -32,23 +19,36 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {},
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/viewcomposition/torientrighthdr.vl b/tests/specs/viewcomposition/torientrighthdr.vl
--- a/tests/specs/viewcomposition/torientrighthdr.vl
+++ b/tests/specs/viewcomposition/torientrighthdr.vl
@@ -1,24 +1,11 @@
 {
-    "transform": [
-        {
-            "filter": "datum.year == 2000"
-        },
-        {
-            "as": "gender",
-            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "config": {
         "header": {}
     },
-    "mark": "bar",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/population.json"
     },
-    "width": {
-        "step": 17
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "gender",
@@ -30,25 +17,38 @@
             },
             "type": "nominal"
         },
-        "x": {
-            "field": "age",
-            "type": "ordinal"
-        },
         "column": {
             "field": "gender",
             "header": {
                 "titleOrient": "right"
             },
-            "type": "nominal",
-            "spacing": 0
+            "spacing": 0,
+            "type": "nominal"
         },
+        "x": {
+            "field": "age",
+            "type": "ordinal"
+        },
         "y": {
-            "field": "people",
             "aggregate": "sum",
-            "type": "quantitative",
             "axis": {
                 "title": "Population"
-            }
+            },
+            "field": "people",
+            "type": "quantitative"
         }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.year == 2000"
+        },
+        {
+            "as": "gender",
+            "calculate": "datum.sex == 2 ? 'Female' : 'Male'"
+        }
+    ],
+    "width": {
+        "step": 17
     }
 }
diff --git a/tests/specs/windowtransform/joinAggregate1.vl b/tests/specs/windowtransform/joinAggregate1.vl
--- a/tests/specs/windowtransform/joinAggregate1.vl
+++ b/tests/specs/windowtransform/joinAggregate1.vl
@@ -1,59 +1,59 @@
 {
-    "transform": [
-        {
-            "joinaggregate": [
-                {
-                    "op": "sum",
-                    "as": "TotalTime",
-                    "field": "Time"
-                }
-            ]
-        },
-        {
-            "as": "PercentOfTotal",
-            "calculate": "datum.Time/datum.TotalTime * 100"
-        }
-    ],
-    "height": {
-        "step": 12
-    },
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "Time": 8,
-                "Activity": "Sleeping"
+                "Activity": "Sleeping",
+                "Time": 8
             },
             {
-                "Time": 2,
-                "Activity": "Eating"
+                "Activity": "Eating",
+                "Time": 2
             },
             {
-                "Time": 4,
-                "Activity": "TV"
+                "Activity": "TV",
+                "Time": 4
             },
             {
-                "Time": 8,
-                "Activity": "Work"
+                "Activity": "Work",
+                "Time": 8
             },
             {
-                "Time": 2,
-                "Activity": "Exercise"
+                "Activity": "Exercise",
+                "Time": 2
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "PercentOfTotal",
-            "type": "quantitative",
             "axis": {
                 "title": "% of total Time"
-            }
+            },
+            "field": "PercentOfTotal",
+            "type": "quantitative"
         },
         "y": {
             "field": "Activity",
             "type": "nominal"
         }
-    }
+    },
+    "height": {
+        "step": 12
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "joinaggregate": [
+                {
+                    "as": "TotalTime",
+                    "field": "Time",
+                    "op": "sum"
+                }
+            ]
+        },
+        {
+            "as": "PercentOfTotal",
+            "calculate": "datum.Time/datum.TotalTime * 100"
+        }
+    ]
 }
diff --git a/tests/specs/windowtransform/joinAggregate2.vl b/tests/specs/windowtransform/joinAggregate2.vl
--- a/tests/specs/windowtransform/joinAggregate2.vl
+++ b/tests/specs/windowtransform/joinAggregate2.vl
@@ -1,44 +1,44 @@
 {
-    "transform": [
-        {
-            "filter": "datum.IMDB_Rating != null"
-        },
-        {
-            "joinaggregate": [
-                {
-                    "op": "mean",
-                    "as": "AverageRating",
-                    "field": "IMDB_Rating"
-                }
-            ]
-        },
-        {
-            "filter": "(datum.IMDB_Rating - datum.AverageRating) > 2.5"
-        }
-    ],
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "IMDB_Rating",
-            "type": "quantitative",
             "axis": {
                 "title": "IMDB Rating"
-            }
+            },
+            "field": "IMDB_Rating",
+            "type": "quantitative"
         },
         "y": {
+            "axis": {
+                "title": ""
+            },
             "field": "Title",
             "sort": {
                 "encoding": "x",
                 "order": "descending"
             },
-            "type": "nominal",
-            "axis": {
-                "title": ""
-            }
+            "type": "nominal"
         }
-    }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "filter": "datum.IMDB_Rating != null"
+        },
+        {
+            "joinaggregate": [
+                {
+                    "as": "AverageRating",
+                    "field": "IMDB_Rating",
+                    "op": "mean"
+                }
+            ]
+        },
+        {
+            "filter": "(datum.IMDB_Rating - datum.AverageRating) > 2.5"
+        }
+    ]
 }
diff --git a/tests/specs/windowtransform/joinAggregate3.vl b/tests/specs/windowtransform/joinAggregate3.vl
--- a/tests/specs/windowtransform/joinAggregate3.vl
+++ b/tests/specs/windowtransform/joinAggregate3.vl
@@ -1,4 +1,29 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "url": "https://vega.github.io/vega-lite/data/movies.json"
+    },
+    "encoding": {
+        "x": {
+            "axis": {
+                "title": "IMDB Rating"
+            },
+            "field": "IMDB_Rating",
+            "type": "quantitative"
+        },
+        "y": {
+            "axis": {
+                "title": ""
+            },
+            "field": "Title",
+            "sort": {
+                "encoding": "x",
+                "order": "descending"
+            },
+            "type": "nominal"
+        }
+    },
+    "mark": "bar",
     "transform": [
         {
             "filter": "datum.IMDB_Rating != null"
@@ -14,39 +39,14 @@
             ],
             "joinaggregate": [
                 {
-                    "op": "mean",
                     "as": "AverageYearRating",
-                    "field": "IMDB_Rating"
+                    "field": "IMDB_Rating",
+                    "op": "mean"
                 }
             ]
         },
         {
             "filter": "(datum.IMDB_Rating - datum.AverageYearRating) > 2.5"
         }
-    ],
-    "mark": "bar",
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/movies.json"
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "encoding": {
-        "x": {
-            "field": "IMDB_Rating",
-            "type": "quantitative",
-            "axis": {
-                "title": "IMDB Rating"
-            }
-        },
-        "y": {
-            "field": "Title",
-            "sort": {
-                "encoding": "x",
-                "order": "descending"
-            },
-            "type": "nominal",
-            "axis": {
-                "title": ""
-            }
-        }
-    }
+    ]
 }
diff --git a/tests/specs/windowtransform/window1.vl b/tests/specs/windowtransform/window1.vl
--- a/tests/specs/windowtransform/window1.vl
+++ b/tests/specs/windowtransform/window1.vl
@@ -1,63 +1,63 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "sum",
-                    "as": "TotalTime",
-                    "field": "Time"
-                }
-            ],
-            "frame": [
-                null,
-                null
-            ]
-        },
-        {
-            "as": "PercentOfTotal",
-            "calculate": "datum.Time/datum.TotalTime * 100"
-        }
-    ],
-    "height": {
-        "step": 12
-    },
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "Time": 8,
-                "Activity": "Sleeping"
+                "Activity": "Sleeping",
+                "Time": 8
             },
             {
-                "Time": 2,
-                "Activity": "Eating"
+                "Activity": "Eating",
+                "Time": 2
             },
             {
-                "Time": 4,
-                "Activity": "TV"
+                "Activity": "TV",
+                "Time": 4
             },
             {
-                "Time": 8,
-                "Activity": "Work"
+                "Activity": "Work",
+                "Time": 8
             },
             {
-                "Time": 2,
-                "Activity": "Exercise"
+                "Activity": "Exercise",
+                "Time": 2
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
-            "field": "PercentOfTotal",
-            "type": "quantitative",
             "axis": {
                 "title": "% of total time"
-            }
+            },
+            "field": "PercentOfTotal",
+            "type": "quantitative"
         },
         "y": {
             "field": "Activity",
             "type": "nominal"
         }
-    }
+    },
+    "height": {
+        "step": 12
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "frame": [
+                null,
+                null
+            ],
+            "window": [
+                {
+                    "as": "TotalTime",
+                    "field": "Time",
+                    "op": "sum"
+                }
+            ]
+        },
+        {
+            "as": "PercentOfTotal",
+            "calculate": "datum.Time/datum.TotalTime * 100"
+        }
+    ]
 }
diff --git a/tests/specs/windowtransform/window2.vl b/tests/specs/windowtransform/window2.vl
--- a/tests/specs/windowtransform/window2.vl
+++ b/tests/specs/windowtransform/window2.vl
@@ -1,58 +1,58 @@
 {
-    "transform": [
-        {
-            "filter": "datum.IMDB_Rating != null"
-        },
-        {
-            "window": [
-                {
-                    "op": "mean",
-                    "as": "AverageRating",
-                    "field": "IMDB_Rating"
-                }
-            ],
-            "frame": [
-                null,
-                null
-            ]
-        },
-        {
-            "filter": "(datum.IMDB_Rating - datum.AverageRating) > 2.5"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": "bar",
             "encoding": {
                 "x": {
-                    "field": "IMDB_Rating",
-                    "type": "quantitative",
                     "axis": {
                         "title": "IMDB Rating"
-                    }
+                    },
+                    "field": "IMDB_Rating",
+                    "type": "quantitative"
                 },
                 "y": {
                     "field": "Title",
                     "type": "ordinal"
                 }
-            }
+            },
+            "mark": "bar"
         },
         {
-            "mark": {
-                "color": "red",
-                "type": "rule"
-            },
             "encoding": {
                 "x": {
-                    "field": "AverageRating",
                     "aggregate": "mean",
+                    "field": "AverageRating",
                     "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "type": "rule"
             }
+        }
+    ],
+    "transform": [
+        {
+            "filter": "datum.IMDB_Rating != null"
+        },
+        {
+            "frame": [
+                null,
+                null
+            ],
+            "window": [
+                {
+                    "as": "AverageRating",
+                    "field": "IMDB_Rating",
+                    "op": "mean"
+                }
+            ]
+        },
+        {
+            "filter": "(datum.IMDB_Rating - datum.AverageRating) > 2.5"
         }
     ]
 }
diff --git a/tests/specs/windowtransform/window3.vl b/tests/specs/windowtransform/window3.vl
--- a/tests/specs/windowtransform/window3.vl
+++ b/tests/specs/windowtransform/window3.vl
@@ -1,64 +1,34 @@
 {
-    "transform": [
-        {
-            "filter": "datum.IMDB_Rating != null"
-        },
-        {
-            "as": "year",
-            "field": "Release_Date",
-            "timeUnit": "year"
-        },
-        {
-            "window": [
-                {
-                    "op": "mean",
-                    "as": "AverageYearRating",
-                    "field": "IMDB_Rating"
-                }
-            ],
-            "groupby": [
-                "year"
-            ],
-            "frame": [
-                null,
-                null
-            ]
-        },
-        {
-            "filter": "(datum.IMDB_Rating - datum.AverageYearRating) > 2.5"
-        }
-    ],
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
-        "url": "https://vega.github.io/vega-lite/data/movies.json",
         "format": {
             "parse": {
                 "Release_Date": "date:'%b %d %Y'"
             }
-        }
+        },
+        "url": "https://vega.github.io/vega-lite/data/movies.json"
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "layer": [
         {
-            "mark": {
-                "type": "bar",
-                "clip": true
-            },
             "encoding": {
                 "x": {
-                    "field": "IMDB_Rating",
-                    "type": "quantitative",
                     "axis": {
                         "title": "IMDB Rating"
-                    }
+                    },
+                    "field": "IMDB_Rating",
+                    "type": "quantitative"
                 },
                 "y": {
                     "field": "Title",
                     "type": "ordinal"
                 }
+            },
+            "mark": {
+                "clip": true,
+                "type": "bar"
             }
         },
         {
-            "mark": "tick",
             "encoding": {
                 "color": {
                     "value": "red"
@@ -71,7 +41,37 @@
                     "field": "Title",
                     "type": "ordinal"
                 }
-            }
+            },
+            "mark": "tick"
+        }
+    ],
+    "transform": [
+        {
+            "filter": "datum.IMDB_Rating != null"
+        },
+        {
+            "as": "year",
+            "field": "Release_Date",
+            "timeUnit": "year"
+        },
+        {
+            "frame": [
+                null,
+                null
+            ],
+            "groupby": [
+                "year"
+            ],
+            "window": [
+                {
+                    "as": "AverageYearRating",
+                    "field": "IMDB_Rating",
+                    "op": "mean"
+                }
+            ]
+        },
+        {
+            "filter": "(datum.IMDB_Rating - datum.AverageYearRating) > 2.5"
         }
     ]
 }
diff --git a/tests/specs/windowtransform/window4.vl b/tests/specs/windowtransform/window4.vl
--- a/tests/specs/windowtransform/window4.vl
+++ b/tests/specs/windowtransform/window4.vl
@@ -1,4 +1,31 @@
 {
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "data": {
+        "format": {
+            "parse": {
+                "Release_Date": "date:'%b %d %Y'"
+            }
+        },
+        "url": "https://vega.github.io/vega-lite/data/movies.json"
+    },
+    "encoding": {
+        "x": {
+            "field": "Release_Date",
+            "type": "temporal"
+        },
+        "y": {
+            "axis": {
+                "title": "Residual"
+            },
+            "field": "RatingDelta",
+            "type": "quantitative"
+        }
+    },
+    "mark": {
+        "opacity": 0.3,
+        "strokeWidth": 0.3,
+        "type": "point"
+    },
     "transform": [
         {
             "filter": "datum.IMDB_Rating != null"
@@ -15,48 +42,21 @@
             }
         },
         {
+            "frame": [
+                null,
+                null
+            ],
             "window": [
                 {
-                    "op": "mean",
                     "as": "AverageRating",
-                    "field": "IMDB_Rating"
+                    "field": "IMDB_Rating",
+                    "op": "mean"
                 }
-            ],
-            "frame": [
-                null,
-                null
             ]
         },
         {
             "as": "RatingDelta",
             "calculate": "datum.IMDB_Rating - datum.AverageRating"
         }
-    ],
-    "mark": {
-        "strokeWidth": 0.3,
-        "opacity": 0.3,
-        "type": "point"
-    },
-    "data": {
-        "url": "https://vega.github.io/vega-lite/data/movies.json",
-        "format": {
-            "parse": {
-                "Release_Date": "date:'%b %d %Y'"
-            }
-        }
-    },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
-    "encoding": {
-        "x": {
-            "field": "Release_Date",
-            "type": "temporal"
-        },
-        "y": {
-            "field": "RatingDelta",
-            "type": "quantitative",
-            "axis": {
-                "title": "Residual"
-            }
-        }
-    }
+    ]
 }
diff --git a/tests/specs/windowtransform/window5.vl b/tests/specs/windowtransform/window5.vl
--- a/tests/specs/windowtransform/window5.vl
+++ b/tests/specs/windowtransform/window5.vl
@@ -1,94 +1,69 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "rank",
-                    "as": "rank"
-                }
-            ],
-            "groupby": [
-                "matchday"
-            ],
-            "sort": [
-                {
-                    "field": "point",
-                    "order": "descending"
-                }
-            ]
-        }
-    ],
-    "height": 400,
-    "mark": {
-        "orient": "vertical",
-        "type": "line"
-    },
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
-                "point": 3,
                 "matchday": 1,
+                "point": 3,
                 "team": "Man Utd"
             },
             {
-                "point": 1,
                 "matchday": 1,
+                "point": 1,
                 "team": "Chelsea"
             },
             {
-                "point": 1,
                 "matchday": 1,
+                "point": 1,
                 "team": "Man City"
             },
             {
-                "point": 0,
                 "matchday": 1,
+                "point": 0,
                 "team": "Spurs"
             },
             {
-                "point": 6,
                 "matchday": 2,
+                "point": 6,
                 "team": "Man Utd"
             },
             {
-                "point": 1,
                 "matchday": 2,
+                "point": 1,
                 "team": "Chelsea"
             },
             {
-                "point": 0,
                 "matchday": 2,
+                "point": 0,
                 "team": "Man City"
             },
             {
-                "point": 3,
                 "matchday": 2,
+                "point": 3,
                 "team": "Spurs"
             },
             {
-                "point": 9,
                 "matchday": 3,
+                "point": 9,
                 "team": "Man Utd"
             },
             {
-                "point": 1,
                 "matchday": 3,
+                "point": 1,
                 "team": "Chelsea"
             },
             {
-                "point": 0,
                 "matchday": 3,
+                "point": 0,
                 "team": "Man City"
             },
             {
-                "point": 6,
                 "matchday": 3,
+                "point": 6,
                 "team": "Spurs"
             }
         ]
     },
-    "width": 400,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "color": {
             "field": "team",
@@ -116,5 +91,30 @@
             "field": "rank",
             "type": "ordinal"
         }
-    }
+    },
+    "height": 400,
+    "mark": {
+        "orient": "vertical",
+        "type": "line"
+    },
+    "transform": [
+        {
+            "groupby": [
+                "matchday"
+            ],
+            "sort": [
+                {
+                    "field": "point",
+                    "order": "descending"
+                }
+            ],
+            "window": [
+                {
+                    "as": "rank",
+                    "op": "rank"
+                }
+            ]
+        }
+    ],
+    "width": 400
 }
diff --git a/tests/specs/windowtransform/window6.vl b/tests/specs/windowtransform/window6.vl
--- a/tests/specs/windowtransform/window6.vl
+++ b/tests/specs/windowtransform/window6.vl
@@ -1,24 +1,5 @@
 {
-    "transform": [
-        {
-            "window": [
-                {
-                    "op": "rank",
-                    "as": "rank"
-                }
-            ],
-            "sort": [
-                {
-                    "field": "score",
-                    "order": "descending"
-                }
-            ]
-        },
-        {
-            "filter": "datum.rank <= 5"
-        }
-    ],
-    "mark": "bar",
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "values": [
             {
@@ -111,7 +92,6 @@
             }
         ]
     },
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "encoding": {
         "x": {
             "field": "score",
@@ -120,11 +100,31 @@
         "y": {
             "field": "student",
             "sort": {
-                "op": "mean",
                 "field": "score",
+                "op": "mean",
                 "order": "descending"
             },
             "type": "nominal"
         }
-    }
+    },
+    "mark": "bar",
+    "transform": [
+        {
+            "sort": [
+                {
+                    "field": "score",
+                    "order": "descending"
+                }
+            ],
+            "window": [
+                {
+                    "as": "rank",
+                    "op": "rank"
+                }
+            ]
+        },
+        {
+            "filter": "datum.rank <= 5"
+        }
+    ]
 }
diff --git a/tests/specs/windowtransform/window7.vl b/tests/specs/windowtransform/window7.vl
--- a/tests/specs/windowtransform/window7.vl
+++ b/tests/specs/windowtransform/window7.vl
@@ -1,43 +1,11 @@
 {
-    "transform": [
-        {
-            "filter": "datum.Miles_per_Gallon !== null"
-        },
-        {
-            "as": "year",
-            "field": "Year",
-            "timeUnit": "year"
-        },
-        {
-            "window": [
-                {
-                    "op": "mean",
-                    "as": "Average_MPG",
-                    "field": "Miles_per_Gallon"
-                }
-            ],
-            "sort": [
-                {
-                    "field": "year",
-                    "order": "ascending"
-                }
-            ],
-            "frame": [
-                null,
-                0
-            ],
-            "ignorePeers": false
-        }
-    ],
-    "height": 400,
+    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
     "data": {
         "url": "https://vega.github.io/vega-lite/data/cars.json"
     },
-    "width": 500,
-    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
+    "height": 400,
     "layer": [
         {
-            "mark": "circle",
             "encoding": {
                 "x": {
                     "field": "Year",
@@ -48,13 +16,10 @@
                     "field": "Miles_per_Gallon",
                     "type": "quantitative"
                 }
-            }
+            },
+            "mark": "circle"
         },
         {
-            "mark": {
-                "color": "red",
-                "type": "line"
-            },
             "encoding": {
                 "x": {
                     "field": "Year",
@@ -62,13 +27,48 @@
                     "type": "temporal"
                 },
                 "y": {
-                    "field": "Average_MPG",
-                    "type": "quantitative",
                     "axis": {
                         "title": "Miles per gallon"
-                    }
+                    },
+                    "field": "Average_MPG",
+                    "type": "quantitative"
                 }
+            },
+            "mark": {
+                "color": "red",
+                "type": "line"
             }
         }
-    ]
+    ],
+    "transform": [
+        {
+            "filter": "datum.Miles_per_Gallon !== null"
+        },
+        {
+            "as": "year",
+            "field": "Year",
+            "timeUnit": "year"
+        },
+        {
+            "frame": [
+                null,
+                0
+            ],
+            "ignorePeers": false,
+            "sort": [
+                {
+                    "field": "year",
+                    "order": "ascending"
+                }
+            ],
+            "window": [
+                {
+                    "as": "Average_MPG",
+                    "field": "Miles_per_Gallon",
+                    "op": "mean"
+                }
+            ]
+        }
+    ],
+    "width": 500
 }
diff --git a/tools/PlayTutorial.hs b/tools/PlayTutorial.hs
--- a/tools/PlayTutorial.hs
+++ b/tools/PlayTutorial.hs
@@ -44,7 +44,6 @@
 
 import qualified Data.Aeson.Encode.Pretty as AP
 import qualified Data.ByteString.Lazy.Char8 as BL
-import qualified Data.Text as T
 
 import qualified Graphics.Vega.Tutorials.VegaLite as VL
 
@@ -54,13 +53,29 @@
 import System.Directory (createDirectoryIfMissing)
 import System.Environment (getArgs, getProgName)
 import System.Exit (exitFailure)
-import System.FilePath ((</>), FilePath)
+import System.FilePath ((</>))
 import System.IO (hPutStrLn, stderr)
 
 import Prelude hiding (filter)
 
 -- Could use TH to get at the tutorials, but for now hard code the names.
 
+-- The simple example used in the README
+--
+carData :: VegaLite
+carData =
+  let cars =  dataFromUrl "https://vega.github.io/vega-datasets/data/cars.json" []
+
+      enc = encoding
+            . position X [ PName "Horsepower", PmType Quantitative ]
+            . position Y [ PName "Miles_per_Gallon", PmType Quantitative, PTitle "Miles per Gallon" ]
+            . color [ MName "Origin" ]
+
+      bkg = background "rgba(0, 0, 0, 0.05)"
+
+  in toVegaLite [ bkg, cars, mark Circle [MTooltip TTEncoding], enc [] ]
+
+
 -- The intro visualization used in the API documentation (not in
 -- the tutorial).
 --
@@ -76,12 +91,12 @@
       w = width 600
       h = height 150
 
-      pos1Opts fld ttl = [PName fld, PmType Quantitative, PAxis [AxTitle ttl]]
+      pos1Opts fld ttl = [PName fld, PmType Quantitative, PTitle ttl]
       x1Opts = pos1Opts "days" "Days since January 1, 2020"
       y1Opts = pos1Opts "magnitude" "Magnitude" ++ [PSort [Descending], yRange]
       yRange = PScale [SDomain (DNumbers [-1, 3])]
 
-      filtOpts = [MName "filterName", MmType Nominal]
+      filtOpts = [MName "filterName"]
       filtEnc = color (MLegend [ LTitle "Filter", LTitleFontSize 16, LLabelFontSize 14 ] : filtOpts)
                 . shape filtOpts
 
@@ -93,8 +108,8 @@
                     . filtEnc
 
       selName = "brush"
-      pos2Opts fld = [PName fld, PmType Quantitative, PAxis [AxNoTitle],
-                     PScale [SDomain (DSelectionField selName fld)]]
+      pos2Opts fld = [PName fld, PmType Quantitative, PNoTitle,
+                     PScale [SDomainOpt (DSelectionField selName fld)]]
       x2Opts = pos2Opts "days"
       y2Opts = pos2Opts "magnitude" ++ [PSort [Descending]]
 
@@ -132,7 +147,6 @@
 
       details = asSpec [ columns 1
                        , facetFlow [ FName "filterName"
-                                   , FmType Nominal
                                    , FHeader headerOpts
                                    ]
                        , spacing 10
@@ -161,10 +175,12 @@
 --
 vl :: [(String, VegaLite)]
 vl = [ ("api-betelgeuse", betelgeuse)
+     , ("api-cardata", carData)
      , ("stripplot", VL.stripPlot)
      , ("stripplotwithbackground", VL.stripPlotWithBackground)
      , ("stripploty", VL.stripPlotY)
      , ("stripplotwithcolor", VL.stripPlotWithColor)
+     , ("stripplotwithcolor2", VL.stripPlotWithColor2)
      , ("stripplotwithcolorordinal", VL.stripPlotWithColorOrdinal)
      , ("piechart", VL.pieChart)
      , ("piechartwithcounting", VL.pieChartWithCounting)
@@ -235,7 +251,7 @@
       specFile = prefix <> ".vg.json"
       prefix = outdir </> name
 
-      opts = object [T.pack "downloadFileName" .= name]
+      opts = object ["downloadFileName" .= name]
 
   toHtmlFileWith (Just opts) htmlFile spec
   BL.writeFile specFile (AP.encodePretty (fromVL spec))
