default minpad fix; html_output_format
This commit is contained in:
parent
b5a8186d99
commit
77ec4adcad
@ -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
|
# Set the (left, top, right, bottom) minimum padding around the plot area
|
||||||
# to fit ticks, tick labels, guides, colorbars, etc.
|
# to fit ticks, tick labels, guides, colorbars, etc.
|
||||||
function _update_min_padding!(sp::Subplot)
|
function _update_min_padding!(sp::Subplot)
|
||||||
toppad = 2mm + title_padding(sp)
|
leftpad = 10mm + sp.attr[:left_margin] + guide_padding(sp.attr[:yaxis])
|
||||||
bottompad = 5mm + guide_padding(sp.attr[:xaxis])
|
toppad = 2mm + sp.attr[:top_margin] + title_padding(sp)
|
||||||
leftpad = 10mm + guide_padding(sp.attr[:yaxis])
|
rightpad = 3mm + sp.attr[:right_margin]
|
||||||
@show (leftpad, toppad, 3mm, bottompad)
|
bottompad = 5mm + sp.attr[:bottom_margin] + guide_padding(sp.attr[:xaxis])
|
||||||
sp.minpad = (leftpad, toppad, 3mm, bottompad)
|
@show (leftpad, toppad, rightpad, bottompad)
|
||||||
|
sp.minpad = (leftpad, toppad, rightpad, bottompad)
|
||||||
end
|
end
|
||||||
|
|
||||||
_update_plot_object(plt::Plot) = nothing
|
_update_plot_object(plt::Plot) = nothing
|
||||||
|
|||||||
@ -122,10 +122,10 @@ const _mimeformats = Dict(
|
|||||||
"image/svg+xml" => "svg"
|
"image/svg+xml" => "svg"
|
||||||
)
|
)
|
||||||
|
|
||||||
# a backup for html... passes to svg
|
# # a backup for html... passes to svg
|
||||||
function Base.writemime(io::IO, ::MIME"text/html", plt::Plot)
|
# function Base.writemime(io::IO, ::MIME"text/html", plt::Plot)
|
||||||
writemime(io, MIME("image/svg+xml"), plt)
|
# writemime(io, MIME("image/svg+xml"), plt)
|
||||||
end
|
# end
|
||||||
|
|
||||||
for mime in keys(_mimeformats)
|
for mime in keys(_mimeformats)
|
||||||
@eval function Base.writemime(io::IO, m::MIME{Symbol($mime)}, plt::Plot)
|
@eval function Base.writemime(io::IO, m::MIME{Symbol($mime)}, plt::Plot)
|
||||||
@ -134,6 +134,22 @@ for mime in keys(_mimeformats)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function html_output_format(fmt)
|
||||||
|
if fmt == "png"
|
||||||
|
@eval function Base.writemime(io::IO, ::MIME"text/html", plt::Plot)
|
||||||
|
print(io, "<img src=\"data:image/png;base64,", base64(writemime, MIME("image/png"), plt), "\" />")
|
||||||
|
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
|
# IJulia
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user