There seems to exist an od behavior of Plots when we use LaTeXStrings to format labels: they overlap. This problem is new because I am revisiting some teaching material, and it did not happen before.

I am on a Windows 10 machine, Julia 1.6.3, using Plots.jl v1.22.5, GR v0.61.0, LaTeXStrings v1.2.1. Please find an example below (it works the same way, even in simple plots with just two labels).

Help would be very much appreciated. I came across a turnaround to this problem here. Unfortunately, it is too elaborate to pass on to students, who have to produce a lot of plots. Thanks.

@lmiq, that’s an option, and if the problem is not solved by the Plots team, possibly a good one. But I have a lot of plots and the arguments of Plots and PGFPlotsX are sometimes quite different. There was a similar problem in the past and it was solved (it was not about overlapping; symbols would not display correctly). Confusing that this LaTeXStrings problem keeps coming up. Thanks for the suggestion.

@rafael.guerra, you are a magician! That definitely solves the problem. But I need to keep the plotting issues as simple as possible. This is for master students in economics that are learning some programming techniques for the first time … in an economics course. If I do not keep it simple, they will get frustrated … and my Matlab colleagues will tell me “I told you so”. Thanks anyway.

@lmiq, thanks. The extra_kwargs=Dict(:subplot=>Dict(:legend_hfactor=>1.25)) indeed does the trick. That is good news.

The computer in my office had an older version of Plots and GR, and the plots produced last year look perfect (see an example below). Don’t know why upgrades keep coming up with new bugs as far as LaTeXStrings is concerned.

@rafael.guerra, yes, you are right: Julia and Plots are two diamonds. And thank you very much for your speedy and immaculate solutions. They always work. Thanks for your kind help.