plotly / plotly/plotly.R

Axis labels for NA-Data with factor levels

Open
#910 4 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

When having a NA-Dataframe, but correct facor levels for x and y, the created empty plot does not label the axis according to the factor levels.

In the following example I'd expect an empty plot with axis labels "Entry 1" and "Entry 2" on the x and a range of about [0; 20] on the y axis

data <- data.frame(a = factor(NA, levels = c("Entry1", "Entry2")), b = factor(NA, levels = c(1:20)))
plot_ly(data, x = ~a, y = ~b, type = "bar")

also:

data <- data.frame(a = factor(character(), levels = c("Entry1", "Entry2")), b = factor(numeric(), levels = c(1:20)))
plot_ly(data, x = ~a, y = ~b, type = "bar")

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 both examples with plot_ly using the factor levels shown in the issue, then trace how empty or NA data is handled for bar-chart axes. Verify that the completed behavior labels the x axis with Entry1 and Entry2 and gives the y axis a range of about 0 to 20.

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.