diff --git a/src/args.jl b/src/args.jl index e673c937..e40b0216 100644 --- a/src/args.jl +++ b/src/args.jl @@ -91,8 +91,9 @@ const _allMarkers = vcat(:none, :auto, sort(collect(keys(_shapes)))) :n => :none, :no => :none, :a => :auto, - :circle => :ellipse, - :c => :ellipse, + :ellipse => :circle, + :c => :circle, + :circ => :circle, :square => :rect, :sq => :rect, :r => :rect, @@ -628,7 +629,7 @@ function preprocessArgs!(d::KW) if haskey(d, :markershape) d[:markershape] = _replace_markershape(d[:markershape]) elseif anymarker - d[:markershape_to_add] = :ellipse # add it after _apply_recipe + d[:markershape_to_add] = :circle # add it after _apply_recipe end # handle fill diff --git a/src/backends/bokeh.jl b/src/backends/bokeh.jl index 1c67b5b9..286267de 100644 --- a/src/backends/bokeh.jl +++ b/src/backends/bokeh.jl @@ -61,7 +61,7 @@ supported_args(::BokehBackend) = merge_with_base_supported([ ]) supported_types(::BokehBackend) = [:path, :scatter] supported_styles(::BokehBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] -supported_markers(::BokehBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] +supported_markers(::BokehBackend) = [:none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] supported_scales(::BokehBackend) = [:identity, :ln] is_subplot_supported(::BokehBackend) = false @@ -80,7 +80,7 @@ end const _glyphtypes = KW( - :ellipse => :Circle, + :circle => :Circle, :rect => :Square, :diamond => :Diamond, :utriangle => :Triangle, @@ -99,7 +99,7 @@ function bokeh_glyph_type(d::KW) st = d[:seriestype] mt = d[:markershape] if st == :scatter && mt == :none - mt = :ellipse + mt = :circle end # if we have a marker, use that diff --git a/src/backends/gadfly.jl b/src/backends/gadfly.jl index d32599b7..1a1df404 100644 --- a/src/backends/gadfly.jl +++ b/src/backends/gadfly.jl @@ -301,7 +301,7 @@ function addGadflySeries!(plt::Plot, d::KW) if st in (:histogram2d, :hexbin) && (isa(d[:fillcolor], ColorGradient) || isa(d[:fillcolor], ColorFunction)) push!(gplt.scales, Gadfly.Scale.ContinuousColorScale(p -> RGB(getColorZ(d[:fillcolor], p)))) elseif st == :scatter && d[:markershape] == :none - d[:markershape] = :ellipse + d[:markershape] = :circle end # markers diff --git a/src/backends/glvisualize.jl b/src/backends/glvisualize.jl index de834204..c177b19e 100644 --- a/src/backends/glvisualize.jl +++ b/src/backends/glvisualize.jl @@ -4,64 +4,34 @@ supported_args(::GLVisualizeBackend) = merge_with_base_supported([ # :annotations, - # :axis, - # :background_color, - # :color_palette, - # :fillrange, - # :fillcolor, - # :fillalpha, - # :foreground_color, - # :group, + # :background_color_legend, :background_color_inside, :background_color_outside, + # :foreground_color_grid, :foreground_color_legend, :foreground_color_title, + # :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, # :label, - # :layout, - # :legend, - # :linecolor, - # :linestyle, - # :seriestype - # :seriescolor, :seriesalpha, - # :linewidth, - # :linealpha, - # :markershape, - # :markercolor, - # :markersize, - # :markeralpha, - # :markerstrokewidth, - # :markerstrokecolor, - # :markerstrokestyle, - # :n, - # :bins, - # :nc, - # :nr, - # :pos, - # :smooth, - # :show, - # :size, - # :title, + # :linecolor, :linestyle, :linewidth, :linealpha, + # :markershape, :markercolor, :markersize, :markeralpha, + # :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, + # :fillrange, :fillcolor, :fillalpha, + # :bins, :bar_width, :bar_edges, :bar_position, + # :title, :title_location, :titlefont, # :window_title, - # :x, - # :xguide, - # :xlims, - # :xticks, - # :y, - # :yguide, - # :ylims, - # :yrightlabel, - # :yticks, - # :xscale, - # :yscale, - # :xflip, - # :yflip, - # :z, - # :tickfont, - # :guidefont, - # :legendfont, - # :grid, - # :surface - # :levels, + # :guide, :lims, :ticks, :scale, :flip, :rotation, + # :tickfont, :guidefont, :legendfont, + # :grid, :legend, :colorbar, + # :marker_z, :levels, + # :ribbon, :quiver, :arrow, + # :orientation, + # :overwrite_figure, + # :polar, + # :normalize, :weights, + # :contours, :aspect_ratio, + # :match_dimensions, + # :clims, + # :inset_subplots, ]) supported_types(::GLVisualizeBackend) = [:surface] supported_styles(::GLVisualizeBackend) = [:auto, :solid] -supported_markers(::GLVisualizeBackend) = [:none, :auto, :ellipse] +supported_markers(::GLVisualizeBackend) = [:none, :auto, :circle] supported_scales(::GLVisualizeBackend) = [:identity] is_subplot_supported(::GLVisualizeBackend) = false @@ -69,10 +39,10 @@ is_subplot_supported(::GLVisualizeBackend) = false function _initialize_backend(::GLVisualizeBackend; kw...) - @eval begin - import GLVisualize - export GLVisualize - end + @eval begin + import GLVisualize + export GLVisualize + end end # --------------------------------------------------------------------------- @@ -81,55 +51,37 @@ immutable GLScreenWrapper window end -# function _create_plot(pkg::GLVisualizeBackend, d::KW) -function _create_backend_figure(plt::Plot{GLVisualizeBackend}) - # TODO: create the window/canvas/context that is the plot within the backend - # TODO: initialize the plot... title, xlabel, bgcolor, etc +function gl_display(plt::Plot{GLVisualizeBackend}) + # init a window + w=GLVisualize.glscreen() + @async GLVisualize.renderloop(w) + GLScreenWrapper(w) - # TODO: this should be moved to the display method? - w=GLVisualize.glscreen() - @async GLVisualize.renderloop(w) - GLScreenWrapper(w) - # Plot(GLScreenWrapper(w), pkg, 0, d, KW[]) + for sp in plt.subplots + # TODO: setup subplot + + for series in series_list(sp) + # TODO: setup series + d = series.d + st = d[:seriestype] + + if st == :surface + x, y, z = map(Float32, series.d[:x]), map(Float32, series.d[:y]), map(Float32, series.d[:z].surf) + GLVisualize.view(GLVisualize.visualize((x*ones(y)', ones(x)*y', z), :surface), plt.o.window) + else + error("Series type $st not supported by GLVisualize") + end + end + end end # ---------------------------------------------------------------- -function _series_added(plt::Plot{GLVisualizeBackend}, series::Series) - # TODO: add one series to the underlying package - # TODO: this should be moved to the display method? - x, y, z = map(Float32, series.d[:x]), map(Float32, series.d[:y]), map(Float32, series.d[:z].surf) - GLVisualize.view(GLVisualize.visualize((x*ones(y)', ones(x)*y', z), :surface), plt.o.window) - # plt -end - - -# When series data is added/changed, this callback can do dynamic updates to the backend object. -# note: if the backend rebuilds the plot from scratch on display, then you might not do anything here. -function _series_updated(plt::Plot{GLVisualizeBackend}, series::Series) - # TODO -end - -# ---------------------------------------------------------------- - - -# Override this to update plot items (title, xlabel, etc), and add annotations (d[:annotations]) -function _update_plot_object(plt::Plot{GLVisualizeBackend}) - # TODO -end - - -# ---------------------------------------------------------------- - -function _writemime(io::IO, ::MIME"image/png", plt::AbstractPlot{GLVisualizeBackend}) - # TODO: write a png to io -end +# function _writemime(io::IO, ::MIME"image/png", plt::AbstractPlot{GLVisualizeBackend}) +# # TODO: write a png to io +# end function _display(plt::Plot{GLVisualizeBackend}) - # TODO: display/show the plot - - # NOTE: I think maybe this should be empty? We can start with the assumption that creating - # and adding to a plot will automatically open a window and draw to it, then the display - # wouldn't actually need to do anything + gl_display(plt) end diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 476d3ff1..8554294f 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -63,7 +63,7 @@ const gr_linetype = KW( const gr_markertype = KW( :auto => 1, :none => -1, - :ellipse => -1, + :circle => -1, :rect => -7, :diamond => -13, :utriangle => -3, diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index d7f131e2..71b479a9 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -34,7 +34,7 @@ supported_args(::PGFPlotsBackend) = merge_with_base_supported([ ]) supported_types(::PGFPlotsBackend) = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :histogram2d, :ysticks, :xsticks, :contour] supported_styles(::PGFPlotsBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] -supported_markers(::PGFPlotsBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon] #vcat(_allMarkers, Shape) +supported_markers(::PGFPlotsBackend) = [:none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon] #vcat(_allMarkers, Shape) supported_scales(::PGFPlotsBackend) = [:identity, :ln, :log2, :log10] is_subplot_supported(::PGFPlotsBackend) = false @@ -66,7 +66,7 @@ const _pgfplots_markers = KW( :xcross => "x", :utriangle => "triangle*", :dtriangle => "triangle*", - :ellipse => "*", + :circle => "*", :rect => "square*", :star5 => "star", :star6 => "asterisk", diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 4598cf7d..325ab4e0 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -37,7 +37,7 @@ supported_types(::PlotlyBackend) = [ ] supported_styles(::PlotlyBackend) = [:auto, :solid, :dash, :dot, :dashdot] supported_markers(::PlotlyBackend) = [ - :none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, + :none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :pentagon, :hexagon, :octagon, :vline, :hline ] supported_scales(::PlotlyBackend) = [:identity, :log10] diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 6a73521d..7c25ab26 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -149,7 +149,7 @@ end # get the marker shape function py_marker(marker::Symbol) marker == :none && return " " - marker == :ellipse && return "o" + marker == :circle && return "o" marker == :rect && return "s" marker == :diamond && return "D" marker == :utriangle && return "^" diff --git a/src/backends/qwt.jl b/src/backends/qwt.jl index e4b43ac9..c311f3db 100644 --- a/src/backends/qwt.jl +++ b/src/backends/qwt.jl @@ -22,7 +22,7 @@ supported_args(::QwtBackend) = merge_with_base_supported([ :guide, :lims, :ticks, :scale, ]) supported_types(::QwtBackend) = [:path, :scatter, :hexbin, :bar] -supported_markers(::QwtBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :star8, :hexagon] +supported_markers(::QwtBackend) = [:none, :auto, :rect, :circle, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :star8, :hexagon] supported_scales(::QwtBackend) = [:identity, :log10] is_subplot_supported(::QwtBackend) = true @@ -72,13 +72,13 @@ function adjustQwtKeywords(plt::Plot{QwtBackend}, iscreating::Bool; kw...) if st == :scatter d[:seriestype] = :none if d[:markershape] == :none - d[:markershape] = :ellipse + d[:markershape] = :circle end elseif st in (:hline, :vline) addLineMarker(plt, d) d[:seriestype] = :none - d[:markershape] = :ellipse + d[:markershape] = :circle d[:markersize] = 1 if st == :vline d[:x], d[:y] = d[:y], d[:x] diff --git a/src/backends/unicodeplots.jl b/src/backends/unicodeplots.jl index eb3a6ab2..35975b2e 100644 --- a/src/backends/unicodeplots.jl +++ b/src/backends/unicodeplots.jl @@ -17,7 +17,7 @@ supported_types(::UnicodePlotsBackend) = [ :histogram2d ] supported_styles(::UnicodePlotsBackend) = [:auto, :solid] -supported_markers(::UnicodePlotsBackend) = [:none, :auto, :ellipse] +supported_markers(::UnicodePlotsBackend) = [:none, :auto, :circle] supported_scales(::UnicodePlotsBackend) = [:identity] is_subplot_supported(::UnicodePlotsBackend) = true diff --git a/src/backends/winston.jl b/src/backends/winston.jl index 10117100..db9ca629 100644 --- a/src/backends/winston.jl +++ b/src/backends/winston.jl @@ -23,7 +23,7 @@ supported_args(::WinstonBackend) = merge_with_base_supported([ ]) supported_types(::WinstonBackend) = [:path, :scatter, :bar] supported_styles(::WinstonBackend) = [:auto, :solid, :dash, :dot, :dashdot] -supported_markers(::WinstonBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] +supported_markers(::WinstonBackend) = [:none, :auto, :rect, :circle, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] supported_scales(::WinstonBackend) = [:identity, :log10] is_subplot_supported(::WinstonBackend) = false @@ -52,7 +52,7 @@ end @compat const winston_marker = KW(:none=>".", :rect => "square", - :ellipse=>"circle", + :circle=>"circle", :diamond=>"diamond", :utriangle=>"triangle", :dtriangle=>"down-triangle", @@ -135,7 +135,7 @@ function _series_added(plt::Plot{WinstonBackend}, series::Series) elseif d[:seriestype] == :scatter if d[:markershape] == :none - d[:markershape] = :ellipse + d[:markershape] = :circle end # elseif d[:seriestype] == :step diff --git a/src/components.jl b/src/components.jl index 65055dc3..d7d05902 100644 --- a/src/components.jl +++ b/src/components.jl @@ -101,7 +101,7 @@ function makearrowhead(angle; h = 2.0, w = 0.4) end const _shapes = KW( - :ellipse => makeshape(20), + :circle => makeshape(20), :rect => makeshape(4, offset=-0.25), :diamond => makeshape(4), :utriangle => makeshape(3), diff --git a/src/recipes.jl b/src/recipes.jl index a1601033..807a3e94 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -501,7 +501,7 @@ end @recipe function f(::Type{Val{:scatter3d}}, x, y, z) seriestype := :path3d if d[:markershape] == :none - markershape := :ellipse + markershape := :circle end linewidth := 0 linealpha := 0 @@ -606,7 +606,7 @@ notch_width(q2, q4, N) = 1.58 * (q4-q2)/sqrt(N) # Outliers @series begin seriestype := :scatter - markershape := :ellipse + markershape := :circle x := outliers_x y := outliers_y label := "" diff --git a/src/series_new.jl b/src/series_new.jl index ad861949..fc3c224c 100644 --- a/src/series_new.jl +++ b/src/series_new.jl @@ -56,7 +56,7 @@ function _add_defaults!(d::KW, plt::Plot, sp::Subplot, commandIndex::Int) if d[:seriestype] in (:scatter, :scatter3d) d[:linewidth] = 0 if d[:markershape] == :none - d[:markershape] = :ellipse + d[:markershape] = :circle end end