Print variable value in plot title with custom precision after decimal point (Plots.jl)

Hi all!
I’m trying to print variable values in the title of a plot using:

title = L"\eta_1 = %$(mean(df_b.η))"

But the result shows many numbers after the decimal point which takes the whole line of the title. How can I control the format of the print?

Thank you!

You can probably do

title = L"\eta_1 = %$(round(mean(df_b.η); digits = 2))"

And change 2 to your preferred precision

This helps only a little, the number that shows is:
2.2142441546857053e11
after using your suggestion the display is now:
2.2142441546857e11

Which helps, but what I need the display to be in the form of:
2.21e11

Sorry I only thought about small numbers. For the specific case you could use the sigdigits kwarg of round.

There might even be a way with round to do something accurate in both case but I am not at a computer with Julia now.

Another alternative is to use Printf · The Julia Language

sigdigits works! thank you!!!