{"id":37670167,"url":"https://github.com/rwpenney/vl4s","last_synced_at":"2026-01-16T12:02:41.488Z","repository":{"id":82854188,"uuid":"111322732","full_name":"rwpenney/vl4s","owner":"rwpenney","description":"Tool for auto-generating a Scala plotting library from Vega-Lite schema, to support interactive web-based graphs and visualizations.","archived":false,"fork":false,"pushed_at":"2018-06-04T15:47:09.000Z","size":151,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-12T21:48:03.610Z","etag":null,"topics":["data-science","data-visualization","json-schema","plot","plotting","scala","vega-lite"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rwpenney.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-11-19T18:52:42.000Z","updated_at":"2023-12-24T22:19:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"86080a44-e4e4-4df6-a90b-0898bab1e993","html_url":"https://github.com/rwpenney/vl4s","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/rwpenney/vl4s","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwpenney%2Fvl4s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwpenney%2Fvl4s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwpenney%2Fvl4s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwpenney%2Fvl4s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwpenney","download_url":"https://codeload.github.com/rwpenney/vl4s/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwpenney%2Fvl4s/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28431160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-science","data-visualization","json-schema","plot","plotting","scala","vega-lite"],"created_at":"2026-01-16T12:02:41.415Z","updated_at":"2026-01-16T12:02:41.474Z","avatar_url":"https://github.com/rwpenney.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VL4S (Vega-Lite for Scala)\n\nvl4s is a tool for automatically generating\na [Scala](https://www.scala-lang.org) library\nvia which interactive plots can be generated conforming\nto the [Vega-Lite](https://vega.github.io/vega-lite) specification.\n\n![BesselPlot](gallery/plot-bessel.png)\n\nvl4s is intended to allow the\nJSON [schema](https://github.com/vega/schema/tree/master/vega-lite)\nprovided by Vega-Lite to be converted into a Scala API\nwhich provides natural, and type-safe,\nways of describing plots in Scala and emitting Vega-Lite JSON documents\nthat can be embedded in web-pages.\nThis is an alternative approach to that of [Vegas](https://www.vegas-viz.org/),\nand [Argus](https://github.com/aishfenton/Argus), aiming to create\na DSL that is closer to the structure of the underlying JSON schema\n(hence, hopefully, easier to document) and allowing export\nof a [json4s](http://json4s.org) datastructure that could\nbe customized by the user.\n\nThe build-system is managed by [SBT](http://www.scala-sbt.org/),\nand consists of two projects:\n* the \"root\" project, which must be compiled and run to generate\n  the file \"vl4s/src/main/scala/auto-vega.scala\"\n  from either the upstream VegaLite schema based on a version-number\n  supplied with the \"-V\" command-line argument,\n  or a local copy of a schema file (e.g. \"v2.1.3.json\")\n* the \"vl4s\" project, which will build the VegaLite API itself,\n  and allows creation of VegaLite JSON documents from\n  a user-supplied plot specification.\n\nThe tool supports the entire Vega-Lite 2.4 grammar,\nincluding generation of interactive line plots,\nand histograms with aggregation operations, repeats, selections, etc.\n\n\n## Example\n\n![AptSizePlot](gallery/plot-apt-sizes.png)\n\nGiven a tab-separated datafile representing the sizes of packages\nin a [Debian](https://www.debian.org) system,\none can generate an interactive Vega-Lite plot\nusing a recipe such as:\n```scala\nimport org.json4s._\nimport org.json4s.native.JsonMethods.{ pretty, render }\nimport uk.rwpenney.vl4s._\nimport uk.rwpenney.vl4s.ShortcutImplicits._\n\nval spec = SimpleSpec() .\n  data(\"apt-package-sizes.tsv\") .\n  selection(\n    Map(\"chosen\" -\u003e SingleSelection() .\n                      encodings(Seq(SingleDefChannel.color)) .\n                      vtype(SingleSelection_type.single))) .\n  mark(Mark.bar) .\n  encoding(EncodingWithFacet() .\n    \u003e\u003e { enc =\u003e enc .\n      x(enc.XYaxisDef .\n        axis(Axis() .\n          title(\"log(size)\")) .\n        field(\"logSize\") .\n        vtype(BasicType.quantitative) .\n        bin(BinParams() .\n          maxbins(20))) .\n      y(enc.XYaxisDef .\n        axis(Axis() .\n          title(\"count\")) .\n        field(\"*\") .\n        vtype(BasicType.quantitative) .\n        aggregate(AggregateOp.count)) .\n      color(MarkPropValueDefWithCondition() .\n        condition(ConditionalSelection_MarkPropFieldDef_() .\n          field(\"simpleSection\") .\n          selection(\"chosen\") .\n          vtype(BasicType.nominal)) .\n        value(\"grey\"))\n    }\n  )\n\nval json = spec.toJValue\nprintln(pretty(render(json)))\n```\nThis will generate a JSON document of the following form:\n```json\n{\n  \"data\":{\n    \"url\":\"apt-package-sizes.tsv\"\n  },\n  \"selection\":{\n    \"chosen\":{\n      \"encodings\":[\"color\"],\n      \"type\":\"single\"\n    }\n  },\n  \"mark\":\"bar\",\n  \"encoding\":{\n    \"x\":{\n      \"axis\":{\n        \"title\":\"log(size)\"\n      },\n      \"field\":\"logSize\",\n      \"type\":\"quantitative\",\n      \"bin\":{\n        \"maxbins\":20.0\n      }\n    },\n    \"y\":{\n      \"axis\":{\n        \"title\":\"count\"\n      },\n      \"field\":\"*\",\n      \"type\":\"quantitative\",\n      \"aggregate\":\"count\"\n    },\n    \"color\":{\n      \"condition\":{\n        \"field\":\"simpleSection\",\n        \"selection\":\"chosen\",\n        \"type\":\"nominal\"\n      },\n      \"value\":\"grey\"\n    }\n  }\n}\n```\nAlternatively, one can use the methods in the ExportImplicits object\nto wrap this in an HTML `\u003cdiv\u003e` for inclusion in a web-page.\nThere are more [examples](vl4s-demo/src/main/scala/main.scala)\nbeneath the [vl4s-demo](vl4s-demo/src/main/scala) source directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwpenney%2Fvl4s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwpenney%2Fvl4s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwpenney%2Fvl4s/lists"}