Why Julia plotting is not working under Plotly but works under GR?

Viewed 120

I have a Julia program that runs without any problems when I use GR as a backend. When I try to use Plotly as a backend it generates an error (see at the bottom of this post).

I can see Plotly, PlotlyJS and PlotlyBase in Project.toml.

The command that causes the error is:

Plots.savefig(p, plot_save_path)

Here plot_save_path is a valid path. The command only generates an error if the following is executed before it:

plotly()

Is there a way to fix this and make Plotly work in my program?

The error message is:

ERROR: UndefVarError: savefig not defined
Stacktrace:
  [1] _show(io::IOStream, #unused#::MIME{Symbol("image/svg+xml")}, plt::Plots.Plot{Plots.PlotlyBackend})
    @ Plots C:\Users\fsald\.julia\packages\Plots\dNEbX\src\backends\plotlybase.jl:21
  [2] show
    @ C:\Users\fsald\.julia\packages\Plots\dNEbX\src\output.jl:212 [inlined]
  [3] #271
    @ C:\Users\fsald\.julia\packages\Plots\dNEbX\src\output.jl:13 [inlined]
  [4] open(::Plots.var"#271#272"{Plots.Plot{Plots.PlotlyBackend}}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base .\io.jl:330
  [5] open
    @ .\io.jl:328 [inlined]
  [6] svg(plt::Plots.Plot{Plots.PlotlyBackend}, fn::String)
    @ Plots C:\Users\fsald\.julia\packages\Plots\dNEbX\src\output.jl:12
  [7] savefig(plt::Plots.Plot{Plots.PlotlyBackend}, fn::String)
    @ Plots C:\Users\fsald\.julia\packages\Plots\dNEbX\src\output.jl:121
  [8] save_plot(p::Plots.Plot{Plots.PlotlyBackend}, filename::String, output_file_path::String; timetag::Bool)
    @ Main C:\Users\fsald\Dropbox\Code\Julia\bootstrapWalkforward\BW1\src\Utils.jl:3986
  [9] save_plot(p::Plots.Plot{Plots.PlotlyBackend}, filename::String, output_file_path::String)
    @ Main C:\Users\fsald\Dropbox\Code\Julia\bootstrapWalkforward\BW1\src\Utils.jl:3974
 [10] optimize(data::DataFrame, ctrl_parms::ControlParameters, params::Vector{Dict{Symbol, Any}}, indx::UnitRange{Int64}; fast::Bool)
    @ Main C:\Users\fsald\Dropbox\Code\Julia\bootstrapWalkforward\BW1\src\ModelFunctions.jl:1343
 [11] top-level scope
    @ c:\Users\fsald\Dropbox\Code\Julia\bootstrapwalkforward\BW1\src\BootWalk.jl:423   
0 Answers
Related