# Ratio between the plot and the figure - white area around

I am having trouble removing this white area around my plot:

I have tried `aspect_ratio` and `size` options but couldn’t change. It happens both in VSCode and Jupyter notebook. It doesn’t happen in my laptop though. Any good insights? This same thing also doesn’t happen with 2D plots, only 3D…
Thank you!

``````using Plots

# Generate some data for the plane
x = 0:0.1:1   # x-coordinates
y = 0:0.1:1   # y-coordinates
z = [-i -j +1 for i in x, j in y]

plot(x, y, z,
st=:surface,
color=:lightgray,
alpha=0.3,
legend=false,
xlims=(0.2,0.5),
ylims=(0.2,0.5),
zlims=(0.2,0.5),
camera=(80,20),
xticks=0.2:0.1:0.5,
yticks=0.2:0.1:0.5,
zticks=0.25:0.1:0.55,
dpi=:400)
``````

Plots.jl is more an art than a science…

The best I could get was using both `size` and `Measures` with a `-10mm` margin, more than that had no effect:

CODE
``````using Measures, Plots; gr(size=(600,600))

# Generate some data for the plane
x = 0:0.1:1   # x-coordinates
y = 0:0.1:1   # y-coordinates
z = [(-i -j +1) for i in x, j in y]

plot(x, y, z,
st=:surface,
color=:lightgray,
alpha=0.3,
legend=false,
xlims=(0.2,0.5),
ylims=(0.2,0.5),
zlims=(0.2,0.5),
camera=(80,20),
xticks=0.2:0.1:0.5,
yticks=0.2:0.1:0.5,
zticks=0.25:0.1:0.55,
dpi=:400,
margins=-10mm
)
``````
1 Like

This solves my problem for now, but there’s definitely something mysterious with the formatting in newer versions of `Plots.jl` perhaps. For instance, I was always able to create surface plots like this immediately both in VSCode and Jupyter. Somehow it adjusted nicely to the screen:

Now, the default has become something like this, which is way worse looking and impossible to make it match the one above:

Do you think I messed up some backend thing (?) with another package or something alike?