# How to set width of VegaLite.jl Plot at time of image saving?

**URL:** https://discourse.julialang.org/t/how-to-set-width-of-vegalite-jl-plot-at-time-of-image-saving/131648
**Category:** Visualization
**Created:** [August 17, 2025, 4:35am UTC](https://discourse.julialang.org/t/how-to-set-width-of-vegalite-jl-plot-at-time-of-image-saving/131648 "2025-08-17T04:35:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Alex1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alex1/32/11771_2.png) [@Alex1](https://discourse.julialang.org/u/Alex1)
#### Post date: [August 17, 2025, 4:35am UTC](https://discourse.julialang.org/t/how-to-set-width-of-vegalite-jl-plot-at-time-of-image-saving/131648/1 "2025-08-17T04:35:34Z")

</div>

Hi, is there a way to set image width for VegaLite.jl **at the time of image saving**?

And maintaining the default chart ratio (sometimes when I set width the ratio is changed)?

```julia
using DataFrames, VegaLite, JSON

# Plotting code does not know the required image width, so it can't specify it
df = DataFrame(x=0:9, y=(i->i^2).(0:9))
vspec = (
  mark=(type=:line,),
  encoding=(
    x=(field="x", type=:quantitative),
    y=(field="y", type=:quantitative)
  )
)
spec = VegaLite.VLSpec(JSON.parse(JSON.json(vspec)))
fig = spec(df)

# Image saving code, it knows the image width, but how to specify it?
VegaLite.save("plot.png", fig)

```

Also, when using multi-plot plot (facet, column, row) - the image width multiplied by count of rows, so you specify width=800px and with 3 columns got 2400px instead. Is there a way to set width for the whole image?
