Skip to content

Commit

Permalink
refactor: update cont. color scale for recipe performance (#43)
Browse files Browse the repository at this point in the history
use new palette

fix moderneinc/moderne-ui#4273
  • Loading branch information
sjungling authored May 6, 2024
1 parent 8e80d75 commit 1112c02
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions moderne_visualizations_misc/recipe_performance.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 65,
"metadata": {
"tags": [
"parameters"
Expand All @@ -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",
Expand All @@ -31,7 +31,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 67,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -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": [
Expand All @@ -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",
Expand All @@ -103,7 +109,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 1112c02

Please sign in to comment.