Skip to main content
100%

Plots in Tables

✓ Published0🌍 Public
JJustinCally
Last edited May 28, 2021
Created on May 28, 2021

This example demonstrates how to embed small, arrow-based line charts directly within the cells of a LaTeX table, creating an integrated display of data and its visual summary. The R code uses `ggplot2` to generate four separate horizontal arrow segments (each representing a different x-range on a common scale), saving each as a PNG file with `ggsave`. The `dplyr` and `kableExtra` libraries then build a table where the second column contains LaTeX `\includegraphics` commands, referencing those saved images. The `kbl` function formats the table with `escape = F` to allow the raw LaTeX code, and `column_spec` sets the plot column's width. Overall, it shows a workflow for combining statistical graphics and tabular text in a single rendered document.

AI-generated description

Similar vizzes