plotly / plotly/plotly.R

plotly cannot handle Inf or -Inf when plotting

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

plotly does not seem to know what to do with values that are Inf or -Inf. The expected behavior (as done by ggplot2) is to map those values to the maximum and minimum values representable in the type when plotting but to not include them in calculations related to ranges, zooming, axis labels, grid lines, etc.

library(dplyr)
library(ggplot2)
# as expected, this extends the line up to limits of the plot
p <- data.frame(x=c(1,1,Inf), y = c(Inf, 1, 1)) %>% ggplot(aes(x=x,y=y)) + geom_line()
p
library(plotly)
# This doesn't plot anything
ggplotly(p)

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 reproducing the provided R example through ggplotly(p), comparing its handling of Inf and -Inf with ggplot2. Trace the plotting and range calculation path involved in that entry point; done means the values reach the plot limits without affecting ranges, zooming, axis labels, or grid lines.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.