Closed keesterbrugge closed 5 years ago
#unrepl/mime {:content-type "application/vnd.vegalite.v2+json" :content {
"$schema" "https://vega.github.io/schema/vega-lite/v2.json",
"description" "A simple bar chart with embedded data.",
"data" {
"values" [
{"a" "A", "b" 28}, {"a" "B", "b" 55}, {"a" "C", "b" 43},
{"a" "D", "b" 91}, {"a" "E", "b" 81}, {"a" "F", "b" 53},
{"a" "G", "b" 19}, {"a" "H", "b" 87}, {"a" "I", "b" 52}
]
},
"mark" "bar",
"encoding" {
"x" {"field" "a", "type" "ordinal"},
"y" {"field" "b", "type" "quantitative"}
}}}
should work
Hi Christophe,
Thanks! This indeed works, see the screenshot below.
However, if I want to use a vega-lite spec that's bound to a symbol – vl-spec
in this case – I don't know how to use #unrepl/mime
anymore
and if I want to plot the result of a function call it seems to turn into an infinite loop
Is this expected behaviour?
I would like to be able to create my vega-lite specs with a library like oz and/or read in json files and then plot them inline with unrepl/mime
I would appreciate suggestions on how to do that.
Thanks again for your work!
Actually you are breaking grounds. Let's me explain how it works right now:
#unrepl/mime
tag literal then the payload goes through the MIME facilities of Jupyter Labmaster
.The workaround for 2/ is to do (tagged-literal 'unrepl/mime (my-spec))
but I'm considering evaluating expressions inside literals.
Does it shed enough light on the matter to help you solve the issue?
Thank for you fast response.
I can confirm this now works
This helps a lot
@cgrand Thanks for unblocking us! Would vega work more or less the same way with s/vegalite/vega/
applied to the :content-type
? Also, I'm assuming v2
is for version here; Do you know if its possible to get a RC version through this :content-type
specification?
Thanks again!
@metasoarous honestly I have no idea. IClojure does nothing special (except edn -> json conversion) so whatever works with IPython.display
should work with unrepl/mime
.
@keesterbrugge with the commit above your original code should work (without explicit tagged-literal
call)
You're right
Cheers!
Hi,
Thanks for your work on this kernel.
Currently I mostly use ggplot in R for visualisations. I would love to have vega-lite available to me in a notebook environment with clojure.
In the ipython kernel a vega-lite spec can be rendered inline as follows
Does similar functionality exist in iClojure?