Skip to content

Commit 0641197

Browse files
Add axisTextSpacing parameters to theme()
1 parent fee3768 commit 0641197

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

demo/jvm-batik/src/main/kotlin/frontendContextDemo/scripts/Spoke.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import org.jetbrains.letsPlot.geom.extras.arrow
66
import org.jetbrains.letsPlot.geom.geomSpoke
77
import org.jetbrains.letsPlot.letsPlot
88
import org.jetbrains.letsPlot.scale.scaleColorGradient
9-
import org.jetbrains.letsPlot.themes.elementText
109
import org.jetbrains.letsPlot.themes.theme
1110
import org.jetbrains.letsPlot.themes.themeMinimal
1211
import org.jetbrains.letsPlot.tooltips.layerTooltips
@@ -78,7 +77,7 @@ object Spoke {
7877
scaleColorGradient(low = "#3288bd", high = "#d53e4f", guide = "none") +
7978
coordFixed(xlim = ab, ylim = ab) +
8079
themeMinimal() +
81-
theme(axisText = elementText(margin = 10), axisTitle = "blank")
80+
theme(axisTextSpacing = 10.0, plotMargin = 6.0, axisTitle = "blank")
8281

8382
p.show()
8483
}

future_changes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ GeoTools [v 33.2](https://github.com/geotools/geotools/releases/tag/33.2)
99
- `geomTextRepel()` and `geomLabelRepel()` [[#1092](https://github.com/JetBrains/lets-plot/issues/1092)].
1010
See: [example notebook](https://nbviewer.org/github/JetBrains/lets-plot-kotlin/blob/master/docs/examples/jupyter-notebooks/f-4.11.0/ggrepel.ipynb).
1111

12+
- Plot Layout:
13+
14+
- New `axisTextSpacing`, `axisTextSpacingX`, and `axisTextSpacingY` parameters in `theme()` to control spacing between axis ticks and labels.
15+
- See new [plot layout diagram](https://nbviewer.org/github/JetBrains/lets-plot/blob/master/docs/f-25b/plot_layout_scheme.ipynb) notebook showing various layout options and their effects on plot appearance.
16+
1217

1318
### Changed
1419

plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/themes/theme.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ import org.jetbrains.letsPlot.intern.filterNonNullValues
8282
* @param axisTicksLengthX Length of tick marks.
8383
* @param axisTicksLengthY Length of tick marks.
8484
*
85+
* @param axisTextSpacing Spacing between the axis label text and its tick mark.
86+
* @param axisTextSpacingX Spacing between the axis label text and its tick mark.
87+
* @param axisTextSpacingY Spacing between the axis label text and its tick mark.
88+
*
8589
* @param axisLine Lines along axes.
8690
* @param axisLineX Lines along axes.
8791
* @param axisLineY Lines along axes.
@@ -225,6 +229,10 @@ class theme(
225229
axisTicksLengthX: Number? = null,
226230
axisTicksLengthY: Number? = null,
227231

232+
axisTextSpacing: Number? = null,
233+
axisTextSpacingX: Number? = null,
234+
axisTextSpacingY: Number? = null,
235+
228236
axisLine: Any? = null,
229237
axisLineX: Any? = null,
230238
axisLineY: Any? = null,
@@ -332,6 +340,10 @@ class theme(
332340
Option.Theme.AXIS_TICKS_LENGTH_X to axisTicksLengthX,
333341
Option.Theme.AXIS_TICKS_LENGTH_Y to axisTicksLengthY,
334342

343+
Option.Theme.AXIS_TEXT_SPACING to axisTextSpacing,
344+
Option.Theme.AXIS_TEXT_SPACING_X to axisTextSpacingX,
345+
Option.Theme.AXIS_TEXT_SPACING_Y to axisTextSpacingY,
346+
335347
Option.Theme.AXIS_LINE to axisLine,
336348
Option.Theme.AXIS_LINE_X to axisLineX,
337349
Option.Theme.AXIS_LINE_Y to axisLineY,

0 commit comments

Comments
 (0)