Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8421274
chore: upgrade plotly.js to v2.12.0
cpsievert Dec 30, 2025
a2f37a7
chore: upgrade plotly.js to v2.12.1
cpsievert Dec 30, 2025
fc0b036
chore: upgrade plotly.js to v2.13.0
cpsievert Dec 30, 2025
dcdd359
chore: upgrade plotly.js to v2.13.1
cpsievert Dec 30, 2025
d4c3715
chore: upgrade plotly.js to v2.13.2
cpsievert Dec 30, 2025
a7975a3
chore: upgrade plotly.js to v2.13.3
cpsievert Dec 30, 2025
9d5fa8f
chore: upgrade plotly.js to v2.14.0
cpsievert Dec 30, 2025
84f89c6
chore: upgrade plotly.js to v2.15.0
cpsievert Dec 30, 2025
beafd47
chore: upgrade plotly.js to v2.15.1
cpsievert Dec 30, 2025
3351a33
chore: upgrade plotly.js to v2.16.0
cpsievert Dec 30, 2025
e7022b1
chore: upgrade plotly.js to v2.16.1
cpsievert Dec 30, 2025
6e95dbf
chore: upgrade plotly.js to v2.16.2
cpsievert Dec 30, 2025
6a56f88
chore: upgrade plotly.js to v2.16.3
cpsievert Dec 30, 2025
e071415
chore: upgrade plotly.js to v2.16.4
cpsievert Dec 30, 2025
e9b20d9
chore: upgrade plotly.js to v2.16.5
cpsievert Dec 30, 2025
638f93b
chore: upgrade plotly.js to v2.17.0
cpsievert Dec 30, 2025
8de56da
chore: upgrade plotly.js to v2.17.1
cpsievert Dec 30, 2025
341b32d
chore: upgrade plotly.js to v2.18.0
cpsievert Dec 30, 2025
2685343
chore: upgrade plotly.js to v2.18.1
cpsievert Dec 30, 2025
b20bdef
chore: upgrade plotly.js to v2.18.2
cpsievert Dec 30, 2025
1cf9ccf
chore: upgrade plotly.js to v2.19.0
cpsievert Dec 30, 2025
cc960f8
chore: upgrade plotly.js to v2.19.1
cpsievert Dec 30, 2025
3aabdbe
chore: upgrade plotly.js to v2.20.0
cpsievert Dec 30, 2025
e08bbc1
chore: upgrade plotly.js to v2.21.0
cpsievert Dec 30, 2025
972f728
chore: upgrade plotly.js to v2.22.0
cpsievert Dec 30, 2025
a987c74
chore: upgrade plotly.js to v2.23.0
cpsievert Dec 30, 2025
50b7db2
chore: upgrade plotly.js to v2.23.1
cpsievert Dec 30, 2025
7369403
Upgrade plotly.js to v2.23.2
cpsievert Dec 30, 2025
988b3c9
Upgrade plotly.js to v2.24.0
cpsievert Dec 30, 2025
782f921
Upgrade plotly.js to v2.24.1
cpsievert Dec 30, 2025
8f233e6
Upgrade plotly.js to v2.24.2
cpsievert Dec 30, 2025
16a7eb5
Upgrade plotly.js to v2.24.3
cpsievert Dec 30, 2025
51e6872
Upgrade plotly.js to v2.25.0
cpsievert Dec 30, 2025
8d8c0be
Upgrade plotly.js to v2.25.1
cpsievert Dec 30, 2025
76d5440
Upgrade plotly.js to v2.25.2
cpsievert Dec 30, 2025
aec6bde
Add TODO tracking file for plotly.js upgrade
cpsievert Dec 30, 2025
8a9466c
Update TODO with regression investigation results
cpsievert Dec 30, 2025
f0ae020
Update .Rbuildignore to exclude upgrade files
cpsievert Dec 30, 2025
8fa3218
Clean up upgrade tracking files and revert R version requirement
cpsievert Jan 19, 2026
f2a409a
Merge branch 'master' into chore/update-plotlyjs
cpsievert Jan 19, 2026
11b0950
Restore upgrade tracking files to git
cpsievert Jan 19, 2026
67955a9
Accept new snaps
cpsievert Jan 19, 2026
743c01a
Update shinytest2 snapshots for plotly.js v2.25.2
cpsievert Jan 19, 2026
b37b91f
Document plotly.js v2.25.2 upgrade in NEWS
cpsievert Jan 19, 2026
56d909f
Remove upgrade tracking files from git (keep locally)
cpsievert Jan 19, 2026
ee076f6
Apply suggestions from code review
cpsievert Jan 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ README.Rmd
abbvie.R
^\.httr-oauth$
^\.github$
^\.venv$
CLAUDE\.md
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ revdep/
travis_debug.R
.httr-oauth
tests/testthat/Rplots.pdf
.venv/
98 changes: 98 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

