fix error bars in log scale
This commit is contained in:
parent
52cb6fbd3a
commit
cef5b0293e
@ -1090,6 +1090,12 @@ function error_coords(errorbar, errordata, otherdata...)
|
|||||||
return (ed, od...)
|
return (ed, od...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# clamp non-NaN values in an array to Base.eps(Float64) for log-scale plots
|
||||||
|
function clamp_to_eps!(ary)
|
||||||
|
replace!(x -> x <= 0.0 ? Base.eps(Float64) : x, ary)
|
||||||
|
nothing
|
||||||
|
end
|
||||||
|
|
||||||
# we will create a series of path segments, where each point represents one
|
# we will create a series of path segments, where each point represents one
|
||||||
# side of an errorbar
|
# side of an errorbar
|
||||||
|
|
||||||
@ -1103,6 +1109,9 @@ end
|
|||||||
plotattributes[:x], plotattributes[:y], plotattributes[:z] =
|
plotattributes[:x], plotattributes[:y], plotattributes[:z] =
|
||||||
error_coords(xerr, x, y, z)
|
error_coords(xerr, x, y, z)
|
||||||
end
|
end
|
||||||
|
if :xscale ∈ keys(plotattributes) && plotattributes[:xscale] == :log10
|
||||||
|
clamp_to_eps!(plotattributes[:x])
|
||||||
|
end
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
@deps xerror path
|
@deps xerror path
|
||||||
@ -1117,6 +1126,9 @@ end
|
|||||||
plotattributes[:y], plotattributes[:x], plotattributes[:z] =
|
plotattributes[:y], plotattributes[:x], plotattributes[:z] =
|
||||||
error_coords(yerr, y, x, z)
|
error_coords(yerr, y, x, z)
|
||||||
end
|
end
|
||||||
|
if :yscale ∈ keys(plotattributes) && plotattributes[:yscale] == :log10
|
||||||
|
clamp_to_eps!(plotattributes[:y])
|
||||||
|
end
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
@deps yerror path
|
@deps yerror path
|
||||||
@ -1129,6 +1141,9 @@ end
|
|||||||
plotattributes[:z], plotattributes[:x], plotattributes[:y] =
|
plotattributes[:z], plotattributes[:x], plotattributes[:y] =
|
||||||
error_coords(zerr, z, x, y)
|
error_coords(zerr, z, x, y)
|
||||||
end
|
end
|
||||||
|
if :zscale ∈ keys(plotattributes) && plotattributes[:zscale] == :log10
|
||||||
|
clamp_to_eps!(plotattributes[:z])
|
||||||
|
end
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
@deps zerror path
|
@deps zerror path
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user