diff --git a/docs/examples/jupyter-notebooks/f-4.7.1/auto_rotate.ipynb b/docs/examples/jupyter-notebooks/f-4.7.1/auto_rotate.ipynb
new file mode 100644
index 00000000..ac8db370
--- /dev/null
+++ b/docs/examples/jupyter-notebooks/f-4.7.1/auto_rotate.ipynb
@@ -0,0 +1,1347 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "1c0418df-1e85-4e45-8d9b-ad0b0f976888",
+ "metadata": {},
+ "source": [
+ "# Automatically Choose `orientation=\"y\"` When Aes Y Is Discrete"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "e6e9b70b-0c73-46e7-9d3c-1b8235fb9435",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ " "
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/html": [
+ " \n",
+ " "
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/html": [
+ " "
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "%useLatestDescriptors\n",
+ "%use lets-plot\n",
+ "%use dataframe"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "675df112-673b-489b-a434-328352f39405",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Lets-Plot Kotlin API v.0.0.0-SNAPSHOT. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.3.1."
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "LetsPlot.getInfo()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "c09b40e6-80d8-4619-9b06-ede0cb2dff02",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/kotlindataframe+json": "{\"nrow\":3,\"ncol\":6,\"columns\":[\"country\",\"continent\",\"year\",\"lifeExp\",\"pop\",\"gdpPercap\"],\"kotlin_dataframe\":[{\"country\":\"Afghanistan\",\"continent\":\"Asia\",\"year\":1952,\"lifeExp\":28.801,\"pop\":8425333,\"gdpPercap\":779.4453145},{\"country\":\"Afghanistan\",\"continent\":\"Asia\",\"year\":1957,\"lifeExp\":30.332,\"pop\":9240934,\"gdpPercap\":820.8530296},{\"country\":\"Afghanistan\",\"continent\":\"Asia\",\"year\":1962,\"lifeExp\":31.997,\"pop\":10267083,\"gdpPercap\":853.10071}]}",
+ "text/html": [
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ "\n",
+ "DataFrame: rowsCount = 3, columnsCount = 6
\n",
+ "country | continent | year | lifeExp | pop | gdpPercap |
---|
Afghanistan | Asia | 1952 | 28.801000 | 8425333 | 779.445315 |
Afghanistan | Asia | 1957 | 30.332000 | 9240934 | 820.853030 |
Afghanistan | Asia | 1962 | 31.997000 | 10267083 | 853.100710 |
\n",
+ " \n",
+ " \n",
+ " "
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "val df = DataFrame.readCSV(\"https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/gapminder.csv\")\n",
+ "val albaniaDf = df.filter { it[\"country\"] == \"Albania\" }\n",
+ "\n",
+ "df.head(3)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "699f343d-bd40-4e2c-a073-c5290d2e486b",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "val data = df.toMap()\n",
+ "val albaniaData = albaniaDf.toMap()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "8030d842-d477-4d00-b9da-0b5565702fca",
+ "metadata": {},
+ "source": [
+ "#### 1. How Does Automatic Setting `orientation=\"y\"` Work"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "34cb1515-f432-493f-a5aa-8ba81db01898",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ " \n",
+ " "
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gggrid(listOf(\n",
+ " letsPlot(data) { x = \"continent\"; y = \"pop\"; fill = \"continent\" } + geomBar() + ggtitle(\"Default\"),\n",
+ " letsPlot(data) { x = \"pop\"; y = \"continent\"; fill = \"continent\" } + geomBar() + ggtitle(\"Automatic setting orientation=\\\"y\\\"\")\n",
+ "), ncol = 2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "8bea57bf-d77b-4009-bdf5-87980228f107",
+ "metadata": {},
+ "source": [
+ "#### 2. Marking by `asDiscrete()`"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "99e8238b-cb28-4285-8c22-b4ce900ee732",
+ "metadata": {},
+ "source": [
+ "If you're using continuous data for the Y-axis, the plot may be incorrect. Try marking the Y-axis data with the `asDiscrete()` function, this will rotate your geom."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "2b2b5994-dcaf-44d5-89c2-dce4359852ac",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ " \n",
+ " "
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gggrid(listOf(\n",
+ " letsPlot(albaniaData) + geomBar(stat = Stat.sum(), size = 0) { x = \"lifeExp\"; y = \"year\" },\n",
+ " letsPlot(albaniaData) + geomBar(stat = Stat.sum(), size = 0) { x = \"lifeExp\"; y = asDiscrete(\"year\") }\n",
+ "), ncol = 2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d242a67e-1988-4413-a1c8-26677b206b6b",
+ "metadata": {},
+ "source": [
+ "#### 3. Other Kinds of Geoms Support Automatic Choosing of Orientation"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "ed5b4926-9d46-42d7-8e6d-cb7aeda4a86e",
+ "metadata": {},
+ "source": [
+ "Such manipulations with automatic rotation can be done for geoms `geomBoxplot()`, `geomViolin()`, `geomBar()` and `geomLollipop()`."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "id": "2f262b06-3d12-47e0-b8d6-b47182b4e5fe",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ " \n",
+ " "
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gggrid(listOf(\n",
+ " letsPlot(data) { x = \"continent\"; y = \"lifeExp\"; fill = \"continent\" } + geomBoxplot(),\n",
+ " letsPlot(data) { x = \"lifeExp\"; y = \"continent\"; fill = \"continent\" } + geomBoxplot(),\n",
+ " letsPlot(data) { x = \"continent\"; y = \"lifeExp\"; fill = \"continent\" } + geomViolin(),\n",
+ " letsPlot(data) { x = \"lifeExp\"; y = \"continent\"; fill = \"continent\" } + geomViolin(),\n",
+ " letsPlot(albaniaData) { x = asDiscrete(\"year\"); y = \"lifeExp\" } + geomLollipop(stat = Stat.sum(), size = 2),\n",
+ " letsPlot(albaniaData) { x = \"lifeExp\"; y = asDiscrete(\"year\") } + geomLollipop(stat = Stat.sum(), size = 2),\n",
+ "), ncol = 2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "ff2f39bb-e1c1-4950-9673-1f972152f250",
+ "metadata": {},
+ "source": [
+ "#### 4. `stat = Stat.boxplot()`, `stat = Stat.boxplotOutlier()`, `statSummary()`"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "ee04a709-1c45-4581-95c3-8628716d6775",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ " \n",
+ " "
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "gggrid(listOf(\n",
+ " letsPlot(data) { x = \"continent\"; y = \"lifeExp\" } + geomPointRange(stat = Stat.boxplot()),\n",
+ " letsPlot(data) { x = \"lifeExp\"; y = \"continent\" } + geomPointRange(stat = Stat.boxplot()),\n",
+ " letsPlot(data) { x = \"continent\"; y = \"lifeExp\" } + geomPointRange(stat = Stat.boxplot()),\n",
+ " letsPlot(data) { x = \"lifeExp\"; y = \"continent\" } + geomPointRange(stat = Stat.boxplotOutlier()),\n",
+ " letsPlot(data) { x = \"continent\"; y = \"lifeExp\" } + statSummary(),\n",
+ " letsPlot(data) { x = \"lifeExp\"; y = \"continent\" } + statSummary()\n",
+ "), ncol = 2)"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Kotlin",
+ "language": "kotlin",
+ "name": "kotlin"
+ },
+ "language_info": {
+ "codemirror_mode": "text/x-kotlin",
+ "file_extension": ".kt",
+ "mimetype": "text/x-kotlin",
+ "name": "kotlin",
+ "nbconvert_exporter": "",
+ "pygments_lexer": "kotlin",
+ "version": "1.9.23"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/future_changes.md b/future_changes.md
index ba730ddd..1895cd5d 100644
--- a/future_changes.md
+++ b/future_changes.md
@@ -18,6 +18,10 @@
See: [example notebook](https://nbviewer.org/github/JetBrains/lets-plot-kotlin/blob/master/docs/examples/jupyter-notebooks/f-4.7.1/param_size_unit.ipynb).
+- Auto-detection of `orientation="y"` in bar-chart etc. [[#558](https://github.com/JetBrains/lets-plot/issues/558)].
+
+ See: [example notebook](https://nbviewer.org/github/JetBrains/lets-plot-kotlin/blob/master/docs/examples/jupyter-notebooks/f-4.7.1/auto_rotate.ipynb).
+
- Parameter `plotInset` in `theme()`.
See: [example notebook](https://nbviewer.org/github/JetBrains/lets-plot-kotlin/blob/master/docs/examples/jupyter-notebooks/f-4.7.1/theme_plot_inset.ipynb).