{ "cells": [ { "cell_type": "markdown", "id": "7fa76ef4-bde5-4ff8-8834-3567a1571565", "metadata": {}, "source": [ "# Customizing Tick Marks in Colorbars\n", "\n", "Two new parameters in the `theme()` function, `legend_ticks` and `legend_ticks_length`, provide fine-grained control over colorbar tick marks." ] }, { "cell_type": "code", "execution_count": 1, "id": "b9168017-8aad-42fa-acb6-88ec16e0dad4", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from lets_plot import *\n", "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 2, "id": "74cdfb7a-0b1c-4c00-95a0-8282fcae2210", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = dict(time=['Lunch', 'Lunch', 'Dinner', 'Dinner', 'Dinner'])\n", "p = ggplot(data) + geom_bar(aes(x='time', fill='..count..')) + scale_fill_grey() + theme_void() + ggsize(400, 200)\n", "p" ] }, { "cell_type": "code", "execution_count": 3, "id": "b4f0eeb4-dab9-413e-8c0e-393f0cf0426a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "long_ticks = theme(legend_ticks_length=10) + ggtitle(\"Long Ticks\")\n", "thick_ticks = theme(legend_ticks=element_line(size=4)) + ggtitle(\"Thick Ticks\")\n", "thick_red_ticks = theme(legend_ticks=element_line(size=4, color='red')) + ggtitle(\"Thick Red Ticks\")\n", "hidden_ticks = theme(legend_ticks='blank') + ggtitle(\"Hidden Ticks\")\n", "\n", "gggrid([\n", " p + long_ticks,\n", " p + thick_ticks,\n", " p + thick_red_ticks,\n", " p + hidden_ticks,\n", "]) + ggsize(800, 200)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.21" } }, "nbformat": 4, "nbformat_minor": 5 }