Package ‘plotly’ - R

2y ago
48 Views
3 Downloads
225.74 KB
72 Pages
Last View : 13d ago
Last Download : 3m ago
Upload by : Brady Himes
Transcription

Package ‘plotly’January 10, 2021Title Create Interactive Web Graphics via 'plotly.js'Version 4.9.3License MIT file LICENSEDescriptionCreate interactive web graphics from 'ggplot2' graphs and/or a custom interface to the (MITlicensed) JavaScript library 'plotly.js' inspired by the grammar of graphics.URL https://plotly-r.com, plotly.com/r/BugReports https://github.com/ropensci/plotly/issuesDepends R ( 3.2.0), ggplot2 ( 3.0.0)Imports tools, scales, httr ( 1.3.0), jsonlite ( 1.6), magrittr,digest, viridisLite, base64enc, htmltools ( 0.3.6),htmlwidgets ( 1.5.2.9001), tidyr, RColorBrewer, dplyr, vctrs,tibble, lazyeval ( 0.2.0), rlang, crosstalk, purrr,data.table, promisesSuggests MASS, maps, hexbin, ggthemes, GGally, testthat, knitr,devtools, shiny ( 1.1.0), shinytest ( 1.3.0), curl,rmarkdown, vdiffr, Cairo, broom, webshot, listviewer,dendextend, sf, maptools, rgeos, png, IRdisplay, processx,plotlyGeoAssets, forcats, palmerpenguinsLazyData trueRoxygenNote 7.1.1Encoding UTF-8NeedsCompilation noAuthor Carson Sievert [aut, cre] ( https://orcid.org/0000-0002-4958-2844 ),Chris Parmer [aut],Toby Hocking [aut],Scott Chamberlain [aut],Karthik Ram [aut],Marianne Corvellec [aut] ( https://orcid.org/0000-0002-1994-3581 ),Pedro Despouy [aut],1

