Comments (8)
FWIW, I like the vega-lite data spec as it broadens the pool of examples available online. There is a ton more vega or vega-lite written on the web than whatever a DSL would make of it.
from oz.
I share the view, that an API layer is not worth the effort, maybe even counter productive.
The beauty of using vega-lite / vega from clojure is, that it can be expressed as pure nested clojure maps. I think using clojure keywords instead of strings, makes it even more readable. So writing your example above as clojure maps with keyword looks very good to me:
{ :data {:values dat}
:mark :bar
:encoding {
:x { :field "a" :type :nominal}
:y {:field "b" :type :quantitative}}}
An API would make sense in statically typed language, as then you could expect the auto completion in the IDE to work perfectly. But this is not the case for clojure.
from oz.
Hi @randomizedthinking. Thanks for asking.
I have thought about this a bit, and am open to the possibility. However, my experience with constructor layers like Altair has been that they can be more trouble than they're worth. The abstractions have a tendency to break down as things get complicated, and as minimal as vega-lite already is, I worry that its a disservice to coax users into adopting some library specific api, rather than learning the underlying vega-lite.
For example, looking at the vegalite API and cutting out the unecessary details, I'm not sure the abstraction is really worth it's weight.
vegalite() %>%
add_data(dat) %>%
encode_x("a", "ordinal") %>%
encode_y("b", "quantitative") %>%
mark_bar()
{ "data": {"values": dat},
"mark": "bar",
"encoding": {
"x":{ "field": "a", "type": "nominal"},
"y": {"field": "b", type": "quantitative"}}}
Still, I'm open to hearing an argument in defense of something like this if any oz users care to make one.
from oz.
I understand your point. My feeling is that even a thin layer of abstraction would help users to adopt vega/vega-lite. For your example, I think most users would prefer the abstracted one over the raw vega-lite data spec.
Given the underlying design of vegalite is very reasonable, it is up for discussion whether we would like to re-design or adopt a new DSL to wrap vega-lite data spec, or go with a direct-translation approach.
from oz.
Thanks for chiming in @BorisVSchmid. You more clearly spell out the sentiment I had in mind when I said that "I worry that its a disservice to coax users into adopting some library specific api..."
I'm still not entirely closed to the idea, but I'm also unlikely to highlight such an API as the "way to get started", and would likely put such constructors in their own namespace (oz.builder
?).
from oz.
Agreed that vega-lite data spec is well designed. My personal feeling is that when there are advanced options like layers involved, it is not so straightforward to set the spec correct easily. @metasoarous, the oz.builder
namespace could be an reasonable approach.
from oz.
Layers are actually a great example of how things can go wrong here though. In Altair I once tried to create a visualization with two layers, each of which had a different data source, and while this is perfectly acceptable in Vega-Lite, Altair hadn't considered that use case in its constructors, and I couldn't get it to work without manually crafting the Vega-Lite by hand. So I guess this is all the more to the point of my reservation, which is that where constructors might have the most value (the non-trivial stuff) is precisely where assumptions are most likely to be violated.
Again, I'm not totally writing the idea off; Just highlighting why I want to consider it carefully.
Thanks again for bringing this up for discussion.
from oz.
I agree @behrica.
@randomizedthinking Have you looked at Hanami/Saite's plot templating functionality? That's probably the closest thing to something I'd consider including in Oz. There are some ergonomics of that system I find a little offputting (all-caps in places), or I'd probably have tried it with Oz already. At the end of the day though, I haven't really needed something like it. But if there's inspiration to push something forward in this direction that meshes well with Oz, I'd consider it.
Thanks again folks!
from oz.
Related Issues (20)
- Support streaming data into a visualization via core.async chan
- More idiomatic support for reactive data updates (via reagent atom/reaction data inputs)
- More idiomatic support for reactive Vega signals (as reagent atoms/reactions)
- Add option to ingest clj file comments as markdown
- Add function for setting global compile option defaults
- Progressively stream clj file and markdown block evaluations to client
- Stop using prewalk on client for applying components to hiccup docs
- Live-reloading styles
- Add cli
- Oz does not seem to respect the xOffset setting HOT 5
- Clarify that 1.6.0-alpha36 is the current version HOT 2
- Bump vega-lite to 5.2.0 HOT 1
- live-view! function should work on directories HOT 3
- export! error with png
- WARN Missing type for channel "order", using "quantitative" instead.
- Issues using spec with new notebook features
- rebuilding when output file is missing (but input has not changed)
- Unable to embed static rendering on Windows HOT 6
- memory leak when updating reagent component HOT 7
- Incorrect rendition when using `oz/view!`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oz.