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

io.github.danielTucano.matplotlib.pyplot.plot.kt Maven / Gradle / Ivy

package io.github.danielTucano.matplotlib.pyplot

import io.github.danielTucano.extensions.emptyIfNullOrComma
import io.github.danielTucano.extensions.toPythonNumberArrayStringOrEmpty
import io.github.danielTucano.extensions.toPythonStringQuotedOrEmpty
import io.github.danielTucano.matplotlib.KwargValue
import io.github.danielTucano.matplotlib.Line2D
import io.github.danielTucano.matplotlib.toKwargPythonStringOrEmpty
import io.github.danielTucano.python.PythonScriptBuilder

fun plot(
    x: List? = null,
    y: List,
    fmt: String? = null,
    kwargs: Map? = null
): Line2D {
    return object: Line2D {
        override val variableName: String = "line2D_${Line2D.line2DNumber}"
        init {
            PythonScriptBuilder.addCommand("$variableName = plt.plot(" +
                    "${x.toPythonNumberArrayStringOrEmpty()}${x.emptyIfNullOrComma()}" +
                    "${y.toPythonNumberArrayStringOrEmpty()}${fmt.emptyIfNullOrComma()}" +
                    "${fmt.toPythonStringQuotedOrEmpty()}${kwargs.emptyIfNullOrComma()}" +
                    kwargs.toKwargPythonStringOrEmpty() +
                    ")")
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy