R
R draws a plot with your own code. It reads one Vista source as input_1, a data.frame. After you edit the code, select Run to redraw it.
Draw a bar plot with R
The default script takes the first two columns of input_1, here Drink and Cups, and draws them with base R's barplot in steelblue. The first plot takes a while, because the R runtime has to load in your browser.
R interactive example
Loading interactive example…
The live example needs a desktop screen. The result it produces is shown here, and the explanation and settings below work on any screen.
| Drink | Cups |
|---|---|
| Tea | 20 |
| Coffee | 30 |
| Cocoa | 10 |
- Wait for the plot to appear. Current below the code editor means the plot reflects your code.
- In the code editor, find
col = "steelblue"and change the color, for example to"tomato". - Select Run. The plot redraws. Editing alone doesn't run the code.
When to use
Use R for statistical plots when your team already writes base R graphics. The source arrives as a data.frame. If your code uses matplotlib and Polars, use Python. If a built-in chart can do the job, use it, because it loads faster.
Inputs
- Data source
Accepts: Tables.
Accepts one connection on this port.
Settings
- R
R plot code. Edit it in the R editor in Properties.
Default:
# Choose the label and value columns from your source. label_column <- names(input_1)[1] value_column <- names(input_1)[2] barplot(as.numeric(input_1[[value_column]]), names.arg = input_1[[label_column]], xlab = label_column, ylab = value_column, main = paste(value_column, "by", label_column), col = "steelblue")- Corner radius (px)
Corner radius in whole logical pixels.
Default:
0- Border width (px)
Border width in whole logical pixels.
Default:
0
R FAQs
- How do I know the plot matches my code?
- Below the code editor, Current means the plot reflects your last Run. While you wait for a run, or if one fails, the label on the plot starts with Outdated.
- Can I use install.packages()?
- No. Use the bundled libraries only.
- Why is the first R plot slow?
- The R runtime has to load in your browser before the first plot can draw.
Chart your data. Build it in Vista.
Vista opens in your browser, with no account.