implement contour_labels for PyPlot and fix #1091

This commit is contained in:
Daniel Schwabeneder 2018-02-28 22:10:45 +01:00
parent 9c4cc5acda
commit fdb2ee2847
3 changed files with 9 additions and 1 deletions

View File

@ -45,6 +45,7 @@ const _gr_attr = merge_with_base_supported([
:framestyle,
:tick_direction,
:camera,
:contour_labels,
])
const _gr_seriestype = [
:path, :scatter,

View File

@ -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

View File

@ -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