plotly is an R package for creating interactive web graphics via the plotly.js JavaScript library. It provides two main interfaces:
- `ggplotly()`: Converts ggplot2 objects to interactive plotly visualizations
- `plot_ly()`: Direct interface to plotly.js for specialized chart types

## Common Commands

### Running Tests
```r
# Run all tests
devtools::test()

# Run visual tests (requires kaleido via reticulate)
Sys.setenv("VISUAL_TESTS" = "true")
devtools::test()

# Run a single test file
devtools::test(filter = "ggplot-bar")
```

### Package Check
```r
rcmdcheck::rcmdcheck()
```

### Building Documentation
```r
devtools::document()
```

### Visual Testing via Docker
For consistent visual test results:
```shell
docker run -v $(pwd):/home/plotly --privileged -p 3838:3838 cpsievert/plotly-orca
```
Access the validation Shiny app at http://0.0.0.0:3838

CI-only visual test run:
```shell
docker run -e VMODE="ci" -v $(pwd):/home/plotly --privileged cpsievert/plotly-orca
```

## Architecture

### ggplot2 to plotly Conversion Pipeline

The conversion from ggplot2 to plotly follows this flow:

1. **`ggplotly()`** (`R/ggplotly.R`): Entry point that dispatches on input type
2. **`gg2list()`** (`R/ggplotly.R`): Main conversion function that:
- Builds the ggplot object to extract computed data
- Processes each layer through `layers2traces()`
- Processes layout through `layers2layout()`
3. **`layers2traces()`** (`R/layers2traces.R`): Converts ggplot2 geom layers to plotly trace objects
4. **`layers2layout()`** (`R/layers2layout.R`): Converts ggplot2 theme/coordinate settings to plotly layout

### Direct plotly Interface

1. **`plot_ly()`** (`R/plotly.R`): Creates a plotly object with trace attributes
2. **`add_trace()`** and `add_*()` functions (`R/add.R`): Add traces to existing plots
3. **`layout()`** (`R/layout.R`): Modify plot layout
4. **`plotly_build()`** (`R/plotly_build.R`): Evaluates lazy attributes and creates final JSON for plotly.js

### Key Modules

- `R/shiny.R`: Shiny integration and event handling
- `R/subplots.R`: Combining multiple plots
- `R/highlight.R`: Linked brushing/crosstalk support
- `R/animate.R`: Animation support
- `R/kaleido.R`, `R/orca.R`: Static image export

## Testing Patterns

Tests should check the return value of `plotly_build()`:
```r
test_that("example test", {
p <- plot_ly(x = 1:10, y = 1:10)
built <- plotly_build(p)
expect_equal(built$x$data[[1]]$x, 1:10)
})
```

Visual tests use `expect_doppelganger()` from `tests/testthat/helper-vdiffr.R`:
```r
test_that("visual test", {
p <- plot_ly(x = 1:10, y = 1:10)
expect_doppelganger(p, "scatter-basic")
})
```

## Code Style

Follow the tidyverse style guide: http://style.tidyverse.org/
19 changes: 19 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# plotly (development version)

## Changes to plotly.js

Upgrades plotly.js from v2.11.1 to v2.25.2 (35 releases). Key new features now available:

