JuliaPy / JuliaPy/PythonPlot.jl

plots with missing and NaN data

未關閉
#54 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Julia
星號
85
分支
9
PR 合併指標
30 天內沒有已合併 PR

描述

Missing and missing are first class types/values in Julia Base. PythonPlot should simply not plot missing data. It errors in PythonPlot.
```julia
julia> plot([1, missing, 2])
ERROR: Python: ValueError: setting an array element with a sequence.
```

Here is a type translation inspired by one that works for PyCall (https://github.com/JuliaPy/PyPlot.jl/issues/593):
```julia
using PythonPlot
using PythonCall

"Recast julia Arrays with missing as python masked arrays."
function PythonCall.Py(a::Array{Union{T,Missing},N}) where {T,N}
np = PythonCall.pyimport("numpy")
np.ma.masked_invalid(np.array(replace(a, missing => NaN)))
end

# test
plot([1,2,missing,4,5], marker="o")
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。