Giter Club home page Giter Club logo

vegalite.jl's Introduction

VegaLite.jl

Julia bindings to Vega-Lite

Project Status: Active - The project has reached a stable, usable state and is being actively developed. Build Status Build status codecov

Overview

VegaLite.jl is a plotting package for the julia programming language. The package is based on Vega-Lite, which extends a traditional grammar of graphics API into a grammar of interactive graphics.

Additionally, VegaLite.jl provides basic support for Vega.

VegaLite.jl allows you to create a wide range of statistical plots. It exposes the full functionality of the underlying Vega-Lite and is at the same time tightly integrated into the julia ecosystem. Here is an example of a scatter plot:

using VegaLite, VegaDatasets

dataset("cars") |>
@vlplot(
    :point,
    x=:Horsepower,
    y=:Miles_per_Gallon,
    color=:Origin,
    width=400,
    height=400
)

plot

Installation

To install VegaLite.jl, run the following command in the julia Pkg REPL-mode:

(v1.0) pkg> add VegaLite

Documentation

The current documentation can be found here.

Note for Jupyterlab Users

VegaLite.jl can be used in combination with many different front end clients including JupyterLab, Pluto.jl, and Julia for VSCode.

Important: JupyterLab supplies its own version of Vega-Lite and cannot be kept in perfect sync with VegaLite.jl. Formatting discrepancies can and will arise on occasion for JupyterLab users. VegaLite.jl targets the latest available minor release of Vega-Lite which is also supported by JupyterLab.

Developer Notes

JupyterLab support depends on Juperlab's built-in renderer; before updating to a new major version of vega-lite, check the JupyterLab project for the latest supported version of vega-lite.

vegalite.jl's People

Contributors

cmcaine avatar davidanthoff avatar dilumaluthge avatar ericforgy avatar ericqu avatar fonsp avatar fredo-dedup avatar github-actions[bot] avatar hsm207 avatar jeremiahpslewis avatar mcmcgrath13 avatar mo-gul avatar mortenpi avatar noahrhodes avatar nosferican avatar odow avatar oheil avatar pallharaldsson avatar pdimens avatar petrkryslucsd avatar rened avatar rick2047 avatar rschwarz avatar tbenst avatar tkelman avatar tkf avatar tpapp avatar vpetukhov avatar

Stargazers

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

Watchers

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

vegalite.jl's Issues

How to make a histogram

I was trying the following code

x  = randn(1000);
v = data_values(x=x) +    
             mark_bar() +   
             encoding_x_quant(value=:x, scale(bandSize=.5)) +
             encoding_y_quant(aggregate="count")

but I got error message:
"MethodError: encoding_y_quant has no method matching encoding_y_quant()"

Or what should be the right way to create a histogram?

v0.1.1 release

@fredo-dedup I just tagged a v0.1.1 release. It is just a bug fix release that solves a problem with our build step: with the old version, the build step would modify files that are under source control, then the repo is dirty and future Pkg.update()s don't work anymore. This had all been solved on master for a while, but essentially if folks did a Pkg.add("VegaLite") right now, they would end up with a dirty repo that can no longer be updated, which seems not ideal ;)

I followed the usual julia procedure for bug fix releases: I created a branch release-0.1 that branches off v0.1.0, and on that branch we can do bug fix releases for the v0.1.x series.

Save as pdf

Is there a function to save a plot as a pdf to disc?

IJulia integration doesn't work

Starting on Tue morning I can't get any plot to show in IJulia. When I e.g. execute the example from the README in an IJulia cell, I just get an empty output cell. This happens on 3 computers on Windows, and I'm 99% sure that at least on one of them things worked Mon night and that I haven't updated anything since on that machine.

Everything works great if I plot from the REPL.

I tested this on Chrome and Edge.

Build Process Failed on Julia v0.6

trying to add the package Pkg.add("VegaLite") I get this

INFO: Installing VegaLite v0.1.0
INFO: Building Cairo
Build process failed.
build!(::Array{String,1}, ::Set{Any}, ::String) at ./pkg/entry.jl:627
build!(::Array{String,1}, ::Set{Any}, ::String) at ./pkg/entry.jl:624 (repeats 2 times)
build!(::Array{String,1}, ::Dict{Any,Any}, ::Set{Any}) at ./pkg/entry.jl:635
build(::Array{String,1}) at ./pkg/entry.jl:650
resolve(::Dict{String,Base.Pkg.Types.VersionSet}, ::Dict{String,Dict{VersionNumber,Base.Pkg.Types.Available}}, ::Dict{String,Tuple{VersionNumber,Bool}}, ::Dict{String,Base.Pkg.Types.Fixed}, ::Dict{String,VersionNumber}, ::Set{String}) at ./pkg/entry.jl:570
resolve(::Dict{String,Base.Pkg.Types.VersionSet}, ::Dict{String,Dict{VersionNumber,Base.Pkg.Types.Available}}, ::Dict{String,Tuple{VersionNumber,Bool}}, ::Dict{String,Base.Pkg.Types.Fixed}) at ./pkg/entry.jl:479
edit(::Function, ::String, ::Base.Pkg.Types.VersionSet, ::Vararg{Base.Pkg.Types.VersionSet,N} where N) at ./pkg/entry.jl:30
(::Base.Pkg.Entry.##1#3{String,Base.Pkg.Types.VersionSet})() at ./task.jl:335

Stacktrace:
[1] sync_end() at ./task.jl:287
[2] macro expansion at ./task.jl:303 [inlined]
[3] add(::String, ::Base.Pkg.Types.VersionSet) at ./pkg/entry.jl:51
[4] (::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}})() at ./pkg/dir.jl:36
[5] cd(::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}}, ::String) at ./file.jl:70
[6] #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{String,N} where N) at ./pkg/dir.jl:36
[7] add(::String) at ./pkg/pkg.jl:117

Updated all packages and have this

2 required packages:

  • IJulia 1.8.0
  • ODBC 0.6.0
    34 additional packages:
  • BinDeps 0.8.8
  • BinaryProvider 0.3.0
  • Cairo 0.5.1
  • CategoricalArrays 0.3.9
  • CodecZlib 0.4.3
  • ColorTypes 0.6.7
  • Colors 0.8.2
  • Compat 0.63.0
  • Conda 0.7.1
  • DataFrames 0.11.6
  • DataStreams 0.3.4
  • DataStructures 0.8.1
  • DecFP 0.4.3
  • FixedPointNumbers 0.4.6
  • Graphics 0.3.0
  • Gtk 0.13.1
  • JSON 0.17.2
  • MbedTLS 0.5.8
  • Missings 0.2.9
  • NaNMath 0.3.1
  • NamedTuples 4.0.0
  • NodeJS 0.4.0
  • Nullables 0.0.5
  • Reexport 0.1.0
  • Requires 0.4.3
  • Rsvg 0.2.0
  • SHA 0.5.7
  • SortingAlgorithms 0.2.1
  • StatsBase 0.21.0
  • TranscodingStreams 0.5.2
  • URIParser 0.3.1
  • VegaLite 0.1.0
  • WeakRefStrings 0.4.4
  • ZMQ 0.6.0

running on

Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-1052-aws x86_64)

Python Version

Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19)
[GCC 7.2.0]

Notebook Server 5.4.0

Tried adding Cairo first Pkg.add("Cairo")

INFO: Removing Gtk v0.13.1
INFO: Removing NodeJS v0.4.0
INFO: Removing Requires v0.4.3
INFO: Removing Rsvg v0.2.0
INFO: Removing VegaLite v0.1.0
INFO: Package database updated
INFO: METADATA is out-of-date — you may not have the latest version of Cairo
INFO: Use Pkg.update() to get the latest versions of your packages

