Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/images/guides/geoms/guidePieChartsInPlotGrid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/images/guides/geoms/guidePieChartsInPlotGrid_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/images/guides/other/guideExportDensityPlot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/images/guides/other/guideExportDensityPlot_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions docs/topics/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,46 @@ plot(weatherData) { // Begin plotting
}
```

</tab>
<tab title="DataFrame (With compiler plugin)">

```kotlin
val weatherData = dataFrameOf(
"time" to listOf(0, 1, 2, 4, 5, 7, 8, 9),
"temperature" to listOf(12.0, 14.2, 15.1, 15.9, 17.9, 15.6, 14.2, 24.3),
"humidity" to listOf(0.5, 0.32, 0.11, 0.89, 0.68, 0.57, 0.56, 0.5)
)

weatherData.plot { // Begin plotting
x(time) // Set x-axis with time data
y(temperature) { // Set y-axis with temperature data
// Define scale for temperature (y-axis)
scale = continuous(0.0..25.5)
}

bars { // Add a bar layer
fillColor(humidity) { // Customizing bar colors based on humidity
// Setting the color range
scale = continuous(range = Color.YELLOW..Color.RED)
}
borderLine.width = 0.0 // Define border line width
}

line {
width = 3.0 // Set line width
color = Color.hex("#6e5596") // Define line color
type = LineType.DOTDASH // Specify the line type
}

layout { // Set plot layout
title = "Simple plot with kandy-lets-plot" // Add title
// Add caption
caption = "See `examples` section for more\n complicated and interesting examples!"
size = 700 to 450 // Plot dimension settings
}
}
```

</tab></tabs>
<!---END-->

Expand Down
28 changes: 28 additions & 0 deletions docs/topics/samples/area/Area-Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,34 @@ plot {
}
```

</tab>
<tab title="DataFrame (With compiler plugin)">

```kotlin
val loadServer = dataFrameOf(
"time" to columnOf("00:00", "03:00", "06:00", "09:00", "12:00", "15:00", "18:00", "21:00"),
"load" to columnOf(10, 5, 15, 50, 75, 60, 80, 40)
)

loadServer.plot {
layout.title = "Daily Server Load Dynamics"
area {
x(time) { axis.name = "Time" }
y(load) {
axis.name = "Load (%)"
scale = continuous(0..100)
}
borderLine {
color = Color.ORANGE
type = LineType.DASHED
width = 2.5
}
fillColor = Color.RED
alpha = 0.7
}
}
```

</tab></tabs>
<!---END-->

Expand Down
48 changes: 48 additions & 0 deletions docs/topics/samples/area/Area-with-Mark-Line.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,54 @@ df.plot {
}
```

</tab>
<tab title="DataFrame (With compiler plugin)">

```kotlin
val months = listOf(
"January", "February",
"March", "April", "May",
"June", "July", "August",
"September", "October", "November",
"December"
)
val tempBerlin =
listOf(-0.5, 0.0, 4.8, 9.0, 14.3, 17.5, 19.2, 18.9, 14.5, 9.7, 4.7, 1.0)
val tempMadrid =
listOf(6.3, 7.9, 11.2, 12.9, 16.7, 21.1, 24.7, 24.2, 20.3, 15.4, 9.9, 6.6)

val df = dataFrameOf(
"month" to months + months,
"temperature" to tempBerlin + tempMadrid,
"city" to List(12) { "Berlin" } + List(12) { "Madrid" }
)

df.plot {
area {
x(month)
y(temperature)
fillColor(city) {
scale = categorical("Berlin" to Color.hex("#07C3F2"), "Madrid" to Color.hex("#FDB60D"))
}
alpha = 0.5
borderLine.width = 1.5
}
hLine {
yIntercept.constant(tempBerlin.average())
color = Color.BLACK
width = 2.0
type = LineType.DASHED
}
hLine {
yIntercept.constant(tempMadrid.average())
color = Color.RED
width = 2.0
type = LineType.DASHED
}
layout.size = 1000 to 450
}
```

</tab></tabs>
<!---END-->

Expand Down
23 changes: 23 additions & 0 deletions docs/topics/samples/area/Area-with-Reversed-Axis.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,29 @@ plot {
}
```

</tab>
<tab title="DataFrame (With compiler plugin)">

