Barchart

Barchart

The Barchart node creates bar charts using ggplot2 to compare values across categories. It uses geom_bar(stat = "identity") so the bar heights represent actual values in your data.

What it does

  • Creates a bar chart from a category variable (X) and a value variable (Y)
  • Uses stat = "identity" so bars represent values directly from the data
  • Optionally groups bars by a fill variable using position_dodge()
  • Optionally adds error bars using geom_errorbar() with adjustable width
  • Supports custom axis labels
  • The plot can be downloaded as a PNG image

How to use it

  1. Connect a data source — drag an edge from an Input CSV node
  2. Select a category variable (X) — choose the column for the x axis categories
  3. Select a value variable (Y) — choose the numeric column for bar heights
  4. Optionally configure — set a fill variable for grouped bars, an error bar variable, or custom axis labels
  5. Click Run — the bar chart is generated and displayed

Configuration

Setting Required Description
Upstream connection Yes A node providing data
Category variable (X) Yes Categorical variable for the x axis
Value variable (Y) Yes Numeric variable for bar heights
Fill variable No A grouping variable to create side-by-side (dodged) bars
Error bar variable No Column containing error values (e.g. SE) added/subtracted from Y
Error bar width No Width of error bar caps (default 0.3)
X axis label No Custom label (defaults to column name)
Y axis label No Custom label (defaults to column name)
Comment No Annotation for generated R code

Output

The Output tab displays:

  • The bar chart as an image
  • A Zoom button to view the plot full-screen
  • A Download plot button to save it as a PNG file (named barchart_{y}_by_{x}.png)

Generated R code

Basic bar chart:

library(ggplot2)
ggplot(data = my_data, aes(x = species, y = count)) +
  geom_bar(stat = "identity") +
  theme_classic()

With fill variable and custom labels:

library(ggplot2)
ggplot(data = my_data, aes(x = species, y = count, fill = diet)) +
  geom_bar(stat = "identity", position = position_dodge()) +
  theme_classic() +
  labs(x = "Species", y = "Count")

With error bars:

library(ggplot2)
ggplot(data = my_data, aes(x = species, y = count, fill = diet)) +
  geom_bar(stat = "identity", position = position_dodge()) +
  geom_errorbar(aes(ymin = count - se, ymax = count + se), width = 0.3, position = position_dodge()) +
  theme_classic() +
  labs(x = "Species", y = "Count")

Tips

  • The category variable (X) is typically categorical — it defines the groups along the x axis
  • The value variable (Y) should be numeric — it defines the height of each bar
  • Use the fill variable to create grouped (side-by-side) bars within each category using position_dodge()
  • Without a fill variable, bars are stacked by default (one bar per category)
  • Error bars show ± the error variable (e.g. standard error) around each bar height
  • Adjust the error bar width to control how wide the caps appear (default 0.3)
  • You can download the plot for use in reports or presentations