{ "cells": [ { "cell_type": "markdown", "id": "issue-706-title", "metadata": {}, "source": [ "# Issue #706, \"scale_alpha: conflict of constant and mapped values of alpha aesthetic\"\n", "\n", "When a layer uses a constant numeric aesthetic (e.g. `geom_point(alpha=0.5)`) alongside another layer\n", "that maps the same aesthetic to data with a non-identity transform (e.g. `scale_alpha(trans='log10')`),\n", "the constant was incorrectly run through the transform, producing a wrong value. For alpha this often meant\n", "a negative value that was later clamped to 0." ] }, { "cell_type": "code", "execution_count": 1, "id": "issue-706-setup", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from lets_plot import *\n", "\n", "LetsPlot.setup_html()\n", "\n", "data = {\n", " 'x': [-3, -2, -1, 0, 1, 2, 3],\n", " 'y': [-3, -2, -1, 0, 1, 2, 3],\n", " # negative and zero values are outside log10 domain; only 1, 4, 9 survive\n", " 'v': [-9, -4, -1, 0, 1, 4, 9],\n", "}" ] }, { "cell_type": "markdown", "id": "issue-706-section-1", "metadata": {}, "source": [ "## 1. Original failing case: constant `alpha=0.5` + `scale_alpha(trans='log10')`\n", "\n", "Before the fix the large red points (Layer 1) were invisible (alpha clamped to 0).\n", "After the fix they should appear at 50% opacity.\n", "\n", "ggplot2 behavior: produces a warning about out-of-domain values but renders both layers." ] }, { "cell_type": "code", "execution_count": 2, "id": "issue-706-case1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "