Skip to content

Commit 93fbce8

Browse files
committed
merge conflicts
2 parents 2124bbd + caa4175 commit 93fbce8

File tree

7 files changed

+212
-153
lines changed

7 files changed

+212
-153
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
* `subplot()` now works much better with annotations, images, and shapes:
4040
- When `xref`/`yref` references an x/y axis these references are bumped accordingly (#1181).
4141
- When `xref`/`yref` references paper coordinates, these coordinates are updated accordingly (#1332).
42+
* `subplot()` now repositions shapes with fixed height/width (i.e., `xsizemode`/`ysizemode` of `"pixel"`) correctly (#1494).
4243
* The colorscale generated via the `color` argument in `plot_ly()` now uses an evenly spaced grid of values instead of quantiles (#1308).
4344
* When using **shinytest** to test a **shiny** that contains **plotly** graph, false positive differences are no longer reported (rstudio/shinytest#174).
4445
* When the `size` argument maps to `marker.size`, it now converts to an array of appropriate length (#1479).
@@ -51,6 +52,7 @@
5152
* Recursive attribute validation is now only performed on recursive objects (#1315).
5253
* The `text` attribute is no longer collapsed to a string when `hoveron='fills+points'` (#1448).
5354
* `layout.[x-y]axis.domain` is no longer supplied a default when `layout.grid` is specified (#1427).
55+
* When uploading charts to a plot.ly account via `api_create()`, layout attributes are no longer incorrectly src-ified, which was causing inconsistencies in local/remote rendering of `ggplotly()` charts (#1197).
5456

5557
# 4.8.0
5658

R/subplots.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ reposition <- function(obj, domains) {
416416
o <- obj[[i]]
417417
xs <- if (identical(o$xref, "paper")) {
418418
if (is.numeric(o$sizex)) obj[[i]]$sizex <- o$sizex * abs(diff(xdom))
419-
c("x", "x0", "x1")
419+
if (identical(o$xsizemode, "pixel")) "xanchor" else c("x", "x0", "x1")
420420
}
421421
for (j in xs) {
422422
if (is.numeric(o[[j]])) {
@@ -425,7 +425,7 @@ reposition <- function(obj, domains) {
425425
}
426426
ys <- if (identical(o$yref, "paper")) {
427427
if (is.numeric(o$sizey)) obj[[i]]$sizey <- o$sizey * abs(diff(ydom))
428-
c("y", "y0", "y1")
428+
if (identical(o$ysizemode, "pixel")) "yanchor" else c("y", "y0", "y1")
429429
}
430430
for (j in ys) {
431431
if (is.numeric(o[[j]])) {

R/utils.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ verify_attr_names <- function(p) {
441441
verify_attr_spec <- function(p) {
442442
if (!is.null(p$x$layout)) {
443443
p$x$layout <- verify_attr(
444-
p$x$layout, Schema$layout$layoutAttributes
444+
p$x$layout, Schema$layout$layoutAttributes, layoutAttr = TRUE
445445
)
446446
}
447447
for (tr in seq_along(p$x$data)) {
@@ -456,7 +456,7 @@ verify_attr_spec <- function(p) {
456456
p
457457
}
458458

459-
verify_attr <- function(proposed, schema) {
459+
verify_attr <- function(proposed, schema, layoutAttr = FALSE) {
460460
for (attr in names(proposed)) {
461461
attrSchema <- schema[[attr]] %||% schema[[sub("[0-9]+$", "", attr)]]
462462
# if schema is missing (i.e., this is an un-official attr), move along
@@ -485,8 +485,10 @@ verify_attr <- function(proposed, schema) {
485485
}
486486

487487
# tag 'src-able' attributes (needed for api_create())
488+
# note that layout has 'src-able' attributes that shouldn't
489+
# be turned into grids https://github.com/ropensci/plotly/pull/1489
488490
isSrcAble <- !is.null(schema[[paste0(attr, "src")]]) && length(proposed[[attr]]) > 1
489-
if (isDataArray || isSrcAble) {
491+
if ((isDataArray || isSrcAble) && !isTRUE(layoutAttr)) {
490492
proposed[[attr]] <- structure(proposed[[attr]], apiSrc = TRUE)
491493
}
492494

@@ -514,7 +516,7 @@ verify_attr <- function(proposed, schema) {
514516

515517
# do the same for "sub-attributes"
516518
if (identical(role, "object") && is.recursive(proposed[[attr]])) {
517-
proposed[[attr]] <- verify_attr(proposed[[attr]], schema[[attr]])
519+
proposed[[attr]] <- verify_attr(proposed[[attr]], schema[[attr]], layoutAttr = layoutAttr)
518520
}
519521
}
520522

tests/figs/subplot/plotly-subplot-ggmatrix.svg

Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)