Hi all,
I want to recreate this plot.
My code currently create this far away from the desired plot:
using Plots, LaTeXStrings, Plots.PlotMeasures
gr()
f(x) = x^(2)
plot(f, ylims= (0,33), xlims=(-2,10), framestyle=:zerolines,
legend=:outerright, bottom_margin=5mm,
label=L"f(x) = x^{2}",
size=(720, 360), tickfontsize=10)
plot!(f,3,5, label=L"B_{n}", fill=(0, 0.45, :green))
plot!(f, 0,4.5,
fillrange = 20, fillalpha = 0.35, c = 1,
label = L"A_{n}")
The tricky part is this:
using Plots, LaTeXStrings, Plots.PlotMeasures
gr()
f(x) = x^(2)
plot(f, ylims= (0,33), xlims=(-2,10), framestyle=:zerolines,
legend=:outerright, bottom_margin=5mm,
label=L"f(x) = x^{2}",
size=(720, 360), tickfontsize=10)
plot!(f,3,5, label=L"B_{n}", fill=(0, 0.45, :green))
plot!(f, 3,5,
fillrange = f(5), fillalpha = 0.35, c = 1,
label = L"A_{n}")
plot!([0, 3], [f(3), f(3)], fillalpha = 0.35, c = 1, label = "", linewidth = 0, fillrange = f(5))
1 Like
Thanks @BeastyBlacksmith you are the best! So the last line is to fill a rectangle, that shall do the tricks.