Skip to content

Commit 05f83b1

Browse files
committed
Fix Altair PNG rendering and seaborn kdeplot API in notebook
Restore alt.renderers.enable('png') that was dropped during the 2025 modernization attempt, and replace removed kdeplot shade= with fill=.
1 parent 900bf71 commit 05f83b1

1 file changed

Lines changed: 2 additions & 56 deletions

File tree

‎Examples.ipynb‎

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,7 @@
55
"execution_count": null,
66
"metadata": {},
77
"outputs": [],
8-
"source": [
9-
"%matplotlib inline\n",
10-
"\n",
11-
"import readline\n",
12-
"import altair as alt\n",
13-
"import pandas as pd\n",
14-
"import seaborn as sns\n",
15-
"from matplotlib import pyplot\n",
16-
"from plotnine import *\n",
17-
"import numpy as np\n",
18-
"\n",
19-
"from plotly import figure_factory\n",
20-
"from plotly import graph_objects\n",
21-
"import plotly.express as px\n",
22-
"from IPython.core.magic import Magics, magics_class, cell_magic\n",
23-
"\n",
24-
"from IPython.display import Image\n",
25-
"\n",
26-
"from pylab import rcParams\n",
27-
"\n",
28-
"size = 20\n",
29-
"params = {\n",
30-
" \"legend.fontsize\": size,\n",
31-
" \"figure.figsize\": (15, 5),\n",
32-
" \"axes.labelsize\": size,\n",
33-
" \"axes.titlesize\": size,\n",
34-
" \"xtick.labelsize\": size,\n",
35-
" \"ytick.labelsize\": size,\n",
36-
" \"axes.titlesize\": 1.5 * size,\n",
37-
" \"figure.figsize\": (12, 12),\n",
38-
"}\n",
39-
"rcParams.update(params)\n",
40-
"theme_update(\n",
41-
" figure_size=(9, 9),\n",
42-
" title=element_text(size=size),\n",
43-
" text=element_text(size=0.6 * size),\n",
44-
") # for plotnine\n",
45-
"\n",
46-
"\n",
47-
"import plotly.io as pio\n",
48-
"pio.renderers.default = \"png\"\n",
49-
"pio.renderers[\"png\"].width = 750\n",
50-
"pio.renderers[\"png\"].height = 750\n",
51-
"\n",
52-
"# For now, use default (will show as objects)"
53-
]
8+
"source": "%matplotlib inline\n\nimport readline\nimport altair as alt\nimport pandas as pd\nimport seaborn as sns\nfrom matplotlib import pyplot\nfrom plotnine import *\nimport numpy as np\n\nfrom plotly import figure_factory\nfrom plotly import graph_objects\nimport plotly.express as px\nfrom IPython.core.magic import Magics, magics_class, cell_magic\n\nfrom IPython.display import Image\n\nfrom pylab import rcParams\n\nsize = 20\nparams = {\n \"legend.fontsize\": size,\n \"figure.figsize\": (15, 5),\n \"axes.labelsize\": size,\n \"axes.titlesize\": size,\n \"xtick.labelsize\": size,\n \"ytick.labelsize\": size,\n \"axes.titlesize\": 1.5 * size,\n \"figure.figsize\": (12, 12),\n}\nrcParams.update(params)\ntheme_update(\n figure_size=(9, 9),\n title=element_text(size=size),\n text=element_text(size=0.6 * size),\n) # for plotnine\n\n\nimport plotly.io as pio\npio.renderers.default = \"png\"\npio.renderers[\"png\"].width = 750\npio.renderers[\"png\"].height = 750\n\n# Render Altair charts as PNG via vl-convert\nalt.renderers.enable(\"png\", scale_factor=2.0)"
549
},
5510
{
5611
"cell_type": "code",
@@ -1554,16 +1509,7 @@
15541509
]
15551510
},
15561511
"outputs": [],
1557-
"source": [
1558-
"(sns\n",
1559-
" .FacetGrid(diamonds, \n",
1560-
" hue=\"cut\", \n",
1561-
" height=10, \n",
1562-
" xlim=(55, 70))\n",
1563-
" .map(sns.kdeplot, 'depth', shade=True)\n",
1564-
" .add_legend()\n",
1565-
");"
1566-
]
1512+
"source": "(sns\n .FacetGrid(diamonds, \n hue=\"cut\", \n height=10, \n xlim=(55, 70))\n .map(sns.kdeplot, 'depth', fill=True)\n .add_legend()\n);"
15671513
},
15681514
{
15691515
"cell_type": "code",

0 commit comments

Comments
 (0)