JuliaPy / JuliaPy/PythonPlot.jl

plots with missing and NaN data

オープン
#54 コメント 0 件 リアクション 0 件 担当者 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 を短くまとめたダイジェスト。