Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add element_geom(pen, brush, paper) #836

Merged
merged 15 commits into from
Aug 4, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check ordering in theme setting to choose which colors to use.
  • Loading branch information
OLarionova-HORIS committed Aug 4, 2023
commit 7a90be75ce90245301f05758bb890be00115887c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package org.jetbrains.letsPlot.core.plot.builder.defaultTheme
import org.jetbrains.letsPlot.core.plot.base.GeomKind
import org.jetbrains.letsPlot.core.plot.base.aes.GeomTheme
import org.jetbrains.letsPlot.core.plot.base.theme.*
import org.jetbrains.letsPlot.core.plot.builder.defaultTheme.values.ThemeOption
import org.jetbrains.letsPlot.core.plot.builder.defaultTheme.values.ThemeValues.Companion.mergeWith
import org.jetbrains.letsPlot.core.plot.builder.defaultTheme.values.ThemeValuesLPMinimal2
import org.jetbrains.letsPlot.core.plot.builder.presentation.DefaultFontFamilyRegistry
Expand All @@ -29,7 +30,15 @@ class DefaultTheme(
private val plot = DefaultPlotTheme(options, fontFamilyRegistry)
private val tooltips = DefaultTooltipsTheme(options, fontFamilyRegistry)
private val geometries: MutableMap<GeomKind, GeomTheme> = HashMap()
private val colors = DefaultColorTheme(options, fontFamilyRegistry)
private val colors = run {
// theme() + flavor() => use colors from flavor
// flavor() + theme() => from theme(geom)
val useGeomOption = with(userOptions.keys) { indexOf(ThemeOption.GEOM) > indexOf(ThemeOption.FLAVOR) }
DefaultColorTheme(
if (useGeomOption) options else themeSettings,
fontFamilyRegistry
)
}

override fun horizontalAxis(flipAxis: Boolean): AxisTheme = if (flipAxis) axisY else axisX

Expand All @@ -46,7 +55,6 @@ class DefaultTheme(
override fun tooltips(): TooltipsTheme = tooltips

override fun geometries(geomKind: GeomKind): GeomTheme = geometries.getOrPut(geomKind) {
// use settings from named theme and flavor options (without specified in theme())
DefaultGeomTheme.forGeomKind(geomKind, colors)
}

Expand Down