@@ -35,16 +35,16 @@ marginPlot <- function(margin, type, xvar, yvar, xparams, yparams, pb, data,
35
35
extraParams <- append(xparams , extraParams )
36
36
extraParams <- extraParams [! duplicated(names(extraParams ))]
37
37
if (type == " histogram" ) {
38
- if (! is.null(pb $ panel $ x_scales [[1 ]]$ get_limits )) {
39
- extraParams [[originParamName ]] <- pb $ panel $ x_scales [[1 ]]$ get_limits()[1 ]
38
+ if (! is.null(pb $ layout $ panel_scales $ x [[1 ]]$ get_limits )) {
39
+ extraParams [[originParamName ]] <- pb $ layout $ panel_scales $ x [[1 ]]$ get_limits()[1 ]
40
40
}
41
41
}
42
42
} else if (margin == " y" ) {
43
43
extraParams <- append(yparams , extraParams )
44
44
extraParams <- extraParams [! duplicated(names(extraParams ))]
45
45
if (type == " histogram" ) {
46
- if (! is.null(pb $ panel $ y_scales [[1 ]]$ get_limits )) {
47
- extraParams [[originParamName ]] <- pb $ panel $ y_scales [[1 ]]$ get_limits()[1 ]
46
+ if (! is.null(pb $ layout $ panel_scales $ y [[1 ]]$ get_limits )) {
47
+ extraParams [[originParamName ]] <- pb $ layout $ panel_scales $ y [[1 ]]$ get_limits()[1 ]
48
48
}
49
49
}
50
50
}
@@ -172,18 +172,18 @@ addMainTheme <- function(marginal, margin, p) {
172
172
getScale <- function (margin , type , pb ) {
173
173
if (margin == " x" ) {
174
174
if (type == " boxplot" ) {
175
- scale <- pb $ panel $ x_scales [[1 ]]
175
+ scale <- pb $ layout $ panel_scales $ x [[1 ]]
176
176
scale $ aesthetics <- gsub(" ^x" , " y" , scale $ aesthetics )
177
- scale $ limits <- pb $ panel $ x_scales [[1 ]]$ get_limits()
177
+ scale $ limits <- pb $ layout $ panel_scales $ x [[1 ]]$ get_limits()
178
178
} else {
179
- scale <- pb $ panel $ x_scales [[1 ]]
179
+ scale <- pb $ layout $ panel_scales $ x [[1 ]]
180
180
}
181
181
} else if (margin == " y" ) {
182
182
if (type == " boxplot" ) {
183
- scale <- pb $ panel $ y_scales [[1 ]]
184
- scale $ limits <- pb $ panel $ y_scales [[1 ]]$ get_limits()
183
+ scale <- pb $ layout $ panel_scales $ y [[1 ]]
184
+ scale $ limits <- pb $ layout $ panel_scales $ y [[1 ]]$ get_limits()
185
185
} else {
186
- scale <- pb $ panel $ y_scales [[1 ]]
186
+ scale <- pb $ layout $ panel_scales $ y [[1 ]]
187
187
scale $ aesthetics <- gsub(" ^y" , " x" , scale $ aesthetics )
188
188
}
189
189
}
@@ -195,9 +195,9 @@ getScale <- function(margin, type, pb) {
195
195
# marginal plots will use the same range
196
196
getLimits <- function (pb , margin ) {
197
197
if (margin == " x" ) {
198
- scales <- pb $ panel $ x_scales [[1 ]]
198
+ scales <- pb $ layout $ panel_scales $ x [[1 ]]
199
199
} else if (margin == " y" ) {
200
- scales <- pb $ panel $ y_scales [[1 ]]
200
+ scales <- pb $ layout $ panel_scales $ y [[1 ]]
201
201
} else {
202
202
stop(" Invalid `margin` parameter (only x and y are supported)" , call. = FALSE )
203
203
}
0 commit comments