Skip to content

Commit 4cdde72

Browse files
committed
A new declarative DSL
1 parent 026371a commit 4cdde72

64 files changed

Lines changed: 2862 additions & 489 deletions

Some content is hidden

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

DESCRIPTION

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
Package: plotly
22
Type: Package
33
Title: Interactive, publication-quality graphs online.
4-
Version: 0.6.2
5-
Authors@R: c(person("Chris", "Parmer", role = c("aut", "cre"),
4+
Version: 1.0.0
5+
Authors@R: c(person("Chris", "Parmer", role = c("aut", "cph"),
66
email = "[email protected]"),
77
person("Scott", "Chamberlain", role = "aut",
88
email = "[email protected]"),
99
person("Karthik", "Ram", role = "aut",
1010
email = "[email protected]"),
11-
person("Toby", "Hocking", role="aut",
12-
13-
person("Marianne", "Corvellec", role="aut",
14-
15-
person("Pedro", "Despouy", role="aut",
16-
17-
person("Carson", "Sievert", role="aut",
18-
19-
Author: Chris Parmer
20-
Maintainer: Marianne Corvellec <[email protected]>
11+
person("Toby", "Hocking", role = "aut",
12+
email = "[email protected]"),
13+
person("Marianne", "Corvellec", role = "aut",
14+
email = "[email protected]"),
15+
person("Pedro", "Despouy", role = "aut",
16+
email = "[email protected]"),
17+
person("Carson", "Sievert", role = c("aut", "cre"),
18+
email = "[email protected]"))
2119
License: MIT + file LICENSE
2220
Description: An interface to plotly's online graphing tools with desktop R
2321
environments. Send data to a plotly account and view the graphs in a web
@@ -31,9 +29,10 @@ Depends:
3129
ggplot2
3230
Imports:
3331
httr,
34-
RJSONIO
32+
jsonlite
3533
Suggests:
3634
maps,
3735
testthat,
3836
knitr,
39-
devtools
37+
devtools,
38+
simsalapar

NAMESPACE

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,55 @@
11
# Generated by roxygen2 (4.1.1): do not edit by hand
22

3+
S3method("+",figure)
4+
S3method("+",plotly)
5+
S3method(print,figure)
6+
S3method(print,plotly)
7+
export(angularaxis)
8+
export(annotation)
9+
export(area)
10+
export(bar)
11+
export(box)
12+
export(colorbar)
13+
export(contour)
14+
export(contours)
315
export(embed_notebook)
16+
export(error_x)
17+
export(error_y)
18+
export(error_z)
19+
export(font)
420
export(get_figure)
521
export(gg2list)
622
export(ggplot_build2)
23+
export(ggplotly)
724
export(group2NA)
8-
export(knit_print.clientresp)
25+
export(heatmap)
26+
export(histogram)
27+
export(histogram2d)
28+
export(knit_print.figure)
29+
export(knit_print.plotly)
930
export(layer2traces)
31+
export(layout)
32+
export(legend)
33+
export(line)
34+
export(margin)
35+
export(marker)
1036
export(paramORdefault)
1137
export(plotly)
1238
export(plotly_POST)
39+
export(radialaxis)
40+
export(scatter)
41+
export(scatter3d)
42+
export(scene)
1343
export(signup)
44+
export(stream)
45+
export(subplot)
46+
export(surface)
1447
export(toRGB)
15-
import(RJSONIO)
48+
export(xaxis)
49+
export(xbins)
50+
export(yaxis)
51+
export(ybins)
52+
export(zaxis)
1653
import(ggplot2)
1754
import(httr)
55+
import(jsonlite)

R/aux.R

Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
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

Comments
 (0)