From 7acb5a4bdb0497877b4d214c0cc1a05a8d9bfcf7 Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Wed, 2 Jan 2019 17:39:28 +0100 Subject: [PATCH 1/5] allow annotations to take a tuple and pass it to text --- src/components.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components.jl b/src/components.jl index 46fc0f7d..f1f27dc4 100644 --- a/src/components.jl +++ b/src/components.jl @@ -554,7 +554,7 @@ function process_annotation(sp::Subplot, xs, ys, labs, font = font()) alphabet = "abcdefghijklmnopqrstuvwxyz" push!(anns, (x, y, text(string("(", alphabet[sp[:subplot_index]], ")"), font))) else - push!(anns, (x, y, isa(lab, PlotText) ? lab : text(lab, font))) + push!(anns, (x, y, isa(lab, PlotText) ? lab : isa(lab, Tuple) ? text(lab...) : text(lab, font))) end end anns @@ -569,7 +569,7 @@ function process_annotation(sp::Subplot, positions::Union{AVec{Symbol},Symbol}, alphabet = "abcdefghijklmnopqrstuvwxyz" push!(anns, (pos, text(string("(", alphabet[sp[:subplot_index]], ")"), font))) else - push!(anns, (pos, isa(lab, PlotText) ? lab : text(lab, font))) + push!(anns, (pos, isa(lab, PlotText) ? lab : isa(lab, Tuple) ? text(lab...) : text(lab, font))) end end anns From 9679eae662d86b37aca91e7fee7eda2c83968829 Mon Sep 17 00:00:00 2001 From: wfrgra Date: Sat, 5 Jan 2019 13:46:53 +1100 Subject: [PATCH 2/5] stop default widen behaviour overriding axis limit rounding --- src/axes.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/axes.jl b/src/axes.jl index 6f00a27a..1b2f693b 100644 --- a/src/axes.jl +++ b/src/axes.jl @@ -459,7 +459,7 @@ const _widen_seriestypes = (:line, :path, :steppre, :steppost, :sticks, :scatter function default_should_widen(axis::Axis) should_widen = false - if !is_2tuple(axis[:lims]) + if !(is_2tuple(axis[:lims]) || axis[:lims] == :round) for sp in axis.sps for series in series_list(sp) if series.plotattributes[:seriestype] in _widen_seriestypes From ba46299088ec4cff1d3df686804e89a9ed02500c Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Sat, 5 Jan 2019 17:57:21 +0100 Subject: [PATCH 3/5] Fix stray srand in showtheme --- src/Plots.jl | 2 +- src/themes.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Plots.jl b/src/Plots.jl index 0a6522d6..48669c7d 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -5,7 +5,7 @@ _current_plots_version = v"0.20.6" using Reexport import StaticArrays -using Dates, Printf, Statistics, Base64, LinearAlgebra +using Dates, Printf, Statistics, Base64, LinearAlgebra, Random import SparseArrays: findnz @reexport using RecipesBase diff --git a/src/themes.jl b/src/themes.jl index da313498..592d0a78 100644 --- a/src/themes.jl +++ b/src/themes.jl @@ -100,7 +100,7 @@ _get_showtheme_args(thm::Symbol, func::Symbol) = thm, get(_color_functions, func end end - srand(1) + Random.seed!(1) label := "" colorbar := false From 53e27dbc38a99fffa1dfa4d28ce478cbb2cc22dc Mon Sep 17 00:00:00 2001 From: Josef Heinen Date: Sun, 6 Jan 2019 11:24:45 +0100 Subject: [PATCH 4/5] Added support for discrete contour plots --- REQUIRE | 2 +- src/backends/gr.jl | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/REQUIRE b/REQUIRE index aae86c2c..6fad4eba 100644 --- a/REQUIRE +++ b/REQUIRE @@ -13,4 +13,4 @@ JSON NaNMath Requires Contour -GR 0.35.0 +GR 0.36.0 diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 505ad39f..1d4fbca6 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -1029,16 +1029,13 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) else h = series[:levels] > 1 ? range(zmin, stop=zmax, length=series[:levels]) : [(zmin + zmax) / 2] end + GR.setlinetype(gr_linetype[get_linestyle(series)]) + GR.setlinewidth(max(0, get_linewidth(series) / (sum(gr_plot_size) * 0.001))) if series[:fillrange] != nothing - GR.surface(x, y, z, GR.OPTION_CELL_ARRAY) + GR.contourf(x, y, h, z, series[:contour_labels] == true ? 1 : 0) else - GR.setlinetype(gr_linetype[get_linestyle(series)]) - GR.setlinewidth(max(0, get_linewidth(series) / (sum(gr_plot_size) * 0.001))) - if plot_color(series[:linecolor]) == [plot_color(:black)] - GR.contour(x, y, h, z, 0 + (series[:contour_labels] == true ? 1 : 0)) - else - GR.contour(x, y, h, z, 1000 + (series[:contour_labels] == true ? 1 : 0)) - end + coff = plot_color(series[:linecolor]) == [plot_color(:black)] ? 0 : 1000 + GR.contour(x, y, h, z, coff + (series[:contour_labels] == true ? 1 : 0)) end # create the colorbar of contour levels From 8951526d0d395f7bece2217d1d021b5fa9cdac57 Mon Sep 17 00:00:00 2001 From: Josef Heinen Date: Mon, 7 Jan 2019 13:26:08 +0100 Subject: [PATCH 5/5] Set minimum GR version --- REQUIRE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/REQUIRE b/REQUIRE index 6fad4eba..a6b2ed11 100644 --- a/REQUIRE +++ b/REQUIRE @@ -13,4 +13,4 @@ JSON NaNMath Requires Contour -GR 0.36.0 +GR 0.37.0