then Pkg.add("VegaLite")
result:

INFO: Installing Gtk v0.13.1
INFO: Installing NodeJS v0.4.0
INFO: Installing Requires v0.4.3
INFO: Installing Rsvg v0.2.0
INFO: Installing VegaLite v0.1.0
Build process failed.
build!(::Array{String,1}, ::Set{Any}, ::String) at ./pkg/entry.jl:627
build!(::Array{String,1}, ::Set{Any}, ::String) at ./pkg/entry.jl:624
build!(::Array{String,1}, ::Dict{Any,Any}, ::Set{Any}) at ./pkg/entry.jl:635
build(::Array{String,1}) at ./pkg/entry.jl:650
resolve(::Dict{String,Base.Pkg.Types.VersionSet}, ::Dict{String,Dict{VersionNumber,Base.Pkg.Types.Available}}, ::Dict{String,Tuple{VersionNumber,Bool}}, ::Dict{String,Base.Pkg.Types.Fixed}, ::Dict{String,VersionNumber}, ::Set{String}) at ./pkg/entry.jl:570
resolve(::Dict{String,Base.Pkg.Types.VersionSet}, ::Dict{String,Dict{VersionNumber,Base.Pkg.Types.Available}}, ::Dict{String,Tuple{VersionNumber,Bool}}, ::Dict{String,Base.Pkg.Types.Fixed}) at ./pkg/entry.jl:479
edit(::Function, ::String, ::Base.Pkg.Types.VersionSet, ::Vararg{Base.Pkg.Types.VersionSet,N} where N) at ./pkg/entry.jl:30
(::Base.Pkg.Entry.##1#3{String,Base.Pkg.Types.VersionSet})() at ./task.jl:335

Stacktrace:
[1] sync_end() at ./task.jl:287
[2] macro expansion at ./task.jl:303 [inlined]
[3] add(::String, ::Base.Pkg.Types.VersionSet) at ./pkg/entry.jl:51
[4] (::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}})() at ./pkg/dir.jl:36
[5] cd(::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}}, ::String) at ./file.jl:70
[6] #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{String,N} where N) at ./pkg/dir.jl:36
[7] add(::String) at ./pkg/pkg.jl:117

`@vlplot not defined` after install

I've never used Vega-Lite before, but I tried it out in Julia 0.6.2:

julia> using VegaLite, VegaDatasets

julia> dataset("cars") |>
       @vlplot(
           :point,
           x=:Horsepower,
           y=:Miles_per_Gallon,
           color=:Origin,
           width=400,
           height=400
       )
ERROR: UndefVarError: @vlplot not defined

The install produced some warnings, including a possible problem with Node.js (but from the VegaLite building step, not from Node.js's process):

...
INFO: Cloning cache of NodeJS from https://github.com/davidanthoff/NodeJS.jl.git
INFO: Cloning cache of Rsvg from https://github.com/lobingera/Rsvg.jl.git
INFO: Cloning cache of VegaLite from https://github.com/fredo-dedup/VegaLite.jl.git
...
INFO: Installing NodeJS v0.4.0
INFO: Installing Rsvg v0.2.0
INFO: Installing VegaLite v0.1.0
...
INFO: Building NodeJS
INFO: Downloading Node.js binary
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10.8M  100 10.8M    0     0  2682k      0  0:00:04  0:00:04 --:--:-- 2692k
INFO: Extracting Node.js binary
INFO: Building Rsvg
INFO: Building VegaLite
npm WARN notice [SECURITY] hoek has the following vulnerability: 1 moderate. Go here for more details: https://nodesecurity.io/advisories?search=hoek&version=2.16.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN lifecycle npm is using /home/risingj/.julia/v0.6/NodeJS/deps/bin/node-v8.10.0-linux-x64/bin/node but there is no node binary in the current PATH. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] install /home/risingj/.julia/v0.6/VegaLite/deps/node_modules/canvas
> node-gyp rebuild

/usr/bin/env: ‘node’: No such file or directory

> [email protected] install /home/risingj/.julia/v0.6/VegaLite/deps/node_modules/canvas-prebuilt
> node-pre-gyp install

/usr/bin/env: ‘node’: No such file or directory
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/canvas):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/canvas-prebuilt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-pre-gyp install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT

