From 00201b5f9c615df81a58b8c85316c5981adf8e79 Mon Sep 17 00:00:00 2001 From: Josef Heinen Date: Wed, 11 May 2016 16:18:03 +0200 Subject: [PATCH 1/7] Added (native) image support --- src/backends/gr.jl | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index ece9500d..c82f6439 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -36,14 +36,18 @@ supportedArgs(::GRBackend) = [ :aspect_ratio ] supportedAxes(::GRBackend) = _allAxes -supportedTypes(::GRBackend) = [:none, :line, :path, :steppre, :steppost, :sticks, - :scatter, :hist2d, :hexbin, :hist, :density, :bar, - :hline, :vline, :contour, :heatmap, :path3d, :scatter3d, :surface, - :wireframe, :ohlc, :pie] +supportedTypes(::GRBackend) = [ + :none, :line, :path, :steppre, :steppost, + :scatter, :hist2d, :hexbin, :hist, :density, + :bar, :sticks, + :hline, :vline, :heatmap, :pie, :image, :ohlc, + :contour, :path3d, :scatter3d, :surface, :wireframe + ] supportedStyles(::GRBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] supportedMarkers(::GRBackend) = vcat(_allMarkers, Shape) supportedScales(::GRBackend) = [:identity, :log10] subplotSupported(::GRBackend) = true +nativeImagesSupported(::GRBackend) = true # -------------------------------------------------------------------------------------- @@ -721,6 +725,19 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true, a1 = a2 end GR.selntran(1) + elseif lt == :image + img = p[:z].surf + w, h = size(img) + if eltype(img) <: Colors.AbstractGray + grey = round(UInt8, float(img) * 255) + rgba = map(c -> UInt32( 0xff000000 + Int(c)<<16 + Int(c)<<8 + Int(c) ), grey) + else + rgba = map(c -> UInt32( round(Int, alpha(c) * 255) << 24 + + round(Int, blue(c) * 255) << 16 + + round(Int, green(c) * 255) << 8 + + round(Int, red(c) * 255) ), img) + end + GR.drawimage(xmin, xmax, ymin, ymax, w, h, rgba) elseif lt == :polar xmin, xmax, ymin, ymax = viewport ymax -= 0.05 * (xmax - xmin) From 5109c6f72b49c9c59bc4c6a165eaaea63a4c4f98 Mon Sep 17 00:00:00 2001 From: Josef Heinen Date: Thu, 12 May 2016 15:29:43 +0200 Subject: [PATCH 2/7] Fixed some bugs in gr.jl - Turn off interpolation for heatmaps - Fixed bug plotting scatter after heatmap (scatter drew to the colorbar viewport) - Don't draw superfluous legends --- src/backends/gr.jl | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index c82f6439..3e03198e 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -438,9 +438,9 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true, GR.setcolormap(1000 + GR.COLORMAP_COOLWARM) - legend = false + legend = falses(length(plt.seriesargs)) - for p in plt.seriesargs + for (ind, p) in enumerate(plt.seriesargs) lt = p[:linetype] if lt in (:hist2d, :hexbin, :contour, :surface, :wireframe, :heatmap) if isa(p[:fillcolor], ColorGradient) @@ -473,13 +473,13 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true, end GR.polyline(p[:x], p[:y]) end - legend = true + legend[ind] = true end if lt == :line if length(p[:x]) > 1 gr_polyline(p[:x], p[:y]) end - legend = true + legend[ind] = true elseif lt in [:steppre, :steppost] n = length(p[:x]) x = zeros(2*n + 1) @@ -499,13 +499,13 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true, if n > 1 GR.polyline(x, y) end - legend = true + legend[ind] = true elseif lt == :sticks x, y = p[:x], p[:y] for i = 1:length(y) GR.polyline([x[i], x[i]], [ymin, y[i]]) end - legend = true + legend[ind] = true elseif lt == :scatter || (p[:markershape] != :none && axes_2d) GR.setmarkercolorind(gr_getcolorind(p[:markercolor])) gr_setmarkershape(p) @@ -526,7 +526,7 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true, gr_polymarker(p, [p[:x][i]], [p[:y][i]]) end end - legend = true + legend[ind] = true elseif lt == :bar y = p[:y] for i = 1:length(y) @@ -577,6 +577,7 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true, charheight = max(0.016 * diag, 0.01) GR.setcharheight(charheight) GR.colormap() + GR.setviewport(viewport[1], viewport[2], viewport[3], viewport[4]) elseif lt == :contour x, y, z = p[:x], p[:y], transpose_z(p, p[:z].surf, false) zmin, zmax = gr_getzlims(d, minimum(z), maximum(z), false) @@ -597,6 +598,7 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true, charheight = max(0.016 * diag, 0.01) GR.setcharheight(charheight) GR.axes(0, ztick, xmax, zmin, 0, 1, 0.005) + GR.setviewport(viewport[1], viewport[2], viewport[3], viewport[4]) elseif lt in [:surface, :wireframe] x, y, z = p[:x], p[:y], transpose_z(p, p[:z].surf, false) zmin, zmax = gr_getzlims(d, minimum(z), maximum(z), true) @@ -633,11 +635,12 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true, zmin, zmax = gr_getzlims(d, minimum(z), maximum(z), true) GR.setspace(zmin, zmax, 0, 90) z = reshape(z, length(x) * length(y)) - GR.surface(x, y, z, GR.OPTION_CELL_ARRAY) + GR.surface(x, y, z, GR.OPTION_COLORED_MESH) if cmap GR.setviewport(viewport[2] + 0.02, viewport[2] + 0.05, viewport[3], viewport[4]) GR.colormap() + GR.setviewport(viewport[1], viewport[2], viewport[3], viewport[4]) end elseif lt in [:path3d, :scatter3d] x, y, z = p[:x], p[:y], p[:z] @@ -762,15 +765,15 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true, GR.restorestate() end - if d[:legend] != :none && legend + if d[:legend] != :none && any(legend) == true GR.savestate() GR.selntran(0) GR.setscale(0) w = 0 i = 0 n = 0 - for p in plt.seriesargs - if p[:label] == "" + for (ind, p) in enumerate(plt.seriesargs) + if !legend[ind] || p[:label] == "" continue end n += 1 @@ -793,8 +796,8 @@ function gr_display(plt::Plot{GRBackend}, clear=true, update=true, GR.setlinewidth(1) GR.drawrect(px - 0.08, px + w + 0.02, py + dy, py - dy * n) i = 0 - for p in plt.seriesargs - if p[:label] == "" + for (ind, p) in enumerate(plt.seriesargs) + if !legend[ind] || p[:label] == "" continue end GR.setlinewidth(p[:linewidth]) From 534f57b227466c0172d75577f93d5e9b1b8e167c Mon Sep 17 00:00:00 2001 From: Patrick Kofod Mogensen Date: Wed, 11 May 2016 20:23:40 +0200 Subject: [PATCH 3/7] Replace string cats with join() in pgfplots. --- src/backends/pgfplots.jl | 99 +++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 51 deletions(-) diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index a5591e03..98658aaa 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -87,17 +87,17 @@ const _pgfplots_linestyles = KW( ) const _pgfplots_markers = KW( - :none => "mark = none,", - :cross => "mark = +,", - :xcross => "mark = x,", - :utriangle => "mark = triangle*,", - :dtriangle => "mark = triangle*,", - :ellipse => "mark = o*,", - :rect => "mark = square*,", - :star5 => "mark = star,", - :star6 => "mark = asterisk,", - :diamond => "mark = diamond*,", - :pentagon => "mark = pentagon*," + :none => "none", + :cross => "+", + :xcross => "x", + :utriangle => "triangle*", + :dtriangle => "triangle*", + :ellipse => "o*", + :rect => "square*", + :star5 => "star", + :star6 => "asterisk", + :diamond => "diamond*", + :pentagon => "pentagon*" ) const _pgfplots_legend_pos = KW( @@ -120,50 +120,49 @@ end function _pgfplots_get_linestyle!(kwargs, plt) ls = plt[:linestyle] if haskey(_pgfplots_linestyles, ls) - kwargs[:style] *= _pgfplots_linestyles[ls]*"," + push!(kwargs[:style], _pgfplots_linestyles[ls]) end - kwargs[:style] *= "line width = $(plt[:linewidth]) pt"*"," + push!(kwargs[:style], "line width = $(plt[:linewidth]) pt") end function _pgfplots_get_marker!(kwargs, plt) # Control marker shape mark = plt[:markershape] - kwargs[:style] *= _pgfplots_markers[mark] + push!(kwargs[:style], "mark = " * _pgfplots_markers[mark]) # Control marker size - kwargs[:style] *= "mark size = $(plt[:markersize]/2)," + push!(kwargs[:style], "mark size = $(plt[:markersize]/2)") # Control marker colors and alphas α = plt[:markeralpha] == nothing ? 1.0 : plt[:markeralpha] - kwargs[:style] *= "mark options = {color=$(_pgfplots_get_color(plt, :markerstrokecolor))," - kwargs[:style] *= mark == :dtriangle ? "rotate=180," : "" - kwargs[:style] *= "fill=$(_pgfplots_get_color(plt, :markercolor))," - kwargs[:style] *= "fill opacity = $α," + push!(kwargs[:style], "mark options = {color=$(_pgfplots_get_color(plt, :markerstrokecolor))") + mark == :dtriangle && push!(kwargs[:style], "rotate=180") + push!(kwargs[:style], "fill=$(_pgfplots_get_color(plt, :markercolor)), fill opacity = $α") markstrokestyle = plt[:markerstrokestyle] if haskey(_pgfplots_linestyles, markstrokestyle) - kwargs[:style] *= _pgfplots_linestyles[markstrokestyle] + push!(kwargs[:style], _pgfplots_linestyles[markstrokestyle]) end - kwargs[:style] *= "}," + push!(kwargs[:style], "}") end function _pgfplots_get_series_color!(kwargs, plt) α = plt[:seriesalpha] == nothing ? 1.0 : plt[:seriesalpha] - kwargs[:style] *= "color=$(_pgfplots_get_color(plt, :seriescolor))," - kwargs[:style] *= "draw opacity = $α," + push!(kwargs[:style], "color=$(_pgfplots_get_color(plt, :seriescolor))") + push!(kwargs[:style], "draw opacity = $α") end function _pgfplots_get_line_color!(kwargs, plt) α = plt[:linealpha] == nothing ? 1.0 : plt[:linealpha] - kwargs[:style] *= "color=$(_pgfplots_get_color(plt, :linecolor))," - kwargs[:style] *= "draw opacity = $α," + kwargs[:style] *= ", color=$(_pgfplots_get_color(plt, :linecolor))" + kwargs[:style] *= ", draw opacity = $α" end function _pgfplots_get_fill_color!(kwargs, plt) α = plt[:fillalpha] == nothing ? 1.0 : plt[:fillalpha] - kwargs[:style] *= "fill=$(_pgfplots_get_color(plt, :fillcolor))," - kwargs[:style] *= "fill opacity = $α," + kwargs[:style] *= ", fill=$(_pgfplots_get_color(plt, :fillcolor))" + kwargs[:style] *= ", fill opacity = $α" end function _pgfplots_get_label!(kwargs, plt) @@ -172,55 +171,55 @@ function _pgfplots_get_label!(kwargs, plt) end end - function _pgfplots_get_plot_kwargs(plt) kwargs = KW() - kwargs[:style] = "" + kwargs[:style] = [] _pgfplots_get_linestyle!(kwargs, plt) _pgfplots_get_marker!(kwargs, plt) _pgfplots_get_series_color!(kwargs, plt) _pgfplots_get_label!(kwargs, plt) + kwargs[:style] = join(kwargs[:style], ',') kwargs end function _pgfplots_axis(plt_series) line_type = plt_series[:linetype] plt_kwargs = _pgfplots_get_plot_kwargs(plt_series) - if line_type == :path + if line_type == :path PGFPlots.Linear(plt_series[:x], plt_series[:y]; plt_kwargs...) elseif line_type == :path3d PGFPlots.Linear3(plt_series[:x], plt_series[:y], plt_series[:z]; plt_kwargs...) elseif line_type == :scatter PGFPlots.Scatter(plt_series[:x], plt_series[:y]; plt_kwargs...) elseif line_type == :steppre - plt_kwargs[:style] *= "const plot mark right," + plt_kwargs[:style] *= ", const plot mark right" PGFPlots.Linear(plt_series[:x], plt_series[:y]; plt_kwargs...) elseif line_type == :stepmid - plt_kwargs[:style] *= "const plot mark mid," + plt_kwargs[:style] *= ", const plot mark mid" PGFPlots.Linear(plt_series[:x], plt_series[:y]; plt_kwargs...) elseif line_type == :steppost - plt_kwargs[:style] *= "const plot," + plt_kwargs[:style] *= ", const plot" PGFPlots.Linear(plt_series[:x], plt_series[:y]; plt_kwargs...) elseif line_type == :hist #TODO patch this in PGFPlots.jl instead; the problem is that PGFPlots will # save _all_ data points in the figure which can be quite heavy plt_hist = hist(plt_series[:y]) - plt_kwargs[:style] *= "ybar interval," + plt_kwargs[:style] *= ", ybar interval" _pgfplots_get_line_color!(plt_kwargs, plt_series) _pgfplots_get_fill_color!(plt_kwargs, plt_series) PGFPlots.Linear(plt_hist[1][1:end-1]+plt_hist[1].step/2, plt_hist[2]; plt_kwargs...) elseif line_type == :hist2d PGFPlots.Histogram2(plt_series[:x], plt_series[:y]) elseif line_type == :bar - plt_kwargs[:style] *= "ybar," + plt_kwargs[:style] *= ", ybar" _pgfplots_get_line_color!(plt_kwargs, plt_series) _pgfplots_get_fill_color!(plt_kwargs, plt_series) PGFPlots.Linear(plt_series[:x], plt_series[:y]; plt_kwargs...) elseif line_type == :sticks || line_type == :ysticks - plt_kwargs[:style] *= "ycomb" + plt_kwargs[:style] *= ", ycomb" PGFPlots.Linear(plt_series[:x], plt_series[:y]; plt_kwargs...) elseif line_type == :xsticks - plt_kwargs[:style] *= "xcomb" + plt_kwargs[:style] *= ", xcomb" PGFPlots.Linear(plt_series[:x], plt_series[:y]; plt_kwargs...) elseif line_type == :contour PGFPlots.Contour(plt_series[:z].surf, plt_series[:x], plt_series[:y]) @@ -300,36 +299,36 @@ function _pgfplots_get_axis_kwargs(d) for arg in (:xlabel, :ylabel, :zlabel, :title) axisargs[arg] = d[arg] end - axisargs[:style] = "" - axisargs[:style] *= d[:xflip] == true ? "x dir=reverse," : "" - axisargs[:style] *= d[:yflip] == true ? "y dir=reverse," : "" + axisargs[:style] = [] + d[:xflip] == true && push!(axisargs[:style], "x dir=reverse") + d[:yflip] == true && push!(axisargs[:style], "y dir=reverse") if d[:xscale] in (:log, :log2, :ln, :log10) axisargs[:xmode] = "log" if d[:xscale] == :log2 - axisargs[:style] *= "log basis x=2," + push!(axisargs[:style], "log basis x=2") elseif d[:xscale] in (:log, :log10) - axisargs[:style] *= "log basis x=10," + push!(axisargs[:style], "log basis x=10") end end if d[:yscale] in (:log, :log2, :ln, :log10) axisargs[:ymode] = "log" if d[:yscale] == :log2 - axisargs[:style] *= "log basis y=2," + push!(axisargs[:style], "log basis y=2") elseif d[:yscale] in (:log, :log10) - axisargs[:style] *= "log basis x=10," + push!(axisargs[:style], "log basis x=10") end end if d[:zscale] in (:log, :log2, :ln, :log10) axisargs[:zmode] = "log" if d[:zscale] == :log2 - axisargs[:style] *= "log basis z=2," + push!(axisargs[:style], "log basis z=2") elseif d[:zscale] in (:log, :log10) - axisargs[:style] *= "log basis x=10," + push!(axisargs[:style], "log basis x=10") end end # Control background color - axisargs[:style] *= "axis background/.style={fill=$(_pgfplots_get_color(d, :background_color))}," + push!(axisargs[:style], "axis background/.style={fill=$(_pgfplots_get_color(d, :background_color))}") # Control x/y-limits if d[:xlims] !== :auto axisargs[:xmin] = d[:xlims][1] @@ -339,11 +338,8 @@ function _pgfplots_get_axis_kwargs(d) axisargs[:ymin] = d[:ylims][1] axisargs[:ymax] = d[:ylims][2] end - if d[:grid] == true - axisargs[:style] *= "grid = major," - elseif d[:grid] == false - end + d[:grid] == true && push!(axisargs[:style], "grid = major") if d[:aspect_ratio] == :equal || d[:aspect_ratio] == 1 axisargs[:axisEqual] = "true" @@ -352,6 +348,7 @@ function _pgfplots_get_axis_kwargs(d) if ((d[:legend] != :none) || (d[:legend] != :best)) && (d[:legend] in keys(_pgfplots_legend_pos)) axisargs[:legendPos] = _pgfplots_legend_pos[d[:legend]] end + axisargs[:style] = join(axisargs[:style], ',') axisargs end From 89f8030ba1e60e8d2650625da89534d2d928313b Mon Sep 17 00:00:00 2001 From: Patrick Kofod Mogensen Date: Wed, 11 May 2016 21:34:02 +0200 Subject: [PATCH 4/7] Add markerstrokewidth to pgfplots. --- src/backends/pgfplots.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index 98658aaa..55d6e5c4 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -24,7 +24,7 @@ supportedArgs(::PGFPlotsBackend) = [ :markercolor, :markersize, :markeralpha, - # :markerstrokewidth, + :markerstrokewidth, :markerstrokecolor, :markerstrokestyle, # :n, @@ -138,6 +138,7 @@ function _pgfplots_get_marker!(kwargs, plt) # Control marker colors and alphas α = plt[:markeralpha] == nothing ? 1.0 : plt[:markeralpha] push!(kwargs[:style], "mark options = {color=$(_pgfplots_get_color(plt, :markerstrokecolor))") + push!(kwargs[:style], "line width=$(plt[:markerstrokewidth])") mark == :dtriangle && push!(kwargs[:style], "rotate=180") push!(kwargs[:style], "fill=$(_pgfplots_get_color(plt, :markercolor)), fill opacity = $α") markstrokestyle = plt[:markerstrokestyle] From 9231da461036b2754b2302c9801dd58712c95f4d Mon Sep 17 00:00:00 2001 From: Patrick Kofod Mogensen Date: Wed, 11 May 2016 21:58:50 +0200 Subject: [PATCH 5/7] Clean up wall of pushes in _pgfplots_get_marker, and lines starting with kwarg. --- src/backends/pgfplots.jl | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index 55d6e5c4..4eab0671 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -128,42 +128,44 @@ end function _pgfplots_get_marker!(kwargs, plt) - # Control marker shape + # Control marker shape, size, colors, alphas, and stroke width mark = plt[:markershape] - push!(kwargs[:style], "mark = " * _pgfplots_markers[mark]) - - # Control marker size - push!(kwargs[:style], "mark size = $(plt[:markersize]/2)") - - # Control marker colors and alphas α = plt[:markeralpha] == nothing ? 1.0 : plt[:markeralpha] - push!(kwargs[:style], "mark options = {color=$(_pgfplots_get_color(plt, :markerstrokecolor))") - push!(kwargs[:style], "line width=$(plt[:markerstrokewidth])") + push!(kwargs[:style], "mark = " * _pgfplots_markers[mark], + "mark size = $(plt[:markersize]/2)", + "mark options = {color=$(_pgfplots_get_color(plt, :markerstrokecolor))", + "fill=$(_pgfplots_get_color(plt, :markercolor))", + "fill opacity = $α", + "line width=$(plt[:markerstrokewidth])") + + # Rotate the marker if :dtriangle was chosen mark == :dtriangle && push!(kwargs[:style], "rotate=180") - push!(kwargs[:style], "fill=$(_pgfplots_get_color(plt, :markercolor)), fill opacity = $α") - markstrokestyle = plt[:markerstrokestyle] - if haskey(_pgfplots_linestyles, markstrokestyle) - push!(kwargs[:style], _pgfplots_linestyles[markstrokestyle]) + + # Apply marker stroke style if it is a valid PGFPlots stroke style + if haskey(_pgfplots_linestyles, plt[:markerstrokestyle]) + push!(kwargs[:style], _pgfplots_linestyles[plt[:markerstrokestyle]]) end + + # End the open mark options bracker push!(kwargs[:style], "}") end function _pgfplots_get_series_color!(kwargs, plt) α = plt[:seriesalpha] == nothing ? 1.0 : plt[:seriesalpha] - push!(kwargs[:style], "color=$(_pgfplots_get_color(plt, :seriescolor))") - push!(kwargs[:style], "draw opacity = $α") + push!(kwargs[:style], "color=$(_pgfplots_get_color(plt, :seriescolor))", + "draw opacity = $α") end function _pgfplots_get_line_color!(kwargs, plt) α = plt[:linealpha] == nothing ? 1.0 : plt[:linealpha] - kwargs[:style] *= ", color=$(_pgfplots_get_color(plt, :linecolor))" - kwargs[:style] *= ", draw opacity = $α" + kwargs[:style] *= ", color=$(_pgfplots_get_color(plt, :linecolor))" * + ", draw opacity = $α" end function _pgfplots_get_fill_color!(kwargs, plt) α = plt[:fillalpha] == nothing ? 1.0 : plt[:fillalpha] - kwargs[:style] *= ", fill=$(_pgfplots_get_color(plt, :fillcolor))" - kwargs[:style] *= ", fill opacity = $α" + kwargs[:style] *= ", fill=$(_pgfplots_get_color(plt, :fillcolor))" * + ", fill opacity = $α" end function _pgfplots_get_label!(kwargs, plt) From 5196ce52635bce5765948e2e9751e1ae5ac63761 Mon Sep 17 00:00:00 2001 From: Patrick Kofod Mogensen Date: Wed, 11 May 2016 22:13:45 +0200 Subject: [PATCH 6/7] Add PGFPlots support for the size kw. --- src/backends/pgfplots.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index 4eab0671..48c41d6f 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -34,7 +34,7 @@ supportedArgs(::PGFPlotsBackend) = [ # :pos, # :smooth, # :show, - # :size, + :size, :title, # :windowtitle, :x, @@ -366,7 +366,8 @@ function _make_pgf_plot(plt::Plot{PGFPlotsBackend}) push!(os, _pgfplots_axis(plt_series)) end axisargs =_pgfplots_get_axis_kwargs(plt.plotargs) - plt.o = PGFPlots.Axis([os...]; axisargs...) + w, h = map(px2mm, plt.plotargs[:size]) + plt.o = PGFPlots.Axis([os...]; width = "$w mm", height = "$h mm", axisargs...) end function Base.writemime(io::IO, mime::MIME"image/svg+xml", plt::AbstractPlot{PGFPlotsBackend}) From 65e18a8669612c998905d0ced3ee638fc6a26635 Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Thu, 19 May 2016 12:36:34 -0400 Subject: [PATCH 7/7] upper bound on RecipesBase in REQUIRE; added NEWS.md; closes #259 --- NEWS.md | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++ REQUIRE | 2 +- test/REQUIRE | 2 +- 3 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 NEWS.md diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 00000000..45d179a0 --- /dev/null +++ b/NEWS.md @@ -0,0 +1,124 @@ + +# Plots.jl NEWS + +#### notes on release changes, ongoing development, and future planned work + +- I (@tbreloff) am in development of totally revamped internals, in which much of the logic in building series is changed to recursively stacking recipes in a modular fashion. I'll write a blog post sometime soon detailing why this is amazing, but for now you can get a taste of it by looking at the [RecipesBase readme](https://github.com/JuliaPlots/RecipesBase.jl) +- Version 0.6.2 will be the last full release of the "Old Plots", and the 0.6 minor will be only small bug fixes. +- All new development should target 0.7 (recipes and subplots)! + +## 0.7 (WIP on tb_recipes/dev and master) + +- Revamped and simplified internals +- [Recipes, recipes, recipes](https://github.com/JuliaPlots/RecipesBase.jl/issues/6) +- [Layouts and Subplots](https://github.com/tbreloff/Plots.jl/issues/60) + +## Version 0.6 + +#### 0.6.2 + +- `linewidth` fixes +- `markershape` fix +- converted center calc to centroid for shapes +- new dependency on [RecipesBase](https://github.com/JuliaPlots/RecipesBase.jl) +- REQUIRE upper limit for RecipesBase: 0.0.1 +- GR fixes/improvements (@jheinen) + - support `zlims`, `bins` + - allow Plots colormaps + - other bug fixes + - native image support +- PGFPlots fixes/improvements (@pkofod) +- DataFrames are handled by recipes +- Plotly: zaxis, tick rotation, 3d axis fix +- Improvements in handling discrete data +- Support for image display +- `arrow` keyword and support for adding arrows to paths +- changed quiver recipe to use arrows +- Bug fixes for boxplots, heatmaps, and more + +#### 0.6.1 + +- `rotation` keyword +- improved supported graphs +- subplot bug fix + +#### 0.6.0 + +- `apply_series_recipe` framework for built-in recipes +- [boxplot/violin recipes](https://github.com/tbreloff/ExamplePlots.jl/blob/master/notebooks/boxplot.ipynb) +- [errorbar/ribbon recipes](https://github.com/tbreloff/ExamplePlots.jl/blob/master/notebooks/errorbars.ipynb) +- [quiver recipe](https://github.com/tbreloff/ExamplePlots.jl/blob/master/notebooks/quiver.ipynb) +- `polar` coordinates +- better support for shapes and custom polygons (see [batman](https://github.com/tbreloff/ExamplePlots.jl/blob/master/notebooks/batman.ipynb)) +- z-axis keywords +- 3D indexing overhaul: `push!`, `append!` support +- matplotlib colormap constants (`:inferno` is the new default colormap for Plots) +- `typealias KW Dict{Symbol,Any}` used in place of splatting in many places +- png generation for plotly backend using wkhtmltoimage +- `normalize` and `weights` keywords +- background/foreground subcategories for fine-tuning of looks +- `add_theme`/`set_theme` and ggplot2 theme (see [this issue](https://github.com/tbreloff/Plots.jl/issues/201)) +- `PLOTS_DEFAULT_BACKEND` environment variable +- `barh` linetype +- support for non-gridded surfaces with pyplot's trisurface +- pyplot surface zcolor +- internal refactor of supported.jl +- `wrap` method to bypass input processing +- `translate`, `scale` and `rotate` methods for coordinates and shapes +- and many more minor fixes and improvements + +#### 0.5.4 + +- old heatmaps have been renamed to hist2d, and true heatmaps implemented (see https://github.com/tbreloff/Plots.jl/issues/147) +- lots of reorganization and redesign of the internals +- lots of renaming to keep to conventions: AbstractPlot, AbstractBackend, etc +- initial redesign of layouts +- integration with Atom PlotPane +- arc diagram and chord diagram (thanks to @diegozea: see https://github.com/tbreloff/Plots.jl/issues/163) +- work on GR, GLVisualize, and PGFPlots backends (thanks @jheinen @dlfivefifty @pkofod) +- improvements to Plotly setup (thanks @spencerlyon2) +- overhaul to series creation logic and groupby mechanic +- replace Dict with `typealias KW Dict{Symbol,Any}` in many places, also replacing keyword arg splatting +- new `shape` linetype for plotting polygons in plot-coordinates (see https://github.com/tbreloff/ExamplePlots.jl/blob/master/notebooks/batman.ipynb) +- many other fixes + +#### 0.5.3 + +- `@gif` macro with `every`/`when` syntax +- bezier curves and other graph drawing helpers +- added FixedSizeArrays dependency with relevant functionality +- merged lots of improvements to GR (thanks @jheinen) +- `overwrite_figure`/`reuse` arg for reusing the same figure window +- deprecated Qwt, Winston, and Bokeh backends +- improved handling of 3D inputs (call `z=rand(10,10); surface(z)` for example) +- fix IJulia display issue +- lots of progress on PlotlyJS backend +- and many other changes and fixes... + +#### 0.5.2 + +- Added [GR.jl](https://github.com/jheinen/GR.jl) as a backend (unfinished but functional) All credit to @jheinen +- Set defaults within backend calls (i.e. `gadfly(legend=false)`) +- `abline!`; also extrema allows plotting functions without giving x (i.e. `plot(cos, 0, 10); plot!(sin)`) @pkofod @joshday +- Integration with [PlotlyJS.jl](https://github.com/spencerlyon2/PlotlyJS.jl) for using Plotly inside a Blink window @spencerlyon2 +- The Plotly backend has been split into my built-in version (`plotly()`) and @spencerlyon2's backend (`plotlyjs()`) +- Revamped backend setup code for easily adding new backends +- New docs (WIP) at http://plots.readthedocs.org/ +- Overhaul to `:legend` keyword (see https://github.com/tbreloff/Plots.jl/issues/135) +- New dependency on Requires, allows auto-loading of DataFrames support +- Support for plotting lists of Tuples and FixedSizeArrays +- new `@animate` macro for super simple animations (see https://github.com/tbreloff/Plots.jl/issues/111#issuecomment-181515616) +- allow Function for `:fillrange` and `zcolor` arguments (for example: `scatter(sin, 0:10, marker=15, fill=(cos,0.4), zcolor=sin)`) +- allow vectors of PlotText without x/y coords (for example: `scatter(rand(10), m=20, ann=map(text, 1:10))`) +- Lots and lots of fixes + +#### 0.5.1 + +#### 0.5.0 + +- `with` function for temporary defaults +- contours +- basic 3D plotting +- preliminary support for Bokeh +- `stroke` and `brush` for more fine-tuned control over visuals +- smarter "magic" arguments: `line`, `marker` diff --git a/REQUIRE b/REQUIRE index 37795210..7e341d99 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,6 +1,6 @@ julia 0.4 -RecipesBase +RecipesBase 0.0.1 0.0.2 Colors Reexport Compat diff --git a/test/REQUIRE b/test/REQUIRE index b8806bb9..32a0c01e 100644 --- a/test/REQUIRE +++ b/test/REQUIRE @@ -1,6 +1,6 @@ julia 0.4 -RecipesBase +RecipesBase 0.0.1 0.0.2 Colors Reexport Requires