Skip to content

Commit 9812dcd

Browse files
committed
Merge branch 'master' into fix-docs
2 parents 6937fad + e04eb4f commit 9812dcd

File tree

303 files changed

+428
-330
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

303 files changed

+428
-330
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- {os: ubuntu-latest, r: 'oldrel-1'}
3636
- {os: ubuntu-latest, r: 'oldrel-2'}
3737
- {os: ubuntu-latest, r: 'oldrel-3'}
38-
- {os: ubuntu-latest, r: 'oldrel-4'}
38+
# - {os: ubuntu-latest, r: 'oldrel-4'} # dependency issues with oldrel-4
3939

4040
env:
4141
VISUAL_TESTS: ${{ matrix.config.visual_tests }}
@@ -46,7 +46,7 @@ jobs:
4646
plotly_api_key: ${{ secrets.PLOTLY_API_KEY }}
4747

4848
steps:
49-
- uses: actions/checkout@v2
49+
- uses: actions/checkout@v4
5050
with:
5151
persist-credentials: false
5252

@@ -63,10 +63,16 @@ jobs:
6363
cache-version: 3
6464
needs: check
6565

66+
- name: Set up Python (for reticulate)
67+
if: matrix.config.visual_tests == true
68+
uses: actions/setup-python@v4
69+
with:
70+
python-version: '3.11'
71+
6672
- name: Install kaleido
6773
if: matrix.config.visual_tests == true
6874
run: |
69-
Rscript -e 'library(reticulate); use_python(install_python()); py_install(c("kaleido", "plotly"))'
75+
Rscript -e 'library(reticulate); use_python(Sys.which("python")); py_install(c("kaleido", "plotly"))'
7076
7177
# Run test() before R CMD check since, for some reason, rcmdcheck::rcmdcheck() skips vdiffr tests
7278
- name: Run Tests

