dpi support for pyplot

This commit is contained in:
Thomas Breloff 2016-06-27 09:20:42 -04:00
parent 78e0ae31af
commit a3eddf8ba7
3 changed files with 5 additions and 2 deletions

View File

@ -62,6 +62,7 @@ const _arg_desc = KW(
:overwrite_figure => "Bool. Should we reuse the same GUI window/figure when plotting (true) or open a new one (false).", :overwrite_figure => "Bool. Should we reuse the same GUI window/figure when plotting (true) or open a new one (false).",
:html_output_format => "Symbol. When writing html output, what is the format? `:png` and `:svg` are currently supported.", :html_output_format => "Symbol. When writing html output, what is the format? `:png` and `:svg` are currently supported.",
:inset_subplots => "nothing or vector of 2-tuple (parent,bbox). optionally pass a vector of (parent,bbox) tuples which are the parent layout and the relative bounding box of inset subplots", :inset_subplots => "nothing or vector of 2-tuple (parent,bbox). optionally pass a vector of (parent,bbox) tuples which are the parent layout and the relative bounding box of inset subplots",
:dpi => "Number. Dots Per Inch of output figures",
# subplot args # subplot args
:title => "String. Subplot title.", :title => "String. Subplot title.",

View File

@ -216,6 +216,7 @@ const _plot_defaults = KW(
:html_output_format => :auto, :html_output_format => :auto,
:inset_subplots => nothing, # optionally pass a vector of (parent,bbox) tuples which are :inset_subplots => nothing, # optionally pass a vector of (parent,bbox) tuples which are
# the parent layout and the relative bounding box of inset subplots # the parent layout and the relative bounding box of inset subplots
:dpi => DPI, # dots per inch for images, etc
) )

View File

@ -30,6 +30,7 @@ supported_args(::PyPlotBackend) = merge_with_base_supported([
:match_dimensions, :match_dimensions,
:clims, :clims,
:inset_subplots, :inset_subplots,
:dpi,
]) ])
supported_types(::PyPlotBackend) = [ supported_types(::PyPlotBackend) = [
:path, :steppre, :steppost, :shape, :path, :steppre, :steppost, :shape,
@ -1013,7 +1014,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
fig[:clear]() fig[:clear]()
fig[:set_size_inches](px2inch(w), px2inch(h), forward = true) fig[:set_size_inches](px2inch(w), px2inch(h), forward = true)
fig[:set_facecolor](py_color(plt[:background_color_outside])) fig[:set_facecolor](py_color(plt[:background_color_outside]))
fig[:set_dpi](DPI) fig[:set_dpi](plt[:dpi])
# resize the window # resize the window
PyPlot.plt[:get_current_fig_manager]()[:resize](w, h) PyPlot.plt[:get_current_fig_manager]()[:resize](w, h)
@ -1278,7 +1279,7 @@ for (mime, fmt) in _pyplot_mimeformats
# figsize = map(px2inch, plt[:size]), # figsize = map(px2inch, plt[:size]),
facecolor = fig.o["get_facecolor"](), facecolor = fig.o["get_facecolor"](),
edgecolor = "none", edgecolor = "none",
dpi = DPI dpi = plt[:dpi]
) )
end end
end end