Hi all,
I have the code from previous forum I made, that reflect a graph toward y axis. Now I want to reflect it toward y=x , I can’t just do yreflection = y -> x
it prompts a lot of errors
This code works on y axis reflection.
using Plots, LaTeXStrings, Plots.PlotMeasures
gr()
function make_fg_plot()
f(x) = log(6x)
g(x) = 2x + log(6x)
yshift = y -> y + 0
yreflection = y -> y
ytransform = yshift ∘ yreflection
plt = plot(; xtick=:false, ylims = (-15, 15),
legend = :topleft, bottom_margin=5mm)
for (T, attrs) in [(identity, (;label = "", linecolor = :green)),
(ytransform, (;label = "", linecolor = :red))]
plot!(plt, T ∘ f, 0, 10; label="")
plot!(plt, T ∘ g, 0, 10; label="")
for i=0:0.2:2
plot!(plt, [2+i, 2+i], T.([f(2+i), g(2+i)]); label="")
end
annotate!([(3,-16.1, (L"x", 10, :black))])
annotate!([(3,-15.1, (L"|", 10, :black))])
end
return plt
end
make_fg_plot()