R topics documented:2Salim Brüggemann [ctb] ( https://orcid.org/0000-0002-5329-5987 ),Plotly Technologies Inc. [cph]Maintainer Carson Sievert cpsievert1@gmail.com Repository CRANDate/Publication 2021-01-10 14:30:02 UTCR topics documented:add annotations . . . . .add data . . . . . . . . .add fun . . . . . . . . .add trace . . . . . . . .animation opts . . . . .api create . . . . . . . .as.widget . . . . . . . .as widget . . . . . . . .attrs selected . . . . . .bbox . . . . . . . . . . .colorbar . . . . . . . . .config . . . . . . . . . .embed notebook . . . .event data . . . . . . . .event register . . . . . .event unregister . . . . .export . . . . . . . . . .geom2trace . . . . . . .get figure . . . . . . . .gg2list . . . . . . . . . .ggplotly . . . . . . . . .group2NA . . . . . . . .hide colorbar . . . . . .hide guides . . . . . . .hide legend . . . . . . .highlight . . . . . . . . .highlight key . . . . . .hobbs . . . . . . . . . .knit print.api grid . . .knit print.api grid localknit print.api plot . . .last plot . . . . . . . . .layout . . . . . . . . . .mic . . . . . . . . . . .offline . . . . . . . . . .orca . . . . . . . . . . .partial bundle . . . . . .plotly-shiny . . . . . . .plotlyProxy . . . . . . 2323333343435353636394142

add annotations3plotly build . . . . . . . .plotly data . . . . . . . .plotly empty . . . . . . .plotly example . . . . . .plotly IMAGE . . . . . .plotly json . . . . . . . .plotly POST . . . . . . .plot dendro . . . . . . . .plot geo . . . . . . . . . .plot ly . . . . . . . . . . .plot mapbox . . . . . . .print.api . . . . . . . . . .print.api grid . . . . . . .print.api grid local . . . .print.api plot . . . . . . .rangeslider . . . . . . . . .raster2uri . . . . . . . . .remove typedarray polyfillres mn . . . . . . . . . . .schema . . . . . . . . . .showRGB . . . . . . . . .signup . . . . . . . . . . .style . . . . . . . . . . . .subplot . . . . . . . . . . .TeX . . . . . . . . . . . .toRGB . . . . . . . . . . .toWebGL . . . . . . . . .to basic . . . . . . . . . .wind . . . . . . . . . . . .Indexadd 6162626364666768686970Add an annotation(s) to a plotDescriptionAdd an annotation(s) to a plotUsageadd annotations(p, text NULL, ., data NULL, inherit TRUE)

4add dataArgumentspa plotly objecttextannotation text (required).these arguments are documented at c/components/annotations/attributes.jsdataa data frame.inheritinherit attributes from plot ly()?Author(s)Carson Sievertadd dataAdd data to a plotly visualizationDescriptionAdd data to a plotly visualizationUsageadd data(p, data NULL)Argumentspa plotly visualizationdataa data frame.Examplesplot ly() % % add data(economics) % % add trace(x date, y pce)

add fun5add funApply function to plot, without modifying dataDescriptionUseful when you need two or more layers that apply a summary statistic to the original data.Usageadd fun(p, fun, .)Argumentspa plotly object.funa function. Should take a plotly object as input and return a modified plotlyobject.arguments passed to fun.add traceAdd trace(s) to a plotly visualizationDescriptionAdd trace(s) to a plotly visualizationUsageadd trace(p, ., data NULL, inherit TRUE)add markers(p, x NULL, y NULL, z NULL, ., data NULL, inherit TRUE)add text(p,x NULL,y NULL,z NULL,text NULL,.,data NULL,inherit TRUE)add paths(p, x NULL, y NULL, z NULL, ., data NULL, inherit TRUE)add lines(p, x NULL, y NULL, z NULL, ., data NULL, inherit TRUE)

6add traceadd segments(p,x NULL,y NULL,xend NULL,yend NULL,.,data NULL,inherit TRUE)add polygons(p, x NULL, y NULL, ., data NULL, inherit TRUE)add sf(p, ., x x, y y, data NULL, inherit TRUE)add table(p, ., rownames TRUE, data NULL, inherit TRUE)add ribbons(p,x NULL,ymin NULL,ymax NULL,.,data NULL,inherit TRUE)add image(p, z NULL, colormodel NULL, ., data NULL, inherit TRUE)add area(p, r NULL, t NULL, ., data NULL, inherit TRUE)add pie(p, values NULL, labels NULL, ., data NULL, inherit TRUE)add bars(p, x NULL, y NULL, ., data NULL, inherit TRUE)add histogram(p, x NULL, y NULL, ., data NULL, inherit TRUE)add histogram2d(p,x NULL,y NULL,z NULL,.,data NULL,inherit TRUE)

add trace7add histogram2dcontour(p,x NULL,y NULL,z NULL,.,data NULL,inherit TRUE)add heatmap(p, x NULL, y NULL, z NULL, ., data NULL, inherit TRUE)add contour(p, z NULL, ., data NULL, inherit TRUE)add boxplot(p, x NULL, y NULL, ., data NULL, inherit TRUE)add surface(p, z NULL, ., data NULL, inherit TRUE)add mesh(p, x NULL, y NULL, z NULL, ., data NULL, inherit TRUE)add scattergeo(p, .)add choropleth(p, z NULL, ., data NULL, inherit TRUE)Argumentspa plotly object.Arguments (i.e., attributes) passed along to the trace type. See schema() fora list of acceptable attributes for a given trace type (by going to traces - type - attributes). Note that attributes provided at this level may overrideother arguments (e.g. plot ly(x 1:10,y 1:10,color I("red"),marker list(color "blue"))).dataA data frame (optional) or crosstalk::SharedData object.inheritinherit attributes from plot ly()?xthe x variable.ythe y variable.za numeric matrix (unless add image(), which wants a raster object, see as.raster()).texttextual labels.xend"final" x position (in this context, x represents "start")yend"final" y position (in this context, y represents "start")rownameswhether or not to display the rownames of data.ymina variable used to define the lower boundary of a polygon.ymaxa variable used to define the upper boundary of a polygon.colormodelSets the colormodel for image traces if z is not a raster object. If z is a rasterobject (see as.raster()), the 'rgba' colormodel is always used.

8add tracerFor polar chart only. Sets the radial coordinates.tFor polar chart only. Sets the radial coordinates.valuesthe value to associated with each slice of the pie.labelsthe labels (categories) corresponding to values.Author(s)Carson ce/See Alsoplot ly()Examples# the plot ly() function initiates an object, and if no trace type# is specified, it sets a sensible defaultp - plot ly(economics, x date, y uempmed)p# some add *() functions are a specific case of a trace type# for example, add markers() is a scatter trace with mode of markersadd markers(p)# scatter trace with mode of textadd text(p, text "%")# scatter trace with mode of linesadd paths(p)# like add paths() , but ensures points are connected according to x add lines(p)# if you prefer to work with plotly.js more directly, can always# use add trace() and specify the type yourselfadd trace(p, type "scatter", mode "markers lines")# mappings provided to plot ly() are "global", but can be overwrittenplot ly(economics, x date, y uempmed, color I("red"), showlegend FALSE) % %add lines() % %add markers(color pop)# a number of add *() functions are special cases of the scatter trace

add traceplot ly(economics, x date) % %add ribbons(ymin pce - 1e3, ymax pce 1e3)# use group by() (or group2NA() ) to apply visual mapping# once per group (e.g. one line per group)txhousing % %group by(city) % %plot ly(x date, y median) % %add lines(color I("black"))## Not run:# use add sf() or add polygons() to create geo-spatial maps# o-spatial-data-with-sf-and-plotly/if (requireNamespace("sf", quietly TRUE)) {nc - sf::st read(system.file("shape/nc.shp", package "sf"), quiet TRUE)plot ly() % % add sf(data nc)}# univariate summary statisticsplot ly(mtcars, x factor(vs), y mpg) % %add boxplot()plot ly(mtcars, x factor(vs), y mpg) % %add trace(type "violin")# add histogram() does binning for you.mtcars % %plot ly(x factor(vs)) % %add histogram()# .but you can 'pre-compute' bar heights in Rmtcars % %dplyr::count(vs) % %plot ly(x vs, y n) % %add bars()# the 2d analogy of add histogram() is add histogram2d()/add histogram2dcontour()library(MASS)(p - plot ly(geyser, x waiting, y duration))add histogram2d(p)add histogram2dcontour(p)# the 2d analogy of add bars() is add heatmap()/add contour()# (i.e., bin counts must be pre-specified)den - kde2d(geyser waiting, geyser duration)p - plot ly(x den x, y den y, z den z)add heatmap(p)add contour(p)# add table() makes it easy to map a data frame to the table trace typeplot ly(economics) % %add table()# pie charts!9

10animation optsds - data.frame(labels c("A", "B", "C"), values c(10, 40, 60))plot ly(ds, labels labels, values values) % %add pie() % %layout(title "Basic Pie Chart using Plotly")data(wind)plot ly(wind, r r, t t) % %add area(color nms) % %layout(radialaxis list(ticksuffix "%"), orientation 270)# ---------# 3D chart types# ---------plot ly(z volcano) % %add surface()plot ly(x c(0, 0, 1), y c(0, 1, 0), z c(0, 0, 0)) % %add mesh()## End(Not run)animation optsAnimation configuration optionsDescriptionAnimations can be created by either using the frame argument in plot ly() or the (unofficial)frame ggplot2 aesthetic in ggplotly(). By default, animations populate a play button and slidercomponent for controlling the state of the animation (to pause an animation, click on a relevantlocation on the slider bar). Both the play button and slider component transition between framesaccording rules specified by animation opts().Usageanimation opts(p,frame 500,transition frame,easing "linear",redraw TRUE,mode "immediate")animation slider(p, hide FALSE, .)animation button(p, ., label)

animation opts11Argumentspa plotly object.frameThe amount of time between frames (in milliseconds). Note that this amountshould include the transition.transitionThe duration of the smooth transition between frames (in milliseconds).easingThe type of transition easing. See the list of options here c/plots/animation attributes.jsredrawTrigger a redraw of the plot at completion of the transition? A redraw maysignificantly impact performance, but may be necessary to update graphical elements that can’t be transitioned.modeDescribes how a new animate call interacts with currently-running animations.If immediate, current animations are interrupted and the new animation is started.If next, the current frame is allowed to complete, after which the new animationis started. If afterall all existing frames are animated to completion before thenew animation is started.hideremove the animation slider?.for animation slider, attributes are passed to a special layout.sliders objecttied to the animation frames. The definition of these attributes may be found r/src/components/sliders/attributes.js For animation button, arguments are passed to a special layout.updatemenus button object tied to the animation c/components/updatemenus/attributes.jslabela character string used for the animation button’s labelAuthor(s)Carson SievertExamplesdf - data.frame(x c(1, 2, 2, 1, 1, 2),y c(1, 2, 2, 1, 1, 2),z c(1, 1, 2, 2, 3, 3))plot ly(df) % %add markers(x 1.5, y 1.5) % %add markers(x x, y y, frame z)# it's a good idea to remove smooth transitions when there is# no relationship between objects in each viewplot ly(mtcars, x wt, y mpg, frame cyl) % %animation opts(transition 0)# works the same way with ggplotly

12api createif (interactive()) {p - ggplot(txhousing, aes(month, median)) geom line(aes(group year), alpha 0.3) geom smooth() geom line(aes(frame year, ids month), color "red") facet wrap( city)}ggplotly(p, width 1200, height 900) % %animation opts(1000)#' # for more, see https://plotly.com/r/animating-views.htmlapi createTools for working with plotly’s REST API (v2)DescriptionConvenience functions for working with version 2 of plotly’s REST API. Upload R objects to aplotly account via api create() and download plotly objects via api download plot()/api download grid().For anything else, use api().Usageapi create(x last plot(),filename NULL,fileopt c("overwrite", "new"),sharing c("public", "private", "secret"),.)## S3 method for class 'plotly'api create(x last plot(),filename NULL,fileopt "overwrite",sharing "public",.)## S3 method for class 'ggplot'api create(x last plot(),filename NULL,fileopt "overwrite",

api create)13sharing "public",.## S3 method for class 'data.frame'api create(x, filename NULL, fileopt "overwrite", sharing "public", .)api download plot(id, username)api download grid(id, username)api(endpoint "/", verb "GET", body NULL, .)ArgumentsxAn R object to hosted on plotly’s web platform. Can be a plotly/ggplot2 objector a data.frame.filenamecharacter vector naming file(s). If x is a plot, can be a vector of length 2 namingboth the plot AND the underlying grid.fileoptcharacter string describing whether to "overwrite" existing files or ensure "new"file(s) are always created.sharingIf ’public’, anyone can view this graph. It will appear in your profile and canappear in search engines. You do not need to be logged in to Plotly to view thischart. If ’private’, only you can view this plot. It will not appear in the Plotlyfeed, your profile, or search engines. You must be logged in to Plotly to viewthis graph. You can privately share this graph with other Plotly users in youronline Plotly account and they will need to be logged in to view this plot. If’secret’, anyone with this secret link can view this chart. It will not appear in thePlotly feed, your profile, or search engines. If it is embedded inside a webpageor an IPython notebook, anybody who is viewing that page will be able to viewthe graph. You do not need to be logged in to view this plot.For api(), these arguments are passed onto httr::RETRY(). For api create(),these arguments are included in the body of the HTTP request.ida filename id.usernamea plotly username.endpointthe endpoint (i.e., location) for the request. To see a list of all available endpoints, call api(). Any relevant query parameters should be included here (seeexamples).verbname of the HTTP verb to use (as in, httr::RETRY()).bodybody of the HTTP request(as in, httr::RETRY()). If this value is not alreadyconverted to JSON (via jsonlite::toJSON()), it uses the internal to JSON()to ensure values are "automatically unboxed" (i.e., vec.Author(s)Carson Sievert

14api createReferenceshttps://api.plot.ly/v2See Alsosignup()Examples## Not -----------------api create() makes it easy to upload ggplot2/plotly objectsand/or data frames to your plotly -----------------# A data frame creates a plotly "grid". Printing one will take you# to the it's web address so you can start creating!(m - api create(mtcars))# A plotly/ggplot2 object create a plotly "plot".p - plot ly(mtcars, x factor(vs))(r - api create(p))# api create() returns metadata about the remote "file". Here is# one way you could use that metadata to download a plot for local use:fileID - strsplit(r file fid, ":")[[1]]layout(api download plot(fileID[2], fileID[1]),title sprintf("Local version of a href '%s' this /a plot", r file web --------------# The api() function provides a low-level interface for performing# any action at any endpoint! It always returns a list.# ---------# list all the endpointsapi()# search the entire platform!# see https://api.plot.ly/v2/searchapi("search?q overdose")api("search?q plottype:pie trump fake")# these examples will require a user accountusr - Sys.getenv("plotly username", NA)if (!is.na(usr)) {# your account info https://api.plot.ly/v2/#usersapi(spr

p a plotly object. fun a function. Should take a plotly object as input and return a modified plotly object. arguments passed to fun. add_trace Add trace(s) to a plotly visualization Description Add trace(s) to a plotly visualization Usage add_trace(p, ., data NULL, inherit TRUE)File Size: 210KB

