|
| 1 | +# Trace Auxiliary Objects |
| 2 | +# https://plot.ly/javascript-graphing-library/reference/#Trace_auxiliary_objects |
| 3 | +is.aux <- function(x) inherits(x, "auxiliary") |
| 4 | + |
| 5 | +#' Create an 'error_y' auxiliary object |
| 6 | +#' |
| 7 | +#' Available in \link{scatter}, \link{bar}, \link{histogram}, and \link{scatter3d}. |
| 8 | +#' |
| 9 | +#' @param type, symmetric, array, value, arrayminus, valueminus, color, |
| 10 | +#' thickness, width, opacity, visible |
| 11 | +#' @export |
| 12 | +#' @author Carson Sievert |
| 13 | +#' @references \url{https://plot.ly/javascript-graphing-library/reference/#error_y} |
| 14 | +#' @examples \dontrun{ |
| 15 | +#' means <- with(diamonds, tapply(carat, cut, mean)) |
| 16 | +#' sds <- with(diamonds, tapply(carat, cut, sd)) |
| 17 | +#' # construct the error bar object |
| 18 | +#' err <- error_y(array = as.numeric(sds)) |
| 19 | +#' # pass it to a trace object |
| 20 | +#' scatter(names(means), as.numeric(means), error_y = err) |
| 21 | +#' } |
| 22 | +error_y <- function(type = NULL, symmetric = NULL, array = NULL, value = NULL, |
| 23 | + arrayminus = NULL, valueminus = NULL, color = NULL, |
| 24 | + thickness = NULL, width = NULL, opacity = NULL, visible = NULL) { |
| 25 | + argz <- list( |
| 26 | + type = type, symmetric = symmetric, array = array, value = value, |
| 27 | + arrayminus = arrayminus, valueminus = valueminus, color = color, |
| 28 | + thickness = thickness, width = width, opacity = opacity, visible = visible |
| 29 | + ) |
| 30 | + structure( |
| 31 | + dropNulls(argz), |
| 32 | + class = c("error_y", "auxiliary") |
| 33 | + ) |
| 34 | +} |
| 35 | + |
| 36 | +#' Create an 'error_x' auxiliary object |
| 37 | +#' |
| 38 | +#' Available in \link{scatter}, \link{bar}, \link{histogram}, and \link{scatter3d}. |
| 39 | +#' |
| 40 | +#' @param type, symmetric, array, value, arrayminus, valueminus, color, |
| 41 | +#' thickness, width, opacity, copy_ystyle, visible |
| 42 | +#' @export |
| 43 | +#' @author Carson Sievert |
| 44 | +#' @references \url{https://plot.ly/javascript-graphing-library/reference/#error_x} |
| 45 | +#' @examples \dontrun{ |
| 46 | +#' means <- with(diamonds, tapply(carat, cut, mean)) |
| 47 | +#' sds <- with(diamonds, tapply(carat, cut, sd)) |
| 48 | +#' # construct the error bar object |
| 49 | +#' err <- error_x(array = as.numeric(sds)) |
| 50 | +#' # pass it to a trace object |
| 51 | +#' scatter(as.numeric(means), names(means), error_x = err) |
| 52 | +#' } |
| 53 | +error_x <- function(type = NULL, symmetric = NULL, array = NULL, value = NULL, |
| 54 | + arrayminus = NULL, valueminus = NULL, color = NULL, |
| 55 | + thickness = NULL, width = NULL, opacity = NULL, |
| 56 | + copy_ystyle = NULL, visible = NULL) { |
| 57 | + argz <- list( |
| 58 | + type = type, symmetric = symmetric, array = array, value = value, |
| 59 | + arrayminus = arrayminus, valueminus = valueminus, color = color, |
| 60 | + thickness = thickness, width = width, opacity = opacity, |
| 61 | + copy_ystyle = copy_ystyle, visible = visible |
| 62 | + ) |
| 63 | + structure( |
| 64 | + dropNulls(argz), |
| 65 | + class = c("error_x", "auxiliary") |
| 66 | + ) |
| 67 | +} |
| 68 | + |
| 69 | +#' Create a 'xbins' auxiliary object |
| 70 | +#' |
| 71 | +#' Available in \link{histogram}, \link{histogram2d}, \link{histogram2dcontour} |
| 72 | +#' |
| 73 | +#' @param start, end, size |
| 74 | +#' @export |
| 75 | +#' @author Carson Sievert |
| 76 | +#' @references \url{https://plot.ly/javascript-graphing-library/reference/#xbins} |
| 77 | +#' @examples \dontrun{ |
| 78 | +#' |
| 79 | +#' } |
| 80 | +xbins <- function(start = NULL, end = NULL, size = NULL) { |
| 81 | + argz <- list( |
| 82 | + start = start, end = end, size = size |
| 83 | + ) |
| 84 | + structure( |
| 85 | + dropNulls(argz), |
| 86 | + class = c("xbins", "auxiliary") |
| 87 | + ) |
| 88 | +} |
| 89 | + |
| 90 | +#' Create a 'ybins' auxiliary object |
| 91 | +#' |
| 92 | +#' Available in \link{histogram}, \link{histogram2d}, \link{histogram2dcontour} |
| 93 | +#' |
| 94 | +#' @param start, end, size |
| 95 | +#' @export |
| 96 | +#' @author Carson Sievert |
| 97 | +#' @references \url{https://plot.ly/javascript-graphing-library/reference/#ybins} |
| 98 | +#' @examples \dontrun{ |
| 99 | +#' |
| 100 | +#' } |
| 101 | +ybins <- function(start = NULL, end = NULL, size = NULL) { |
| 102 | + argz <- list( |
| 103 | + start = start, end = end, size = size |
| 104 | + ) |
| 105 | + structure( |
| 106 | + dropNulls(argz), |
| 107 | + class = c("ybins", "auxiliary") |
| 108 | + ) |
| 109 | +} |
| 110 | + |
| 111 | +#' Create a 'marker' auxiliary object |
| 112 | +#' |
| 113 | +#' Available in \link{scatter}, \link{bar}, \link{histogram}, \link{box}, |
| 114 | +#' \link{area}, \link{scatter3d}. |
| 115 | +#' |
| 116 | +#' @param color, size, symbol, line, opacity, sizeref, sizemode, colorscale, |
| 117 | +#' cauto, cmin, cmax, outliercolor, maxdisplayed |
| 118 | +#' @export |
| 119 | +#' @author Carson Sievert |
| 120 | +#' @references \url{https://plot.ly/javascript-graphing-library/reference/#marker} |
| 121 | +#' @examples \dontrun{ |
| 122 | +#' |
| 123 | +#' } |
| 124 | +marker <- function(color = NULL, size = NULL, symbol = NULL, line = NULL, |
| 125 | + opacity = NULL, sizeref = NULL, sizemode = NULL, |
| 126 | + colorscale = NULL, cauto = NULL, cmin = NULL, cmax = NULL, |
| 127 | + outliercolor = NULL, maxdisplayed = NULL) { |
| 128 | + argz <- list( |
| 129 | + color = color, size = size, symbol = symbol, line = line, opacity = opacity, |
| 130 | + sizeref = sizeref, sizemode = sizemode, colorscale = colorscale, |
| 131 | + cauto = cauto, cmin = cmin, cmax = cmax, outliercolor = outliercolor, |
| 132 | + maxdisplayed = maxdisplayed |
| 133 | + ) |
| 134 | + structure( |
| 135 | + dropNulls(argz), |
| 136 | + class = c("marker", "auxiliary") |
| 137 | + ) |
| 138 | +} |
| 139 | + |
| 140 | +#' Create a 'line' auxiliary object |
| 141 | +#' |
| 142 | +#' Available in \link{scatter}, \link{box}, \link{contour}, |
| 143 | +#' \link{histogram2dcontour}, \link{scatter3d}, \link{marker}. |
| 144 | +#' |
| 145 | +#' @param color, width, dash, opacity, shape, smoothing, outliercolor, outlierwidth |
| 146 | +#' @export |
| 147 | +#' @author Carson Sievert |
| 148 | +#' @references \url{https://plot.ly/javascript-graphing-library/reference/#line} |
| 149 | +#' @examples \dontrun{ |
| 150 | +#' |
| 151 | +#' } |
| 152 | +line <- function(color = NULL, width = NULL, dash = NULL, opacity = NULL, |
| 153 | + shape = NULL, smoothing = NULL, outliercolor = NULL, |
| 154 | + outlierwidth = NULL) { |
| 155 | + argz <- list( |
| 156 | + color = color, width = width, dash = dash, opacity = opacity, shape = shape, |
| 157 | + smoothing = smoothing, outliercolor = outliercolor, |
| 158 | + outlierwidth = outlierwidth |
| 159 | + ) |
| 160 | + structure( |
| 161 | + dropNulls(argz), |
| 162 | + class = c("line", "auxiliary") |
| 163 | + ) |
| 164 | +} |
| 165 | + |
| 166 | +#' Create a 'contours' auxiliary object |
| 167 | +#' |
| 168 | +#' Available in \link{contour} and \link{histogram2dcontour}. |
| 169 | +#' |
| 170 | +#' @param showlines, start, end, size, coloring |
| 171 | +#' @export |
| 172 | +#' @author Carson Sievert |
| 173 | +#' @references \url{https://plot.ly/javascript-graphing-library/reference/#contours} |
| 174 | +#' @examples \dontrun{ |
| 175 | +#' |
| 176 | +#' } |
| 177 | +contours <- function(showlines = NULL, start = NULL, end = NULL, |
| 178 | + size = NULL, coloring = NULL) { |
| 179 | + argz <- list( |
| 180 | + showlines = showlines, start = start, end = end, size = size, |
| 181 | + coloring = coloring |
| 182 | + ) |
| 183 | + structure( |
| 184 | + dropNulls(argz), |
| 185 | + class = c("contours", "auxiliary") |
| 186 | + ) |
| 187 | +} |
| 188 | + |
| 189 | + |
| 190 | +#' Create a 'colorbar' auxiliary object |
| 191 | +#' |
| 192 | +#' Available in \link{heatmap}, \link{contour}, \link{histogram2d}, \link{histogram2dcontour} |
| 193 | +#' |
| 194 | +#' @param title, titleside, titlefont, thickness, thicknessmode, len, lenmode, |
| 195 | +#' autotick, nticks, ticks, showticklabels, tick0, dtick, ticklen, tickwidth, |
| 196 | +#' tickcolor, tickangle, tickfont, exponentformat, showexponent, x, y, xanchor, |
| 197 | +#' yanchor, bgcolor, outlinecolor, outlinewidth, bordercolor, borderwidth, |
| 198 | +#' xpad, ypad |
| 199 | +#' @export |
| 200 | +#' @author Carson Sievert |
| 201 | +#' @references \url{https://plot.ly/javascript-graphing-library/reference/#colorbar} |
| 202 | +#' @examples \dontrun{ |
| 203 | +#' |
| 204 | +#' } |
| 205 | +colorbar <- function(title = NULL, titleside = NULL, titlefont = NULL, |
| 206 | + thickness = NULL, thicknessmode = NULL, len = NULL, |
| 207 | + lenmode = NULL, autotick = NULL, nticks = NULL, |
| 208 | + ticks = NULL, showticklabels = NULL, tick0 = NULL, |
| 209 | + dtick = NULL, ticklen = NULL, tickwidth = NULL, |
| 210 | + tickcolor = NULL, tickangle = NULL, tickfont = NULL, |
| 211 | + exponentformat = NULL, showexponent = NULL, x = NULL, |
| 212 | + y = NULL, xanchor = NULL, yanchor = NULL, bgcolor = NULL, |
| 213 | + outlinecolor = NULL, outlinewidth = NULL, |
| 214 | + bordercolor = NULL, borderwidth = NULL, xpad = NULL, |
| 215 | + ypad = NULL) { |
| 216 | + argz <- list( |
| 217 | + title = title, titleside = titleside, titlefont = titlefont, |
| 218 | + thickness = thickness, thicknessmode = thicknessmode, len = len, |
| 219 | + lenmode = lenmode, autotick = autotick, nticks = nticks, ticks = ticks, |
| 220 | + showticklabels = showticklabels, tick0 = tick0, dtick = dtick, |
| 221 | + ticklen = ticklen, tickwidth = tickwidth, tickcolor = tickcolor, |
| 222 | + tickangle = tickangle, tickfont = tickfont, exponentformat = exponentformat, |
| 223 | + showexponent = showexponent, x = x, y = y, xanchor = xanchor, |
| 224 | + yanchor = yanchor, bgcolor = bgcolor, outlinecolor = outlinecolor, |
| 225 | + outlinewidth = outlinewidth, bordercolor = bordercolor, |
| 226 | + borderwidth = borderwidth, xpad = xpad, ypad = ypad |
| 227 | + ) |
| 228 | + structure( |
| 229 | + dropNulls(argz), |
| 230 | + class = c("colorbar", "auxiliary") |
| 231 | + ) |
| 232 | +} |
| 233 | + |
| 234 | +#' Create a 'stream' auxiliary object |
| 235 | +#' |
| 236 | +#' Available in \link{scatter}, \link{bar}, \link{histogram}, \link{box}, |
| 237 | +#' \link{heatmap}, \link{contour}, \link{histogram2d}, \link{histogram2dcontour}, |
| 238 | +#' \link{area}, \link{scatter3d}, \link{surface}. |
| 239 | +#' |
| 240 | +#' @param token, maxpoints |
| 241 | +#' @export |
| 242 | +#' @author Carson Sievert |
| 243 | +#' @references \url{https://plot.ly/javascript-graphing-library/reference/#stream} |
| 244 | +#' @examples \dontrun{ |
| 245 | +#' |
| 246 | +#' } |
| 247 | +stream <- function(token = NULL, maxpoints = NULL) { |
| 248 | + argz <- list( |
| 249 | + token = token, maxpoints = maxpoints |
| 250 | + ) |
| 251 | + structure( |
| 252 | + dropNulls(argz), |
| 253 | + class = c("stream", "auxiliary") |
| 254 | + ) |
| 255 | +} |
| 256 | + |
| 257 | + |
| 258 | +#' Create a 'error_z' auxiliary object |
| 259 | +#' |
| 260 | +#' Available in \link{scatter3d}. |
| 261 | +#' |
| 262 | +#' @param type, symmetric, array, value, arrayminus, valueminus, color, |
| 263 | +#' thickness, width, opacity, visible. |
| 264 | +#' @export |
| 265 | +#' @author Carson Sievert |
| 266 | +#' @references \url{https://plot.ly/javascript-graphing-library/reference/#error_z} |
| 267 | +#' @examples \dontrun{ |
| 268 | +#' |
| 269 | +#' } |
| 270 | +error_z <- function(type = NULL, symmetric = NULL, array = NULL, value = NULL, |
| 271 | + arrayminus = NULL, valueminus = NULL, color = NULL, |
| 272 | + thickness = NULL, width = NULL, opacity = NULL, |
| 273 | + visible = NULL) { |
| 274 | + argz <- list( |
| 275 | + type = type, symmetric = symmetric, array = array, value = value, |
| 276 | + arrayminus = arrayminus, valueminus = valueminus, color = color, |
| 277 | + thickness = thickness, width = width, opacity = opacity, visible = visible |
| 278 | + ) |
| 279 | + structure( |
| 280 | + dropNulls(argz), |
| 281 | + class = c("error_z", "auxiliary") |
| 282 | + ) |
| 283 | +} |
0 commit comments