diff --git a/src/backends.jl b/src/backends.jl index 90f2fcf8..47c9dbe3 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -60,11 +60,12 @@ guide_padding(axis::Axis) = axis[:guide] == "" ? 0mm : axis[:guidefont].pointsiz # Set the (left, top, right, bottom) minimum padding around the plot area # to fit ticks, tick labels, guides, colorbars, etc. function _update_min_padding!(sp::Subplot) - toppad = 2mm + title_padding(sp) - bottompad = 5mm + guide_padding(sp.attr[:xaxis]) - leftpad = 10mm + guide_padding(sp.attr[:yaxis]) - @show (leftpad, toppad, 3mm, bottompad) - sp.minpad = (leftpad, toppad, 3mm, bottompad) + leftpad = 10mm + sp.attr[:left_margin] + guide_padding(sp.attr[:yaxis]) + toppad = 2mm + sp.attr[:top_margin] + title_padding(sp) + rightpad = 3mm + sp.attr[:right_margin] + bottompad = 5mm + sp.attr[:bottom_margin] + guide_padding(sp.attr[:xaxis]) + @show (leftpad, toppad, rightpad, bottompad) + sp.minpad = (leftpad, toppad, rightpad, bottompad) end _update_plot_object(plt::Plot) = nothing diff --git a/src/output.jl b/src/output.jl index cf29734c..55443275 100644 --- a/src/output.jl +++ b/src/output.jl @@ -122,10 +122,10 @@ const _mimeformats = Dict( "image/svg+xml" => "svg" ) -# a backup for html... passes to svg -function Base.writemime(io::IO, ::MIME"text/html", plt::Plot) - writemime(io, MIME("image/svg+xml"), plt) -end +# # a backup for html... passes to svg +# function Base.writemime(io::IO, ::MIME"text/html", plt::Plot) +# writemime(io, MIME("image/svg+xml"), plt) +# end for mime in keys(_mimeformats) @eval function Base.writemime(io::IO, m::MIME{Symbol($mime)}, plt::Plot) @@ -134,6 +134,22 @@ for mime in keys(_mimeformats) end end +function html_output_format(fmt) + if fmt == "png" + @eval function Base.writemime(io::IO, ::MIME"text/html", plt::Plot) + print(io, "") + end + elseif fmt == "svg" + @eval function Base.writemime(io::IO, ::MIME"text/html", plt::Plot) + writemime(io, MIME("image/svg+xml"), plt) + end + else + error("only png or svg allowed. got: $fmt") + end +end + +html_output_format("svg") + # --------------------------------------------------------- # IJulia # ---------------------------------------------------------