Giter Club home page Giter Club logo

deneb.jl's Introduction

Deneb.jl

Deneb.jl logo

Tests Docs Coverage

Deneb is the brightest star in the constellation of the Cygnus, and together with Vega and Altair they form the Summer Triangle asterism.

Deneb.jl is a convenient Julia API for creating Vega-Lite visualizations, with high inspiration from Python's Vega-Altair.

Quickstart

using Deneb
cars = "https://vega.github.io/vega-datasets/data/cars.json"
Data(url=cars) * Mark(:point) * Encoding(
    "Horsepower:q",
    "Miles_per_Gallon:q",
    color=:Origin
)

See the Gallery for more examples.

Why Deneb.jl?

The excellent VegaLite.jl package, with Julia bindings to Vega-Lite, already exists in the Julia ecosystem. So, why create yet another package to accomplish the same thing?

VegaLite.jl allows for the creation of virtually any possible Vega-Lite specification in an elegant manner. However, its strategy for composing plots can be somewhat confusing and obscure (refer to this VegaLite.jl issue for more details). In response to this, I proposed an alternative composition strategy in this PR. This, along with an excuse to start a personal project to further explore the Julia language, served as the main motivation to start creating Deneb.jl.

Deneb.jl is not intended as a replacement for VegaLite.jl. VegaLite.jl benefits from the attention of numerous contributors with vast experience in creating and maintaining Julia packages. In contrast, I am simply a Julia and Vega-Lite enthusiast with limited time to explore Julia's capabilities in my free time. However, if Deneb.jl attracts some interest, I'm willing to continue improving its documentation and other aspects of the package. Of course, contributions from others are always welcome.

Below a list of good and not-so-good things about Deneb.jl:

  • It provides a coherent API that allows for a convenient and intuitive construction of any Vega-Lite visualization.
  • Layering and composing single and multi-view charts is intuitive using the operators + (familiar to Altair users) and * (familiar to AlgebraOfGraphics.jl users).
  • While the documentation may currently lack completeness and coherence, there is a comprehensive set of examples available in the Gallery section. These examples should serve as a valuable resource to enable any user already familiar with Vega-Lite and/or Altair.
  • I initially started this project as an exercise to learn more about Julia. Therefore, the internal design of Deneb.jl was primarily driven by my personal learning appetite at the time and might not represent the optimal or most idiomatic design choices. However, things just work.
  • There are numerous tests in place, although the test coverage is not yet close to 100% in any way.

deneb.jl's People

Contributors

brucala avatar george9000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

george9000

deneb.jl's Issues

Charts not displaying in Jupyter

Charts are not being displayed properly in Jupyter.
I think in the past it work because the mime type application/vnd.vegalite.v4+json was automatically available in Jupyter lab, but v5 isn't.

Use `vl-convert` to save charts

Currently saving charts relies on NodeJS (and that's the only reason Deneb.jl depends on NodeJS). An alternative (currently used by Altair) is to use vl-convert instead. Blog post about vl-convert.

One convenience about vl-convert is that it would be an standalone artifact that does not require any external dependencies, unlike the approach with NodeJS that requires to install things like Canvas.

Unlike NodeJS, vl-convert does not convert to pdf. We could keep both dependencies (vl-convert for png/svg and NodeJS for pdf) but maybe make NodeJS a weak dependency.

Transform * Facet composition not working

In the composition of a Transform with a Facet, the transform disappears:

transform = Transform(
    fold=stations,
    as=[:Station, :snow_depth],
) 
facet = Facet(row=:Station) * Encoding(x="monthdate(date):O")
transform * facet

results in:

{
    "mark": {
      "tooltip": true
    }
  },
  "spec": {
    "encoding": {
      "x": {
        "timeUnit": "monthdate",
        "field": "date",
        "type": "ordinal"
      }
    },
    "width": 500
  },
  "facet": {
    "row": {
      "field": "Station"
    }
  }
}

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

npm version

While trying out Deneb, the following warning was printed:

npm notice
npm notice New major version of npm available! 8.5.5 -> 9.8.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.8.0
npm notice Run npm install -g [email protected] to update!
npm notice

I don't have npm installed. Is this an artifact that Deneb installs? If so, should the version be updated?

Escape special chars in encoding shorthand syntax

Due to the shorthand string syntax, using chars like ( or : in the Encoding can give unexpected results:

julia > Encoding("Beak Length (mm):Q")
Deneb.EncodingSpec: 
{
  "x": {
    "aggregate": "Beak Length ",
    "field": "mm",
    "type": "quantitative"
  }
}

At the moment there are no escaping rules to avoid that. In the meantime one can simply use the verbose syntax without the shorthands:

> julia> Encoding(x=(field="Beak Length (mm)", type=:quantitative))
Deneb.EncodingSpec: 
{
  "x": {
    "field": "Beak Length (mm)",
    "type": "quantitative"
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.