Make compatible with InspectDR v0.1.4.

This commit is contained in:
MA Laforge 2017-02-02 20:38:34 -05:00
parent c728bf52b8
commit 3ca39728d8

View File

@ -128,16 +128,17 @@ end
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
function _inspectdr_getscale(s::Symbol) function _inspectdr_getscale(s::Symbol, yaxis::Bool)
#TODO: Support :asinh, :sqrt #TODO: Support :asinh, :sqrt
kwargs = yaxis? (:tgtmajor=>8, :tgtminor=>2): () #More grid lines on y-axis
if :log2 == s if :log2 == s
return InspectDR.AxisScale(:log2) return InspectDR.AxisScale(:log2; kwargs...)
elseif :log10 == s elseif :log10 == s
return InspectDR.AxisScale(:log10) return InspectDR.AxisScale(:log10; kwargs...)
elseif :ln == s elseif :ln == s
return InspectDR.AxisScale(:ln) return InspectDR.AxisScale(:ln; kwargs...)
else #identity else #identity
return InspectDR.AxisScale(:lin) return InspectDR.AxisScale(:lin; kwargs...)
end end
end end
@ -337,14 +338,17 @@ end
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
function _inspectdr_setupsubplot(sp::Subplot{InspectDRBackend}) function _inspectdr_setupsubplot(sp::Subplot{InspectDRBackend})
const gridon = InspectDR.grid(vmajor=true, hmajor=true) const gridon = InspectDR.GridRect(vmajor=true, hmajor=true)
const gridoff = InspectDR.grid() const gridoff = InspectDR.GridRect()
const plot = sp.o const plot = sp.o
const strip = plot.strips[1] #Only 1 strip supported with Plots.jl
#No independent control of grid???
strip.grid = sp[:grid]? gridon: gridoff
xaxis = sp[:xaxis]; yaxis = sp[:yaxis] xaxis = sp[:xaxis]; yaxis = sp[:yaxis]
xscale = _inspectdr_getscale(xaxis[:scale]) plot.xscale = _inspectdr_getscale(xaxis[:scale], false)
yscale = _inspectdr_getscale(yaxis[:scale]) strip.yscale = _inspectdr_getscale(yaxis[:scale], true)
plot.axes = InspectDR.AxesRect(xscale, yscale)
xmin, xmax = axis_limits(xaxis) xmin, xmax = axis_limits(xaxis)
ymin, ymax = axis_limits(yaxis) ymin, ymax = axis_limits(yaxis)
if ispolar(sp) if ispolar(sp)
@ -353,11 +357,13 @@ function _inspectdr_setupsubplot(sp::Subplot{InspectDRBackend})
xmin, xmax = -rmax, rmax xmin, xmax = -rmax, rmax
ymin, ymax = -rmax, rmax ymin, ymax = -rmax, rmax
end end
plot.ext = InspectDR.PExtents2D() #reset plot.xext = InspectDR.PExtents1D() #reset
plot.ext_full = InspectDR.PExtents2D(xmin, xmax, ymin, ymax) strip.yext = InspectDR.PExtents1D() #reset
plot.xext_full = InspectDR.PExtents1D(xmin, xmax)
strip.yext_full = InspectDR.PExtents1D(ymin, ymax)
a = plot.annotation a = plot.annotation
a.title = sp[:title] a.title = sp[:title]
a.xlabel = xaxis[:guide]; a.ylabel = yaxis[:guide] a.xlabel = xaxis[:guide]; a.ylabels = [yaxis[:guide]]
l = plot.layout l = plot.layout
l.frame.fillcolor = _inspectdr_mapcolor(sp[:background_color_subplot]) l.frame.fillcolor = _inspectdr_mapcolor(sp[:background_color_subplot])
@ -376,8 +382,6 @@ function _inspectdr_setupsubplot(sp::Subplot{InspectDRBackend})
_inspectdr_mapptsize(xaxis[:tickfont].pointsize), _inspectdr_mapptsize(xaxis[:tickfont].pointsize),
color = _inspectdr_mapcolor(xaxis[:foreground_color_text]) color = _inspectdr_mapcolor(xaxis[:foreground_color_text])
) )
#No independent control of grid???
l.grid = sp[:grid]? gridon: gridoff
leg = l.legend leg = l.legend
leg.enabled = (sp[:legend] != :none) leg.enabled = (sp[:legend] != :none)
#leg.width = 150 #TODO: compute??? #leg.width = 150 #TODO: compute???