JetBrains / lets-plot-kotlin

Grammar of Graphics for Kotlin
https://lets-plot.org/kotlin/
MIT License
419 stars 36 forks source link

Subplot themes not inherited by parent #197

Closed Martmists-GH closed 8 months ago

Martmists-GH commented 11 months ago

The following two plots have been set to use the Darcula theme: Screenshot_20230802_180208

However, There is still spacing and a border in white. This cannot currently be solved as SubPlotsFeature does not support themeing.

Code:

// Subplot 1
val freq = letsPlot(mapOf(
    "frequency" to fftData.indices,
    "gain (dB)" to fftData.map(Complex::length),
)) + geomLine() {
    x = "frequency"
    y = "gain (dB)"
} + scaleXLog10() + scaleYLog10()
// Subplot 2
val phase = letsPlot(mapOf(
    "frequency" to fftData.indices,
    "phase (rad)" to fftData.map(Complex::angle),
)) + geomLine {
    x = "frequency"
    y = "phase (rad)"
} + scaleXLog10()
// Parent plot
val grid = gggrid(
    plots=listOf(freq, phase).map { it + flavorDarcula() },  // Apply theme
    ncol = 1,
)  // + flavorDarcula()  // Unsupported
grid.show()
alshan commented 8 months ago

Fixed in v4.5.0: Common Theme for Subplots. However, inheritance works other way around: elements inherit theme of their container.