plotly / plotly/plotly.R

ggplotly breaks custom, log transformed, axis labels

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

Unfortunately this does not show an error, only a warning. A better behavior would probably be returning an error when passing an expression.

See below for an example where the x axis has been log transformed.

plot_gg = ggplot(iris,aes(Sepal.Length,Sepal.Width,col=Species))+
    geom_point()+ 
    scale_x_continuous(trans = scales::log2_trans(),
                       breaks = scales::trans_breaks("log2", function(x) 2^x),
                       labels = scales::trans_format("log2", scales::math_format(2^.x)))
plot_gg

image

plot_ly=plotly::ggplotly(plot_gg)
plot_ly

image

Warning message:
In is.na(ticktext) :
  is.na() applied to non-(list or vector) of type 'expression'

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 R example in the issue and compare the ggplot2 output with the ggplotly output and warning. Trace how ggplotly handles transformed axis breaks and expression-valued labels; done means the behavior is intentional and covered by a regression check, either by handling the labels correctly or reporting the unsupported expression clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.