{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "considerable-start", "metadata": {}, "outputs": [], "source": [ "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "grateful-williams", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "id": "color-smith", "metadata": {}, "outputs": [], "source": [ "LetsPlot.set_theme(theme_minimal())" ] }, { "cell_type": "markdown", "id": "breeding-sheet", "metadata": {}, "source": [ "#### Draw arrows\n", "\n", "- the arrowhead always points to the specified coordinate of the segment\n", "- the segment itself is drawn so that it does not intersect with its arrow\n", "- no beveled corners (previously, acute angle could be drawn beveled)" ] }, { "cell_type": "code", "execution_count": 4, "id": "amateur-security", "metadata": {}, "outputs": [], "source": [ "def plot_with_arrows(angle, type='open'):\n", " return ggplot() \\\n", " + geom_vline(xintercept=0) \\\n", " + geom_vline(xintercept=1) \\\n", " + geom_segment(x=0, xend=1, y=0, yend=0,\n", " size=5,\n", " alpha=0.5,\n", " arrow=arrow(ends='both', type=type, length=75, angle=angle)) \\\n", " + ggsize(600, 350)" ] }, { "cell_type": "code", "execution_count": 5, "id": "demonstrated-template", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "