FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
plotly.R/man/partial_bundle.Rd at master · plotly/plotly.R · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
plotly
/
plotly.R
Public
Notifications
You must be signed in to change notification settings
Fork
641
Star
2.7k
Code
Issues
714
Pull requests
46
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
plotly.R
/
man
/
partial_bundle.Rd
Copy path
More file actions
More file actions
Latest commit
History
History
History
76 lines (69 loc) · 2.66 KB
Breadcrumbs
plotly.R
/
man
/
partial_bundle.Rd
Copy path
File metadata and controls
76 lines (69 loc) · 2.66 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
%
Generated
by
roxygen2
:
do
not
edit
by
hand
%
Please
edit
documentation
in
R
/
partial_bundles.R
\
name
{
partial_bundle
}
\
alias
{
partial_bundle
}
\
title
{
Use
a
partial
bundle
of
plotly.js
}
\
usage
{
partial_bundle(
p
,
type
=
"
auto
"
,
local
=
TRUE
,
minified
=
TRUE
)
}
\
arguments
{
\
item
{
p
}{
a
plotly
object.
}
\
item
{
type
}{
name
of
the (
partial
)
bundle.
The
default
, \
code
{
'
auto
'
},
attempts
to
find
the
smallest
single
bundle
that
can
render
\
code
{
p
}
.
If
no
single
partial
bundle
can
render
\
code
{
p
},
then
the
full
bundle
is
used.
}
\
item
{
local
}{
whether
or
not
to
download
the
partial
bundle
so
that
it
can
be
viewed
later
without
an
internet
connection.
}
\
item
{
minified
}{
whether
or
not
to
use
a
minified
js
file (
non
-
minified
file
can
be
useful
for
debugging
plotly.js
)}
}
\
description
{
Leveraging
plotly.js
'
partial bundles can lead to smaller file sizes
and faster rendering. The full list of available bundles, and the
trace types that they support, are available
\h
ref{https://github.com/plotly/plotly.js/blob/master/dist/README.md#partial-bundles}{here}
}
\d
etails{
WARNING: use this function with caution when rendering multiple
plotly graphs on a single website. That
'
s
because
,
if
multiple
plotly.js
bundles
are
used
,
the
most
recent
bundle
will
override
the
other
bundles.
See
the
examples
section
for
an
example.
}
\
examples
{
\
dontshow
{
if
(interactive()
||
!
identical(
.Platform
$
OS.type
,
"
windows
"
)) withAutoprint(\{
#
examplesIf}
#
----------------------------------------------------------------------
#
This function is always safe to use when rendering a single
#
plotly graph. In this case, we get a 3x file reduction.
#
----------------------------------------------------------------------
\
dontrun
{
library(
plotly
)
p
<-
plot_ly(
x
=
1
:
10
,
y
=
1
:
10
) \%
>
\% add_markers()
save_widget
<-
function
(
p
,
f
) {
owd
<-
setwd(dirname(
f
))
on.exit(setwd(
owd
))
htmlwidgets
::
saveWidget(
p
,
f
)
mb
<-
round(file.info(
f
)
$
size
/
1e6
,
3
)
message(
"
File is:
"
,
mb
,
"
MB
"
)
}
f1
<-
tempfile(
fileext
=
"
.html
"
)
f2
<-
tempfile(
fileext
=
"
.html
"
)
save_widget(
p
,
f1
)
save_widget(partial_bundle(
p
),
f2
)
#
----------------------------------------------------------------------
#
But, since plotly.js bundles override one another,
#
be careful when putting multiple graphs in a larger document!
#
Note how the surface (part of the gl3d bundle) renders, but the
#
heatmap (part of the cartesian bundle) doesn't...
#
----------------------------------------------------------------------
library(
htmltools
)
p1
<-
plot_ly(
z
=
~
volcano
) \%
>
\%
add_heatmap() \%
>
\%
partial_bundle()
p2
<-
plot_ly(
z
=
~
volcano
) \%
>
\%
add_surface() \%
>
\%
partial_bundle()
browsable(tagList(
p1
,
p2
))
}
\
dontshow
{\})
#
examplesIf}
}
\
author
{
Carson
Sievert
}
Back
|
FazBrowse Home
|
New Git URL