# Why won't \`savefig\` work with \`plotly\`?

**URL:** <https://discourse.julialang.org/t/why-wont-savefig-work-with-plotly/76410>\
**Category:** General Usage\
**Tags:** question, plots\
**Created:** [February 14, 2022, 10:25am UTC](https://discourse.julialang.org/t/why-wont-savefig-work-with-plotly/76410 "2022-02-14T10:25:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soldalma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/soldalma/32/29388_2.png) [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Post date:** [February 14, 2022, 10:25am UTC](https://discourse.julialang.org/t/why-wont-savefig-work-with-plotly/76410/1 "2022-02-14T10:25:16Z")

</div>

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

I can see 'Plotly` and 'PlotlyBase` in `Project.toml`.

The command that causes the error is:

```julia
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:

```julia
plotly()

```

The error message is:

```julia
plotly()
Plots.savefig(p, plot_save_path)
ERROR: LoadError: 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\8ouqB\src\backends\plotlybase.jl:21
 [2] show
   @ C:\Users\fsald\.julia\packages\Plots\8ouqB\src\output.jl:214 [inlined]
 [3] svg(plt::Plots.Plot{Plots.PlotlyBackend}, fn::String)
   @ Plots C:\Users\fsald\.julia\packages\Plots\8ouqB\src\output.jl:15        
 [4] savefig(plt::Plots.Plot{Plots.PlotlyBackend}, fn::String)
   @ Plots C:\Users\fsald\.julia\packages\Plots\8ouqB\src\output.jl:123       
 [5] 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:3148
 [6] 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:3136
 [7] optimize(data::DataFrame, ctrl_parms::ControlParameters, params::Vector{Dict{String, Any}}, indx::UnitRange{Int64}; fast::Bool)
   @ Main C:\Users\fsald\Dropbox\Code\Julia\bootstrapWalkforward\BW1\src\ModelFunctions.jl:1329
 [8] top-level scope
   @ c:\Users\fsald\Dropbox\Code\Julia\bootstrapwalkforward\BW1\src\BootWalk.jl:420
in expression starting at c:\Users\fsald\Dropbox\Code\Julia\bootstrapwalkforward\BW1\src\BootWalk.jl:416

```

How can I save charts while using Plotly as a backend?