CODE_OF_CONDUCT.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at accounts@plot.ly. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.4, available at [http://contributor-covenant.org/version/1/4](http://contributor-covenant.org/version/1/4/), and may also be found online at <https://community.plotly.com/pub/code-of-conduct>.

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: plotly
22
Title: Create Interactive Web Graphics via 'plotly.js'
3-
Version: 4.10.4.9000
3+
Version: 4.11.0
44
Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"),
55
email = "cpsievert1@gmail.com", comment = c(ORCID = "0000-0002-4958-2844")),
66
person("Chris", "Parmer", role = "aut",
@@ -83,6 +83,7 @@ Encoding: UTF-8
8383
Roxygen: list(markdown = TRUE)
8484
Config/Needs/check:
8585
tidyverse/ggplot2,
86+
ggobi/GGally,
8687
rcmdcheck,
8788
devtools,
8889
reshape2,

LICENSE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
The MIT License (MIT)
1+
MIT License
22

3-
Copyright (c) 2017 Plotly Technologies Inc
3+
Copyright (c) 2017-2024 Plotly Technologies Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

NEWS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
# plotly (development version)
1+
# plotly 4.11.0
22

33
## New features
44

55
* `ggplotly()` now supports the `{ggridges}` package. (#2314)
66

77
## Improvements
88

9-
* `ggplotly()` now works better with the development version of ggplot2 (> v3.4.4). (#2315, #2368)
9+
* Various updates to `ggplotly()` to better support recent versions of ggplot2. (#2315, #2368, #2442, thanks @teunbrand).
1010

1111
## Bug fixes
1212

1313
* Closed #2337: Creating a new `event_data()` handler no longer causes a spurious reactive update of existing `event_data()`s. (#2339)
14+
* Closed #2376: Removes errant boxmode warning for grouped boxplot. (#2396)
15+
* Closed #2392: Trivial warning about RColorBrewer minimal n value is no longer thrown (#1999)
1416

1517
# 4.10.4
1618

R/ggplotly.R

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,9 @@ gg2list <- function(p, width = NULL, height = NULL,
668668
"\\*\\s+degree[ ]?[\\*]?", "&#176;",
669669
gsub("\"", "", tickData[["degree_label"]])
670670
)
671-
rng[[paste0(xy, ".major")]] <- tickData[[paste0(xy, "_start")]]
671+
# Downstream logic expects these 'break positions' to be on 0-1 scale
672+
# (which is then rescaled back to the data scale)
673+
rng[[paste0(xy, ".major")]] <- scales::rescale(tickData[[paste0(xy, "_start")]])
672674

673675
# If it doesn't already exist (for this panel),
674676
# generate graticule (as done in, CoordSf$render_bg)
@@ -742,8 +744,8 @@ gg2list <- function(p, width = NULL, height = NULL,
742744

743745
# https://github.com/tidyverse/ggplot2/pull/3566#issuecomment-565085809
744746
hasTickText <- !(is.na(ticktext) | is.na(tickvals))
745-
ticktext <- ticktext[hasTickText]
746-
tickvals <- tickvals[hasTickText]
747+
ticktext <- as.character(unlist(ticktext[hasTickText]))
748+
tickvals <- as.numeric(unlist(tickvals[hasTickText]))
747749

748750
axisObj <- list(
749751
# TODO: log type?
@@ -783,8 +785,11 @@ gg2list <- function(p, width = NULL, height = NULL,
783785
# set scaleanchor/scaleratio if these are fixed coordinates
784786
# the logic here is similar to what p$coordinates$aspect() does,
785787
# but the ratio is scaled to the data range by plotly.js
786-
fixed_coords <- c("CoordSf", "CoordFixed", "CoordMap", "CoordQuickmap")
787-
if (inherits(p$coordinates, fixed_coords)) {
788+
is_fixed <- inherits(
789+
p$coordinates,
790+
c("CoordSf", "CoordFixed", "CoordMap", "CoordQuickmap")
791+
)
792+
if (is_fixed || isFALSE(p$coordinates$is_free())) {
788793
axisObj$scaleanchor <- anchor
789794
ratio <- p$coordinates$ratio %||% 1
790795
axisObj$scaleratio <- if (xy == "y") ratio else 1 / ratio
@@ -1157,8 +1162,9 @@ utils::globalVariables(c("groupDomains", "layers", "prestats_data", "scales", "s
11571162

11581163
# Get the "complete" set of theme elements and their calculated values
11591164
calculated_theme_elements <- function(plot) {
1160-
if (is.function(asNamespace("ggplot2")$complete_theme)) {
1161-
theme <- ggplot2::complete_theme(plot$theme)
1165+
complete_theme <- ggfun("complete_theme")
1166+
if (is.function(complete_theme)) {
1167+
theme <- complete_theme(plot$theme)
11621168
elements <- names(theme)
11631169
} else {
11641170
theme <- ggfun("plot_theme")(plot)
@@ -1435,7 +1441,9 @@ gdef2trace <- function(gdef, theme, gglayout) {
14351441
}
14361442

14371443
vals <- lapply(gglayout[c("xaxis", "yaxis")], function(ax) {
1438-
if (identical(ax$tickmode, "auto")) ax$ticktext else ax$tickvals
1444+
res <- if (identical(ax$tickmode, "auto")) ax$ticktext else ax$tickvals
1445+
# if zero-length, return NULL to avoid subscript oob errors
1446+
res %||% NULL
14391447
})
14401448

14411449
list(

R/layers2traces.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ to_basic.GeomCol <- function(data, prestats_data, layout, params, p, ...) {
197197
#' @export
198198
to_basic.GeomViolin <- function(data, prestats_data, layout, params, p, ...) {
199199
n <- nrow(data)
200+
data <- data[order(data[["y"]], decreasing = FALSE), ]
200201
revData <- data[order(data[["y"]], decreasing = TRUE), ]
201202
idx <- !names(data) %in% c("x", "xmin", "xmax")
202203
data <- rbind(

R/plotly_build.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ map_color <- function(traces, stroke = FALSE, title = "", colorway, na.color = "
783783
isOrdered <- all(vapply(color[isDiscrete], is.ordered, logical(1)))
784784
lvls <- getLevels(unlist(color[isDiscrete]))
785785
N <- length(lvls)
786-
pal <- palette %||% if (isOrdered) viridisLite::viridis(N) else RColorBrewer::brewer.pal(N, "Set2")
786+
pal <- palette %||% if (isOrdered) viridisLite::viridis(N) else RColorBrewer::brewer.pal(max(N, 3L), "Set2")
787787
colScale <- scales::col_factor(pal, levels = names(pal) %||% lvls, na.color = na.color)
788788
color_codes <- Map(function(x, y) toRGB(colScale(as.character(x)), y), color[isDiscrete], alphas[isDiscrete])
789789
traces[isDiscrete] <- Map(mapColor, traces[isDiscrete], color_codes)

R/utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ verify_attr_names <- function(p) {
449449
# some layout attributes (e.g., [x-y]axis can have trailing numbers)
450450
attrs_name_check(
451451
sub("[0-9]+$", "", names(p$x$layout)),
452-
c(names(Schema$layout$layoutAttributes), c("barmode", "bargap", "mapType")),
452+
c(names(Schema$layout$layoutAttributes), c("boxmode", "barmode", "bargap", "mapType")),
453453
"layout"
454454
)
455455
attrs_name_check(

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ ggplot2 API won’t ever support (e.g., surface,
100100
plot_ly(z = ~volcano, type = "surface")
101101
```
102102

103-
![<https://plot.ly/~brnvg/1134>](https://plot.ly/~brnvg/1134.png)
103+
![<https://plotly.com/~brnvg/1134>](https://plotly.com/~brnvg/1134.png)
104104

105105
## Learn more
106106

0 commit comments

Comments
 (0)