The position
parameter in scaleX*(), scaleY*()
functions controls position of the axis:
%useLatestDescriptors
%use lets-plot
%use dataframe
LetsPlot.getInfo()
Lets-Plot Kotlin API v.4.8.0. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.4.1.
val df = DataFrame.readCSV("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/iris.csv")
df.head(3)
DataFrame: rowsCount = 3, columnsCount = 5
sepal_length | sepal_width | petal_length | petal_width | species |
---|---|---|---|---|
5.100000 | 3.500000 | 1.400000 | 0.200000 | setosa |
4.900000 | 3.000000 | 1.400000 | 0.200000 | setosa |
4.700000 | 3.200000 | 1.300000 | 0.200000 | setosa |
val p = letsPlot(df.toMap()) +
geomPoint(size=5) { x = "sepal_width"; y = "sepal_length"; color = "species" } +
scaleColorBrewer(palette = "Set1") +
themeGrey()
p
position = "right"
¶p + scaleYContinuous("Sepal Length", position = "right")
position = "top"
¶p + scaleXContinuous(position = "top")
position = "both"
¶p + scaleXContinuous("Sepal Width", position="both") +
scaleYContinuous("Sepal Length", position="both")
p + scaleXContinuous("Sepal Width", position = "both") +
scaleYContinuous("Sepal Length", position = "both") +
coordFixed()