Failure on Linux: nonexistent file?

On Linux, using VegaLite, with Julia 0.7.0:

ERROR: LoadError: LoadError: SystemError: opening file /home/pkrysl/.julia/packages/VegaLite/1I7Wn/src/schema/../../deps/lib/vega-lite-schema.json: No such file or directory
Stacktrace:
 [1] #systemerror#39(::Nothing, ::Function, ::String, ::Bool) at ./error.jl:106
 [2] systemerror at ./error.jl:106 [inlined]
 [3] #open#297(::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Function, ::String) at ./iostream.jl:283
 [4] open at ./iostream.jl:275 [inlined]
 [5] #open#298(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(JSON.Parser, Symbol("##4#5")){DataType,DataType,Bool,Int64}, ::String) at ./iostream.jl:367
 [6] open at ./iostream.jl:367 [inlined]
 [7] #parsefile#3 at /home/pkrysl/.julia/packages/JSON/Hs3Dj/src/Parser.jl:413 [inlined]
 [8] parsefile(::String) at /home/pkrysl/.julia/packages/JSON/Hs3Dj/src/Parser.jl:412
 [9] top-level scope at none:0
 [10] include at ./boot.jl:317 [inlined]
 [11] include_relative(::Module, ::String) at ./loading.jl:1038
 [12] include at ./sysimg.jl:29 [inlined]
 [13] include(::String) at /home/pkrysl/.julia/packages/VegaLite/1I7Wn/src/VegaLite.jl:3
 [14] top-level scope at none:0
 [15] include at ./boot.jl:317 [inlined]
 [16] include_relative(::Module, ::String) at ./loading.jl:1038
 [17] include(::Module, ::String) at ./sysimg.jl:29
 [18] top-level scope at none:2
 [19] eval at ./boot.jl:319 [inlined]
 [20] eval(::Expr) at ./client.jl:399
 [21] top-level scope at ./none:3
in expression starting at /home/pkrysl/.julia/packages/VegaLite/1I7Wn/src/schema/schema_parsing.jl:151
in expression starting at /home/pkrysl/.julia/packages/VegaLite/1I7Wn/src/VegaLite.jl:77
ERROR: Failed to precompile VegaLite [112f6efa-9a02-5b7d-90c0-432ed331239a] to /home/pkrysl/.julia/compiled/v0.7/VegaLite/lrJqi.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] macro expansion at ./logging.jl:313 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1185
 [4] _require(::Base.PkgId) at ./logging.jl:311
 [5] require(::Base.PkgId) at ./loading.jl:852
 [6] macro expansion at ./logging.jl:311 [inlined]
 [7] require(::Module, ::Symbol) at ./loading.jl:834

Encoding API

Here is an idea for a slightly tweaked encoding API: don't have a encoding function, instead have functions like encode_x, encode_y, encode_color etc. These would also replace the current xquantitative etc. functions.

These new encode_x functions would take a positional first argument that could either be a Symbol (to reference a field), or a String that provides some convenient shortcut syntax.

So some of the examples would look like this:

mpg |> # add values ('data()' need the VegaLite qualification because it is exported by RDatasets too)
  markpoint() |>
  encode_x(:Cty, axis=nothing) |>
  encode_y(:Hwy, vlscale(zero=false)) |>
  encode_color(:Manufacturer) |>    # bind color to :Manufacturer, nominal scale
  config(vlcell(width=350, height=400))

What we lose with that is the mandatory decision whether one wants to encode a field as quant, nominal etc. But I think that is good, in most cases we should be able to just use the julia data type to decide a sensible default for that.

