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

coord_polar: axis, ticks, labels, xlim/ylim #979

Merged
merged 18 commits into from
Jan 10, 2024
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c574810
Make expand additive
IKupriyanov-HORIS Dec 20, 2023
2467a22
coord_polar: reduce number of ticks for v axis
IKupriyanov-HORIS Dec 20, 2023
4fc32be
coord_polar: replace absolute expand with relative
IKupriyanov-HORIS Dec 20, 2023
4be95a0
coord_polar: v axis ticks alignment
IKupriyanov-HORIS Dec 20, 2023
e3d7535
coord_polar: hardcoded anchor for ticks
IKupriyanov-HORIS Dec 20, 2023
a9705f1
coord_polar: more ticks for circle axis
IKupriyanov-HORIS Dec 21, 2023
52151a7
coord_polar: fix horizontal axis ticks order, fix axis circle positio…
IKupriyanov-HORIS Dec 21, 2023
7af0732
coord_polar: fix horizontal axis first and last ticks overlapping
IKupriyanov-HORIS Dec 21, 2023
f6fd891
coord_polar: update notebook
IKupriyanov-HORIS Dec 22, 2023
0900649
coord_polar: replace thetaFromX with flipped
IKupriyanov-HORIS Dec 25, 2023
f54d197
coord_polar: temp fix for axis, need proper fix for the domain flip
IKupriyanov-HORIS Dec 26, 2023
62f8d02
coord_polar: properly handle theta=y in PolarCoordinateSystem
IKupriyanov-HORIS Dec 27, 2023
dc71ebc
coord_polar: handle theta=y mostly in PolarCoordinateSystem. Investig…
IKupriyanov-HORIS Dec 27, 2023
9c94803
coord_polar: fixed breaks and ticks. The only not working case is a Y…
IKupriyanov-HORIS Dec 28, 2023
a550e39
coord_polar: fixed breaks and ticks with start parameter
IKupriyanov-HORIS Dec 28, 2023
b99f9ea
coord_polar: minor code cleanup
IKupriyanov-HORIS Dec 29, 2023
09921c8
coord_polar: fix domain for discrete angle scale
IKupriyanov-HORIS Jan 1, 2024
0e4782f
coord_polar: add xlim/ylim for radar plot / lollipop
IKupriyanov-HORIS Jan 5, 2024
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
coord_polar: v axis ticks alignment
  • Loading branch information
IKupriyanov-HORIS committed Jan 5, 2024
commit 4be95a0e0fabf96a7544f7e3c7b4d1d5cd6aebe0
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package org.jetbrains.letsPlot.core.plot.builder.guide
import org.jetbrains.letsPlot.commons.geometry.DoubleVector
import org.jetbrains.letsPlot.commons.values.Color
import org.jetbrains.letsPlot.core.plot.base.render.svg.SvgComponent
import org.jetbrains.letsPlot.core.plot.base.render.svg.Text
import org.jetbrains.letsPlot.core.plot.base.render.svg.TextLabel
import org.jetbrains.letsPlot.core.plot.base.theme.AxisTheme
import org.jetbrains.letsPlot.core.plot.base.theme.PanelGridTheme
Expand Down Expand Up @@ -47,7 +46,12 @@ class PolarAxisComponent(
for ((i, br) in breaksData.majorBreaks.withIndex()) {
//if (br in start..end) {
val label = breaksData.majorLabels[i % breaksData.majorLabels.size]
val labelOffset = DoubleVector.ZERO // tickLabelBaseOffset.add(labelAdjustments.additionalOffset(i))

val labelOffset = when (orientation.isHorizontal) {
false -> tickLabelBaseOffset.add(labelAdjustments.additionalOffset(i))
true -> DoubleVector.ZERO
}

val group = buildTick(label, labelOffset, axisTheme)

when (orientation.isHorizontal) {
Expand Down Expand Up @@ -84,7 +88,7 @@ class PolarAxisComponent(
): SvgGElement {

var tickMark: SvgLineElement? = null
if (false && axisTheme.showTickMarks()) { // doesnt fit to polar coord
if (!orientation.isHorizontal && axisTheme.showTickMarks()) {
tickMark = SvgLineElement()
tickMark.strokeWidth().set(axisTheme.tickMarkWidth())
tickMark.strokeColor().set(axisTheme.tickMarkColor())
Expand All @@ -96,7 +100,7 @@ class PolarAxisComponent(
tickLabel.addClassName("${Style.AXIS_TEXT}-${axisTheme.axis}")
}

val markLength = 0.0//axisTheme.tickMarkLength()
val markLength = axisTheme.tickMarkLength()
when (orientation) {
Orientation.LEFT -> {
if (tickMark != null) {
Expand Down Expand Up @@ -134,8 +138,8 @@ class PolarAxisComponent(

if (tickLabel != null) {
tickLabel.moveTo(labelOffset.x, labelOffset.y)
tickLabel.setHorizontalAnchor(Text.HorizontalAnchor.MIDDLE)
tickLabel.setVerticalAnchor(Text.VerticalAnchor.CENTER)
tickLabel.setHorizontalAnchor(labelAdjustments.horizontalAnchor)
tickLabel.setVerticalAnchor(labelAdjustments.verticalAnchor)
tickLabel.rotate(labelAdjustments.rotationDegree)
g.children().add(tickLabel.rootGroup)
}
Expand Down