You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/userguide/vlspec.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,30 @@ The resulting `VLSpec` object is indistinguishable from one that is created via
104
104
105
105
The main benefit of this approach is that one can directly leverage JSON vega-lite examples and code.
106
106
107
+
## Manipulating `VLSpec` object directly
108
+
109
+
Vega-Lite properties can be directly accessed as properties of the `VLSpec` object.
110
+
111
+
```julia
112
+
julia> spec = [(a=x, b=exp(x), c=sin(x)) for x in0:10] |>
113
+
@vlplot(:point, x=:a, y=:b);
114
+
115
+
julia> spec.mark
116
+
:point
117
+
118
+
julia> spec.encoding.x.field
119
+
"a"
120
+
```
121
+
122
+
To modify properties, use [Setfield.jl](https://github.com/jw3126/Setfield.jl):
123
+
124
+
```julia
125
+
julia>using Setfield # imports `@set` etc.
126
+
127
+
julia> spec2 =@set spec.mark =:line
128
+
spec3 =@set spec2.encoding.y.field ="c"
129
+
```
130
+
107
131
## Loading and saving vega-lite specifications
108
132
109
133
The `load` and `save` functions can be used to load and save vega-lite specifications to and from disc. The following example loads a vega-lite specification from a file named `myfigure.vegalite`:
0 commit comments