plotly / plotly/plotly.R

in bar plot bars are in the wrong order

Open
#2,180 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

Please briefly describe your problem and what output you expect. If you have a question, please don't use this form, but instead ask on the community forum http://community.plot.ly/c/api/r or stackoverflow http://stackoverflow.com.

Please include a minimal reprex. The goal of a reprex is to make it as easy as possible for me to recreate your problem so that I can fix it. If you've never heard of a reprex before, start by reading https://github.com/tidyverse/reprex#readme, and follow the advice further down the page. Do NOT include session info unless it's explicitly asked for, or you've used reprex::reprex(..., si = TRUE) to hide it away.

Delete these instructions once you have read them.


Brief description of the problem
bar named 3 months must follow bar named "ban". currently, it is between 12 and 6 month bar


library(plotly)
fig <- plot_ly()
fig <- fig %>% add_bars(
  x = c("12 months", "6 months", "3 months","ban on short term plans" ),
  y = c(-200),
  base = c(0),
  marker = list(
    color = 'red'
  ),
)
fig <- fig %>% add_bars(
  x = c("12 months", "6 months", "3 months","ban on short term plans"),
  y = c(-76, -61, -44,-121),
  base = c(0),
  marker = list(
    color = 'grey'
  ),
  name = 'decrease in premiums'
)
fig

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

Reproduce the ordering issue from the supplied R example, starting with the plot_ly() and add_bars() entry points. Check how the categorical x values are ordered across the two bar traces; done means the “3 months” bar appears immediately before “ban on short term plans” rather than between “12 months” and “6 months”.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.