The other thing we lose is the encoding function that groups all the encodings. But does that provide any benefit? I kind of feel that one might as well just add individual encodings directly into the spec, and it should be clear that they must go into the encodings JSON section, where else could they go? So it seems to me that getting rid of that one level in the hierarchy in the julia API would also just simplify things for users.

I would also suggest a abbreviated string syntax for this like altair, maybe even just use exactly the same syntax. For example, encode_x("Cty:Q") would mean that Cty should be used as a quant field. encode_x("Cty:N") would mean it should be used as a nominal field etc.

Auto-encode

@piever had this super nice idea about an auto-encoding option here. This issue is just to remind me about it later.

Rename package?

@fredo-dedup I think it makes sense to have a vega and vega-lite story in one package here, and I started that with #107. At that point the package name is maybe no longer ideal?

I guess one fun naming option might be Deneb. It seems that Vega, Altair and Deneb are all from the Aquila constellation, and given that Altair is the name for the Python wrapper, this might make sense? Or maybe some other star name that is somehow related to Vega?

This might also generally be a silly idea, and maybe we should just stick with VegaLite.jl... Not sure, just thought I'd bring it up. Certainly also not urgent.

plotting with many variables is slow

In datasets with many variables (columns), plotting is currently slow, even if only a small variable subset is actually used:

using VegaLite, DataFrames

df = DataFrame(rand(100, 10))
@time df |> @vlplot(:point, x=:x1, y=:x2)

0.001305 seconds (9.31 k allocations: 413.561 KiB)

vs.

df = DataFrame(rand(100, 1000))
@time df |> @vlplot(:point, x=:x1, y=:x2)

26.506266 seconds (1.66 M allocations: 88.826 MiB, 0.33% gc time)

Im currently manually reducing datasets to variables that are actually used for plotting, but this becomes cumbersome. Couldn't @vlplot do this automatically?

Display systems

@fredo-dedup Just saw your work in blink_display and wanted to share some ideas I had around that.

I started https://github.com/davidanthoff/BlinkDisplay.jl a while ago. The idea is that this is a package that pushes a display on the display stack and then can handle various MIME types. One could be the vega-lite MIME type (and we could also add support for the vega and plotly MIME types etc., essentially support for the same MIME types that jupyterlab handles). I think one nice aspect about that design would be that VegaLite.jl and BlinkDisplay.jl would not need to have a dependency in either direction, but they would still work together via the MIME type.

I also plan to add support for the vega-lite MIME type to the VS Code julia extension. And I think the Juno folks are also considering providing support for displaying figures via the base multimedia system.

I think if that all works out, it would be great for something like VegaLite.jl: essentially that package would only have to provide a couple of show methods, and then depending on the runtime environment (jupyterlab, nteract, Juno, VS Code, BlinkDisplay) things would just show properly.

I guess the corollary of that is that I think plotting packages like VegaLite.jl should not push things on the display stack. That will at the end of the day mess things up when run say in VS Code, IJulia etc., because it really is those kinds of packages that provide displays that should push them onto the stack, not plotting packages.

XMLHttpRequest is not defined

Trying to convert a spec to SVG when it has a URL as the data source throws the following error:

julia> savefig("foo.svg", f)
WARN Invalid field type "undefined" for channel "x", using "quantitative" instead.
WARN Invalid field type "undefined" for channel "size", using "quantitative" instead.
WARN Invalid field type "undefined" for channel "y", using "quantitative" instead.
ERROR Loading failed https://raw.githubusercontent.com/vega/new-editor/master/data/movies.json ReferenceError: XMLHttpRequest is not defined
    at request$1 (C:\Users\david\.julia\v0.6\VegaLite\deps\node_modules\vega\build\vega.js:1594:13)
    at C:\Users\david\.julia\v0.6\VegaLite\deps\node_modules\vega\build\vega.js:1995:15
    at new Promise (<anonymous>)
    at Object.http (C:\Users\david\.julia\v0.6\VegaLite\deps\node_modules\vega\build\vega.js:1994:10)
    at C:\Users\david\.julia\v0.6\VegaLite\deps\node_modules\vega\build\vega.js:1922:18
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

