Two y-axis overlaps in pyplot

I expect to have two y-axis one on the left and another on the right. but it shows overlapped y-axis on the left.

@show backend()
x = 1:10
y1 = log.(x)
y2 = y1 + 0.05*randn(10)
plot(x, y1, xlabel="x", ylabel="log(x)", title = "\$log(x)\$ vs. x", label=L"log(x)")
scatter!(x,y2, label="\$log(x)\$ + noise")
p = twinx()
plot!(p, x, log10.(x))

image

I can’t confirm:

using Plots
using LaTeXStrings

pyplot()
@show backend()

x = 1:10
y1 = log.(x)
y2 = y1 + 0.05*randn(10)
plot(x, y1, xlabel="x", ylabel="log(x)", title = "\$log(x)\$ vs. x", label=L"log(x)")
scatter!(x,y2, label="\$log(x)\$ + noise")
p = twinx()
plot!(p, x, log10.(x))

image

Perhaps it’s a version problem?

julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: AMD Ryzen 9 3900X 12-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, znver2)

(@v1.6) pkg> st
      Status `C:\Users\Oli\.julia\environments\v1.6\Project.toml`
...
  [4c0ca9eb] Gtk v1.1.7
...
  [b964fa9f] LaTeXStrings v1.2.1
...
  [91a5bcdd] Plots v1.15.2
...
  [d330b81b] PyPlot v2.9.0

HI Oheil, I checked again and found the case is that i set
default(grid=:off, box=:on)
without this setting it appeared normal.

Yes, confirmed. It’s the box=:on setting and it doesn’t happen with GR backend, so it seems to be a pyplot specific problem. Still it’s unclear if this is Julia specific or already in pythons matplotlib.

Perhaps you or someone else can check this and open an appropriate issue for this bug.

Truely GR doesn’t have this problem. Problem for GR is that the Latex string is not rendered sometimes. in this example, the L"xx" string is rendered, but the title, “$ xxx$” is not rendered.
image