Related Documents:

Plotly ii About the Tutorial This tutorial is about Canada based technical computing company Plotly which is also known for its URL. Here, you will learn about how to develop data analytics and visualization tools. Moreover, this tu

Feb 18, 2020 · DASH PLOTLY Presentation Dash https://plot.ly/dash/ “Dash is the fastest way to build interactive analytic apps” (says their website) Open source under MIT licensing Dash is available for both Python and R (similar to RStudio) good&illustrated documentation: https://dash.plot.ly/ Plotly HTML/JS

Instructions and FAQs for creating and submitting interactive Plotly figures to F1000Research Creating Plotly figures 1a. Online method using your Plotly cloud account Go to https://plot.ly/feed/ to sign up. The default Community account is free, and has all the features needed to cr

Bokeh is an interactive visualization Python library. Provides elegant and concise construction of versatile graphics. Usage: Can be used in Jupyter Notebooks and can provide high-performance interactive charts and plots. Plotly - Alternatives (Bokeh, D3.js) D3.js:

Package style descriptive code LQFP (low profile quad flat package) Package body material type P (plastic) JEDEC package outline code MS-026 BCD Mounting method type S (surface mount) Issue date 25-01-2016 Manufacturer package code 98ASS23234W Table 1. Package summary Parameter Min Nom Max Unit package length 9.8 10 10.2 mm package width 9.8 10 .

226 ABS - CBN News TFC Package 227 BRO TFC Package 228 MYX TFC Package 229 Cinema One Global TFC Package 230 DZMM Teleradyo TFC Package . 231 DWRR Radio TFC Package 233 Kapatid TV5 Y Y 235 Net-25 Y Y Y 261 NHK World Premium Y Y 275 SBTN SBTN 300 700 HBO HBO Package .

C h a p t e r 1 Salesforce Managed Package This chapter includes the following topics: Salesforce Managed Package Overview, 5 Salesforce Managed Package URLs, 5 Installing the Managed Package, 6 Uninstalling and Deleting the Managed Package, 9 More Information, 10 Salesforce Managed Package Overview You need the Informatica Cloud Real Time for Salesforce package (the .

approachablemusic.com Of course, learning the basic guitar chords is only the first step to learning guitar. To take your guitar playing to the next level, you also need to gain a rock-solid strum and learn how to use a capo.