All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.kotlinx.ggdsl.letsplot.layers.qqLine.kt Maven / Gradle / Ivy

There is a newer version: 0.4.0-dev-15
Show newest version
/*
* Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package org.jetbrains.kotlinx.ggdsl.letsplot.layers


/* TODO
@PublishedApi

 */
//public val QQ_LINE: LetsPlotGeom = LetsPlotGeom("qqLine")

/*
@PlotDslMarker
// todo move x/y?
<<<<<<< HEAD
class QQLineContext(
    parent: LayerCollectorContext,
=======
public class QQLineContext(
    override var data: MutableNamedData,
>>>>>>> main
    distribution: Distribution?,
    quantiles: Pair?,
) : LayerContext(parent) {
    init {
        distribution?.let {
            distribution(it.name)
            dParams(it.toList())
        }
        quantiles?.let {
            quantiles(it)
        }
    }

    @PublishedApi
    internal val _sample: SampleAes get() = SampleAes(this)

    public val sample: SampleDummyAes get() = SampleDummyAes(this)

    public val alpha: AlphaAes get() = AlphaAes(this)
    public val color: ColorAes get() = ColorAes(this)
    public val width: SizeAes get() = SizeAes(this)
    public val type: LineTypeAes get() = LineTypeAes(this)


    // todo weight

    @PublishedApi
    internal val distribution: DistributionAes get() = DistributionAes(this)

    @PublishedApi
    internal val dParams: DParamsAes get() = DParamsAes(this)

    @PublishedApi
    internal val quantiles: QuantilesAes get() = QuantilesAes(this)

    public object Statistics {
        public val SAMPLE: QQStat.Sample = QQStat.Sample
        public val THEORETICAL: QQStat.Theoretical = QQStat.Theoretical
    }

    public val Stat: Statistics = Statistics


    public inline operator fun  ScalablePositionalAes.invoke(
        stat: QQStat
    ): ScaledUnspecifiedDefaultPositionalMapping {
        val mapping = ScaledUnspecifiedDefaultPositionalMapping(
            this.name,
            stat.toDataSource().scaled(),
            typeOf()
        )
        context.bindingCollector.mappings[this.name] = mapping
        return mapping
    }

    public inline operator fun  MappableNonPositionalAes.invoke(
        stat: QQStat
    ): ScaledUnspecifiedDefaultNonPositionalMapping {
        val mapping = ScaledUnspecifiedDefaultNonPositionalMapping(
            this.name,
            stat.toDataSource().scaled(),
            typeOf()
        )
        context.bindingCollector.mappings[this.name] = mapping
        return mapping
    }

}

<<<<<<< HEAD
inline fun  PlotContext.qqLine(
    source: ColumnPointer,
=======
public inline fun  PlotContext.qqLine(
    source: DataSource,
>>>>>>> main
    distribution: Distribution? = null,
    quantiles: Pair? = null,
    block: QQLineContext.() -> Unit
) {
    layers.add(
        QQLineContext(data, distribution, quantiles)
            .apply {
                copyFrom(this@qqLine)
                _sample(source)
            }
            .apply(block)
            .toLayer(QQ_LINE)
    )
}

public inline fun  PlotContext.qqLine(
    source: Iterable,
    distribution: Distribution? = null,
    quantiles: Pair? = null,
    block: QQLineContext.() -> Unit
) {
    layers.add(
        QQLineContext(data, distribution, quantiles)
            .apply {
                copyFrom(this@qqLine)
                _sample(source)
            }
            .apply(block)
            .toLayer(QQ_LINE)
    )
}

 */






© 2015 - 2025 Weber Informatics LLC | Privacy Policy