knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = FALSE )
library(esquisse)
In RStudio, you can use the Addins menu :
Or in the R console :
esquisser()
To use a data.frame
by default, if using the Addins menu highlight with the cursor a data.frame
in source editor before launching addin.
Otherwise, pass the data.frame
as first argument to the function :
esquisser(mtcars)
If you don't have used a data.frame
when launching the addin, a window to import data will appear.
This feature comes from package {datamods}, you can find more documentation about it here.
This is the main interface and the most interesting part of the addin (in example below, we use penguins
dataset from {palmerpenguins}) :
You can select aesthetics to used by clicking the gear icon in top right corner, then drag-and-drop into aesthetics boxes to create a plot:
A geometry
is automatically picked to represent the data, according to data type. You can select an other geom
with button in top right corner :
Five menus under plot area are available to set plot parameters, filter data and retrieve code to generate the plot.
This menu allow to set plot's title, subtitle, caption, axis and aesthetics labels :
Here you can modify plot parameters, options available in the menu depends on type of plot :
Here you can modify colors used and global theme :
Widgets to interactively filter data used in plot :
The filter module is available in package {datamods}.
The code used to filter the data will be available in the following menu.
In this menu, you can retrieve the code used to produce the plot, as well as the code used to filter the data.
You can copy code to clipboard, or insert it in your current script.
You can save the plot created in various format by clicking the button in plot area's top-right corner:
With "More options", you can access a new window with more parameters to export the plot:
By default, esquisse is launched into a dialog window (if in RStudio), you can choose to use your browser if you prefer, or the Viewer pane.
esquisser(viewer = "browser") esquisser(viewer = "pane")
You can set display mode with an option (in .Rprofile for example) :
options("esquisse.viewer" = "browser")
Currently you can use {esquisse} in the following language: english (default), french ("fr"
), macedonian ("mk"
), albanian ("sq"
). Activate with:
library(esquisse) set_i18n("fr") esquisser()
If you want another language to be supported, you can submit a Pull Request to add a CSV file like the one used for french (file is located in inst/i18n
folder in the package, you can see it here on GitHub).
See {datamods} vignette for more on this topic.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.