diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 9aa375be..e320e8dd 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -45,6 +45,7 @@ const _gr_attr = merge_with_base_supported([ :framestyle, :tick_direction, :camera, + :contour_labels, ]) const _gr_seriestype = [ :path, :scatter, diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index f05a13f0..f5f60464 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -42,6 +42,7 @@ const _pyplot_attr = merge_with_base_supported([ :framestyle, :tick_direction, :camera, + :contour_labels, ]) const _pyplot_seriestype = [ :path, :steppre, :steppost, :shape, @@ -654,6 +655,9 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series) cmap = py_linecolormap(series), extrakw... ) + if series[:contour_labels] == true + PyPlot.clabel(handle, handle[:levels]) + end push!(handles, handle) # contour fills diff --git a/src/utils.jl b/src/utils.jl index e880ae62..cdab41c6 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -575,7 +575,10 @@ _update_clims(zmin, zmax, emin, emax) = min(zmin, emin), max(zmax, emax) function hascolorbar(series::Series) st = series[:seriestype] - hascbar = st in (:heatmap, :contour) + hascbar = st == :heatmap + if st == :contour + hascbar = (isscalar(series[:levels]) ? (series[:levels] > 1) : (length(series[:levels]) > 1)) && (length(unique(Array(series[:z]))) > 1) + end if series[:marker_z] != nothing || series[:line_z] != nothing || series[:fill_z] != nothing hascbar = true end