diff --git a/src/Gadfly.jl b/src/Gadfly.jl index 9954284db..d07307323 100644 --- a/src/Gadfly.jl +++ b/src/Gadfly.jl @@ -43,7 +43,7 @@ input_aesthetics(::Any) = [] output_aesthetics(::Any) = [] default_scales(::Any) = [] default_statistic(::Any) = Stat.identity() -element_coordinate_type(::Any) = Coord.cartesian +element_coordinate_type(::Any, ::Any) = Coord.cartesian abstract Element @@ -417,8 +417,10 @@ function render_prepare(plot::Plot) # Figure out the coordinates coord = plot.coord + coord_type = typeof(plot.coord) for layer in plot.layers - coord_type = element_coordinate_type(layer.geom) + mapped_aesthetics = Set(keys(layer.mapping)) + coord_type = element_coordinate_type(layer.geom, mapped_aesthetics) if coord === nothing coord = coord_type() elseif typeof(coord) != coord_type @@ -593,12 +595,24 @@ function render_prepare(plot::Plot) push!(guides, Guide.zoomslider()) end - if !in(Guide.XTicks, explicit_guide_types) - push!(guides, Guide.xticks()) - end + if isa(coord, Coord.cartesian) + if !in(Guide.XTicks, explicit_guide_types) + push!(guides, Guide.xticks()) + end + + if !in(Guide.YTicks, explicit_guide_types) + push!(guides, Guide.yticks()) + end - if !in(Guide.YTicks, explicit_guide_types) - push!(guides, Guide.yticks()) + elseif isa(coord, Coord.polar) + + if !in(Guide.RhoTicks, explicit_guide_types) + push!(guides, Guide.rhoticks()) + end + + if !in(Guide.PhiTicks, explicit_guide_types) + push!(guides, Guide.phiticks()) + end end end @@ -781,7 +795,7 @@ function render_prepared(plot::Plot, for layer in plot.layers] compose!(plot_context, - [compose(context(order=layer.order), render(layer.geom, theme, aes, + [compose(context(order=layer.order), render(layer.geom, theme, aes, coord, subplot_aes, subplot_data, scales)) for (layer, aes, subplot_aes, subplot_data, theme) in zip(plot.layers, layer_aess, @@ -792,7 +806,7 @@ function render_prepared(plot::Plot, # V. Guides guide_contexts = Any[] for guide in guides - guide_context = render(guide, plot.theme, plot_aes, dynamic) + guide_context = render(guide, plot.theme, plot_aes, coord, dynamic) if guide_context != nothing append!(guide_contexts, guide_context) end @@ -1024,6 +1038,8 @@ const default_aes_scales = @compat Dict{Symbol, Dict}( :lower_fence => Scale.y_continuous(), :upper_hinge => Scale.y_continuous(), :lower_hinge => Scale.y_continuous(), + :rho => Scale.rho_continuous(), + :phi => Scale.phi_continuous(), :xgroup => Scale.xgroup(), :ygroup => Scale.ygroup(), :color => Scale.color_continuous(), diff --git a/src/aesthetics.jl b/src/aesthetics.jl index e36365c38..a5cba729c 100644 --- a/src/aesthetics.jl +++ b/src/aesthetics.jl @@ -14,6 +14,8 @@ typealias NumericalAesthetic x, @compat(Union{NumericalOrCategoricalAesthetic, Distribution}) y, @compat(Union{NumericalOrCategoricalAesthetic, Distribution}) z, @compat(Union{(@compat Void), Function, Matrix}) + rho, NumericalAesthetic + phi, NumericalAesthetic size, Maybe(Vector{Measure}) shape, CategoricalAesthetic color, Maybe(@compat(Union{AbstractVector{RGBA{Float32}}, @@ -50,8 +52,12 @@ typealias NumericalAesthetic # guides xtick, NumericalAesthetic ytick, NumericalAesthetic + rhotick, NumericalAesthetic + phitick, NumericalAesthetic xgrid, NumericalAesthetic ygrid, NumericalAesthetic + rhogrid, NumericalAesthetic + phigrid, NumericalAesthetic color_key_colors, Maybe(Associative) color_key_title, Maybe(AbstractString) color_key_continuous, Maybe(Bool) @@ -61,25 +67,37 @@ typealias NumericalAesthetic # mark some ticks as initially invisible xtickvisible, Maybe(Vector{Bool}) ytickvisible, Maybe(Vector{Bool}) + rhotickvisible, Maybe(Vector{Bool}) + phitickvisible, Maybe(Vector{Bool}) # scale at which ticks should become visible xtickscale, Maybe(Vector{Float64}) ytickscale, Maybe(Vector{Float64}) + rhotickscale, Maybe(Vector{Float64}) + phitickscale, Maybe(Vector{Float64}) # plot viewport extents xviewmin, Any xviewmax, Any yviewmin, Any yviewmax, Any + rhoviewmin, Any + rhoviewmax, Any + phiviewmin, Any + phiviewmax, Any # labeling functions - x_label, Function, showoff - y_label, Function, showoff - xtick_label, Function, showoff - ytick_label, Function, showoff - color_label, Function, showoff - xgroup_label, Function, showoff - ygroup_label, Function, showoff + x_label, Function, showoff + y_label, Function, showoff + rho_label, Function, showoff + phi_label, Function, showoff + xtick_label, Function, showoff + ytick_label, Function, showoff + rhotick_label, Function, showoff + phitick_label, Function, showoff + color_label, Function, showoff + xgroup_label, Function, showoff + ygroup_label, Function, showoff # pseudo-aesthetics pad_categorical_x, Nullable{Bool}, Nullable{Bool}() @@ -103,6 +121,9 @@ end # Alternate aesthetic names const aesthetic_aliases = @compat Dict{Symbol, Symbol}(:colour => :color, + :r => :rho, + :ρ => :rho, + :ϕ => :phi, :x_min => :xmin, :x_max => :xmax, :y_min => :ymin, diff --git a/src/coord.jl b/src/coord.jl index 5953d778d..11adcfaba 100644 --- a/src/coord.jl +++ b/src/coord.jl @@ -8,56 +8,14 @@ using DataArrays import Gadfly.Maybe import Iterators: cycle -export cartesian - -# Cartesian coordinates with position given by the x and y (and similar) -# aesthetics. -# -# Args: -# xvars: Aesthetics to consider when choosing x bounds. -# yvars: Aesthetics to consider when choosing y bounds. -# xmin, xmax, ymin, ymax: -# Force a particular x or y bound, rather than trying to choose it -# from the data. -# -# -immutable Cartesian <: Gadfly.CoordinateElement - xvars::Vector{Symbol} - yvars::Vector{Symbol} - xmin - xmax - ymin - ymax - xflip::Bool - yflip::Bool - fixed::Bool - aspect_ratio::@compat(Union{(@compat Void), Float64}) - raster::Bool - - function Cartesian( - xvars=[:x, :xmin, :xmax, :xintercept], - yvars=[:y, :ymin, :ymax, :yintercept, :middle, - :lower_hinge, :upper_hinge, :lower_fence, :upper_fence, :outliers]; - xflip::Bool=false, yflip::Bool=false, - xmin=nothing, xmax=nothing, ymin=nothing, ymax=nothing, - fixed=false, aspect_ratio=nothing, raster=false) - if isa(aspect_ratio, Real) - aspect_ratio = convert(Float64, aspect_ratio) - end - new(xvars, yvars, xmin, xmax, ymin, ymax, xflip, yflip, fixed, - aspect_ratio, raster) - end -end - - -const cartesian = Cartesian +export cartesian, polar # Return the first concrete aesthetic value in one of the given aesthetics # # Args: # aess: An array of Aesthetics to search through. -# vars: Aesthetic variables to search though. +# vars: Aesthetic variables to search through. # # Returns: # A concrete value if one is found, otherwise nothing. @@ -131,6 +89,52 @@ function aesthetics_type(aess::Vector{Gadfly.Aesthetics}, end +# Cartesian +# --------- + +# Cartesian coordinates with position given by the x and y (and similar) +# aesthetics. +# +# Args: +# xvars: Aesthetics to consider when choosing x bounds. +# yvars: Aesthetics to consider when choosing y bounds. +# xmin, xmax, ymin, ymax: +# Force a particular x or y bound, rather than trying to choose it +# from the data. +# +# +immutable Cartesian <: Gadfly.CoordinateElement + xvars::Vector{Symbol} + yvars::Vector{Symbol} + xmin + xmax + ymin + ymax + xflip::Bool + yflip::Bool + fixed::Bool + aspect_ratio::@compat(Union{(@compat Void), Float64}) + raster::Bool + + function Cartesian( + xvars=[:x, :xmin, :xmax, :xintercept], + yvars=[:y, :ymin, :ymax, :yintercept, :middle, + :lower_hinge, :upper_hinge, :lower_fence, :upper_fence, :outliers]; + xflip::Bool=false, yflip::Bool=false, + xmin=nothing, xmax=nothing, ymin=nothing, ymax=nothing, + fixed=false, aspect_ratio=nothing, raster=false) + if isa(aspect_ratio, Real) + aspect_ratio = convert(Float64, aspect_ratio) + end + new(xvars, yvars, xmin, xmax, ymin, ymax, xflip, yflip, fixed, + aspect_ratio, raster) + end +end + + +const cartesian = Cartesian + + # Produce a context with suitable cartesian coordinates. # # Args: @@ -279,6 +283,194 @@ function apply_coordinate(coord::Cartesian, aess::Vector{Gadfly.Aesthetics}, end +# Polar +# ----- + +# Polar coordinates with position given by the r and theta aesthetics. +# +# Args: +# rhovars: Radial aesthetics to consider when choosing bounds. +# phivars: Angular aesthetics to consider when choosing bounds. +# xmin, xmax, ymin, ymax: +# Force a particular x or y bound, rather than trying to choose it +# from the data. +# +# +immutable Polar <: Gadfly.CoordinateElement + rhovars::Vector{Symbol} + phivars::Vector{Symbol} + xmin + xmax + ymin + ymax + xflip::Bool + yflip::Bool + fixed::Bool + aspect_ratio::@compat(Union{(@compat Void), Float64}) + raster::Bool + + function Polar( + rhovars=[:rho], + phivars=[:phi]; + xflip::Bool=false, yflip::Bool=false, + xmin=nothing, xmax=nothing, ymin=nothing, ymax=nothing, + fixed=false, aspect_ratio=nothing, raster=false) + if isa(aspect_ratio, Real) + aspect_ratio = convert(Float64, aspect_ratio) + end + new(rhovars, phivars, xmin, xmax, ymin, ymax, xflip, yflip, fixed, + aspect_ratio, raster) + end +end + + +const polar = Polar + + +cartesian_to_polar(x, y) = (hypot(x, y), atan2(y, x)) +polar_to_cartesian(ρ, ϕ) = (ρ * cos(ϕ), ρ * sin(ϕ)) + + +# Produce a context with suitable polar coordinates. +# +# Args: +# coord: polar coordinate instance. +# +# Returns: +# A compose Canvas. +# +function apply_coordinate(coord::Polar, aess::Vector{Gadfly.Aesthetics}, + scales::Dict{Symbol, Gadfly.ScaleElement}) + pad_categorical_x = Nullable{Bool}() + pad_categorical_y = Nullable{Bool}() + for aes in aess + if !isnull(aes.pad_categorical_x) + if isnull(pad_categorical_x) + pad_categorical_x = aes.pad_categorical_x + else + pad_categorical_x = Nullable(get(pad_categorical_x) || get(aes.pad_categorical_x)) + end + end + if !isnull(aes.pad_categorical_y) + if isnull(pad_categorical_y) + pad_categorical_y = aes.pad_categorical_y + else + pad_categorical_y = Nullable(get(pad_categorical_y) || get(aes.pad_categorical_y)) + end + end + end + + xmin = xmax = ymin = ymax = nothing + rhomin = rhomax = first_concrete_aesthetic_value(aess, coord.rhovars) + phimin = phimax = first_concrete_aesthetic_value(aess, coord.phivars) + + if rhomin != nothing && phimin != nothing + xmin, ymin = polar_to_cartesian(rhomin, phimin) + xmax, ymax = polar_to_cartesian(rhomax, phimax) + for rhovar in coord.rhovars, phivar in coord.phivars + for aes in aess + rhovals = getfield(aes, rhovar) + phivals = getfield(aes, phivar) + if rhovals === nothing || phivals === nothing + continue + end + + if !isa(rhovals, AbstractArray) + rhovals = [rhovals] + end + if !isa(phivals, AbstractArray) + phivals = [phivals] + end + + if length(rhovals) != length(phivals) + error("Radial and angular aesthetics must have the same length.") + end + + xvals = [ρ * cos(ϕ) for (ρ, ϕ) in zip(rhovals, phivals)] + yvals = [ρ * sin(ϕ) for (ρ, ϕ) in zip(rhovals, phivals)] + + xmin, xmax = Gadfly.concrete_minmax(xvals, xmin, xmax) + ymin, ymax = Gadfly.concrete_minmax(yvals, ymin, ymax) + end + end + end + + xviewmin = xviewmax = yviewmin = yviewmax = nothing + + # viewmin/max that is set explicitly should override min/max + for aes in aess + if aes.xviewmin != nothing + xviewmin = xviewmin === nothing ? aes.xviewmin : min(xviewmin, aes.xviewmin) + end + + if aes.xviewmax != nothing + xviewmax = xviewmax === nothing ? aes.xviewmax : max(xviewmax, aes.xviewmax) + end + + if aes.yviewmin != nothing + yviewmin = yviewmin === nothing ? aes.yviewmin : min(yviewmin, aes.yviewmin) + end + + if aes.yviewmax != nothing + yviewmax = yviewmax === nothing ? aes.yviewmax : max(yviewmax, aes.yviewmax) + end + end + + xmax = xviewmax === nothing ? xmax : max(xmax, xviewmax) + xmin = xviewmin === nothing ? xmin : min(xmin, xviewmin) + ymax = yviewmax === nothing ? ymax : max(ymax, yviewmax) + ymin = yviewmin === nothing ? ymin : min(ymin, yviewmin) + + # Hard limits set in Coord should override everything else + xmin = coord.xmin === nothing ? xmin : coord.xmin + xmax = coord.xmax === nothing ? xmax : coord.xmax + ymin = coord.ymin === nothing ? ymin : coord.ymin + ymax = coord.ymax === nothing ? ymax : coord.ymax + + if xmin === nothing || !isfinite(xmin) + xmin = 0.0 + xmax = 1.0 + end + + if ymin === nothing || !isfinite(ymin) + ymin = 0.0 + ymax = 1.0 + end + + xpadding = Scale.iscategorical(scales, :x) ? 0mm : 2mm + ypadding = Scale.iscategorical(scales, :y) ? 0mm : 2mm + + if Scale.iscategorical(scales, :x) && (isnull(pad_categorical_x) || get(pad_categorical_x)) + xmin -= 0.5 + xmax += 0.5 + end + + if Scale.iscategorical(scales, :y) && (isnull(pad_categorical_y) || get(pad_categorical_y)) + ymin -= 0.5 + ymax += 0.5 + end + + width = xmax - xmin + height = ymax - ymin + + compose!( + context(units=UnitBox( + coord.xflip ? xmax : xmin, + coord.yflip ? ymin : ymax, + coord.xflip ? -width : width, + coord.yflip ? height : -height, + leftpad=xpadding, + rightpad=xpadding, + toppad=ypadding, + bottompad=ypadding), + raster=coord.raster), + svgclass("plotpanel")) +end + + +# Subplot Grid +# ------------ + immutable SubplotGrid <: Gadfly.CoordinateElement end diff --git a/src/data.jl b/src/data.jl index c00e5852b..eaeb17826 100644 --- a/src/data.jl +++ b/src/data.jl @@ -5,6 +5,8 @@ x y z + rho + phi xmin xmax ymin diff --git a/src/geom/bar.jl b/src/geom/bar.jl index 2c82dc491..d7e51f700 100644 --- a/src/geom/bar.jl +++ b/src/geom/bar.jl @@ -269,7 +269,8 @@ end # Returns # A compose form. # -function render(geom::BarGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::BarGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) if geom.orientation == :horizontal Gadfly.assert_aesthetics_defined("BarGeometry", aes, :ymin, :ymax, :x) Gadfly.assert_aesthetics_equal_length("BarGeometry", aes, :ymin, :ymax, :x) diff --git a/src/geom/beeswarm.jl b/src/geom/beeswarm.jl index 7a0850560..de1b8985e 100644 --- a/src/geom/beeswarm.jl +++ b/src/geom/beeswarm.jl @@ -22,7 +22,8 @@ function element_aesthetics(geom::BeeswarmGeometry) end -function render(geom::BeeswarmGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::BeeswarmGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) Gadfly.assert_aesthetics_defined("Geom.point", aes, :x, :y) Gadfly.assert_aesthetics_equal_length("Geom.point", aes, element_aesthetics(geom)...) diff --git a/src/geom/boxplot.jl b/src/geom/boxplot.jl index 1dacd08b1..37c20d3a9 100644 --- a/src/geom/boxplot.jl +++ b/src/geom/boxplot.jl @@ -17,7 +17,8 @@ element_aesthetics(::BoxplotGeometry) = [:x, :y, :color, default_statistic(::BoxplotGeometry) = Gadfly.Stat.boxplot() -function render(geom::BoxplotGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::BoxplotGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) Gadfly.assert_aesthetics_defined("Geom.bar", aes, :lower_fence, :lower_hinge, :upper_hinge, :upper_fence,) diff --git a/src/geom/errorbar.jl b/src/geom/errorbar.jl index 6a6f818c7..27468abd2 100644 --- a/src/geom/errorbar.jl +++ b/src/geom/errorbar.jl @@ -51,7 +51,8 @@ end # Returns: # A compose Form. # -function render(geom::ErrorBarGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::ErrorBarGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) # check for X and Y error bar aesthetics if isempty(Gadfly.undefined_aesthetics(aes, element_aesthetics(xerrorbar())...)) xctx = render(xerrorbar(), theme, aes) diff --git a/src/geom/hexbin.jl b/src/geom/hexbin.jl index b5a15706e..94d4cb743 100644 --- a/src/geom/hexbin.jl +++ b/src/geom/hexbin.jl @@ -30,7 +30,8 @@ function element_aesthetics(geom::HexagonalBinGeometry) end -function render(geom::HexagonalBinGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::HexagonalBinGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) default_aes = Gadfly.Aesthetics() default_aes.color = PooledDataArray(RGB{Float32}[theme.default_color]) default_aes.xsize = [1.0] diff --git a/src/geom/hline.jl b/src/geom/hline.jl index c066815ff..0f251d2c0 100644 --- a/src/geom/hline.jl +++ b/src/geom/hline.jl @@ -21,7 +21,8 @@ end # Generate a form for the hline geometry -function render(geom::HLineGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::HLineGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) Gadfly.assert_aesthetics_defined("Geom.hline", aes, :yintercept) color = geom.color === nothing ? theme.default_color : geom.color diff --git a/src/geom/label.jl b/src/geom/label.jl index aaa8c5691..ccb894180 100644 --- a/src/geom/label.jl +++ b/src/geom/label.jl @@ -268,7 +268,8 @@ const label_layouts = @compat Dict( ) -function render(geom::LabelGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::LabelGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) Gadfly.assert_aesthetics_defined("Geom.Label", aes, :label, :x, :y) if geom.position == :dynamic diff --git a/src/geom/line.jl b/src/geom/line.jl index cd7d7b14f..e67868d16 100644 --- a/src/geom/line.jl +++ b/src/geom/line.jl @@ -68,7 +68,8 @@ end # Returns: # A compose Form. # -function render(geom::LineGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::LineGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) Gadfly.assert_aesthetics_defined("Geom.line", aes, :x, :y) Gadfly.assert_aesthetics_equal_length("Geom.line", aes, element_aesthetics(geom)...) diff --git a/src/geom/point.jl b/src/geom/point.jl index 1da14a3e5..ea67cead1 100644 --- a/src/geom/point.jl +++ b/src/geom/point.jl @@ -13,21 +13,36 @@ const point = PointGeometry function element_aesthetics(::PointGeometry) - [:x, :y, :size, :color, :shape] + [:x, :y, :size, :color, :shape, :rho, :phi] end -# Generate a form for a point geometry. +function element_coordinate_type(::PointGeometry, mapped_aesthetics) + cartesian = :x in mapped_aesthetics && :y in mapped_aesthetics + polar = :rho in mapped_aesthetics && :phi in mapped_aesthetics + if cartesian && !polar + return Coord.cartesian + end + if polar && ! cartesian + return Coord.polar + end + error("Aesthetics (x, y) and (rho, phi) cannot be mixed.") +end + + +# Generate a form for a point geometry in cartesian coordinates. # # Args: # geom: point geometry. # theme: the plot's theme. # aes: aesthetics. +# coord: coordinates. # # Returns: # A compose Form. # -function render(geom::PointGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::PointGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) Gadfly.assert_aesthetics_defined("Geom.point", aes, :x, :y) Gadfly.assert_aesthetics_equal_length("Geom.point", aes, element_aesthetics(geom)...) @@ -92,3 +107,85 @@ function render(geom::PointGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics return compose!(context(order=4), svgclass("geometry"), ctx) end + + +# Generate a form for a point geometry in polar coordinates. +# +# Args: +# geom: point geometry. +# theme: the plot's theme. +# aes: aesthetics. +# coord: coordinates. +# +# Returns: +# A compose Form. +# +function render(geom::PointGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.polar) + Gadfly.assert_aesthetics_defined("Geom.point", aes, :rho, :phi) + Gadfly.assert_aesthetics_equal_length("Geom.point", aes, + element_aesthetics(geom)...) + + default_aes = Gadfly.Aesthetics() + default_aes.color = PooledDataArray(RGBA{Float32}[theme.default_color]) + default_aes.size = Measure[theme.default_point_size] + aes = inherit(aes, default_aes) + + lw_hover_scale = 10 + lw_ratio = theme.line_width / aes.size[1] + + aes_rho, aes_phi = concretize(aes.rho, aes.phi) + + ctx = context() + if aes.shape != nothing + xs = Array(eltype(aes_rho), 0) + ys = Array(eltype(aes_rho), 0) + cs = Array(eltype(aes.color), 0) + size = Array(eltype(aes.size), 0) + shape_max = maximum(aes.shape) + if shape_max > length(theme.shapes) + error("Too many values for the shape aesthetic. Define more shapes in Theme.shapes") + end + + for shape in 1:maximum(aes.shape) + for (ρ, ϕ, c, sz, sh) in Compose.cyclezip(aes.rho, aes.phi, aes.color, + aes.size, aes.shape) + if sh == shape + x, y = polar_to_cartesian(ρ, ϕ) + push!(xs, x) + push!(ys, y) + push!(cs, c) + push!(size, sz) + end + end + compose!(ctx, (context(), theme.shapes[shape](xs, ys, size), fill(cs))) + empty!(xs) + empty!(ys) + empty!(cs) + empty!(size) + end + else + compose!(ctx, + circle([ρ * cos(ϕ) for (ρ, ϕ) in zip(aes.rho, aes.phi)], + [ρ * sin(ϕ) for (ρ, ϕ) in zip(aes.rho, aes.phi)], + aes.size, geom.tag), + fill(aes.color)) + end + compose!(ctx, linewidth(theme.highlight_width)) + + if aes.color_key_continuous != nothing && aes.color_key_continuous + compose!(ctx, + stroke(map(theme.continuous_highlight_color, aes.color))) + else + stroke_colors = + Gadfly.pooled_map(RGBA{Float32}, theme.discrete_highlight_color, aes.color) + classes = + Gadfly.pooled_map(ASCIIString, + c -> svg_color_class_from_label(escape_id(aes.color_label([c])[1])), + aes.color) + + compose!(ctx, stroke(stroke_colors), svgclass(classes)) + end + + return compose!(context(order=4), svgclass("geometry"), ctx) +end diff --git a/src/geom/polygon.jl b/src/geom/polygon.jl index c78ab854c..8af371146 100644 --- a/src/geom/polygon.jl +++ b/src/geom/polygon.jl @@ -36,7 +36,7 @@ end # Render polygon geometry. function render(geom::PolygonGeometry, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics) + aes::Gadfly.Aesthetics, coord::Coord.cartesian) Gadfly.assert_aesthetics_defined("Geom.polygon", aes, :x, :y) default_aes = Gadfly.Aesthetics() diff --git a/src/geom/rectbin.jl b/src/geom/rectbin.jl index a52779206..d4e4d971e 100644 --- a/src/geom/rectbin.jl +++ b/src/geom/rectbin.jl @@ -46,7 +46,8 @@ end # Returns # A compose form. # -function render(geom::RectangularBinGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::RectangularBinGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) default_aes = Gadfly.Aesthetics() default_aes.color = PooledDataArray(RGB{Float32}[theme.default_color]) diff --git a/src/geom/ribbon.jl b/src/geom/ribbon.jl index 4576fbd1f..f7c64cdf5 100644 --- a/src/geom/ribbon.jl +++ b/src/geom/ribbon.jl @@ -22,7 +22,8 @@ function element_aesthetics(::RibbonGeometry) end -function render(geom::RibbonGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::RibbonGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) Gadfly.assert_aesthetics_defined("Geom.ribbon", aes, :x, :ymin, :ymax) Gadfly.assert_aesthetics_equal_length("Geom.ribbon", aes, element_aesthetics(geom)...) diff --git a/src/geom/subplot.jl b/src/geom/subplot.jl index 8114fd463..51be11702 100644 --- a/src/geom/subplot.jl +++ b/src/geom/subplot.jl @@ -129,7 +129,7 @@ function default_scales(geom::SubplotGrid) end -function element_coordinate_type(::SubplotGrid) +function element_coordinate_type(::SubplotGrid, ::Any) return Gadfly.Coord.subplot_grid end diff --git a/src/geom/violin.jl b/src/geom/violin.jl index 80c0cf712..d0a254922 100644 --- a/src/geom/violin.jl +++ b/src/geom/violin.jl @@ -16,7 +16,8 @@ element_aesthetics(::ViolinGeometry) = [:x, :y, :color] default_statistic(::ViolinGeometry) = Gadfly.Stat.violin() -function render(geom::ViolinGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::ViolinGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) # TODO: What should we do with the color aesthetic? Gadfly.assert_aesthetics_defined("Geom.violin", aes, :y, :width) diff --git a/src/geom/vline.jl b/src/geom/vline.jl index 7ee0a4abb..fe9a66b3b 100644 --- a/src/geom/vline.jl +++ b/src/geom/vline.jl @@ -20,7 +20,8 @@ end # Generate a form for the vline geometry -function render(geom::VLineGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(geom::VLineGeometry, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.cartesian) Gadfly.assert_aesthetics_defined("Geom.vline", aes, :xintercept) color = geom.color === nothing ? theme.default_color : geom.color diff --git a/src/geometry.jl b/src/geometry.jl index 915b4182f..3a55fbdfa 100644 --- a/src/geometry.jl +++ b/src/geometry.jl @@ -34,6 +34,7 @@ end const nil = Nil function render(geom::Nil, theme::Gadfly.Theme, aes::Gadfly.Aesthetics, + coord::Gadfly.CoordinateElement, data::Gadfly.Data, scales::Dict{Symbol, ScaleElement}, subplot_layer_aess::Vector{Gadfly.Aesthetics}) end @@ -41,11 +42,12 @@ end # Subplot geometries require some more arguments to render. A simpler render # function is defined and passed through to here for non-subplot geometries. -function render(geom::Gadfly.GeometryElement, theme::Gadfly.Theme, aes::Gadfly.Aesthetics, +function render(geom::Gadfly.GeometryElement, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement, subplot_layer_aess::@compat(Union{(@compat Void), Vector{Gadfly.Aesthetics}}), subplot_layer_datas::@compat(Union{(@compat Void), Vector{Gadfly.Data}}), scales::Dict{Symbol, ScaleElement}) - render(geom, theme, aes) + render(geom, theme, aes, coord) end diff --git a/src/guide.jl b/src/guide.jl index 3bcba1d50..d93a2c2d1 100644 --- a/src/guide.jl +++ b/src/guide.jl @@ -46,12 +46,13 @@ end const background = PanelBackground function render(guide::Gadfly.GuideElement, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics, dynamic::Bool=true) - render(guide, theme, aes) + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement, + dynamic::Bool=true) + render(guide, theme, aes, coord) end function render(guide::PanelBackground, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics) + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement) back = compose!(context(order=-1), rectangle(), svgclass("guide background"), @@ -71,7 +72,7 @@ const zoomslider = ZoomSlider function render(guide::ZoomSlider, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics) + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement) edge_pad = 3mm slide_pad = 0.5mm @@ -399,7 +400,7 @@ end function render(guide::ColorKey, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics) + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement) if theme.key_position == :none return PositionedGuide[] @@ -502,7 +503,7 @@ const manual_color_key = ManualColorKey function render(guide::ManualColorKey, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics) + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement) if theme.key_position == :none return PositionedGuide[] end @@ -569,7 +570,8 @@ end function render(guide::XTicks, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics, dynamic::Bool=true) + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement, + dynamic::Bool=true) if guide.ticks == nothing return PositionedGuide[] end @@ -712,7 +714,7 @@ function render(guide::XTicks, theme::Gadfly.Theme, elseif guide.orientation == :auto contexts = [hlayout_context, vlayout_context] else - error("$(guide.layout) is not a valid orientation for Guide.yticks") + error("$(guide.layout) is not a valid orientation for Guide.xticks") end return [PositionedGuide(contexts, 10, @@ -750,7 +752,8 @@ end function render(guide::YTicks, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics, dynamic::Bool=true) + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement, + dynamic::Bool=true) if guide.ticks == nothing return PositionedGuide[] end @@ -903,6 +906,372 @@ function render(guide::YTicks, theme::Gadfly.Theme, end +immutable RhoTicks <: Gadfly.GuideElement + label::Bool + ticks::@compat(Union{(@compat Void), Symbol, AbstractArray}) + orientation::Symbol + + function RhoTicks(; label::Bool=true, + ticks::@compat(Union{(@compat Void), Symbol, AbstractArray})=:auto, + orientation::Symbol=:auto) + if isa(ticks, Symbol) && ticks != :auto + error("$(ticks) is not a valid value for the `ticks` parameter") + end + return new(label, ticks, orientation) + end +end + +const rhoticks = RhoTicks + + +function default_statistic(guide::RhoTicks) + if guide.ticks == nothing + return Stat.identity() + else + return Stat.rhoticks(ticks=guide.ticks) + end +end + + +function render(guide::RhoTicks, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.polar, + dynamic::Bool=true) + if guide.ticks == nothing + return PositionedGuide[] + end + + if Gadfly.issomething(aes.rhotick) + ticks = aes.rhotick + tickvisibility = aes.rhotickvisible + scale = aes.rhotickscale + + T = eltype(aes.rhotick) + labels = AbstractString[] + for scale_ticks in groupby(x -> x[1], zip(scale, ticks)) + append!(labels, aes.rhotick_label(T[t for (s, t) in scale_ticks])) + end + else + labels = AbstractString[] + ticks = Any[] + tickvisibility = Bool[] + scale = Any[] + end + + if Gadfly.issomething(aes.rhogrid) + grids = aes.rhogrid + if length(grids) < length(ticks) + gridvisibility = tickvisibility[2:end] + else + gridvisibility = tickvisibility + end + else + grids = Any[] + gridvisibility = Bool[] + end + + if sum(gridvisibility) == 0 && sum(tickvisibility) == 0 + return PositionedGuide[] + end + + # grid lines (ellipses) + static_grid_lines = compose!( + context(withoutjs=true), + circle([0], [0], grids[gridvisibility]), + stroke(theme.grid_color), + fill(nothing), + linewidth(theme.grid_line_width), + strokedash(theme.grid_strokedash), + svgclass("guide xgridlines yfixed")) + + if dynamic + dynamic_grid_lines = compose!( + context(withjs=true), + circle([0], [0], grids), + fill(nothing), + visible(gridvisibility), + stroke(theme.grid_color), + linewidth(theme.grid_line_width), + strokedash(theme.grid_strokedash), + svgclass("guide xgridlines yfixed"), + svgattribute("gadfly:scale", scale), + jsplotdata("focused_xgrid_color", + "\"#$(hex(theme.grid_color_focused))\""), + jsplotdata("unfocused_xgrid_color", + "\"#$(hex(theme.grid_color))\"")) + grid_lines = compose!(context(), static_grid_lines, dynamic_grid_lines) + else + grid_lines = compose!(context(), static_grid_lines) + end + + if !guide.label + return [PositionedGuide([grid_lines], 0, under_guide_position)] + end + + label_sizes = text_extents(theme.minor_label_font, + theme.minor_label_font_size, + labels...) + label_widths = [width for (width, height) in label_sizes] + label_heights = [height for (width, height) in label_sizes] + + padding = 1mm + + hlayout = ctxpromise() do draw_context + static_labels = compose!( + context(withoutjs=true), + text(ticks[tickvisibility], [0h + padding], labels[tickvisibility], + [hcenter], [vtop]), + fill(theme.minor_label_color), + font(theme.minor_label_font), + fontsize(theme.minor_label_font_size), + svgclass("guide xlabels")) + + dynamic_labels = compose!( + context(withjs=true), + text(ticks, [1h - padding], labels, [hcenter], [vbottom]), + visible(tickvisibility), + fill(theme.minor_label_color), + font(theme.minor_label_font), + fontsize(theme.minor_label_font_size), + svgattribute("gadfly:scale", scale), + svgclass("guide xlabels")) + + return compose!(context(), static_labels, dynamic_labels) + end + hlayout_context = compose!(context(minwidth=sum(label_widths[tickvisibility]), + minheight=2*padding + maximum(label_heights[tickvisibility])), + hlayout) + + vlayout = ctxpromise() do draw_context + static_labels = compose!( + context(withoutjs=true), + text(ticks[tickvisibility], + [padding], + labels[tickvisibility], + [hright], [vcenter], + [Rotation(-0.5pi, tick, padding) for tick in ticks[tickvisibility]]), + fill(theme.minor_label_color), + font(theme.minor_label_font), + fontsize(theme.minor_label_font_size), + svgclass("guide xlabels")) + + dynamic_labels = compose!( + context(withjs=true), + text(ticks, [padding], labels, [hright], [vbottom], + [Rotation(-0.5pi, tick, padding) for tick in ticks]), + visible(tickvisibility), + fill(theme.minor_label_color), + font(theme.minor_label_font), + fontsize(theme.minor_label_font_size), + svgattribute("gadfly:scale", scale), + svgclass("guide xlabels")) + + return compose!(context(), static_labels, dynamic_labels) + + end + vpenalty = 3 + vlayout_context = compose!(context(minwidth=sum(label_heights[tickvisibility]), + minheight=2padding + maximum(label_widths[tickvisibility]), + penalty=vpenalty), vlayout) + + if guide.orientation == :horizontal + contexts = [hlayout_context] + elseif guide.orientation == :vertical + contexts = [vlayout_context] + elseif guide.orientation == :auto + contexts = [hlayout_context, vlayout_context] + else + error("$(guide.layout) is not a valid orientation for Guide.rhoticks") + end + + return [PositionedGuide(contexts, 10, + bottom_guide_position), + PositionedGuide([grid_lines], 0, under_guide_position)] +end + + +immutable PhiTicks <: Gadfly.GuideElement + label::Bool + ticks::@compat(Union{(@compat Void), Symbol, AbstractArray}) + orientation::Symbol + + function PhiTicks(; label::Bool=true, + ticks::@compat(Union{(@compat Void), Symbol, AbstractArray})=:auto, + orientation::Symbol=:auto) + if isa(ticks, Symbol) && ticks != :auto + error("$(ticks) is not a valid value for the `ticks` parameter") + end + return new(label, ticks, orientation) + end +end + +const phiticks = PhiTicks + + +function default_statistic(guide::PhiTicks) + if guide.ticks == nothing + return Stat.identity() + else + return Stat.rhoticks(ticks=guide.ticks) + end +end + + +function render(guide::PhiTicks, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Coord.polar, + dynamic::Bool=true) + if guide.ticks == nothing + return PositionedGuide[] + end + + if Gadfly.issomething(aes.phitick) + ticks = aes.phitick + tickvisibility = aes.phitickvisible + scale = aes.phitickscale + + T = eltype(aes.phitick) + labels = AbstractString[] + for scale_ticks in groupby(x -> x[1], zip(scale, ticks)) + append!(labels, aes.phitick_label(T[t for (s, t) in scale_ticks])) + end + else + labels = AbstractString[] + ticks = Any[] + tickvisibility = Bool[] + scale = Any[] + end + + if Gadfly.issomething(aes.phigrid) + grids = aes.phigrid + if length(grids) < length(ticks) + gridvisibility = tickvisibility[2:end] + else + gridvisibility = tickvisibility + end + else + grids = Any[] + gridvisibility = Bool[] + end + + if sum(gridvisibility) == 0 && sum(tickvisibility) == 0 + return PositionedGuide[] + end + + # grid lines + static_grid_lines = compose!( + context(withoutjs=true), + line([[(0, 0), (cos(t), sin(t))] for t in grids[gridvisibility]]), + stroke(theme.grid_color), + linewidth(theme.grid_line_width), + strokedash(theme.grid_strokedash), + svgclass("guide ygridlines xfixed")) + + if dynamic + dynamic_grid_lines = compose!( + context(withjs=true), + line([[(0, 0), (cos(t), sin(t))] for t in grids]), + visible(gridvisibility), + stroke(theme.grid_color), + linewidth(theme.grid_line_width), + strokedash(theme.grid_strokedash), + svgclass("guide ygridlines xfixed"), + svgattribute("gadfly:scale", scale), + jsplotdata("focused_ygrid_color", + "\"#$( hex(theme.grid_color_focused))\""), + jsplotdata("unfocused_ygrid_color", + "\"#$(hex(theme.grid_color))\"")) + grid_lines = compose!(context(), static_grid_lines, dynamic_grid_lines) + else + grid_lines = compose!(context(), static_grid_lines) + end + + if !guide.label + return [PositionedGuide([grid_lines], 0, under_guide_position)] + end + + label_sizes = text_extents(theme.minor_label_font, + theme.minor_label_font_size, + labels...) + label_widths = [width for (width, height) in label_sizes] + label_heights = [height for (width, height) in label_sizes] + padding = 1mm + + hlayout = ctxpromise() do draw_context + static_labels = compose!( + context(withoutjs=true), + text([1.0w - padding], ticks[tickvisibility], labels[tickvisibility], + [hright], [vcenter]), + fill(theme.minor_label_color), + font(theme.minor_label_font), + fontsize(theme.minor_label_font_size), + svgclass("guide ylabels")) + + dynamic_labels = compose!( + context(withjs=true), + text([1.0w - padding], ticks, labels, + [hright], [vcenter]), + visible(tickvisibility), + fill(theme.minor_label_color), + font(theme.minor_label_font), + fontsize(theme.minor_label_font_size), + svgattribute("gadfly:scale", scale), + svgclass("guide ylabels")) + + return compose!(context(), static_labels, dynamic_labels) + end + hpenalty = 3 + hlayout_context = + compose!(context(minwidth=maximum(label_widths[tickvisibility]) + 2padding, + minheight=sum(label_heights[tickvisibility]), + penalty=hpenalty), hlayout) + + vlayout = ctxpromise() do draw_context + static_grid_lines = compose!( + context(), + text([1.0w - padding], ticks[tickvisibility], labels[tickvisibility], + [hcenter], [vbottom], + [Rotation(-0.5pi, (1.0w - padding, tick)) + for tick in ticks[tickvisibility]]), + fill(theme.minor_label_color), + font(theme.minor_label_font), + fontsize(theme.minor_label_font_size), + svgclass("guide ylabels")) + + dynamic_grid_lines = compose!( + context(), + text([1.0w - padding], ticks, labels, + [hcenter], [vbottom], + [Rotation(-0.5pi, (1.0w - padding, tick)) + for tick in ticks[tickvisibility]]), + visible(tickvisibility), + fill(theme.minor_label_color), + font(theme.minor_label_font), + fontsize(theme.minor_label_font_size), + svgattribute("gadfly:scale", scale), + svgclass("guide ylabels")) + + return compose!(context(), static_grid_lines, dynamic_grid_lines) + end + vlayout_context = + compose!(context(minwidth=maximum(label_heights[tickvisibility]), + minheight=sum(label_widths[tickvisibility])), + vlayout) + + if guide.orientation == :horizontal + contexts = [hlayout_context] + elseif guide.orientation == :vertical + contexts = [vlayout_context] + elseif guide.orientation == :auto + contexts = [hlayout_context, vlayout_context] + else + error("$(guide.layout) is not a valid orientation for Guide.phiticks") + end + + return [PositionedGuide(contexts, 10, + left_guide_position), + PositionedGuide([grid_lines], 0, under_guide_position)] +end + + # X-axis label Guide immutable XLabel <: Gadfly.GuideElement label::@compat(Union{(@compat Void), AbstractString}) @@ -917,7 +1286,7 @@ const xlabel = XLabel function render(guide::XLabel, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics) + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement) if guide.label === nothing || isempty(guide.label) return nothing end @@ -981,7 +1350,8 @@ end const ylabel = YLabel -function render(guide::YLabel, theme::Gadfly.Theme, aes::Gadfly.Aesthetics) +function render(guide::YLabel, theme::Gadfly.Theme, + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement) if guide.label === nothing || isempty(guide.label) return nothing end @@ -1034,7 +1404,7 @@ end const title = Title function render(guide::Title, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics) + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement) if guide.label === nothing || isempty(guide.label) return nothing end @@ -1063,7 +1433,7 @@ const xrug = XRug function render(guide::XRug, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics) + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement) Gadfly.assert_aesthetics_defined("Guide.xrug", aes, :x) padding = 0.4mm @@ -1085,7 +1455,7 @@ const yrug = YRug function render(guide::YRug, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics) + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement) Gadfly.assert_aesthetics_defined("Guide.yrug", aes, :y) padding = 0.4mm @@ -1224,7 +1594,7 @@ const annotation = Annotation function render(guide::Annotation, theme::Gadfly.Theme, - aes::Gadfly.Aesthetics) + aes::Gadfly.Aesthetics, coord::Gadfly.CoordinateElement) ctx = compose(context(), svgclass("geometry"), guide.ctx) return [PositionedGuide([ctx], 0, over_guide_position)] end diff --git a/src/precompile.jl b/src/precompile.jl index 59dda64aa..6ae616801 100644 --- a/src/precompile.jl +++ b/src/precompile.jl @@ -1,21 +1,21 @@ function _precompile_() ccall(:jl_generating_output, Cint, ()) == 1 || return nothing - precompile(Gadfly.Geom.render, (Gadfly.Geom.SubplotGrid, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.SubplotGrid, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) precompile(Gadfly.render_prepare, (Gadfly.Plot,)) precompile(Gadfly.call, (Array{Any, 1}, Type{Gadfly.Theme},)) precompile(Gadfly.Geom.deferred_label_context, (Gadfly.Geom.LabelGeometry, Gadfly.Aesthetics, Gadfly.Theme, Compose.ParentDrawContext,)) precompile(Gadfly.bounding_order_of_magnitude, (Int64,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.BoxplotGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.BoxplotGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.by_xy_group, (Gadfly.Data, DataArrays.PooledDataArray{Int64, UInt32, 1}, DataArrays.PooledDataArray{Int64, UInt32, 1}, Int64, Int64,)) precompile(Gadfly.Stat.apply_statistic, (Gadfly.Stat.HistogramStatistic, Base.Dict{Symbol, Gadfly.ScaleElement}, Gadfly.Coord.Cartesian, Gadfly.Aesthetics,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.LineGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.LineGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.call, (Array{Any, 1}, Type{Gadfly.Data},)) precompile(Gadfly.Stat.apply_statistic, (Gadfly.Stat.BoxplotStatistic, Base.Dict{Symbol, Gadfly.ScaleElement}, Gadfly.Coord.Cartesian, Gadfly.Aesthetics,)) - precompile(Gadfly.Geom.render_colorful_dodged_bar, (Gadfly.Geom.BarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Symbol,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.PolygonGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render_colorful_dodged_bar, (Gadfly.Geom.BarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Symbol,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.PolygonGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.Guide.layout_guides, (Compose.Context, Gadfly.Coord.SubplotGrid, Gadfly.Theme, Gadfly.Guide.PositionedGuide, Vararg{Gadfly.Guide.PositionedGuide},)) precompile(Gadfly.Guide.layout_guides, (Compose.Context, Gadfly.Coord.SubplotGrid, Gadfly.Theme,)) - precompile(Gadfly.Geom.render_colorful_stacked_bar, (Gadfly.Geom.BarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Symbol,)) + precompile(Gadfly.Geom.render_colorful_stacked_bar, (Gadfly.Geom.BarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Symbol,)) precompile(Gadfly.Guide.render, (Gadfly.Guide.YTicks, Gadfly.Theme, Gadfly.Aesthetics, Bool,)) precompile(Gadfly.Stat.apply_statistic, (Gadfly.Stat.TickStatistic, Base.Dict{Symbol, Gadfly.ScaleElement}, Gadfly.Coord.Cartesian, Gadfly.Aesthetics,)) precompile(Gadfly.plot, (Void, Base.Dict{Symbol, Any}, Type{Gadfly.Stat.FunctionStatistic}, Type{Gadfly.Geom.LineGeometry}, Gadfly.Coord.Cartesian, Gadfly.Guide.XLabel, Vararg{Union{Union{Gadfly.Theme, Gadfly.Element, DataType, Function}, Array{Gadfly.Layer, 1}}},)) @@ -23,14 +23,14 @@ function _precompile_() precompile(Gadfly.Guide.layout_guides, (Compose.Context, Gadfly.Coord.Cartesian, Gadfly.Theme, Gadfly.Guide.PositionedGuide, Vararg{Gadfly.Guide.PositionedGuide},)) precompile(Gadfly.meltdata, (DataFrames.DataFrame, Array{Gadfly.Col.GroupedColumn, 1},)) precompile(Gadfly.Coord.apply_coordinate, (Gadfly.Coord.Cartesian, Array{Gadfly.Aesthetics, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.RibbonGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.RibbonGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.Stat.apply_statistic, (Gadfly.Stat.SmoothStatistic, Base.Dict{Symbol, Gadfly.ScaleElement}, Gadfly.Coord.Cartesian, Gadfly.Aesthetics,)) precompile(Gadfly.assert_aesthetics_defined, (ASCIIString, Gadfly.Aesthetics, Symbol, Vararg{Symbol},)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.XErrorBarGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.XErrorBarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.by_xy_group, (Gadfly.Data, DataArrays.PooledDataArray{Int64, UInt32, 1}, Void, Int64, Int64,)) precompile(Gadfly.Guide.render, (Gadfly.Guide.ZoomSlider, Gadfly.Theme, Gadfly.Aesthetics,)) precompile(Gadfly.plot, (Void, Base.Dict{Symbol, Any}, Type{Gadfly.Stat.QQStatistic}, Type{Gadfly.Geom.PointGeometry}, Function, Function, Vararg{Function},)) - precompile(Gadfly.Geom.render_colorless_bar, (Gadfly.Geom.BarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Symbol,)) + precompile(Gadfly.Geom.render_colorless_bar, (Gadfly.Geom.BarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Symbol,)) precompile(Gadfly.by_xy_group, (Gadfly.Aesthetics, DataArrays.PooledDataArray{Int64, UInt32, 1}, DataArrays.PooledDataArray{Int64, UInt32, 1}, Int64, Int64,)) precompile(Gadfly.by_xy_group, (Gadfly.Aesthetics, DataArrays.PooledDataArray{Int64, UInt32, 1}, Void, Int64, Int64,)) precompile(Gadfly.by_xy_group, (Gadfly.Data, Void, DataArrays.PooledDataArray{Int64, UInt32, 1}, Int64, Int64,)) @@ -41,12 +41,12 @@ function _precompile_() precompile(Gadfly.Scale.apply_scale, (Gadfly.Scale.ContinuousColorScale, Array{Gadfly.Aesthetics, 1}, Gadfly.Data, Vararg{Gadfly.Data},)) precompile(Gadfly.Stat.apply_statistic, (Gadfly.Stat.ContourStatistic, Base.Dict{Symbol, Gadfly.ScaleElement}, Gadfly.Coord.Cartesian, Gadfly.Aesthetics,)) precompile(Gadfly.Stat.apply_statistic, (Gadfly.Stat.HexBinStatistic, Base.Dict{Symbol, Gadfly.ScaleElement}, Gadfly.Coord.Cartesian, Gadfly.Aesthetics,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.YErrorBarGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.YErrorBarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.plot, (Void, Base.Dict{Symbol, Any}, Type{Gadfly.Stat.FunctionStatistic}, Type{Gadfly.Geom.LineGeometry}, Gadfly.Scale.DiscreteColorScale, Gadfly.Guide.XLabel, Vararg{Union{Union{Gadfly.Theme, Gadfly.Element, DataType, Function}, Array{Gadfly.Layer, 1}}},)) precompile(Gadfly.plot, (Void, Base.Dict{Symbol, Any}, Array{Gadfly.Layer, 1}, Gadfly.Guide.XLabel, Gadfly.Guide.YLabel, Gadfly.Guide.ColorKey, Vararg{Union{Union{Gadfly.Theme, Gadfly.Element, DataType, Function}, Array{Gadfly.Layer, 1}}},)) precompile(Gadfly.plot, (Void, Base.Dict{Symbol, Any}, Array{Gadfly.Layer, 1}, Array{Gadfly.Layer, 1}, Gadfly.Guide.XLabel, Gadfly.Guide.YLabel, Vararg{Union{Union{Gadfly.Theme, Gadfly.Element, DataType, Function}, Array{Gadfly.Layer, 1}}},)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.ViolinGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.RectangularBinGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.ViolinGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.RectangularBinGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.plot, (Void, Base.Dict{Symbol, Any}, Gadfly.Geom.SubplotGrid, Gadfly.Guide.XLabel, Gadfly.Guide.YLabel, Gadfly.Guide.Title, Vararg{Gadfly.Guide.Title},)) precompile(Gadfly.Stat.apply_statistic, (Gadfly.Stat.StepStatistic, Base.Dict{Symbol, Gadfly.ScaleElement}, Gadfly.Coord.Cartesian, Gadfly.Aesthetics,)) precompile(Gadfly.Stat.apply_statistic, (Gadfly.Stat.FunctionStatistic, Base.Dict{Symbol, Gadfly.ScaleElement}, Gadfly.Coord.Cartesian, Gadfly.Aesthetics,)) @@ -61,7 +61,7 @@ function _precompile_() precompile(Gadfly.Scale.apply_scale, (Gadfly.Scale.ContinuousScale, Array{Gadfly.Aesthetics, 1}, Gadfly.Data, Vararg{Gadfly.Data},)) precompile(Gadfly.Guide.render, (Gadfly.Guide.ColorKey, Gadfly.Theme, Gadfly.Aesthetics,)) precompile(Gadfly.optimize_ticks, (Array{Any, 1}, Int32, Int32,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.HexagonalBinGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.HexagonalBinGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.Geom.call, (Type{Gadfly.Geom.LineGeometry},)) precompile(Gadfly.Coord.call, (Array{Any, 1}, Type{Gadfly.Coord.Cartesian}, Array{Symbol, 1}, Array{Symbol, 1},)) precompile(Gadfly.optimize_ticks_typed, (Int32, Int32, Bool, Array{Tuple{Float64, Float64}, 1}, Int64, Int64, Int64, Float64, Float64, Float64, Float64, Bool,)) @@ -71,12 +71,12 @@ function _precompile_() precompile(Gadfly.optimize_ticks, (Array{Any, 1}, Base.Dates.Date, Base.Dates.Date,)) precompile(Gadfly.Stat.choose_bin_count_2d, (DataArrays.DataArray{Float64, 1}, DataArrays.DataArray{Float64, 1}, Int64, Int64, Int64, Int64,)) precompile(Gadfly.concretize, (Array{Float64, 1}, Vararg{Array{Float64, 1}},)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.PointGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.PointGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.Scale.apply_scale, (Gadfly.Scale.DiscreteScale, Array{Gadfly.Aesthetics, 1}, Gadfly.Data, Vararg{Gadfly.Data},)) precompile(Gadfly.Stat.xticks, (Array{Any, 1},)) precompile(Gadfly.Stat.choose_bin_count_1d_discrete, (DataArrays.DataArray{Float64, 1}, Array{Float64, 1}, Int64, Int64,)) precompile(Gadfly.Scale.call, (Array{Any, 1}, Type{Gadfly.Scale.ContinuousScale}, Array{Symbol, 1}, Gadfly.Scale.ContinuousScaleTransform,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.LabelGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.LabelGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.Geom.histogram, (Array{Any, 1},)) precompile(Gadfly.Stat.choose_bin_count_1d_discrete, (DataArrays.PooledDataArray{Int64, UInt32, 1}, Array{Int64, 1}, Int64, Int64,)) precompile(Gadfly.Stat.choose_bin_count_1d_discrete, (Array{Float64, 1}, Array{Float64, 1}, Int64, Int64,)) @@ -108,7 +108,7 @@ function _precompile_() precompile(Gadfly.evalmapping!, (Base.Dict{Symbol, Any}, DataFrames.DataFrame, Gadfly.Data,)) precompile(Gadfly.Stat.barminmax, (Array{Int64, 1}, Bool,)) precompile(Gadfly.evalmapping!, (Base.Dict{Symbol, Any}, Void, Gadfly.Data,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.HLineGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.HLineGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.Stat.barminmax, (DataArrays.PooledDataArray{Int64, UInt32, 1}, Bool,)) precompile(Gadfly.Guide.call, (Array{Any, 1}, Type{Gadfly.Guide.XTicks},)) precompile(Gadfly.Scale.color_continuous_gradient, (Array{Any, 1},)) @@ -134,7 +134,7 @@ function _precompile_() precompile(Gadfly.Stat.call, (Array{Any, 1}, Type{Gadfly.Stat.SmoothStatistic},)) precompile(Gadfly.Stat.choose_bin_count_1d, (DataArrays.DataArray{Float64, 1}, Int64, Int64,)) precompile(Gadfly.Stat.apply_statistic_typed, (Float64, Float64, DataArrays.DataArray{Float64, 1}, Array{Void, 1}, Array{Void, 1},)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.VLineGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.VLineGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.Stat.call, (Array{Any, 1}, Type{Gadfly.Stat.BarStatistic},)) precompile(Gadfly.Stat.call, (Array{Any, 1}, Type{Gadfly.Stat.HexBinStatistic},)) precompile(Gadfly.Stat.estimate_distinct_proportion, (DataArrays.PooledDataArray{Int64, UInt32, 1},)) @@ -148,7 +148,7 @@ function _precompile_() precompile(Gadfly.call, (Type{Gadfly.Aesthetics},)) precompile(Gadfly.Stat.apply_statistic_typed, (Float64, Float64, Array{Int64, 1}, Array{Void, 1}, Array{Void, 1},)) precompile(Gadfly.Scale.apply_scales, (Array{Gadfly.ScaleElement, 1}, Array{Gadfly.Aesthetics, 1}, Gadfly.Data, Vararg{Gadfly.Data},)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.BarGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.BarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.add_plot_element!, (Array{Gadfly.Layer, 1}, Gadfly.Geom.LineGeometry,)) precompile(Gadfly.concrete_length, (DataArrays.DataArray{Float64, 1},)) precompile(Gadfly.plot, (DataFrames.DataFrame, Base.Dict{Symbol, Any}, Gadfly.Theme, Type{Gadfly.Geom.PointGeometry},)) @@ -424,7 +424,7 @@ function _precompile_() precompile(Gadfly.Scale.discretize, (DataArrays.PooledDataArray{ASCIIString, UInt8, 1}, Void, Void, Bool,)) precompile(Gadfly.Geom.call, (Type{Gadfly.Geom.RectangularBinGeometry}, Gadfly.Stat.RectbinStatistic,)) precompile(Gadfly.Stat.call, (Type{Gadfly.Stat.FunctionStatistic},)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.ErrorBarGeometry, Gadfly.Theme, Gadfly.Aesthetics,)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.ErrorBarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement,)) precompile(Gadfly.Geom.call, (Type{Gadfly.Geom.LineGeometry}, Gadfly.Stat.DensityStatistic,)) precompile(Gadfly.Stat.bin!, (Array{Int64, 1}, Array{Int32, 1}, Int32, Float64, Int64,)) precompile(Gadfly.Scale.discretize, (DataArrays.DataArray{ASCIIString, 1}, Void, Void, Bool,)) @@ -609,10 +609,10 @@ function _precompile_() precompile(Gadfly.Stat.input_aesthetics, (Gadfly.Stat.HistogramStatistic,)) precompile(Gadfly.Stat.output_aesthetics, (Gadfly.Stat.QQStatistic,)) precompile(Gadfly.get_stroke_vector, (Void,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.PolygonGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.PolygonGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) precompile(Gadfly.Stat.output_aesthetics, (Gadfly.Stat.RectbinStatistic,)) precompile(Gadfly.add_plot_element!, (Array{Gadfly.Layer, 1}, Type{Gadfly.Geom.LineGeometry},)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.RibbonGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.RibbonGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) precompile(Gadfly.Scale.discretize, (Array{ASCIIString, 1}, Array{ASCIIString, 1}, Void, Bool,)) precompile(Gadfly.add_plot_element!, (Gadfly.Plot, Gadfly.Guide.XTicks,)) precompile(Gadfly.plot, (Function, Float64, Int64, Float64, Int64,)) @@ -622,15 +622,15 @@ function _precompile_() precompile(Gadfly.add_plot_element!, (Array{Gadfly.Layer, 1}, Type{Gadfly.Geom.PointGeometry},)) precompile(Gadfly.add_plot_element!, (Gadfly.Plot, Type{Gadfly.Geom.RectangularBinGeometry},)) precompile(Gadfly.Scale.discretize, (Array{Any, 1}, Array{ASCIIString, 1}, Void, Bool,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.ErrorBarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.BoxplotGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.ErrorBarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.BoxplotGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) precompile(Gadfly.add_plot_element!, (Gadfly.Plot, Type{Gadfly.Geom.PointGeometry},)) precompile(Gadfly.Scale.discretize, (Array{Symbol, 1}, Array{Symbol, 1}, Void, Bool,)) precompile(Gadfly.default_scales, (Gadfly.Stat.RectbinStatistic,)) precompile(Gadfly.add_plot_element!, (Gadfly.Plot, Array{Gadfly.Layer, 1},)) precompile(Gadfly.add_plot_element!, (Gadfly.Plot, Gadfly.Guide.ColorKey,)) precompile(Gadfly.Stat.input_aesthetics, (Gadfly.Stat.FunctionStatistic,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.LineGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.LineGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) precompile(Gadfly.Scale.discretize_make_pda, (DataArrays.PooledDataArray{ASCIIString, UInt8, 1}, Array{ASCIIString, 1},)) precompile(Gadfly.default_scales, (Gadfly.Stat.BoxplotStatistic,)) precompile(Gadfly.Stat.output_aesthetics, (Gadfly.Stat.FunctionStatistic,)) @@ -661,7 +661,7 @@ function _precompile_() precompile(Gadfly.add_plot_element!, (Gadfly.Plot, Gadfly.Guide.Title,)) precompile(Gadfly.Guide.call, (Type{Gadfly.Guide.ColorKey}, ASCIIString,)) precompile(Gadfly.Stat.input_aesthetics, (Gadfly.Stat.Histogram2DStatistic,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.RectangularBinGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.RectangularBinGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) precompile(Gadfly.cat_aes_var!, (ASCIIString, Void,)) precompile(Gadfly.Geom.element_aesthetics, (Gadfly.Geom.RibbonGeometry,)) precompile(Gadfly.Scale.element_aesthetics, (Gadfly.Scale.NoneColorScale,)) @@ -679,20 +679,20 @@ function _precompile_() precompile(Gadfly.Stat.input_aesthetics, (Gadfly.Stat.BoxplotStatistic,)) precompile(Gadfly.element_aesthetics, (Function,)) precompile(Gadfly.Scale.element_aesthetics, (Gadfly.Scale.LabelScale,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.ViolinGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.HLineGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.ViolinGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.HLineGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) precompile(Gadfly.Geom.element_aesthetics, (Gadfly.Geom.LabelGeometry,)) precompile(Gadfly.Guide.render, (Gadfly.Guide.XLabel, Gadfly.Theme, Gadfly.Aesthetics, Bool,)) precompile(Gadfly.issomething, (Array{Int64, 1},)) precompile(Gadfly.Scale.identity_formatter, (Array{Base.Dates.DateTime, 1},)) precompile(Gadfly.Geom.default_statistic, (Gadfly.Geom.PointGeometry,)) precompile(Gadfly.Geom.element_aesthetics, (Gadfly.Geom.YErrorBarGeometry,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.VLineGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.VLineGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) precompile(Gadfly.Stat.input_aesthetics, (Gadfly.Stat.EnumerateStatistic,)) precompile(Gadfly.default_scales, (Gadfly.Geom.HexagonalBinGeometry,)) precompile(Gadfly.add_plot_element!, (Gadfly.Plot, Gadfly.Guide.YLabel,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.LabelGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.HexagonalBinGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.LabelGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.HexagonalBinGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) precompile(Gadfly.default_scales, (Gadfly.Geom.HLineGeometry,)) precompile(Gadfly.Guide.call, (Type{Gadfly.Guide.Title}, ASCIIString,)) precompile(Gadfly.cat_aes_var!, (Bool, Bool,)) @@ -705,7 +705,7 @@ function _precompile_() precompile(Gadfly.multilevel_ticks, (Int64, Int64,)) precompile(Gadfly.default_statistic, (Gadfly.Guide.ZoomSlider,)) precompile(Gadfly.evalmapping, (Void, Array{Function, 1},)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.BarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.BarGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) precompile(Gadfly.isconcrete, (Base.Dates.DateTime,)) precompile(Gadfly.default_scales, (Gadfly.Stat.StepStatistic,)) precompile(Gadfly.multilevel_ticks, (Float64, Float64,)) @@ -746,7 +746,7 @@ function _precompile_() precompile(Gadfly.add_plot_element!, (Gadfly.Plot, Type{Gadfly.Geom.HLineGeometry},)) precompile(Gadfly.add_plot_element!, (Gadfly.Plot, Gadfly.Scale.DiscreteColorScale,)) precompile(Gadfly.Stat.default_scales, (Gadfly.Stat.FunctionStatistic,)) - precompile(Gadfly.Geom.render, (Gadfly.Geom.PointGeometry, Gadfly.Theme, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) + precompile(Gadfly.Geom.render, (Gadfly.Geom.PointGeometry, Gadfly.Theme, Gadfly.Aesthetics, Gadfly.CoordinateElement, Array{Gadfly.Aesthetics, 1}, Array{Gadfly.Data, 1}, Base.Dict{Symbol, Gadfly.ScaleElement},)) precompile(Gadfly.cat_aes_var!, (Array{Float64, 1}, Void,)) precompile(Gadfly.default_statistic, (Gadfly.Guide.YLabel,)) precompile(Gadfly.add_plot_element!, (Gadfly.Plot, Gadfly.Scale.DiscreteScale,)) @@ -761,7 +761,7 @@ function _precompile_() precompile(Gadfly.cat_aes_var!, (ASCIIString, ASCIIString,)) precompile(Gadfly.Geom.default_statistic, (Gadfly.Geom.HLineGeometry,)) precompile(Gadfly.default_statistic, (Gadfly.Guide.PanelBackground,)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.HexagonalBinGeometry,)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.HexagonalBinGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) precompile(Gadfly.cat_aes_var!, (Void, Base.Dict{Symbol, AbstractString},)) precompile(Gadfly.hasna, (Base.FloatRange{Float64},)) precompile(Gadfly.Geom.default_statistic, (Gadfly.Geom.ErrorBarGeometry,)) @@ -776,35 +776,35 @@ function _precompile_() precompile(Gadfly.Stat.default_scales, (Gadfly.Stat.Histogram2DStatistic,)) precompile(Gadfly.Coord.call, (Type{Gadfly.Coord.SubplotGrid},)) precompile(Gadfly.Scale.element_aesthetics, (Gadfly.Scale.DiscreteColorScale,)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.LabelGeometry,)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.LabelGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) precompile(Gadfly.Geom.default_statistic, (Gadfly.Geom.PolygonGeometry,)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.ViolinGeometry,)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.ViolinGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) precompile(Gadfly.render_prepared, (Gadfly.Plot, Gadfly.Coord.Cartesian, Gadfly.Aesthetics, Array{Gadfly.Aesthetics, 1}, Array{Array{Gadfly.StatisticElement, 1}, 1}, Array{Array{Gadfly.Aesthetics, 1}, 1}, Array{Array{Gadfly.Data, 1}, 1}, Base.Dict{Symbol, Gadfly.ScaleElement}, Array{Gadfly.GuideElement, 1},)) precompile(Gadfly.Stat.apply_statistic, (Gadfly.Stat.Identity, Base.Dict{Symbol, Gadfly.ScaleElement}, Gadfly.Coord.SubplotGrid, Gadfly.Aesthetics,)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.BarGeometry,)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.BarGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) precompile(Gadfly.classify_data, (Base.UnitRange{Int64},)) precompile(Gadfly.add_plot_element!, (Gadfly.Plot, Type{Gadfly.Scale.NoneColorScale},)) precompile(Gadfly.cat_aes_var!, (DataStructures.OrderedDict{Any, Any}, DataStructures.OrderedDict{Any, Any},)) precompile(Gadfly.cat_aes_var!, (Void, Array{Base.Dates.AbstractTime, 1},)) precompile(Gadfly.cat_aes_var!, (Void, Void,)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.PolygonGeometry,)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.PointGeometry,)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.PolygonGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.PointGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) precompile(Gadfly.evalmapping, (Void, Array{ASCIIString, 1},)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.RibbonGeometry,)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.RibbonGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) precompile(Gadfly.cat_aes_var!, (Array{Int64, 1}, Void,)) precompile(Gadfly.evalmapping, (Void, Array{Int64, 1},)) precompile(Gadfly.cat_aes_var!, (Void, Array{Base.Dates.DateTime, 1},)) precompile(Gadfly.evalmapping, (DataFrames.DataFrame, Array{Int64, 1},)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.RectangularBinGeometry,)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.RectangularBinGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) precompile(Gadfly.Geom.default_statistic, (Gadfly.Geom.SubplotGrid,)) precompile(Gadfly.evalmapping, (Void, Array{Symbol, 1},)) precompile(Gadfly.evalmapping, (Void, Array{Float64, 1},)) precompile(Gadfly.evalmapping, (Void, Function,)) precompile(Gadfly.cat_aes_var!, (Void, Array{Float64, 1},)) precompile(Gadfly.cat_aes_var!, (Void, Array{Base.Dates.Date, 1},)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.HLineGeometry,)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.HLineGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) precompile(Gadfly.Geom.element_coordinate_type, (Gadfly.Geom.SubplotGrid,)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.BoxplotGeometry,)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.BoxplotGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) precompile(Gadfly.cat_aes_var!, (Void, Array{Array{Float64, 1}, 1},)) precompile(Gadfly.hasna, (Base.UnitRange{Int64},)) precompile(Gadfly.Scale.element_aesthetics, (Gadfly.Scale.DiscreteScale,)) @@ -823,8 +823,8 @@ function _precompile_() precompile(Gadfly.cat_aes_var!, (DataArrays.DataArray{ColorTypes.RGB{Float32}, 1}, Void,)) precompile(Gadfly.evalmapping, (DataFrames.DataFrame, DataArrays.DataArray{Float64, 1},)) precompile(Gadfly.classify_data, (DataArrays.DataArray{ASCIIString, 1},)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.ErrorBarGeometry,)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.LineGeometry,)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.ErrorBarGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.LineGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) precompile(Gadfly.cat_aes_var!, (Function, Void,)) precompile(Gadfly.cat_aes_var!, (DataArrays.PooledDataArray{Int64, UInt32, 1}, Void,)) precompile(Gadfly.classify_data, (DataArrays.DataArray{Float64, 1},)) @@ -841,7 +841,7 @@ function _precompile_() precompile(Gadfly.classify_data, (Array{ASCIIString, 1},)) precompile(Gadfly.Geom.default_statistic, (Gadfly.Geom.RectangularBinGeometry,)) precompile(Gadfly.classify_data, (DataArrays.DataArray{UTF8String, 1},)) - precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.VLineGeometry,)) + precompile(Gadfly.element_coordinate_type, (Gadfly.Geom.VLineGeometry, Base.KeyIterator{Dict{Symbol,Any}},)) precompile(Gadfly.evalmapping, (DataFrames.DataFrame, Array{Function, 1},)) precompile(Gadfly.Guide.render, (Gadfly.Guide.PanelBackground, Gadfly.Theme, Gadfly.Aesthetics, Bool,)) precompile(Gadfly.Stat.input_aesthetics, (Gadfly.Stat.JitterStatistic,)) diff --git a/src/scale.jl b/src/scale.jl index 36fb2e371..f0f32efbc 100644 --- a/src/scale.jl +++ b/src/scale.jl @@ -192,6 +192,9 @@ const y_asinh = continuous_scale_partial(y_vars, asinh_transform) const x_sqrt = continuous_scale_partial(x_vars, sqrt_transform) const y_sqrt = continuous_scale_partial(y_vars, sqrt_transform) +const rho_continuous = continuous_scale_partial([:rho], identity_transform) +const phi_continuous = continuous_scale_partial([:phi], identity_transform) + const size_continuous = continuous_scale_partial([:size], identity_transform) diff --git a/src/statistics.jl b/src/statistics.jl index 0276dcb63..17b62bfb7 100644 --- a/src/statistics.jl +++ b/src/statistics.jl @@ -734,6 +734,31 @@ function yticks(; ticks::@compat(Union{Symbol, AbstractArray})=:auto, end +function rhoticks(; ticks::@compat(Union{Symbol, AbstractArray})=:auto, + granularity_weight::Float64=1/4, + simplicity_weight::Float64=1/6, + coverage_weight::Float64=1/3, + niceness_weight::Float64=1/4) + TickStatistic([:rho], "rho", + granularity_weight, simplicity_weight, + coverage_weight, niceness_weight, ticks) +end + + +# FIXME: angular ticks should be treated differently +function phiticks(; ticks::@compat(Union{Symbol, AbstractArray})=:auto, + granularity_weight::Float64=1/4, + simplicity_weight::Float64=1/6, + coverage_weight::Float64=1/3, + niceness_weight::Float64=1/4) + if ticks === nothing + ticks = 0:pi/6:11pi/6 + end + TickStatistic([:phi], "phi", + granularity_weight, simplicity_weight, + coverage_weight, niceness_weight, ticks) +end + # Apply a tick statistic. # @@ -816,7 +841,7 @@ function apply_statistic(stat::TickStatistic, n = Gadfly.concrete_length(in_values) - # check the x/yviewmin/max pesudo-aesthetics + # check the x/yviewmin/max pseudo-aesthetics if stat.out_var == "x" if aes.xviewmin != nothing minval = min(minval, aes.xviewmin) diff --git a/src/varset.jl b/src/varset.jl index 876c7e4b5..6fb14e9d1 100644 --- a/src/varset.jl +++ b/src/varset.jl @@ -28,7 +28,7 @@ macro varset(name::Symbol, table) typ = row.args[2] default = length(row.args) > 2 ? row.args[3] : :nothing else - error("Bad varset systax") + error("Bad varset syntax") end push!(names, var)