From 1112c02122a5aad65b2ae7f64710bbd9f80901ac Mon Sep 17 00:00:00 2001 From: Scott Jungling Date: Mon, 6 May 2024 13:45:34 -0700 Subject: [PATCH] refactor: update cont. color scale for recipe performance (#43) use new palette fix https://github.com/moderneinc/moderne-ui/issues/4273 --- .../recipe_performance.ipynb | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/moderne_visualizations_misc/recipe_performance.ipynb b/moderne_visualizations_misc/recipe_performance.ipynb index 91b6735..0e054a9 100644 --- a/moderne_visualizations_misc/recipe_performance.ipynb +++ b/moderne_visualizations_misc/recipe_performance.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 65, "metadata": { "tags": [ "parameters" @@ -16,13 +16,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 66, "metadata": { "tags": [] }, "outputs": [], "source": [ - "from code_data_science import data_table as dt\n", + "from code_data_science import data_table as dt, palette as pl\n", "\n", "df = dt.read_csv(\"../samples/recipe_performance.csv\")\n", "# parameter is a string\n", @@ -31,7 +31,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 67, "metadata": {}, "outputs": [], "source": [ @@ -62,12 +62,18 @@ "\n", "# Calculate the height of the plot\n", "height_per_recipe = 25\n", - "total_height = max(top_n * height_per_recipe + 150, 300)" + "total_height = max(top_n * height_per_recipe + 150, 300)\n", + "\n", + "color_continuous_scale = [\n", + " [0, pl.__moderne_color_map[\"midnight\"][500]],\n", + " [0.5, pl.__moderne_color_map[\"digital_blue\"][500]],\n", + " [1, pl.__moderne_color_map[\"activity_green\"][500]],\n", + "]\n" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 68, "metadata": {}, "outputs": [], "source": [ @@ -78,7 +84,7 @@ " title=f\"Total {sort_by} time for top {top_n} recipes\",\n", " labels={byTotalTime: f\"Total {sort_by} time (sec)\", \"recipe\": \"Recipe\"},\n", " color=byTotalTime,\n", - " color_continuous_scale=\"Bluered\",\n", + " color_continuous_scale=color_continuous_scale,\n", " orientation=\"h\",\n", " height=total_height,\n", ")\n", @@ -103,7 +109,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.4" + "version": "3.11.9" } }, "nbformat": 4,