Generative Aesthetics: Stress-Testing Color Perception with ggplot2 and scico
Data visualization is often framed as a quest for objective clarity, but the underlying mechanisms of aesthetic mapping remain deeply subjective. While practitioners typically lean on established color schemes to ensure accessibility and professional polish, there is a technical merit to pushing those palettes into non-standard geometries. By applying stochastic perturbation to structured data within the R ecosystem, we can effectively stress-test the perceptual boundaries of scientific color maps.
The recent synthesis of ggplot2’s geometric flexibility and the scico color package demonstrates how procedural noise can be used to evaluate how color mappings handle distortion, overlap, and irregular distribution. By utilizing rnorm to introduce jitter—essentially simulating data noise—one can deconstruct the rigid grid-based nature of standard tiled heatmaps into something approaching organic expressionism.

The fundamental approach involves leveraging the crossing() function to generate a coordinate set, then injecting random variation into those coordinates via the mutate() pipeline. When these coordinates are rendered via geom_tile(), the degree of "imperfection" is controlled by the standard deviation of the normal distribution, often scaled by the y-axis position to create localized chaos. The resulting visual output provides a unique stress test for the Fabio Crameri-designed color maps included in scico, such as 'Oleron' or the cyclic 'romaO'.
Reframing Data Geometry
The transition from a standard grid to an abstract form forces a re-evaluation of how continuous variables are perceived. In the original implementation, basic tile rendering relies on simple linear mappings. By extending this into polar coordinate systems using coord_polar(), the data points are coerced into radial arrangements, which shifts the color interaction entirely. This technique reveals how sensitive our eye is to changes in hue and luminance when the spatial frequency is distorted by non-linear axes.
# Example of polar coordinate mapping
crossing(x=8:70, y=x[1:30]) |>
mutate(dx = rnorm(n(), 0, (y/20)^1.5),
dy = rnorm(n(), 0, (y/10)^1.5)+ ifelse(x %%2 == 0, cos(x * 3 + y / 5)*10, 0)) |>
ggplot() +
geom_tile(aes(x=x+dx, y=y+dy, fill=y), colour=NA,
lwd=1, width=8, height=4, alpha=0.4,
show.legend=FALSE) +
scico::scale_fill_scico(palette = "oleron",
direction = 1) +
scale_y_reverse() +
theme_void() +
theme(panel.background = element_rect(fill = "grey5")) +
coord_polar(theta = "x")
Practical Implications for Visualization
Why move beyond standard bar charts or heatmaps? The primary utility here is not in creating "art," but in gaining a deeper intuition of how palette behavior reacts to varying alpha levels, tile density, and geometric wrapping. When dealing with high-density data, traditional visualization tools can collapse under the weight of overplotting. These generative experiments offer a method to identify which color scales maintain perceptual integrity under extreme conditions—specifically high-frequency jitter and coordinate compression.
For instance, the use of cyclic palettes like romaO against a dark background, as explored in recent iterations of this workflow, highlights the contrast threshold of the chosen colors. While static documentation for color maps often shows linear gradients, seeing them applied to complex polygons highlights potential issues with color blindness or luminosity contrast that might not be immediately apparent in standard reporting.

Furthermore, the integration of cos and sin functions to modulate coordinates allows for the simulation of wave-like structures. By applying these to the dy mutate call, one creates localized variations that mimic environmental patterns. This is a practical way to test how categorical or continuous data behaves when projected onto non-Cartesian planes, a common requirement in geographic or meteorological data analysis.
Moving Forward
For the data professional, this approach suggests a shift in how we think about toolkits like scico. Rather than viewing them solely as functional tools for final-output rendering, these palettes should be viewed as dynamic instruments. By intentionally breaking the visualization, we learn more about the underlying data structures we work with daily. The next step for anyone looking to incorporate these methods isn’t just aesthetic exploration—it is the systematic testing of these mappings against actual complex datasets to see where they fail, and where they excel in preserving meaningful differences.
As you scale these visualizations, remember that high-DPI output is the bottleneck. The quality of the "painting" effect is directly tied to the underlying resolution of the geometry rendering. Future iterations should aim to explore the performance impact of rendering high-count tile sets and the limitations of geom_tile() when shifting from simulated data to high-dimensional empirical data sets.
