@@ -68,6 +68,8 @@ function _start_kaleido_process()
6868 nothing
6969end
7070
71+ savefig (p:: SyncPlot ; kwargs... ) = savefig (p. plot; kwargs... )
72+
7173function savefig (
7274 p:: Plot ;
7375 width:: Union{Nothing,Int} = nothing ,
@@ -119,6 +121,10 @@ function savefig(
119121 end
120122end
121123
124+
125+ @inline _get_Plot (p:: Plot ) = p
126+ @inline _get_Plot (p:: SyncPlot ) = p. plot
127+
122128"""
123129 savefig(
124130 io::IO,
@@ -136,21 +142,20 @@ image scale. `width` and `height` set the dimensions, in pixels. Defaults
136142are taken from `p.layout`, or supplied by plotly
137143"""
138144function savefig (io:: IO ,
139- p:: Plot ;
145+ p:: Union{SyncPlot, Plot} ;
140146 width:: Union{Nothing,Int} = nothing ,
141147 height:: Union{Nothing,Int} = nothing ,
142148 scale:: Union{Nothing,Real} = nothing ,
143149 format:: String = " png" )
144-
145-
146150 if format == " html"
147- return show (io, MIME (" text/html" ), p , include_mathjax= " cdn" , include_plotlyjs= " cdn" , full_html= true )
151+ return show (io, MIME (" text/html" ), _get_Plot (p) , include_mathjax= " cdn" , include_plotlyjs= " cdn" , full_html= true )
148152 end
149153
150154 bytes = savefig (p, width= width, height= height, scale= scale, format= format)
151155 write (io, bytes)
152156end
153157
158+
154159"""
155160 savefig(
156161 p::Plot, fn::AbstractString;
@@ -167,7 +172,7 @@ image scale. `width` and `height` set the dimensions, in pixels. Defaults
167172are taken from `p.layout`, or supplied by plotly
168173"""
169174function savefig (
170- p:: Plot , fn:: AbstractString ;
175+ p:: Union{SyncPlot, Plot} , fn:: AbstractString ;
171176 format:: Union{Nothing,String} = nothing ,
172177 width:: Union{Nothing,Int} = nothing ,
173178 height:: Union{Nothing,Int} = nothing ,
0 commit comments