diff --git a/src/Plots.jl b/src/Plots.jl index 75e197ed..bf41d55b 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -203,7 +203,7 @@ include("output.jl") # define and export shorthand plotting method definitions macro shorthands(funcname::Symbol) - funcname2 = symbol(funcname, "!") + funcname2 = Symbol(funcname, "!") ret = esc(quote export $funcname, $funcname2 $funcname(args...; kw...) = plot(args...; kw..., seriestype = $(quot(funcname))) @@ -285,9 +285,9 @@ plot3d!(args...; kw...) = plot!(args...; kw..., seriestype = :path3d) # quiver!(args...; kw...) = plot!(args...; kw..., seriestype = :quiver) -title!(s::AbstractString; kw...) = plot!(; title = s, kw...) -xlabel!(s::AbstractString; kw...) = plot!(; xlabel = s, kw...) -ylabel!(s::AbstractString; kw...) = plot!(; ylabel = s, kw...) +title!(s::@compat(String); kw...) = plot!(; title = s, kw...) +xlabel!(s::@compat(String); kw...) = plot!(; xlabel = s, kw...) +ylabel!(s::@compat(String); kw...) = plot!(; ylabel = s, kw...) xlims!{T<:Real,S<:Real}(lims::Tuple{T,S}; kw...) = plot!(; xlims = lims, kw...) ylims!{T<:Real,S<:Real}(lims::Tuple{T,S}; kw...) = plot!(; ylims = lims, kw...) zlims!{T<:Real,S<:Real}(lims::Tuple{T,S}; kw...) = plot!(; zlims = lims, kw...) @@ -296,9 +296,9 @@ ylims!(ymin::Real, ymax::Real; kw...) = plot!(; ylims = (ymi zlims!(zmin::Real, zmax::Real; kw...) = plot!(; zlims = (zmin,zmax), kw...) xticks!{T<:Real}(v::AVec{T}; kw...) = plot!(; xticks = v, kw...) yticks!{T<:Real}(v::AVec{T}; kw...) = plot!(; yticks = v, kw...) -xticks!{T<:Real,S<:AbstractString}( +xticks!{T<:Real,S<:@compat(String)}( ticks::AVec{T}, labels::AVec{S}; kw...) = plot!(; xticks = (ticks,labels), kw...) -yticks!{T<:Real,S<:AbstractString}( +yticks!{T<:Real,S<:@compat(String)}( ticks::AVec{T}, labels::AVec{S}; kw...) = plot!(; yticks = (ticks,labels), kw...) annotate!(anns...; kw...) = plot!(; annotation = anns, kw...) annotate!{T<:Tuple}(anns::AVec{T}; kw...) = plot!(; annotation = anns, kw...) @@ -307,9 +307,9 @@ yflip!(flip::Bool = true; kw...) = plot!(; yflip = flip xaxis!(args...; kw...) = plot!(; xaxis = args, kw...) yaxis!(args...; kw...) = plot!(; yaxis = args, kw...) -title!(plt::Plot, s::AbstractString; kw...) = plot!(plt; title = s, kw...) -xlabel!(plt::Plot, s::AbstractString; kw...) = plot!(plt; xlabel = s, kw...) -ylabel!(plt::Plot, s::AbstractString; kw...) = plot!(plt; ylabel = s, kw...) +title!(plt::Plot, s::@compat(String); kw...) = plot!(plt; title = s, kw...) +xlabel!(plt::Plot, s::@compat(String); kw...) = plot!(plt; xlabel = s, kw...) +ylabel!(plt::Plot, s::@compat(String); kw...) = plot!(plt; ylabel = s, kw...) xlims!{T<:Real,S<:Real}(plt::Plot, lims::Tuple{T,S}; kw...) = plot!(plt; xlims = lims, kw...) ylims!{T<:Real,S<:Real}(plt::Plot, lims::Tuple{T,S}; kw...) = plot!(plt; ylims = lims, kw...) zlims!{T<:Real,S<:Real}(plt::Plot, lims::Tuple{T,S}; kw...) = plot!(plt; zlims = lims, kw...) @@ -318,9 +318,9 @@ ylims!(plt::Plot, ymin::Real, ymax::Real; kw...) = plot!(pl zlims!(plt::Plot, zmin::Real, zmax::Real; kw...) = plot!(plt; zlims = (zmin,zmax), kw...) xticks!{T<:Real}(plt::Plot, ticks::AVec{T}; kw...) = plot!(plt; xticks = ticks, kw...) yticks!{T<:Real}(plt::Plot, ticks::AVec{T}; kw...) = plot!(plt; yticks = ticks, kw...) -xticks!{T<:Real,S<:AbstractString}(plt::Plot, +xticks!{T<:Real,S<:@compat(String)}(plt::Plot, ticks::AVec{T}, labels::AVec{S}; kw...) = plot!(plt; xticks = (ticks,labels), kw...) -yticks!{T<:Real,S<:AbstractString}(plt::Plot, +yticks!{T<:Real,S<:@compat(String)}(plt::Plot, ticks::AVec{T}, labels::AVec{S}; kw...) = plot!(plt; yticks = (ticks,labels), kw...) annotate!(plt::Plot, anns...; kw...) = plot!(plt; annotation = anns, kw...) annotate!{T<:Tuple}(plt::Plot, anns::AVec{T}; kw...) = plot!(plt; annotation = anns, kw...) diff --git a/src/animation.jl b/src/animation.jl index 843801b1..4e72c7d9 100644 --- a/src/animation.jl +++ b/src/animation.jl @@ -1,12 +1,12 @@ immutable Animation - dir::ASCIIString - frames::Vector{ASCIIString} + dir::@compat(String) + frames::Vector{@compat(String)} end function Animation() - tmpdir = convert(ASCIIString, mktempdir()) - Animation(tmpdir, ASCIIString[]) + tmpdir = convert(@compat(String), mktempdir()) + Animation(tmpdir, @compat(String)[]) end function frame{P<:AbstractPlot}(anim::Animation, plt::P=current()) @@ -21,10 +21,10 @@ end "Wraps the location of an animated gif so that it can be displayed" immutable AnimatedGif - filename::ASCIIString + filename::@compat(String) end -function gif(anim::Animation, fn::@compat(AbstractString) = "tmp.gif"; fps::Integer = 20) +function gif(anim::Animation, fn::@compat(String) = "tmp.gif"; fps::Integer = 20) fn = abspath(fn) try diff --git a/src/args.jl b/src/args.jl index d93e3f30..ab6cc6d5 100644 --- a/src/args.jl +++ b/src/args.jl @@ -272,10 +272,10 @@ for letter in (:x,:y,:z) :foreground_color_guide, :discrete_values ) - _axis_defaults_byletter[symbol(letter,k)] = nothing + _axis_defaults_byletter[Symbol(letter,k)] = nothing # allow the underscore version too: xguide or x_guide - add_aliases(symbol(letter, k), symbol(letter, "_", k)) + add_aliases(Symbol(letter, k), Symbol(letter, "_", k)) end end @@ -294,7 +294,7 @@ RecipesBase.is_key_supported(k::Symbol) = (k in supportedArgs()) # ----------------------------------------------------------------------------- -makeplural(s::Symbol) = symbol(string(s,"s")) +makeplural(s::Symbol) = Symbol(string(s,"s")) autopick(arr::AVec, idx::Integer) = arr[mod1(idx,length(arr))] autopick(notarr, idx::Integer) = notarr @@ -592,7 +592,7 @@ function preprocessArgs!(d::KW) # handle axis args for letter in (:x, :y, :z) - asym = symbol(letter, :axis) + asym = Symbol(letter, :axis) args = pop!(d, asym, ()) if !(typeof(args) <: Axis) for arg in wraptuple(args) @@ -678,7 +678,7 @@ end "A special type that will break up incoming data into groups, and allow for easier creation of grouped plots" type GroupBy - groupLabels::Vector{UTF8String} # length == numGroups + groupLabels::Vector{@compat(String)} # length == numGroups groupIds::Vector{Vector{Int}} # list of indices for each group end @@ -869,7 +869,7 @@ function _update_subplot_args(plt::Plot, sp::Subplot, d_in::KW, subplot_index::I for letter in (:x, :y, :z) # get (maybe initialize) the axis - axissym = symbol(letter, :axis) + axissym = Symbol(letter, :axis) axis = if haskey(spargs, axissym) spargs[axissym] else @@ -891,7 +891,7 @@ function _update_subplot_args(plt::Plot, sp::Subplot, d_in::KW, subplot_index::I end # then get those args that were passed with a leading letter: `xlabel = "X"` - lk = symbol(letter, k) + lk = Symbol(letter, k) if haskey(d_in, lk) kw[k] = slice_arg(pop!(d_in, lk), subplot_index) end diff --git a/src/axes.jl b/src/axes.jl index 4b92fd06..c292e615 100644 --- a/src/axes.jl +++ b/src/axes.jl @@ -29,32 +29,32 @@ function process_axis_arg!(d::KW, arg, letter = "") arg = get(_scaleAliases, arg, arg) if typeof(arg) <: Font - d[symbol(letter,:tickfont)] = arg - d[symbol(letter,:guidefont)] = arg + d[Symbol(letter,:tickfont)] = arg + d[Symbol(letter,:guidefont)] = arg elseif arg in _allScales - d[symbol(letter,:scale)] = arg + d[Symbol(letter,:scale)] = arg elseif arg in (:flip, :invert, :inverted) - d[symbol(letter,:flip)] = true + d[Symbol(letter,:flip)] = true - elseif T <: @compat(AbstractString) - d[symbol(letter,:guide)] = arg + elseif T <: @compat(String) + d[Symbol(letter,:guide)] = arg # xlims/ylims elseif (T <: Tuple || T <: AVec) && length(arg) == 2 sym = typeof(arg[1]) <: Number ? :lims : :ticks - d[symbol(letter,sym)] = arg + d[Symbol(letter,sym)] = arg # xticks/yticks elseif T <: AVec - d[symbol(letter,:ticks)] = arg + d[Symbol(letter,:ticks)] = arg elseif arg == nothing - d[symbol(letter,:ticks)] = [] + d[Symbol(letter,:ticks)] = [] elseif typeof(arg) <: Number - d[symbol(letter,:rotation)] = arg + d[Symbol(letter,:rotation)] = arg else warn("Skipped $(letter)axis arg $arg") diff --git a/src/backends.jl b/src/backends.jl index b907c959..4d3d0155 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -12,16 +12,16 @@ _backend_instance(sym::Symbol) = haskey(_backendType, sym) ? _backendType[sym]() macro init_backend(s) str = lowercase(string(s)) - sym = symbol(str) - T = symbol(string(s) * "Backend") + sym = Symbol(str) + T = Symbol(string(s) * "Backend") esc(quote immutable $T <: AbstractBackend end export $sym - $sym(; kw...) = (default(; kw...); backend(symbol($str))) - backend_name(::$T) = symbol($str) - push!(_backends, symbol($str)) - _backendType[symbol($str)] = $T - _backendSymbol[$T] = symbol($str) + $sym(; kw...) = (default(; kw...); backend(Symbol($str))) + backend_name(::$T) = Symbol($str) + push!(_backends, Symbol($str)) + _backendType[Symbol($str)] = $T + _backendSymbol[$T] = Symbol($str) include("backends/" * $str * ".jl") end) end @@ -86,7 +86,7 @@ function pickDefaultBackend() if env_default != "" try Pkg.installed(env_default) # this will error if not installed - sym = symbol(lowercase(env_default)) + sym = Symbol(lowercase(env_default)) if haskey(_backendType, sym) return backend(sym) else @@ -103,7 +103,7 @@ function pickDefaultBackend() # features, speed, and robustness for pkgstr in ("PyPlot", "GR", "PlotlyJS", "Immerse", "Gadfly", "UnicodePlots") if Pkg.installed(pkgstr) != nothing - return backend(symbol(lowercase(pkgstr))) + return backend(Symbol(lowercase(pkgstr))) end end diff --git a/src/backends/gr.jl b/src/backends/gr.jl index f46bd158..836e7446 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -1236,8 +1236,8 @@ const _gr_mimeformats = Dict( for (mime, fmt) in _gr_mimeformats - # @eval function Base.writemime(io::IO, ::MIME{symbol($mime)}, plt::Plot{PyPlotBackend}) - @eval function _writemime(io::IO, ::MIME{symbol($mime)}, plt::Plot{GRBackend}) + # @eval function Base.writemime(io::IO, ::MIME{Symbol($mime)}, plt::Plot{PyPlotBackend}) + @eval function _writemime(io::IO, ::MIME{Symbol($mime)}, plt::Plot{GRBackend}) GR.emergencyclosegks() ENV["GKS_WSTYPE"] = $fmt gr_display(plt) diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index 3d5b4fe8..b278cb65 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -198,12 +198,12 @@ end # ---------------------------------------------------------------- function pgf_axis(sp::Subplot, letter) - axis = sp.attr[symbol(letter,:axis)] + axis = sp.attr[Symbol(letter,:axis)] style = [] kw = KW() # axis guide - kw[symbol(letter,:label)] = axis[:guide] + kw[Symbol(letter,:label)] = axis[:guide] # flip/reverse? axis[:flip] && push!(style, "$letter dir=reverse") @@ -211,14 +211,14 @@ function pgf_axis(sp::Subplot, letter) # scale scale = axis[:scale] if scale in (:log2, :ln, :log10) - kw[symbol(letter,:mode)] = "log" + kw[Symbol(letter,:mode)] = "log" scale == :ln || push!(style, "log basis $letter=$(scale == :log2 ? 2 : 10)") end # limits lims = axis_limits(axis) - kw[symbol(letter,:min)] = lims[1] - kw[symbol(letter,:max)] = lims[2] + kw[Symbol(letter,:min)] = lims[1] + kw[Symbol(letter,:max)] = lims[2] # return the style list and KW args style, kw diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 4811ac89..c1e566ae 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -158,7 +158,7 @@ function plotlyfont(font::Font, color = font.color) ) end -function get_annotation_dict(x, y, val::Union{AbstractString,Symbol}) +function get_annotation_dict(x, y, val::Union{@compat(String),Symbol}) KW( :text => val, :xref => "x", @@ -232,12 +232,12 @@ function _update_min_padding!(sp::Subplot{PlotlyBackend}) sp.minpad = plotly_minpad(sp) end -# tickssym(letter) = symbol(letter * "ticks") -# limssym(letter) = symbol(letter * "lims") -# flipsym(letter) = symbol(letter * "flip") -# scalesym(letter) = symbol(letter * "scale") -# labelsym(letter) = symbol(letter * "label") -# rotationsym(letter) = symbol(letter * "rotation") +# tickssym(letter) = Symbol(letter * "ticks") +# limssym(letter) = Symbol(letter * "lims") +# flipsym(letter) = Symbol(letter * "flip") +# scalesym(letter) = Symbol(letter * "scale") +# labelsym(letter) = Symbol(letter * "label") +# rotationsym(letter) = Symbol(letter * "rotation") function plotly_axis(axis::Axis, sp::Subplot) letter = axis[:letter] @@ -336,13 +336,13 @@ function plotly_layout(plt::Plot) # if any(is3d, seriesargs) if is3d(sp) d_out[:scene] = KW( - symbol("xaxis$spidx") => plotly_axis(sp.attr[:xaxis], sp), - symbol("yaxis$spidx") => plotly_axis(sp.attr[:yaxis], sp), - symbol("zaxis$spidx") => plotly_axis(sp.attr[:zaxis], sp), + Symbol("xaxis$spidx") => plotly_axis(sp.attr[:xaxis], sp), + Symbol("yaxis$spidx") => plotly_axis(sp.attr[:yaxis], sp), + Symbol("zaxis$spidx") => plotly_axis(sp.attr[:zaxis], sp), ) else - d_out[symbol("xaxis$spidx")] = plotly_axis(sp.attr[:xaxis], sp) - d_out[symbol("yaxis$spidx")] = plotly_axis(sp.attr[:yaxis], sp) + d_out[Symbol("xaxis$spidx")] = plotly_axis(sp.attr[:xaxis], sp) + d_out[Symbol("yaxis$spidx")] = plotly_axis(sp.attr[:yaxis], sp) end # legend diff --git a/src/backends/plotlyjs.jl b/src/backends/plotlyjs.jl index f7453d6d..1c5c65c3 100644 --- a/src/backends/plotlyjs.jl +++ b/src/backends/plotlyjs.jl @@ -85,7 +85,7 @@ function _initialize_backend(::PlotlyJSBackend; kw...) for (mime, fmt) in PlotlyJS._mimeformats # mime == "image/png" && continue # don't use plotlyjs's writemime for png - @eval Base.writemime(io::IO, m::MIME{symbol($mime)}, p::Plot{PlotlyJSBackend}) = writemime(io, m, p.o) + @eval Base.writemime(io::IO, m::MIME{Symbol($mime)}, p::Plot{PlotlyJSBackend}) = writemime(io, m, p.o) end # override IJulia inline display diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index b868b486..47a70669 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -196,7 +196,7 @@ function getPyPlotMarker(markers::AVec) end # pass through -function getPyPlotMarker(marker::AbstractString) +function getPyPlotMarker(marker::@compat(String)) @assert length(marker) == 1 marker end @@ -325,13 +325,13 @@ end # bounding box: union of axis tick labels function py_bbox_ticks(ax, letter) - labels = ax[symbol("get_"*letter*"ticklabels")]() + labels = ax[Symbol("get_"*letter*"ticklabels")]() py_bbox(labels) end # bounding box: axis guide function py_bbox_axislabel(ax, letter) - pyaxis_label = ax[symbol("get_"*letter*"axis")]()[:label] + pyaxis_label = ax[Symbol("get_"*letter*"axis")]()[:label] py_bbox(pyaxis_label) end @@ -856,21 +856,21 @@ end # # TODO: check for polar, do set_tlim/set_rlim instead # # # pyplot's set_xlim (or y/z) method: -# sp.o[symbol(:set_, axis[:letter], :lim)](lims...) +# sp.o[Symbol(:set_, axis[:letter], :lim)](lims...) # end # -------------------------------------------------------------------------- # get_axis and update_limits! should be moved to subplots.jl? or axes.jl? -get_axis(sp::Subplot, letter::Symbol) = sp.attr[symbol(letter, :axis)] +get_axis(sp::Subplot, letter::Symbol) = sp.attr[Symbol(letter, :axis)] function update_limits!(sp::Subplot{PyPlotBackend}, series::Series, letters) for letter in letters # axis = get_axis(sp, letter) # expand_extrema!(axis, series.d[letter]) # set_lims!(sp, axis) - setPyPlotLims(sp.o, sp.attr[symbol(letter, :axis)]) + setPyPlotLims(sp.o, sp.attr[Symbol(letter, :axis)]) end end @@ -925,7 +925,7 @@ end # lims == :auto && return # ltype = limsType(lims) # if ltype == :limits -# setf = ax[symbol("set_", letter, "lim")] +# setf = ax[Symbol("set_", letter, "lim")] # l1, l2 = lims # if isfinite(l1) # letter == :x ? setf(left = l1) : setf(bottom = l1) @@ -941,16 +941,16 @@ end function setPyPlotLims(ax, axis::Axis) letter = axis[:letter] lims = axis_limits(axis) - ax[symbol("set_", letter, "lim")](lims...) + ax[Symbol("set_", letter, "lim")](lims...) end function addPyPlotTicks(ax, ticks, letter) ticks == :auto && return - axis = ax[symbol(letter,"axis")] + axis = ax[Symbol(letter,"axis")] if ticks == :none || ticks == nothing kw = KW() for dir in (:top,:bottom,:left,:right) - kw[dir] = kw[symbol(:label,dir)] = "off" + kw[dir] = kw[Symbol(:label,dir)] = "off" end axis[:set_tick_params](;which="both", kw...) return @@ -968,7 +968,7 @@ function addPyPlotTicks(ax, ticks, letter) end function applyPyPlotScale(ax, scaleType::Symbol, letter) - func = ax[symbol("set_", letter, "scale")] + func = ax[Symbol("set_", letter, "scale")] scaleType == :identity && return func("linear") scaleType == :ln && return func("log", basex = e, basey = e) scaleType == :log2 && return func("log", basex = 2, basey = 2) @@ -981,7 +981,7 @@ function updateAxisColors(ax, a::Axis) for (loc, spine) in ax[:spines] spine[:set_color](getPyPlotColor(a[:foreground_color_border])) end - axissym = symbol(a[:letter], :axis) + axissym = Symbol(a[:letter], :axis) if haskey(ax, axissym) ax[:tick_params](axis=string(a[:letter]), which="both", colors=getPyPlotColor(a[:foreground_color_axis]), @@ -1025,18 +1025,18 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend}) # axis attributes for letter in (:x, :y, :z) - axissym = symbol(letter, :axis) + axissym = Symbol(letter, :axis) axis = attr[axissym] haskey(ax, axissym) || continue applyPyPlotScale(ax, axis[:scale], letter) setPyPlotLims(ax, axis) addPyPlotTicks(ax, get_ticks(axis), letter) - ax[symbol("set_", letter, "label")](axis[:guide]) + ax[Symbol("set_", letter, "label")](axis[:guide]) if get(axis.d, :flip, false) - ax[symbol("invert_", letter, "axis")]() + ax[Symbol("invert_", letter, "axis")]() end ax[axissym][:label][:set_fontsize](axis[:guidefont].pointsize) - for lab in ax[symbol("get_", letter, "ticklabels")]() + for lab in ax[Symbol("get_", letter, "ticklabels")]() lab[:set_fontsize](axis[:tickfont].pointsize) lab[:set_rotation](axis[:rotation]) end @@ -1096,7 +1096,7 @@ end # ----------------------------------------------------------------- -function createPyPlotAnnotationObject(sp::Subplot{PyPlotBackend}, x, y, val::@compat(AbstractString)) +function createPyPlotAnnotationObject(sp::Subplot{PyPlotBackend}, x, y, val::@compat(String)) ax = sp.o ax[:annotate](val, xy = (x,y)) end @@ -1275,8 +1275,8 @@ const _pyplot_mimeformats = Dict( for (mime, fmt) in _pyplot_mimeformats - # @eval function Base.writemime(io::IO, ::MIME{symbol($mime)}, plt::Plot{PyPlotBackend}) - @eval function _writemime(io::IO, ::MIME{symbol($mime)}, plt::Plot{PyPlotBackend}) + # @eval function Base.writemime(io::IO, ::MIME{Symbol($mime)}, plt::Plot{PyPlotBackend}) + @eval function _writemime(io::IO, ::MIME{Symbol($mime)}, plt::Plot{PyPlotBackend}) # finalizePlot(plt) fig = getfig(plt.o) fig.o["canvas"][:print_figure]( diff --git a/src/backends/unicodeplots.jl b/src/backends/unicodeplots.jl index b0adbcb7..4a78b057 100644 --- a/src/backends/unicodeplots.jl +++ b/src/backends/unicodeplots.jl @@ -280,7 +280,7 @@ end # ------------------------------- # since this is such a hack, it's only callable using `png`... should error during normal `writemime` -function png(plt::AbstractPlot{UnicodePlotsBackend}, fn::@compat(AbstractString)) +function png(plt::AbstractPlot{UnicodePlotsBackend}, fn::@compat(String)) fn = addExtension(fn, "png") # make some whitespace and show the plot diff --git a/src/backends/web.jl b/src/backends/web.jl index 2920ba68..cc8b6782 100644 --- a/src/backends/web.jl +++ b/src/backends/web.jl @@ -4,7 +4,7 @@ # CREDIT: parts of this implementation were inspired by @joshday's PlotlyLocal.jl -function standalone_html(plt::AbstractPlot; title::AbstractString = get(plt.attr, :window_title, "Plots.jl")) +function standalone_html(plt::AbstractPlot; title::@compat(String) = get(plt.attr, :window_title, "Plots.jl")) """ @@ -19,7 +19,7 @@ function standalone_html(plt::AbstractPlot; title::AbstractString = get(plt.attr """ end -function open_browser_window(filename::AbstractString) +function open_browser_window(filename::@compat(String)) @osx_only return run(`open $(filename)`) @linux_only return run(`xdg-open $(filename)`) @windows_only return run(`$(ENV["COMSPEC"]) /c start $(filename)`) diff --git a/src/colors.jl b/src/colors.jl index a62f1bf1..4ae7ac73 100644 --- a/src/colors.jl +++ b/src/colors.jl @@ -18,7 +18,7 @@ colorscheme(c::Colorant; kw...) = ColorWrapper(c; kw...) # -------------------------------------------------------------- -convertColor(c::@compat(Union{AbstractString, Symbol})) = parse(Colorant, string(c)) +convertColor(c::@compat(Union{@compat(String), Symbol})) = parse(Colorant, string(c)) convertColor(c::Colorant) = c convertColor(cvec::AbstractVector) = map(convertColor, cvec) convertColor(c::ColorScheme) = c @@ -390,7 +390,7 @@ webcolor(c, α) = webcolor(convertColor(getColor(c), α)) # # # update sub-background colors # for bgtype in ("legend", "inside", "outside") -# bgsym = symbol("background_color_" * bgtype) +# bgsym = Symbol("background_color_" * bgtype) # if d[bgsym] == :match # d[bgsym] = d[:background_color] # elseif d[bgsym] == nothing @@ -400,7 +400,7 @@ webcolor(c, α) = webcolor(convertColor(getColor(c), α)) # # # update sub-foreground colors # for fgtype in ("legend", "grid", "axis", "text", "border", "guide") -# fgsym = symbol("foreground_color_" * fgtype) +# fgsym = Symbol("foreground_color_" * fgtype) # if d[fgsym] == :match # d[fgsym] = d[:foreground_color] # elseif d[fgsym] == nothing diff --git a/src/components.jl b/src/components.jl index 53e88e10..cb97f302 100644 --- a/src/components.jl +++ b/src/components.jl @@ -110,7 +110,7 @@ const _shapes = KW( ) for n in [4,5,6,7,8] - _shapes[symbol("star$n")] = makestar(n) + _shapes[Symbol("star$n")] = makestar(n) end # ----------------------------------------------------------------------- @@ -196,7 +196,7 @@ end immutable Font - family::AbstractString + family::@compat(String) pointsize::Int halign::Symbol valign::Symbol @@ -227,7 +227,7 @@ function font(args...) valign = arg elseif T <: Colorant color = arg - elseif T <: @compat Union{Symbol,AbstractString} + elseif T <: @compat Union{Symbol,@compat(String)} try color = parse(Colorant, string(arg)) catch @@ -247,7 +247,7 @@ end "Wrap a string with font info" immutable PlotText - str::@compat(AbstractString) + str::@compat(String) font::Font end PlotText(str) = PlotText(string(str), font()) @@ -287,7 +287,7 @@ function stroke(args...; alpha = nothing) style = arg elseif T <: Colorant color = arg - elseif T <: @compat Union{Symbol,AbstractString} + elseif T <: @compat Union{Symbol,@compat(String)} try color = parse(Colorant, string(arg)) end @@ -319,7 +319,7 @@ function brush(args...; alpha = nothing) if T <: Colorant color = arg - elseif T <: @compat Union{Symbol,AbstractString} + elseif T <: @compat Union{Symbol,@compat(String)} try color = parse(Colorant, string(arg)) end @@ -367,12 +367,11 @@ Base.copy(surf::Surface) = Surface(copy(surf.surf)) Base.eltype(surf::Surface) = eltype(surf.surf) function expand_extrema!(a::Axis, surf::Surface) - v = surf.surf - if !isempty(v) - emin, emax = a[:extrema] - a[:extrema] = (min(minimum(v), emin), max(maximum(v), emax)) + ex = a[:extrema] + for vi in surf.surf + expand_extrema!(ex, vi) end - a[:extrema] + ex end "For the case of representing a surface as a function of x/y... can possibly avoid allocations." diff --git a/src/output.jl b/src/output.jl index ef763990..f174e604 100644 --- a/src/output.jl +++ b/src/output.jl @@ -2,48 +2,48 @@ defaultOutputFormat(plt::Plot) = "png" -function png(plt::Plot, fn::@compat(AbstractString)) +function png(plt::Plot, fn::@compat(String)) fn = addExtension(fn, "png") io = open(fn, "w") writemime(io, MIME("image/png"), plt) close(io) end -png(fn::@compat(AbstractString)) = png(current(), fn) +png(fn::@compat(String)) = png(current(), fn) -function svg(plt::Plot, fn::@compat(AbstractString)) +function svg(plt::Plot, fn::@compat(String)) fn = addExtension(fn, "svg") io = open(fn, "w") writemime(io, MIME("image/svg+xml"), plt) close(io) end -svg(fn::@compat(AbstractString)) = svg(current(), fn) +svg(fn::@compat(String)) = svg(current(), fn) -function pdf(plt::Plot, fn::@compat(AbstractString)) +function pdf(plt::Plot, fn::@compat(String)) fn = addExtension(fn, "pdf") io = open(fn, "w") writemime(io, MIME("application/pdf"), plt) close(io) end -pdf(fn::@compat(AbstractString)) = pdf(current(), fn) +pdf(fn::@compat(String)) = pdf(current(), fn) -function ps(plt::Plot, fn::@compat(AbstractString)) +function ps(plt::Plot, fn::@compat(String)) fn = addExtension(fn, "ps") io = open(fn, "w") writemime(io, MIME("application/postscript"), plt) close(io) end -ps(fn::@compat(AbstractString)) = ps(current(), fn) +ps(fn::@compat(String)) = ps(current(), fn) -function tex(plt::Plot, fn::@compat(AbstractString)) +function tex(plt::Plot, fn::@compat(String)) fn = addExtension(fn, "tex") io = open(fn, "w") writemime(io, MIME("application/x-tex"), plt) close(io) end -tex(fn::@compat(AbstractString)) = tex(current(), fn) +tex(fn::@compat(String)) = tex(current(), fn) # ---------------------------------------------------------------- @@ -57,7 +57,7 @@ tex(fn::@compat(AbstractString)) = tex(current(), fn) "tex" => tex, ) -function getExtension(fn::@compat(AbstractString)) +function getExtension(fn::@compat(String)) pieces = split(fn, ".") length(pieces) > 1 || error("Can't extract file extension: ", fn) ext = pieces[end] @@ -65,7 +65,7 @@ function getExtension(fn::@compat(AbstractString)) ext end -function addExtension(fn::@compat(AbstractString), ext::@compat(AbstractString)) +function addExtension(fn::@compat(String), ext::@compat(String)) try oldext = getExtension(fn) if oldext == ext @@ -78,7 +78,7 @@ function addExtension(fn::@compat(AbstractString), ext::@compat(AbstractString)) end end -function savefig(plt::Plot, fn::@compat(AbstractString)) +function savefig(plt::Plot, fn::@compat(String)) # get the extension local ext @@ -96,7 +96,7 @@ function savefig(plt::Plot, fn::@compat(AbstractString)) end func(plt, fn) end -savefig(fn::@compat(AbstractString)) = savefig(current(), fn) +savefig(fn::@compat(String)) = savefig(current(), fn) # --------------------------------------------------------- @@ -128,7 +128,7 @@ const _best_html_output_type = KW( # a backup for html... passes to svg or png depending on the html_output_format arg function Base.writemime(io::IO, ::MIME"text/html", plt::Plot) - output_type = symbol(plt.attr[:html_output_format]) + output_type = Symbol(plt.attr[:html_output_format]) if output_type == :auto output_type = get(_best_html_output_type, backend_name(plt.backend), :svg) end @@ -171,7 +171,7 @@ end # IJulia # --------------------------------------------------------- -const _ijulia_output = ASCIIString["text/html"] +const _ijulia_output = @compat(String)["text/html"] function setup_ijulia() # override IJulia inline display @@ -179,18 +179,18 @@ function setup_ijulia() @eval begin import IJulia export set_ijulia_output - function set_ijulia_output(mimestr::ASCIIString) + function set_ijulia_output(mimestr::@compat(String)) # info("Setting IJulia output format to $mimestr") global _ijulia_output _ijulia_output[1] = mimestr end function IJulia.display_dict(plt::Plot) global _ijulia_output - Dict{ASCIIString, ByteString}(_ijulia_output[1] => sprint(writemime, _ijulia_output[1], plt)) + Dict{@compat(String), ByteString}(_ijulia_output[1] => sprint(writemime, _ijulia_output[1], plt)) end end - # IJulia.display_dict(plt::Plot) = Dict{ASCIIString, ByteString}("text/html" => sprint(writemime, "text/html", plt)) + # IJulia.display_dict(plt::Plot) = Dict{@compat(String), ByteString}("text/html" => sprint(writemime, "text/html", plt)) set_ijulia_output("text/html") end end diff --git a/src/plot.jl b/src/plot.jl index 8ab41d7b..a42bc9ad 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -199,7 +199,7 @@ end function strip_first_letter(s::Symbol) str = string(s) - str[1:1], symbol(str[2:end]) + str[1:1], Symbol(str[2:end]) end @@ -231,7 +231,7 @@ function _apply_series_recipe(plt::Plot, d::KW) if st != :image for letter in (:x, :y, :z) data = d[letter] - axis = sp.attr[symbol(letter, "axis")] + axis = sp.attr[Symbol(letter, "axis")] if eltype(data) <: Number expand_extrema!(axis, data) elseif isa(data, Surface) && eltype(data.surf) <: Number @@ -241,7 +241,7 @@ function _apply_series_recipe(plt::Plot, d::KW) # as well as any coord offset (think of boxplot shape coords... they all # correspond to the same x-value) # @show letter,eltype(data),typeof(data) - d[letter], d[symbol(letter,"_discrete_indices")] = discrete_value!(axis, data) + d[letter], d[Symbol(letter,"_discrete_indices")] = discrete_value!(axis, data) end end end @@ -501,8 +501,8 @@ end # # TODO: remove?? this is the old way of handling discrete data... should be # # replaced by the Axis type and logic # function setTicksFromStringVector(plt::Plot, d::KW, di::KW, letter) -# sym = symbol(letter) -# ticksym = symbol(letter * "ticks") +# sym = Symbol(letter) +# ticksym = Symbol(letter * "ticks") # pargs = plt.attr # v = di[sym] # @@ -534,7 +534,7 @@ end # plt.attr[ticksym] = ticks, labels # # # add an origsym field so that later on we can re-compute the x vector if ticks change -# origsym = symbol(letter * "orig") +# origsym = Symbol(letter * "orig") # di[origsym] = v # di[sym] = get_indices(v, labels) # diff --git a/src/recipes.jl b/src/recipes.jl index 10558548..7b002e59 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -28,8 +28,8 @@ macro userplot(expr::Expr) end typename = expr.args[2] - funcname = symbol(lowercase(string(typename))) - funcname2 = symbol(funcname, "!") + funcname = Symbol(lowercase(string(typename))) + funcname2 = Symbol(funcname, "!") # @show typename funcname expr # return a code block with the type definition and convenience plotting methods @@ -81,7 +81,7 @@ if is_installed("DataFrames") function handle_dfs(df::DataFrames.AbstractDataFrame, d::KW, letter, dfs::DFS) if isa(dfs, Symbol) - get!(d, symbol(letter * "guide"), string(dfs)) + get!(d, Symbol(letter * "guide"), string(dfs)) collect(df[dfs]) else get!(d, :label, reshape(dfs, 1, length(dfs))) @@ -135,10 +135,10 @@ end # expr.args[1].head == :(-->) # end # -# function _equals_symbol(arg::Symbol, sym::Symbol) +# function _equals_Symbol(arg::Symbol, sym::Symbol) # arg == sym # end -# function _equals_symbol(arg::Expr, sym::Symbol) +# function _equals_Symbol(arg::Expr, sym::Symbol) # arg.head == :quote && arg.args[1] == sym # end # @@ -152,11 +152,11 @@ end # quiet, require, force = false, false, false # if _is_arrow_tuple(e) # for flag in e.args -# if _equals_symbol(flag, :quiet) +# if _equals_Symbol(flag, :quiet) # quiet = true -# elseif _equals_symbol(flag, :require) +# elseif _equals_Symbol(flag, :require) # require = true -# elseif _equals_symbol(flag, :force) +# elseif _equals_Symbol(flag, :force) # force = true # end # end diff --git a/src/series_args.jl b/src/series_args.jl index 02dd383d..c22a80f1 100644 --- a/src/series_args.jl +++ b/src/series_args.jl @@ -476,7 +476,7 @@ compute_xyz(x::Void, y::Void, z::Void) = error("x/y/z are all nothing!") # # function handle_dfs(df::DataFrames.AbstractDataFrame, d::KW, letter, dfs::DFS) # if isa(dfs, Symbol) -# get!(d, symbol(letter * "label"), string(dfs)) +# get!(d, Symbol(letter * "label"), string(dfs)) # collect(df[dfs]) # else # get!(d, :label, reshape(dfs, 1, length(dfs))) diff --git a/src/utils.jl b/src/utils.jl index a910f7f9..eabd7ec9 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -274,8 +274,8 @@ limsType{T<:Real,S<:Real}(lims::@compat(Tuple{T,S})) = :limits limsType(lims::Symbol) = lims == :auto ? :auto : :invalid limsType(lims) = :invalid -# axis_symbol(letter, postfix) = symbol(letter * postfix) -# axis_symbols(letter, postfix...) = map(s -> axis_symbol(letter, s), postfix) +# axis_Symbol(letter, postfix) = Symbol(letter * postfix) +# axis_symbols(letter, postfix...) = map(s -> axis_Symbol(letter, s), postfix) Base.convert{T<:Real}(::Type{Vector{T}}, rng::Range{T}) = T[x for x in rng] Base.convert{T<:Real,S<:Real}(::Type{Vector{T}}, rng::Range{S}) = T[x for x in rng]