Title: | Create Charts with 'Observable Plot' |
---|---|
Description: | Creation of charts with the 'Observable Plot' 'JavaScript' library. |
Authors: | Julien Barnier [aut, cre], Observable, Inc. [cph] (Observable Plot library, https://observablehq.com/@observablehq/plot) |
Maintainer: | Julien Barnier <[email protected]> |
License: | GPL (>=3) |
Version: | 0.0.2.9000 |
Built: | 2024-11-10 05:31:11 UTC |
Source: | https://github.com/juba/obsplot |
Sample data from Observable Plot documentation examples
aapl
aapl
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 1260 rows and 7 columns.
https://observablehq.com/@observablehq/plot-area
Sample data from Observable Plot documentation examples
alphabet
alphabet
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 26 rows and 2 columns.
https://observablehq.com/@observablehq/plot-dot
Sample data from Observable Plot documentation examples
anscombe_obs
anscombe_obs
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 44 rows and 3 columns.
https://observablehq.com/@observablehq/plot-facets
Tells obsplot that a single value is a vector channel, and must be converted to an Array in JavaScript
as_data(x)
as_data(x)
x |
the object to be considered as a vector channel |
Sample data from Observable Plot documentation examples
athletes
athletes
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 11538 rows and 12 columns.
https://observablehq.com/@observablehq/plot-bin
Sample data from Observable Plot documentation examples
barley
barley
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 120 rows and 4 columns.
https://observablehq.com/@observablehq/plot-facets
Sample data from Observable Plot documentation examples
bls
bls
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 1708 rows and 3 columns.
https://observablehq.com/@observablehq/plot-area
Sample data from Observable Plot documentation examples
bls_unemployment
bls_unemployment
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 7470 rows and 3 columns.
https://observablehq.com/@observablehq/plot-line
Sample data from Observable Plot documentation examples
caltrain
caltrain
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 78 rows and 7 columns.
https://observablehq.com/@observablehq/plot-text
Sample data from Observable Plot documentation examples
civilizations
civilizations
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 51 rows and 7 columns.
https://observablehq.com/@observablehq/plot-bar
Sample data from Observable Plot documentation examples
congress
congress
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 887 rows and 3 columns.
https://observablehq.com/@observablehq/plot-stack
Sample data from Observable Plot documentation examples
crimea
crimea
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 72 rows and 3 columns.
https://observablehq.com/@observablehq/plot-stack
Sample data from Observable Plot documentation examples
diamonds_obs
diamonds_obs
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 53940 rows and 2 columns.
https://observablehq.com/@observablehq/plot-dot
Sample data from Observable Plot documentation examples
dji
dji
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 5080 rows and 7 columns.
https://observablehq.com/@observablehq/plot-cell
Sample data from Observable Plot documentation examples
driving
driving
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 55 rows and 4 columns.
https://observablehq.com/@observablehq/plot-dot
Add a facet to an obsplot
facet(g, data = NULL, ...)
facet(g, data = NULL, ...)
g |
an obsplot object |
data |
optional data |
... |
options passed to define the facet |
Sample data from Observable Plot documentation examples
gistemp
gistemp
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 1644 rows and 2 columns.
https://observablehq.com/@observablehq/plot-dot
Sample data from Observable Plot documentation examples
income
income
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 49 rows and 4 columns.
https://observablehq.com/@observablehq/plot-link
Sample data from Observable Plot documentation examples
iowa
iowa
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 171 rows and 3 columns.
https://observablehq.com/@observablehq/plot-stack
Add a mark to an obsplot
mark_area(g, ...) mark_areaX(g, ...) mark_areaY(g, ...) mark_barX(g, ...) mark_barY(g, ...) mark_cell(g, ...) mark_cellX(g, ...) mark_cellY(g, ...) mark_dot(g, ...) mark_dotX(g, ...) mark_dotY(g, ...) mark_line(g, ...) mark_lineX(g, ...) mark_lineY(g, ...) mark_link(g, ...) mark_rect(g, ...) mark_rectX(g, ...) mark_rectY(g, ...) mark_ruleX(g, ...) mark_ruleY(g, ...) mark_text(g, ...) mark_textX(g, ...) mark_textY(g, ...) mark_tickX(g, ...) mark_tickY(g, ...) mark_image(g, ...)
mark_area(g, ...) mark_areaX(g, ...) mark_areaY(g, ...) mark_barX(g, ...) mark_barY(g, ...) mark_cell(g, ...) mark_cellX(g, ...) mark_cellY(g, ...) mark_dot(g, ...) mark_dotX(g, ...) mark_dotY(g, ...) mark_line(g, ...) mark_lineX(g, ...) mark_lineY(g, ...) mark_link(g, ...) mark_rect(g, ...) mark_rectX(g, ...) mark_rectY(g, ...) mark_ruleX(g, ...) mark_ruleY(g, ...) mark_text(g, ...) mark_textX(g, ...) mark_textY(g, ...) mark_tickX(g, ...) mark_tickY(g, ...) mark_image(g, ...)
g |
an obsplot object |
... |
named options passed to define the mark ... arguments can accept at most two unnamed arguments : a data object and a call to a transform function. |
Add a decoration mark to an obsplot
mark_frame(g, fill = "none", ...)
mark_frame(g, fill = "none", ...)
g |
an obsplot object |
fill |
fill CSS color |
... |
options passed to define the mark |
Add a render function mark to an obsplot
mark_function(g, f, ...)
mark_function(g, f, ...)
g |
an obsplot object |
f |
render function, defined with |
... |
options passed to define the mark |
Add an SVG element to an obsplot
mark_svg(g, svg, ...)
mark_svg(g, svg, ...)
g |
an obsplot object |
svg |
SVG to add, as a character string |
... |
options passed to define the mark |
Sample data from Observable Plot documentation examples
metros
metros
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 195 rows and 10 columns.
https://observablehq.com/@observablehq/plot-link
Sample data from Observable Plot documentation examples
mobydick1
mobydick1
An object of class character
of length 9622.
https://observablehq.com/@observablehq/plot-group
Create a new obsplot
obsplot( data = NULL, width = "auto", height = "auto", menu = getOption("obsplot_menu"), elementId = NULL, ... )
obsplot( data = NULL, width = "auto", height = "auto", menu = getOption("obsplot_menu"), elementId = NULL, ... )
data |
optional data.frame as primary data source |
width |
plot width. Use NULL to let Plot decide, or "auto" to let htmlwidgets decide |
height |
plot height. Use NULL to let Plot decide, or "auto" to let htmlwidgets decide |
menu |
if TRUE, display a gear menu aside the plot with additional features. Can be set globally with |
elementId |
optional custom element id, passed to createWidget() |
... |
named options passed to Observable Plot |
Output and render functions for using obsplot within Shiny applications and interactive Rmd documents.
obsplotOutput(outputId, width = "100%", height = "400px") renderObsplot(expr, env = parent.frame(), quoted = FALSE)
obsplotOutput(outputId, width = "100%", height = "400px") renderObsplot(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width , height
|
Must be a valid CSS unit (like |
expr |
An expression that generates a obsplot |
env |
The environment in which to evaluate |
quoted |
Is |
Define an obsplot options
opts(g, ...)
opts(g, ...)
g |
an obsplot object |
... |
named options |
Sample data from Observable Plot documentation examples
popchange
popchange
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 52 rows and 3 columns.
https://observablehq.com/@observablehq/plot-bar
Sample data from Observable Plot documentation examples
povcalnet
povcalnet
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 173 rows and 32 columns.
https://observablehq.com/@observablehq/plot-rect
Sample data from Observable Plot documentation examples
riaa
riaa
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 1081 rows and 4 columns.
https://observablehq.com/@observablehq/plot-stack
Define an obsplot scale options
scale_color(g, ...) scale_opacity(g, ...) scale_r(g, ...) scale_x(g, ...) scale_y(g, ...) scale_fx(g, ...) scale_fy(g, ...)
scale_color(g, ...) scale_opacity(g, ...) scale_r(g, ...) scale_x(g, ...) scale_y(g, ...) scale_fx(g, ...) scale_fy(g, ...)
g |
an obsplot object |
... |
named scale options |
Sample data from Observable Plot documentation examples
seattle
seattle
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 1461 rows and 6 columns.
https://observablehq.com/@observablehq/plot-cell
Sample data from Observable Plot changelog
sfcases
sfcases
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 1797 rows and 5 columns.
https://observablehq.com/@visnup/sf-covid-data
Sample data from Observable Plot documentation examples
sftemp
sftemp
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 732 rows and 3 columns.
https://observablehq.com/@observablehq/plot-area
Sample data from Observable Plot documentation examples
simpsons
simpsons
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 600 rows and 13 columns.
https://observablehq.com/@observablehq/plot-cell
Sample data from Observable Plot documentation examples
stateage
stateage
An object of class tbl_df
(inherits from tbl
, data.frame
) with 468 rows and 3 columns.
https://observablehq.com/@observablehq/plot-dot
Sample data from Observable Plot documentation examples
stocks
stocks
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 5040 rows and 8 columns.
https://observablehq.com/@observablehq/plot-line
Define an obsplot style options
style(g, ...)
style(g, ...)
g |
an obsplot object |
... |
named style options |
Convert a Date or POSIXt object to a JS Date format
to_js_date(date)
to_js_date(date)
date |
object to be converted |
Numeric value representing the number of milliseconds between Unix Epoch
(1 January 1970 UTC) and date
.
Define an Observable Plot transform with outputs and options
transform_bin(...) transform_binX(...) transform_binY(...) transform_group(...) transform_groupX(...) transform_groupY(...) transform_groupZ(...) transform_map(...)
transform_bin(...) transform_binX(...) transform_binY(...) transform_group(...) transform_groupX(...) transform_groupY(...) transform_groupZ(...) transform_map(...)
... |
transform outputs and options |
the first argument passed to the function is passed as outputs to the JavaScript transform. It can be a single value or a list.
Define an Observable Plot transform with map and options
transform_mapX(map, ...) transform_mapY(map, ...)
transform_mapX(map, ...) transform_mapY(map, ...)
map |
a map method name |
... |
transform options |
Define an Observable Plot transform with basis and options
transform_normalizeX(basis = NULL, ...) transform_normalizeY(basis = NULL, ...)
transform_normalizeX(basis = NULL, ...) transform_normalizeY(basis = NULL, ...)
basis |
a basis method name |
... |
transform options |
Define an Observable Plot transform options only
transform_selectFirst(...) transform_selectLast(...) transform_selectMinX(...) transform_selectMaxX(...) transform_selectMinY(...) transform_selectMaxY(...)
transform_selectFirst(...) transform_selectLast(...) transform_selectMinX(...) transform_selectMaxX(...) transform_selectMinY(...) transform_selectMaxY(...)
... |
transform options |
Define an Observable Plot transform with two options objects
transform_windowX(spec = NULL, ...) transform_windowY(spec = NULL, ...) transform_stackY(spec = NULL, ...) transform_stackY1(spec = NULL, ...) transform_stackY2(spec = NULL, ...) transform_stackX(spec = NULL, ...) transform_stackX1(spec = NULL, ...) transform_stackX2(spec = NULL, ...)
transform_windowX(spec = NULL, ...) transform_windowY(spec = NULL, ...) transform_stackY(spec = NULL, ...) transform_stackY1(spec = NULL, ...) transform_stackY2(spec = NULL, ...) transform_stackX(spec = NULL, ...) transform_stackX1(spec = NULL, ...) transform_stackX2(spec = NULL, ...)
spec |
specific options |
... |
transform options |
Sample data from Observable Plot documentation examples
travelers
travelers
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 300 rows and 3 columns.
https://observablehq.com/@observablehq/plot-text
Sample data from Observable Plot changelog
trends2020
trends2020
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 3392 rows and 7 columns.
https://observablehq.com/@ben-tanen/the-relentless-2020-news-cycle-in-one-chart
Sample data from Observable Plot documentation examples
unemployment
unemployment
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 1708 rows and 3 columns.
https://observablehq.com/@observablehq/plot-stack