```kotlin
val df = dataFrameOf(
"Day of the Week" to columnOf("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"),
"Star Rating (Reversed)" to columnOf(4, 2, 1, 2, 3, 4, 1)
)

df.plot {
layout.title = "Weekly Star Ratings"
layout.subtitle = "A reversed perspective"
area {
x(`Day of the Week`)
y(`Star Rating (Reversed)`) {
scale = continuous(0..5, transform = Transformation.REVERSE)
}
fillColor = Color.hex("#FCF84A")
alpha = 0.75
}
}
```

</tab></tabs>
<!---END-->

Expand Down
37 changes: 37 additions & 0 deletions docs/topics/samples/area/Fixed-Area-Coordinate.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,43 @@ plot(reservoirDf) {
}
```

</tab>
<tab title="DataFrame (With compiler plugin)">

```kotlin
val reservoirDf = dataFrameOf(
"month" to columnOf(
"January", "February",
"March", "April", "May",
"June", "July", "August",
"September", "October", "November",
"December"
),
"waterLvl" to columnOf(4.5, 4.7, 5.0, 5.5, 6.0, 6.5, 6.7, 6.2, 5.8, 5.3, 4.8, 4.6)
)

plot(reservoirDf) {
layout {
title = "Water Level"
subtitle = "Annual Water Level Fluctuations in Reservoir"
yAxisLabel = "Month"
xAxisLabel = "Water Level (meters)"
}

x(month)
y { axis.limits = 3.0..8.0 }
line {
y(waterLvl)
}
area {
y.constant(5.0)
borderLine.type = LineType.DOTTED
alpha = 0.5
fillColor = Color.RED
}
}
```

</tab></tabs>
<!---END-->

Expand Down
33 changes: 33 additions & 0 deletions docs/topics/samples/area/Several-Areas.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,39 @@ plot(dataset) {
}
```

</tab>
<tab title="DataFrame (With compiler plugin)">

```kotlin
val dataset = dataFrameOf(
"year" to columnOf("2016", "2017", "2018", "2019", "2020", "2021"),
"Apple" to columnOf(700, 800, 750, 900, 850, 950),
"Google" to columnOf(1000, 950, 1200, 1150, 1250, 1300),
"Microsoft" to columnOf(600, 700, 650, 700, 750, 800),
"Meta" to columnOf(1100, 1200, 1150, 1300, 1250, 1350),
"Amazon" to columnOf(300, 400, 350, 450, 500, 600)
).gather { Apple and Google and Microsoft and Meta and Amazon }.into("company", "users")

dataset.groupBy { company }.plot {
layout.title = "User Growth Dynamics"
area {
x(year)
y(users)
fillColor(company) {
scale = categorical(
"Apple" to Color.hex("#FF45ED"),
"Google" to Color.hex("#3DEA62"),
"Microsoft" to Color.BLACK,
"Meta" to Color.hex("#FDB60D"),
"Amazon" to Color.hex("#087CFA")
)
}
borderLine.color(company)
alpha = 0.3
}
}
```

</tab></tabs>
<!---END-->

Expand Down
17 changes: 17 additions & 0 deletions docs/topics/samples/area/Simple-Area.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ plot {
}
```

</tab>
<tab title="DataFrame (With compiler plugin)">

```kotlin
val dataframe = dataFrameOf(
"years" to columnOf("2017", "2018", "2019", "2020", "2021", "2022", "2023"),
"cost" to columnOf(56.1, 22.7, 34.7, 82.1, 53.7, 68.5, 39.9)
)

dataframe.plot {
area {
x(years)
y(cost)
}
}
```

</tab></tabs>
<!---END-->

Expand Down
24 changes: 24 additions & 0 deletions docs/topics/samples/bars/Bar-Gradient.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,30 @@ dataset.plot {
}
```

</tab>
<tab title="DataFrame (With compiler plugin)">

```kotlin
val dataset = dataFrameOf(
"cities" to columnOf("London", "Paris", "Berlin", "Madrid", "Rome", "Amsterdam", "Prague"),
"airPollution" to columnOf(70, 65, 50, 60, 55, 45, 53),
"numberOfCars" to columnOf(3000, 2800, 1800, 2500, 2100, 1300, 2000)
)

dataset.plot {
layout.title = "Air Pollution and Vehicle Count Analysis"
bars {
x(cities) { axis.name = "City" }
y(numberOfCars) { axis.name = "Number of cars (thousands)" }
fillColor(airPollution) {
legend.name = "Air Pollution\n Level (AQI)"
scale = continuous(Color.GREEN..Color.RED)
}
alpha = 0.8
}
}
```

</tab></tabs>
<!---END-->

Expand Down
Loading