implement contour_labels for PyPlot and fix #1091
This commit is contained in:
parent
9c4cc5acda
commit
fdb2ee2847
@ -45,6 +45,7 @@ const _gr_attr = merge_with_base_supported([
|
|||||||
:framestyle,
|
:framestyle,
|
||||||
:tick_direction,
|
:tick_direction,
|
||||||
:camera,
|
:camera,
|
||||||
|
:contour_labels,
|
||||||
])
|
])
|
||||||
const _gr_seriestype = [
|
const _gr_seriestype = [
|
||||||
:path, :scatter,
|
:path, :scatter,
|
||||||
|
|||||||
@ -42,6 +42,7 @@ const _pyplot_attr = merge_with_base_supported([
|
|||||||
:framestyle,
|
:framestyle,
|
||||||
:tick_direction,
|
:tick_direction,
|
||||||
:camera,
|
:camera,
|
||||||
|
:contour_labels,
|
||||||
])
|
])
|
||||||
const _pyplot_seriestype = [
|
const _pyplot_seriestype = [
|
||||||
:path, :steppre, :steppost, :shape,
|
:path, :steppre, :steppost, :shape,
|
||||||
@ -654,6 +655,9 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
cmap = py_linecolormap(series),
|
cmap = py_linecolormap(series),
|
||||||
extrakw...
|
extrakw...
|
||||||
)
|
)
|
||||||
|
if series[:contour_labels] == true
|
||||||
|
PyPlot.clabel(handle, handle[:levels])
|
||||||
|
end
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
|
|
||||||
# contour fills
|
# contour fills
|
||||||
|
|||||||
@ -575,7 +575,10 @@ _update_clims(zmin, zmax, emin, emax) = min(zmin, emin), max(zmax, emax)
|
|||||||
|
|
||||||
function hascolorbar(series::Series)
|
function hascolorbar(series::Series)
|
||||||
st = series[:seriestype]
|
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
|
if series[:marker_z] != nothing || series[:line_z] != nothing || series[:fill_z] != nothing
|
||||||
hascbar = true
|
hascbar = true
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user