@domoritz, do you have some idea what the root cause of this might be? The general story here is that we run this script to convert the vega-lite spec to SVG. In the build phase of the package we download vega and vega-lite via npm with this package file.

I completely understand that digging into the details of this package is probably unrealistic for you, but I guess there is a small chance that you might have seen a similar error before and might just know what we should do :) Thanks!

Code generation story

I've been thinking a bit more about the code generation story. Do you think it might make sense to generate the code from the schema in the build.jl function and just save to disc as .jl files? One benefit I could see is that the package would probably load a lot faster because the code generation would only happen once at package install time, not at every package load time. It might also be easier to fully understand everything that gets generated? There is probably some downside, but I can't really think of any right now?

HeadlessChromium vs Node

I see that you are replacing the Node.js stuff with HeadlessChromium. Was there a problem with the node stuff or do you see some other benefit?

Fix doc page

Hi @fredo-dedup I think the doc build is now working and properly pushing things to the gh-pages branch, but the URL still doesn't seem to work.

Could you double check that in the settings for this github repo, on the first page, under GitHub Pages you have selected gh-pages branch for Source? That is the setting we need, everything else won't work.

Make FilePaths support more robust

Minimally the following should be done:

  • Make sure we patch the URI format properly on all platforms
  • Make sure we handle data elements even deeply nested in the spec (lookup transforms, nested specs)

IJulia story

I've spent a fair bit of time now thinking through the best way to support IJulia. Essentially I think we might want to not have a show method for the html MIME type because I think no matter what we do, we'll run into trouble.

Here are the three options I see that one can use in the generated HTML:

  1. Embed all the vega and vega-lite javascript in the HTML. We would probably use something like browserify for that. That is the strategy that plotlyjs.jl uses in some cases. I think at the end of the day this is unrealistic because it just really bloats IJulia notebooks like crazy.
  2. Emit HTML that loads vega-lite from some URL. That is what we do today. Main issue is that it doesn't work when one is offline.
  3. Emit HTML that uses a local copy of the vega-lite javascript. Main issue is that it doesn't work if one gives the file to someone else.

I think at the end of the day all of these options have such significant drawbacks that we should just cut the HTML show method entirely.

At that point we would have the following situation:

  • Jupyterlab and nteract will use the native vega-lite MIME type. This is the ideal situation in any case, we just embed the vega-lite spec itself, and both of those clients handle all the vega-lite deployment for us. I have that scenario almost working, just waiting for one more merge over at IJulia. nteract already ships with vega-lite support out of the box, and juptyerlab right now has an extension for that, but they plan to move that into the normal jupyterlab deployment.
  • On the classical notebook (which will be phased out as jupyterlab gets more mature) we don't have that option. I would suggest we just rely on PNG or SVG for that case. Yes, we lose the interactivity, but on the flipside things will work without tech hiccups. And if folks do want interactivity, they can just move over to jupyterlab, which they have to do in any case soonish.

@fredo-dedup what do you think about that?

Heatmap from a 2d Matrix

Is it possible to create a heatmap with z values. All the examples in the document seems to perform aggregation / binning in VegaLite. What if I have a matrix

df = rand(1:100, (3,3)) |> DataFrame

│ Row │ x1 │ x2 │ x3 │
├─────┼────┼────┼────┤
│ 1727146 │
│ 2678217 │
│ 3981761

How can I create a heatmap out of this dastaset?

save as JS?

I try to get most of my science out in my and my departments homepage. Getting it out as JS to embedd would be very nice. is there already something like (or could there easily be):

js(filename, plot, optional(div to target; include or link to data))

