plotly / plotly/plotly.R

Uncorrect behavior of error_y with grouped Y values

Open
#1,110 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

I've got some problems plotting an std deviation of some value Y grouped by a factor G,here's the df

df<-data.frame("X"=c(1:20),"Y"=c(1:20),"SD"=c(1:20),"G"=c(rep("A",3),rep("B",5),rep("C",4),rep("D",5),rep("A",3)))

If I plot the value and the sd without grouping them everything is OK:

p3<-plot_ly(df,
x=~X,
y=~Y,
type="scatter",
mode="markers",
marker=list(symbol="x"),
error_y =list(
    array=~SD,
    thickness=1
    )
)
p3

This yields the following plot:

But when i try to plot Y+SD grouped by G the SD appears not in the correct order. See the resulting plot below:

p3<-plot_ly(df,
    x=~X,
    y=~Y,
    color=~G,
    type="scatter",
    mode="markers",
    marker=list(symbol="x"),
    error_y =list(array=~SD,
                  thickness=1
    )
)
p3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided R examples with the sample data frame and compare the grouped and ungrouped plots. Trace how plot_ly handles error_y when color=~G; done means each error bar matches the SD value for its corresponding grouped observation.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.