Julia v1.7.0
I faced two issues:
LoadError: UndefVarError: plot not defined
and
LoadError: UndefVarError: twinx not defined
It took a while, how to achieve the result I was looking for.
Below my simple example copied from the internet, if you have the same issues,
it might be necessary to put “Plots.” before the two commands “plot” and “twinx”,
just play around, by switch back and forth with “true” and “false” inside the if-clause:
using Measures, Plots; gr()
x12=randn(10)
y12=1000*randn(10)
lcx =:blue; lwx=2
lcy =:red; lwy=3
if true
Plots.plot([x12[1]], lc=lcy, lw=lwy, label="y12", right_margin=15mm)
Plots.plot!(x12, label="x12", lc=lcx, lw=lwx, legend=:topleft)
Plots.plot!(twinx(), y12, lc=lcy, lw=lwy, label="")
else
plot([x12[1]], lc=lcy, lw=lwy, label="y12", right_margin=15mm)
plot!(x12, label="x12", lc=lcx, lw=lwx, legend=:topleft)
plot!(Plots.twinx(), y12, lc=lcy, lw=lwy, label="")
end
P.S.:
As far as I understand, it should work without the additional “Plots.”,
maybe one reason on my installation is the fact that I need for the purpose
of data import the package “asammdf” and this is installed via PyCall
from the channel “source-forge”. The installation took a while and I was
warned at the end that I may face issues, because there are some incompatibilities
between packages with the same name originated from different
channels.