|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "id": "8f97280e-cec8-42b2-a968-4fd4364594f8", |
| 7 | + "metadata": { |
| 8 | + "tags": [ |
| 9 | + "hide" |
| 10 | + ] |
| 11 | + }, |
| 12 | + "outputs": [], |
| 13 | + "source": [ |
| 14 | + "import seaborn as sns\n", |
| 15 | + "sns.set_theme()\n", |
| 16 | + "sns.palettes._patch_colormap_display()" |
| 17 | + ] |
| 18 | + }, |
| 19 | + { |
| 20 | + "cell_type": "raw", |
| 21 | + "id": "972edede-df1a-4010-9674-00b864d020e2", |
| 22 | + "metadata": {}, |
| 23 | + "source": [ |
| 24 | + "Pass a list of two colors to interpolate between them:" |
| 25 | + ] |
| 26 | + }, |
| 27 | + { |
| 28 | + "cell_type": "code", |
| 29 | + "execution_count": null, |
| 30 | + "id": "e6ae2547-1042-4ac0-84ea-6f37a0229871", |
| 31 | + "metadata": {}, |
| 32 | + "outputs": [], |
| 33 | + "source": [ |
| 34 | + "sns.blend_palette([\"b\", \"r\"])" |
| 35 | + ] |
| 36 | + }, |
| 37 | + { |
| 38 | + "cell_type": "raw", |
| 39 | + "id": "1d983eac-2dd5-4746-b27f-4dfa19b5e091", |
| 40 | + "metadata": {}, |
| 41 | + "source": [ |
| 42 | + "The color list can be arbitrarily long, and any color format can be used:" |
| 43 | + ] |
| 44 | + }, |
| 45 | + { |
| 46 | + "cell_type": "code", |
| 47 | + "execution_count": null, |
| 48 | + "id": "846b78fd-30ce-4507-93f4-4274122c1987", |
| 49 | + "metadata": {}, |
| 50 | + "outputs": [], |
| 51 | + "source": [ |
| 52 | + "sns.blend_palette([\"#45a872\", \".8\", \"xkcd:golden\"])" |
| 53 | + ] |
| 54 | + }, |
| 55 | + { |
| 56 | + "cell_type": "raw", |
| 57 | + "id": "318fef32-1f83-44d9-9ff9-21fa0231b7c6", |
| 58 | + "metadata": {}, |
| 59 | + "source": [ |
| 60 | + "Return a continuous colormap instead of a discrete palette:" |
| 61 | + ] |
| 62 | + }, |
| 63 | + { |
| 64 | + "cell_type": "code", |
| 65 | + "execution_count": null, |
| 66 | + "id": "f0a05bc3-c60b-47a1-b276-d2e28a4a8226", |
| 67 | + "metadata": {}, |
| 68 | + "outputs": [], |
| 69 | + "source": [ |
| 70 | + "sns.blend_palette([\"#bdc\", \"#7b9\", \"#47a\"], as_cmap=True)" |
| 71 | + ] |
| 72 | + }, |
| 73 | + { |
| 74 | + "cell_type": "code", |
| 75 | + "execution_count": null, |
| 76 | + "id": "0473a402-0ec2-4877-81d2-ed6c57aefc77", |
| 77 | + "metadata": {}, |
| 78 | + "outputs": [], |
| 79 | + "source": [] |
| 80 | + } |
| 81 | + ], |
| 82 | + "metadata": { |
| 83 | + "kernelspec": { |
| 84 | + "display_name": "py310", |
| 85 | + "language": "python", |
| 86 | + "name": "py310" |
| 87 | + }, |
| 88 | + "language_info": { |
| 89 | + "codemirror_mode": { |
| 90 | + "name": "ipython", |
| 91 | + "version": 3 |
| 92 | + }, |
| 93 | + "file_extension": ".py", |
| 94 | + "mimetype": "text/x-python", |
| 95 | + "name": "python", |
| 96 | + "nbconvert_exporter": "python", |
| 97 | + "pygments_lexer": "ipython3", |
| 98 | + "version": "3.10.0" |
| 99 | + } |
| 100 | + }, |
| 101 | + "nbformat": 4, |
| 102 | + "nbformat_minor": 5 |
| 103 | +} |
0 commit comments