It appears that when using the Plots package with the PlotlyJS backend, the left margin does not operate correctly.

Since the left and the bottom are where the Y and X axex reside, one would assume the margins should be applied in the same fashion for these, but right now they don’t.

The bottom works as expected: setting bottom_margin=some_number shifts the X axis title down by the specified distance so that there is white space between the axis numbers and the title.

When you set left_margin=some_number, however, it adds white space to the left of the title - not between the title and the Y axis numbers.

This makes for inconsistent and ugly looking plots, as there’s no way to make the X and Y axes match, except to play around with the bottom_margin until it nearly matches that of the left_margin.

For reference, I am running the LTS version of Julia 1.0.5 with updated packages. I also previously had the same experience with version 1.1 and due to other plotting issues I opted back to 1.0.5.

To demonstrate what I’m referring to, the following code produces the plots shown below.

```
# Load packages
using Plots
plotlyjs()
using Plots.PlotMeasures
# Data to plot
x = collect(Float64, 0:pi/100.:2.0*pi)
y = sin.(x)
# Font size and type
xyfont = font(36, "Times")
legfont = font(32, "Times")
# Figure/Plot image size
pixel_factor = 600
ps_x = pixel_factor * 3
ps_y = pixel_factor * 2
fig_size = (ps_x, ps_y)
# Axis properties
xprop = ("X Axis", (0, 2.0*pi), :none, :ln, :none, xyfont)
yprop = ("Y Axis", (-1., 1.0), :none, :ln, :none, xyfont)
# Generate plot with margin=0mm
plot(
x, y, label="sin(x)", xaxis=xprop, yaxis=yprop,
size=fig_size,
title="Plot 1 Margins: Default=0mm",
titlefont=xyfont,
legendtitle="Legend", legend=:right, legendfont=legfont,
framestyle=:box, color=:red, linestyle=:solid, linewidth=4,
margin=0mm
)
png("plot_1")
# Generate plot with margin=40mm
plot(
x, y, label="sin(x)", xaxis=xprop, yaxis=yprop,
size=fig_size,
title="Plot 2 Margins: Default=40mm",
titlefont=xyfont,
legendtitle="Legend", legend=:right, legendfont=legfont,
framestyle=:box, color=:red, linestyle=:solid, linewidth=4,
margin=40mm
)
png("plot_2")
# Generate plot with margin=40mm, bottom_margin=15mm, left_margin=15mm
plot(
x, y, label="sin(x)", xaxis=xprop, yaxis=yprop,
size=fig_size,
title="Plot 3 Margins: Default=40mm, Bottom=15mm, Left=15mm",
titlefont=xyfont,
legendtitle="Legend", legend=:right, legendfont=legfont,
framestyle=:box, color=:red, linestyle=:solid, linewidth=4,
margin=40mm,
bottom_margin=15mm,
left_margin=15mm
)
png("plot_3")
```

Results of Plot 1:

Results of Plot 2:

Results of Plot 3:

As you can clearly see from the plots, changing the margin values never changes the amount of white space between the Y axis title and the numbers, whereas for the X axis the margin controls work as expected and permit the user to provide ample white space to make the plot legible.

As one final example of how badly this can affect a real plot, take a look at the following:

In this plot the Y axis title is painfully close to the numbers along the axis and I have been unable to find any solution for this.

If there is already some fix, work-around, hack, etc. for any of this please let me know. Otherwise, I hope someone can provide a solution in a future release fairly soon.