JuliaPlots / JuliaPlots/PlotlyJS.jl

group by plot fails when dataframe is accessed by column number

Open
#485 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
444
Forks
86
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
For the first plot below, the wrong data is plotted for the second group of data.

Accessing the column by name does not help either `df[!,somecolumnname` yields identical results as `df[!,1]` for me.

```
using PlotlyBase
import PlotlyJS
using DataFrames

df = DataFrame(a=1:4,b=["a","a","b","b"],timeaxis=[1,2,1,2])

#does not work
#data for both lines **coincides** - why?
plt0 = scatter(df, group=:b, y=df[!,1], x=:timeaxis, mode="lines+markers")
PlotlyJS.plot(plt0, PlotlyBase.Layout(;title=""))

#works
plt0 = scatter(df, group=:b, y=:a, x=:timeaxis, mode="lines+markers")
PlotlyJS.plot(plt0, PlotlyBase.Layout(;title=""))
```

```
julia> versioninfo()
Julia Version 1.10.4
Commit 48d4fd4843 (2024-06-04 10:41 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 32 × AMD Ryzen 9 5950X 16-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
Threads: 16 default, 0 interactive, 8 GC (on 32 virtual cores)
Environment:
JULIA_EDITOR = "code"
JULIA_NUM_THREADS = 16

julia> using Pkg; pkg"status"
Status `C:\Users\bernhard.konig\.julia\environments\v1.10\Project.toml`
[6e4b80f9] BenchmarkTools v1.5.0
[14b8a8f1] PkgTemplates v0.7.51
[295af30f] Revise v3.5.15

julia>
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.