{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "1abfc7de-3ced-4407-b38e-3fc276b6a133", "metadata": {}, "outputs": [], "source": [ "import math\n", "import json\n", "from pathlib import Path\n", "\n", "import plotly.io as pio\n", "import plotly.graph_objects as go\n", "from coloraide import Color\n", "\n", "import gamut_3d_plotly as diagrams\n", "\n", "pio.renderers\n", "pio.renderers.default = \"notebook_connected\"\n", "\n", "\n", "def face_radial_plane(fig, theta_deg, r=2.5, tilt_deg=0):\n", " # normal in xy\n", " nx = -math.sin(math.radians(theta_deg))\n", " ny = math.cos(math.radians(theta_deg))\n", "\n", " # allow optional tilt up/down so it's not perfectly horizontal\n", " tilt = math.radians(tilt_deg) # 0 => horizontal view, positive looks slightly downward\n", " ex = r * nx * math.cos(tilt)\n", " ey = r * ny * math.cos(tilt)\n", " ez = r * math.sin(tilt)\n", "\n", " fig.update_layout(\n", " scene_camera=dict(\n", " eye=dict(x=ex, y=ey, z=ez),\n", " center=dict(x=0, y=0, z=0),\n", " up=dict(x=0, y=0, z=1)\n", " )\n", " )\n" ] }, { "cell_type": "code", "execution_count": 2, "id": "642b3763-f250-4e24-bd4c-2a080772467d", "metadata": {}, "outputs": [], "source": [ "PALETTE_DIR = \"palettes\"\n", "\n", "with Path(PALETTE_DIR, \"monobiome-v111-oklch.json\").open(\"rb\") as f:\n", " mb_v111_dict = json.load(f)\n", "with Path(PALETTE_DIR, \"monobiome-vUCC-oklch.json\").open(\"rb\") as f:\n", " mb_vUCC_dict = json.load(f)\n", "with Path(PALETTE_DIR, \"monobiome-vMCL-oklch.json\").open(\"rb\") as f:\n", " mb_vMCL_dict = json.load(f)\n", "with Path(PALETTE_DIR, \"monobiome-vQBR-oklch.json\").open(\"rb\") as f:\n", " mb_vQBR_dict = json.load(f)\n", "with Path(PALETTE_DIR, \"monobiome-vQBRsn-oklch.json\").open(\"rb\") as f:\n", " mb_vQBRsn_dict = json.load(f)" ] }, { "cell_type": "code", "execution_count": 3, "id": "0e778a92-78fa-40eb-8b4f-51fbbbc9eb0a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "===> Generating oklch model...\n" ] }, { "data": { "text/html": [ " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "