# Plots jl plotlyjs ignores aspect ratio for pdf

**URL:** <https://discourse.julialang.org/t/plots-jl-plotlyjs-ignores-aspect-ratio-for-pdf/68634>\
**Category:** New to Julia\
**Tags:** plots, plotlyjs\
**Created:** [September 23, 2021, 1:55pm UTC](https://discourse.julialang.org/t/plots-jl-plotlyjs-ignores-aspect-ratio-for-pdf/68634 "2021-09-23T13:55:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ribeiro](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@Ribeiro](https://discourse.julialang.org/u/Ribeiro)\
**Post date:** [September 23, 2021, 1:55pm UTC](https://discourse.julialang.org/t/plots-jl-plotlyjs-ignores-aspect-ratio-for-pdf/68634/1 "2021-09-23T13:55:16Z")

</div>

Hi, folks.  
I might be messing up, but it seems that if I plot something with `size=(200,400)` and then `savefig` to PDF, plotlyjs makes my file square-ish.  
Is this a limitation, something I can work around, or me doing something wrong?  
Thanks!

```julia
using Plots
plotlyjs()
plot(rand(3),rand(3), size=(200,400))
savefig("tmp.pdf")

```

---

<div class="post-metadata">

**Author:** ![halleysfifthinc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/halleysfifthinc/32/206280_2.png) [@halleysfifthinc](https://discourse.julialang.org/u/halleysfifthinc)\
**Post date:** [September 23, 2021, 3:02pm UTC](https://discourse.julialang.org/t/plots-jl-plotlyjs-ignores-aspect-ratio-for-pdf/68634/2 "2021-09-23T15:02:09Z")

</div>

In `PlotlyJS.jl`, the `savefig` function doesn’t respect the internal size, but accepts `width` and `height` keyword args. The `Plots.jl` `savefig` function might accept similar kwargs.

[http://juliaplots.org/PlotlyJS.jl/stable/manipulating\_plots/#Saving-figures](http://juliaplots.org/PlotlyJS.jl/stable/manipulating_plots/#Saving-figures)

---

<div class="post-metadata">

**Author:** ![Ribeiro](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@Ribeiro](https://discourse.julialang.org/u/Ribeiro)\
**Post date:** [September 24, 2021, 7:26am UTC](https://discourse.julialang.org/t/plots-jl-plotlyjs-ignores-aspect-ratio-for-pdf/68634/3 "2021-09-24T07:26:06Z")

</div>

Makes sense, thanks!

---

<div class="post-metadata">

**Author:** ![Ribeiro](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@Ribeiro](https://discourse.julialang.org/u/Ribeiro)\
**Post date:** [September 28, 2021, 1:18pm UTC](https://discourse.julialang.org/t/plots-jl-plotlyjs-ignores-aspect-ratio-for-pdf/68634/4 "2021-09-28T13:18:58Z")

</div>

Sorry, I can’t find an easy way to call a PlotlyJS function from Plots. `savefig` does not support `width`/`height`, so maybe there’s a way for me to call `plotllyjs.savefig` from Plots?  
Thanks!

---

<div class="post-metadata">

**Author:** ![halleysfifthinc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/halleysfifthinc/32/206280_2.png) [@halleysfifthinc](https://discourse.julialang.org/u/halleysfifthinc)\
**Post date:** [September 28, 2021, 1:31pm UTC](https://discourse.julialang.org/t/plots-jl-plotlyjs-ignores-aspect-ratio-for-pdf/68634/5 "2021-09-28T13:31:04Z")

</div>

I hesitate to suggest a different plotting package, but I think that if you need to output a pdf of a certain size, using PlotlyJS directly might be the best option.

---

<div class="post-metadata">

**Author:** ![Ribeiro](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@Ribeiro](https://discourse.julialang.org/u/Ribeiro)\
**Post date:** [September 28, 2021, 1:46pm UTC](https://discourse.julialang.org/t/plots-jl-plotlyjs-ignores-aspect-ratio-for-pdf/68634/6 "2021-09-28T13:46:30Z")

</div>

I’d really rather not. I’m making a ton of plots and I already had to switch from GR to PlotlyJS due to some other issues and that was kind of painful. Let’s see if I can avoid that. Thanks!
