plotly / plotly/plotly.R

Add horizontal attribute for colorbars

Open
#2,147 1 comment 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

As of plotly JS v2.8.0 horizontal colorbars are available.

Plotly.R currently uses plotly.js v2.11.1 and the parameter is listed in the R Figure Reference, so it should be possible to make use of this feature.

However I can't find it in schema() and can't apply it:

library(plotly)

fig <- plot_ly(mtcars, x = ~wt, y = ~mpg, color = ~cyl, type = "scatter", mode = "markers")
fig1 <- colorbar(fig, len = 0.5, orientation = "h", bgcolor= "green")
fig1

fig2 <- layout(fig, title = "colorbar orientation", coloraxis = list(colorbar = list(orientation = "h", bgcolor= "green")))
fig2

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 with schema() and the colorbar()/layout() examples in the issue, then compare the R Figure Reference entry with the Plotly.js v2.11.1 schema. Trace how colorbar attributes are exposed and test both examples; done means orientation = "h" is accepted and produces a horizontal colorbar.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, r
Domain
data-visualization
Issue type
Feature
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.