that creates a js snipped that I can just drop into a webpage

properly set up I could then have a pipeline entirely in julia that updates figures ()incl appearance, not just data) on a webpage.

Plotting inside JupyterLab fails

I am unable to render plots on JupyterLab. I am using julia-0.6.3 and the latest tagged release of VegaLite.jl inside a docker container. Upon executing simplest of code snippet I see that the julia-binary takes up one whole CPU forever and never returns.. no error/no output

Wondering if somebody else have noticed similar behavior? I don't see any errors on Jupyter log's.

vegalite jl

console

unicode field names don't work in Firefox (suggested fix)

Running

using VegaLite
using DataFrames
df = DataFrame(x=collect(1:10))
df[] = df[:x]
data_values(df) + mark_point() + encoding_x_quant(:x) + encoding_y_quant()

the plot is blank in Firefox, but shows fine in Chromium. Putting <meta charset="UTF-8"> in <head> of the generated HTML fixes the problem.

Tag a version

I just found this package, and it seems fantastic! This actually seems the best option on julia right now for people that are looking for a grammar of graphics API. Really surprised this package is not getting much, much more publicity...

In any case, could you tag a new version? The latest tagged versions has lots of deprecation warnings on julia 0.5, would be great to have a tagged version that doesn't have these. I just tried the devl branch, and all those seem to be fixed there.

Roadmap

@fredo-dedup I thought it might be a good idea to have a place to discuss the overall roadmap for this package? I'd be really interested to help polish the few remaining things, make things stable etc. I still feel that this has the potential to be a super important package in the data science stack in julia and would like to help :)

Do you have some specific plans with the package?

Shape mapping methods silently fail

The "Choropleth of unemployment rate per county" and "One dot per zipcode in the U.S." example result in a webpage with a blank canvas:
image

A clue to what's wrong is with the "One dot per airport in the US overlayed on geoshape" which is intended to both draw a map and drop points on top of it. Only the points appear:
image

This is after a recent (this morning) Pkg.update, and the VegaLite non-mapping examples work fine.

This is a linux install with Julia 0.6.2, VegaLite 0.3.2, and VegaDatasets 0.3.0.

VegaLite selection in Jupyter

Playing around with VegaLite.jl in an jupyter/IJulia notebook I tried to translate an interactive example fron the VegaLite web page:
Interactive Average
The following code reproduces the plot without the interaction:

using VegaLite, DataFrames
data = DataFrame(
    date=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],
    precipitation=[3.8,3.7,4.9,3.1,1.6,1.1,0.3,1.2,1.9,4.1,5.2,5.0]
)
data |> 
@vlplot() +
@vlplot(
    selection={
        brush={
            typ="interval",
            encodings=["x"]
        }
    },    
    mark="bar",
    encoding={
        x={field="date", typ="ordinal"},
        y={aggregate="mean", field="precipitation", typ="quantitative"},
        opacity={
            condition={selection="brush", value=1},
            value=0.7
        }
    }
) +
@vlplot(
    transform=[{
        filter={selection="brush"}
    }],
    mark="rule",
    encoding={
        y={aggregate="mean", field="precipitation", typ="quantitative"},
        color={value="firebrick"},
        size={value=3}
    }
)

The error message is:

WARN Can not resolve event source: window

I am aware of this issue:
#49
but don't understand everything.

Am I right that interactivity in a IJulia notebook is not yet possible with VegaLite.jl?

Move JSON Schema parser/stuff into own package

I'm not really sure this makes sense, but if the JSON schema stuff is generic enough that it is not vega-lite specific, it might make use to move it into a JSONSchema.jl package, so that other packages can also use it?

Why is the IJulia integration behind a @requires clause?

This just seems another method added to show, no reason to have this conditional on IJulia, right?

If we manage to get a plot pan working for the julia VS Code extension we would for example probably hook into this, so I think it should be just always available.

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.