* **Multiple legends**: Support for `legend2`, `legend3`, etc. with separate positioning and visibility control
* **Shape labels**: New `label` attribute for shapes and `label.texttemplate` for parametric shapes
* **Marker direction**: New `marker.angle`, `marker.angleref`, and `marker.standoff` properties for directional markers
* **Y-axis positioning**: `shift` and `autoshift` properties to avoid y-axis overlapping in multi-axis plots
* **Mapbox clustering**: Clustering options and bounds support for `scattermapbox` traces
* **Equal Earth projection**: New map projection option for geo subplots
* **Pattern fills**: Pattern support extended to pie, funnelarea, sunburst, icicle, and treemap charts
* **Editable selections**: Persistent and editable selections over cartesian subplots with `editSelection` config option
* **Axis label aliases**: `labelalias` for simplified axis label customization
* **Grid styling**: `griddash` property and minor tick/grid line styling options

Also includes a security fix for prototype pollution and ~90KB bundle size reduction.

See the [plotly.js releases page](https://github.com/plotly/plotly.js/releases) for the full changelog.

## Improvements

* `save_image()` now works with kaleido v1.0 and higher. (#2447)
Expand Down
2 changes: 1 addition & 1 deletion R/plotly.R
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ typedArrayPolyfill <- function() {
plotlyMainBundle <- function() {
htmltools::htmlDependency(
name = "plotly-main",
version = "2.11.1",
version = "2.25.2",
package = "plotly",
src = dependency_dir("plotlyjs"),
script = "plotly-latest.min.js",
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,9 @@
},
{
"name": "plotly-htmlwidgets-css",
"version": "2.11.1",
"version": "2.25.2",
"src": {
"href": "plotly-htmlwidgets-css-2.11.1"
"href": "plotly-htmlwidgets-css-2.25.2"
},
"meta": null,
"script": null,
Expand All @@ -472,9 +472,9 @@
},
{
"name": "plotly-main",
"version": "2.11.1",
"version": "2.25.2",
"src": {
"href": "plotly-main-2.11.1"
"href": "plotly-main-2.25.2"
},
"meta": null,
"script": "plotly-latest.min.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,9 @@
},
{
"name": "plotly-htmlwidgets-css",
"version": "2.11.1",
"version": "2.25.2",
"src": {
"href": "plotly-htmlwidgets-css-2.11.1"
"href": "plotly-htmlwidgets-css-2.25.2"
},
"meta": null,
"script": null,
Expand All @@ -475,9 +475,9 @@
},
{
"name": "plotly-main",
"version": "2.11.1",
"version": "2.25.2",
"src": {
"href": "plotly-main-2.11.1"
"href": "plotly-main-2.25.2"
},
"meta": null,
"script": "plotly-latest.min.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,9 @@
},
{
"name": "plotly-htmlwidgets-css",
"version": "2.11.1",
"version": "2.25.2",
"src": {
"href": "plotly-htmlwidgets-css-2.11.1"
"href": "plotly-htmlwidgets-css-2.25.2"
},
"meta": null,
"script": null,
Expand All @@ -479,9 +479,9 @@
},
{
"name": "plotly-main",
"version": "2.11.1",
"version": "2.25.2",
"src": {
"href": "plotly-main-2.11.1"
"href": "plotly-main-2.25.2"
},
"meta": null,
"script": "plotly-latest.min.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@
},
{
"name": "plotly-htmlwidgets-css",
"version": "2.11.1",
"version": "2.25.2",
"src": {
"href": "plotly-htmlwidgets-css-2.11.1"
"href": "plotly-htmlwidgets-css-2.25.2"
},
"meta": null,
"script": null,
Expand All @@ -480,9 +480,9 @@
},
{
"name": "plotly-main",
"version": "2.11.1",
"version": "2.25.2",
"src": {
"href": "plotly-main-2.11.1"
"href": "plotly-main-2.25.2"
},
"meta": null,
"script": "plotly-latest.min.js",
Expand Down
2 changes: 1 addition & 1 deletion inst/htmlwidgets/lib/plotlyjs/locales/es-pe.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion inst/htmlwidgets/lib/plotlyjs/locales/fr.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion inst/htmlwidgets/lib/plotlyjs/locales/hr.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading