# Plots.jl set figure size for LaTeX publications

**URL:** <https://discourse.julialang.org/t/plots-jl-set-figure-size-for-latex-publications/36960>\
**Category:** Visualization\
**Created:** [April 3, 2020, 1:52pm UTC](https://discourse.julialang.org/t/plots-jl-set-figure-size-for-latex-publications/36960 "2020-04-03T13:52:23Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![jamblejoe](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Post date:** [April 20, 2020, 4:43pm UTC](https://discourse.julialang.org/t/plots-jl-set-figure-size-for-latex-publications/36960/18 "2020-04-20T16:43:42Z")

</div>

Hi @kmundnic!

Thanks for this awesome answer! I had a look in the repository([GitHub - kmundnic/pgfplots-example: An example of PGFPlots in LaTeX](https://github.com/kmundnic/pgfplots-example)) already. Thanks a lot! I will open an issue there in case I have any further questions.

In case people are visiting this thread with a similar question, I will post the answert to my initial question. I digged in the source code a bit and worked out, how `Plots.jl` is setting thefigure size for the pyplot backend. They use an internal DPI value of 100, set by the constant `DPI`, found in … . The first line in the function `_create_backend_figure` in `pyplot.jl` tells the story:

```julia
w,h = map(px2inch, Tuple(s * plt[:dpi] / Plots.DPI for s in plt[:size]))

```

The size of the figure set by `Plots.jl` `size` argument is in pixels and then converted to inch using the DPI value of `dpi`( which can be set via `plot(dpi=100)`).  
If you do not want to safe in a pixelformat, you do not have to care about the DPI value. Converting from pts to the correct inches works as follows:

```julia
width_pts = 246.0 # or any other value
inches_per_points = 1.0/72.27
width_inches = width_pts *inches_per_points
width_px= width_inches*100 # or width_inches*DPI

```

Setting `plot(size=(width_px, width_px))` now creates a square plot with exactly 246 points.

---

_[View the full topic](https://discourse.julialang.org/t/plots-jl-set-figure-size-for-latex-publications/36960)._
