Skip to content

Commit

Permalink
Deploying to gh-pages from @ 93dec5e 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
nunofachada committed Sep 1, 2023
1 parent 909e146 commit 6006bb7
Show file tree
Hide file tree
Showing 24 changed files with 482 additions and 2,418 deletions.
Binary file modified generated/gallery/gallery_jupyter.zip
Binary file not shown.
Binary file modified generated/gallery/gallery_python.zip
Binary file not shown.
14 changes: 7 additions & 7 deletions generated/gallery/mg_execution_times/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -613,19 +613,19 @@


<h1 id="computation-times">Computation times<a class="headerlink" href="#computation-times" title="Permanent link">&para;</a></h1>
<p><strong>00:36.628</strong> total execution time for <strong>generated_gallery</strong> files:</p>
<p><strong>00:51.721</strong> total execution time for <strong>generated_gallery</strong> files:</p>
<p>+----------------------------------------------------------------------------------------+-----------+--------+
| <a href="../plot_2_2d_examples/">plot_2_2d_examples</a> (docs/examples/plot_2_2d_examples.py) | 00:13.505 | 0.0 MB |
| <a href="../plot_2_2d_examples/">plot_2_2d_examples</a> (docs/examples/plot_2_2d_examples.py) | 00:19.947 | 0.0 MB |
+----------------------------------------------------------------------------------------+-----------+--------+
| <a href="../plot_4_nd_examples/">plot_4_nd_examples</a> (docs/examples/plot_4_nd_examples.py) | 00:11.310 | 0.0 MB |
| <a href="../plot_4_nd_examples/">plot_4_nd_examples</a> (docs/examples/plot_4_nd_examples.py) | 00:15.867 | 0.0 MB |
+----------------------------------------------------------------------------------------+-----------+--------+
| <a href="../plot_3_3d_examples/">plot_3_3d_examples</a> (docs/examples/plot_3_3d_examples.py) | 00:05.871 | 0.0 MB |
| <a href="../plot_3_3d_examples/">plot_3_3d_examples</a> (docs/examples/plot_3_3d_examples.py) | 00:07.542 | 0.0 MB |
+----------------------------------------------------------------------------------------+-----------+--------+
| <a href="../plot_5_mrg_examples/">plot_5_mrg_examples</a> (docs/examples/plot_5_mrg_examples.py) | 00:04.270 | 0.0 MB |
| <a href="../plot_5_mrg_examples/">plot_5_mrg_examples</a> (docs/examples/plot_5_mrg_examples.py) | 00:06.215 | 0.0 MB |
+----------------------------------------------------------------------------------------+-----------+--------+
| <a href="../plot_1_1d_examples/">plot_1_1d_examples</a> (docs/examples/plot_1_1d_examples.py) | 00:01.666 | 0.0 MB |
| <a href="../plot_1_1d_examples/">plot_1_1d_examples</a> (docs/examples/plot_1_1d_examples.py) | 00:02.143 | 0.0 MB |
+----------------------------------------------------------------------------------------+-----------+--------+
| <a href="../plot_functions/">plot_functions</a> (docs/examples/plot_functions.py) | 00:00.006 | 0.0 MB |
| <a href="../plot_functions/">plot_functions</a> (docs/examples/plot_functions.py) | 00:00.007 | 0.0 MB |
+----------------------------------------------------------------------------------------+-----------+--------+</p>


Expand Down
86 changes: 1 addition & 85 deletions generated/gallery/plot_1_1d_examples/index.html

Large diffs are not rendered by default.

Binary file modified generated/gallery/plot_1_1d_examples_codeobj.pickle
Binary file not shown.
1,412 changes: 178 additions & 1,234 deletions generated/gallery/plot_2_2d_examples/index.html

Large diffs are not rendered by default.

Binary file modified generated/gallery/plot_2_2d_examples_codeobj.pickle
Binary file not shown.
468 changes: 178 additions & 290 deletions generated/gallery/plot_3_3d_examples/index.html

Large diffs are not rendered by default.

Binary file modified generated/gallery/plot_3_3d_examples_codeobj.pickle
Binary file not shown.
408 changes: 16 additions & 392 deletions generated/gallery/plot_4_nd_examples/index.html

Large diffs are not rendered by default.

Binary file modified generated/gallery/plot_4_nd_examples_codeobj.pickle
Binary file not shown.
2 changes: 1 addition & 1 deletion generated/gallery/plot_5_mrg_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Although it is possible to merge data in any dimension, these examples will\nfocus on merging 2D data. Therefore, we'll use the same\n[`plot_examples_2d`](plot_functions.md#plot_examples_2d) function used for\nthe [2D examples](../plot_2_2d_examples):\n\n"
"Although it is possible to merge data in any dimension, these examples will\nfocus on merging 2D data. Therefore, we'll use the same\n[`plot_examples_2d`](plot_functions.md#plot_examples_2d) function used for\nthe [2D examples](plot_2_2d_examples.md):\n\n"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion generated/gallery/plot_5_mrg_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def rng(seed):
# Although it is possible to merge data in any dimension, these examples will
# focus on merging 2D data. Therefore, we'll use the same
# [`plot_examples_2d`](plot_functions.md#plot_examples_2d) function used for
# the [2D examples](../plot_2_2d_examples):
# the [2D examples](plot_2_2d_examples.md):

from plot_functions import plot_examples_2d

Expand Down
2 changes: 1 addition & 1 deletion generated/gallery/plot_5_mrg_examples.py.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2007d6433257ab7ebd44e4d7fed479cd
7a370e69cb42b786ee10efd925cb5971
396 changes: 37 additions & 359 deletions generated/gallery/plot_5_mrg_examples/index.html

Large diffs are not rendered by default.

Binary file modified generated/gallery/plot_5_mrg_examples_codeobj.pickle
Binary file not shown.
8 changes: 4 additions & 4 deletions generated/gallery/plot_functions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt # type: ignore\nimport numpy as np\nimport numpy.typing as npt\nimport pandas as pd\nimport seaborn as sns # type: ignore\n\nfrom pyclugen import Clusters"
"import os\nimport warnings\n\nimport matplotlib.pyplot as plt # type: ignore\nimport numpy as np\nimport numpy.typing as npt\nimport pandas as pd\nimport seaborn as sns # type: ignore\n\nfrom pyclugen import Clusters\n\n# Hide annoying warnings when building docs in CI\nif os.getenv(\"CI\") != None:\n warnings.filterwarnings(\"ignore\")"
]
},
{
Expand Down Expand Up @@ -105,7 +105,7 @@
},
"outputs": [],
"source": [
"def plot_examples_2d(\n *ets, pmargin: float = 0.1, ncols: int = 3, clusters_field: str = \"clusters\"\n):\n \"\"\"Plot the 2D examples given in the ets parameter.\"\"\"\n\n # Get examples\n ex = ets[0::2]\n # Get titles\n et = ets[1::2]\n\n df = clusters2df(*ex, clusters_field=clusters_field)\n\n # Get limits in each dimension\n xmaxs, xmins = get_plot_lims(df, pmargin=pmargin)\n\n # Set seaborn's dark grid style\n sns.set_theme(style=\"darkgrid\")\n\n # Use seaborn to create the plots\n g = sns.FacetGrid(\n df,\n col=\"example\",\n hue=\"cluster\",\n xlim=(xmins[0], xmaxs[0]),\n ylim=(xmins[1], xmaxs[1]),\n aspect=1,\n col_wrap=ncols,\n )\n\n g.map(sns.scatterplot, \"x0\", \"x1\", s=10)\n\n # Set the plot titles and x, y labels\n for ax, t in zip(g.axes, et):\n ax.set_title(t)\n ax.set_xlabel(\"x\")\n ax.set_ylabel(\"y\")"
"def plot_examples_2d(\n *ets, pmargin: float = 0.1, ncols: int = 3, clusters_field: str = \"clusters\"\n):\n \"\"\"Plot the 2D examples given in the ets parameter.\"\"\"\n\n # Get examples\n ex = ets[0::2]\n # Get titles\n et = ets[1::2]\n\n df = clusters2df(*ex, clusters_field=clusters_field)\n\n # Get limits in each dimension\n xmaxs, xmins = get_plot_lims(df, pmargin=pmargin)\n\n # Set seaborn's dark grid style\n sns.set_theme(style=\"darkgrid\")\n\n # Use seaborn to create the plots\n g = sns.FacetGrid(\n df,\n col=\"example\",\n hue=\"cluster\",\n xlim=(xmins.iloc[0], xmaxs.iloc[0]),\n ylim=(xmins.iloc[1], xmaxs.iloc[1]),\n aspect=1,\n col_wrap=ncols,\n )\n\n g.map(sns.scatterplot, \"x0\", \"x1\", s=10)\n\n # Set the plot titles and x, y labels\n for ax, t in zip(g.axes, et):\n ax.set_title(t)\n ax.set_xlabel(\"x\")\n ax.set_ylabel(\"y\")"
]
},
{
Expand All @@ -123,7 +123,7 @@
},
"outputs": [],
"source": [
"def plot_examples_3d(\n *ets,\n pmargin: float = 0.1,\n ncols: int = 3,\n side=350,\n clusters_field: str = \"clusters\",\n):\n \"\"\"Plot the 3D examples given in the ets parameter.\"\"\"\n\n # Get examples\n ex = ets[0::2]\n # Get titles\n et = ets[1::2]\n\n # Number of plots and number of rows in combined plot\n num_plots = len(ex)\n nrows = max(1, int(np.ceil(num_plots / ncols)))\n blank_plots = nrows * ncols - num_plots\n\n df = clusters2df(*ex, clusters_field=clusters_field)\n\n # Get limits in each dimension\n xmaxs, xmins = get_plot_lims(df, pmargin=pmargin)\n\n # Reset to default Matplotlib style, to avoid seaborn interference\n sns.reset_orig()\n\n # To convert inches to pixels afterwards\n px = 1 / plt.rcParams[\"figure.dpi\"] # pixel in inches\n\n # Use Matplotlib to create the plots\n _, axs = plt.subplots(\n nrows,\n ncols,\n figsize=(side * px * ncols, side * px * nrows),\n subplot_kw=dict(projection=\"3d\"),\n )\n axs = axs.reshape(-1)\n for ax, e, t in zip(axs, ex, et):\n ax.set_title(t, fontsize=10)\n ax.set_xlim(xmins[0], xmaxs[0])\n ax.set_ylim(xmins[1], xmaxs[1])\n ax.set_zlim(xmins[2], xmaxs[2])\n ax.set_xlabel(\"$x$\", labelpad=-2)\n ax.set_ylabel(\"$y$\", labelpad=-2)\n ax.set_zlabel(\"$z$\", labelpad=-2)\n ax.tick_params(labelsize=8, pad=-2)\n ax.scatter(\n e.points[:, 0],\n e.points[:, 1],\n e.points[:, 2],\n c=e.clusters,\n depthshade=False,\n edgecolor=\"black\",\n linewidths=0.2,\n )\n\n # Remaining plots are left blank\n for ax in axs[len(ex) : len(ex) + blank_plots]:\n ax.set_axis_off()\n ax.set_facecolor(color=\"white\")\n ax.patch.set_alpha(0)"
"def plot_examples_3d(\n *ets,\n pmargin: float = 0.1,\n ncols: int = 3,\n side=350,\n clusters_field: str = \"clusters\",\n):\n \"\"\"Plot the 3D examples given in the ets parameter.\"\"\"\n\n # Get examples\n ex = ets[0::2]\n # Get titles\n et = ets[1::2]\n\n # Number of plots and number of rows in combined plot\n num_plots = len(ex)\n nrows = max(1, int(np.ceil(num_plots / ncols)))\n blank_plots = nrows * ncols - num_plots\n\n df = clusters2df(*ex, clusters_field=clusters_field)\n\n # Get limits in each dimension\n xmaxs, xmins = get_plot_lims(df, pmargin=pmargin)\n\n # Reset to default Matplotlib style, to avoid seaborn interference\n sns.reset_orig()\n\n # To convert inches to pixels afterwards\n px = 1 / plt.rcParams[\"figure.dpi\"] # pixel in inches\n\n # Use Matplotlib to create the plots\n _, axs = plt.subplots(\n nrows,\n ncols,\n figsize=(side * px * ncols, side * px * nrows),\n subplot_kw=dict(projection=\"3d\"),\n )\n axs = axs.reshape(-1)\n for ax, e, t in zip(axs, ex, et):\n ax.set_title(t, fontsize=10)\n ax.set_xlim(xmins.iloc[0], xmaxs.iloc[0])\n ax.set_ylim(xmins.iloc[1], xmaxs.iloc[1])\n ax.set_zlim(xmins.iloc[2], xmaxs.iloc[2])\n ax.set_xlabel(\"$x$\", labelpad=-2)\n ax.set_ylabel(\"$y$\", labelpad=-2)\n ax.set_zlabel(\"$z$\", labelpad=-2)\n ax.tick_params(labelsize=8, pad=-2)\n ax.scatter(\n e.points[:, 0],\n e.points[:, 1],\n e.points[:, 2],\n c=e.clusters,\n depthshade=False,\n edgecolor=\"black\",\n linewidths=0.2,\n )\n\n # Remaining plots are left blank\n for ax in axs[len(ex) : len(ex) + blank_plots]:\n ax.set_axis_off()\n ax.set_facecolor(color=\"white\")\n ax.patch.set_alpha(0)"
]
},
{
Expand All @@ -141,7 +141,7 @@
},
"outputs": [],
"source": [
"def plot_examples_nd(\n ex: Clusters, t: str, pmargin: float = 0.1, clusters_field: str = \"clusters\"\n):\n \"\"\"Plot the nD example given in the ex parameter.\"\"\"\n\n # How many dimensions?\n nd = ex.points.shape[1]\n\n df = clusters2df(ex, clusters_field=clusters_field)\n\n # Get limits in each dimension\n xmaxs, xmins = get_plot_lims(df, pmargin=pmargin)\n\n # Set seaborn's dark grid style\n sns.set_theme(style=\"darkgrid\")\n\n # Create pairwise plots with nothing on the diagonal\n g = sns.PairGrid(df.iloc[:, :-1], hue=\"cluster\", palette=\"deep\")\n g.map_offdiag(sns.scatterplot, s=10)\n g.figure.suptitle(t, y=1)\n\n # Decorate plot\n for i in range(nd):\n for j in range(nd):\n if i == j:\n # Set the x labels in the diagonal plots\n xycoord = (xmaxs[i] + xmins[i]) / 2\n g.axes[i, i].text(\n xycoord, xycoord, f\"$x{i}$\", fontsize=20, ha=\"center\", va=\"center\"\n )\n else:\n # Set appropriate plot intervals and aspect ratio\n g.axes[i, j].set_xlim([xmins[j], xmaxs[j]])\n g.axes[i, j].set_ylim([xmins[i], xmaxs[i]])\n g.axes[i, j].set_aspect(1)"
"def plot_examples_nd(\n ex: Clusters, t: str, pmargin: float = 0.1, clusters_field: str = \"clusters\"\n):\n \"\"\"Plot the nD example given in the ex parameter.\"\"\"\n\n # How many dimensions?\n nd = ex.points.shape[1]\n\n df = clusters2df(ex, clusters_field=clusters_field)\n\n # Get limits in each dimension\n xmaxs, xmins = get_plot_lims(df, pmargin=pmargin)\n\n # Set seaborn's dark grid style\n sns.set_theme(style=\"darkgrid\")\n\n # Create pairwise plots with nothing on the diagonal\n g = sns.PairGrid(df.iloc[:, :-1], hue=\"cluster\", palette=\"deep\")\n g.map_offdiag(sns.scatterplot, s=10)\n g.figure.suptitle(t, y=1)\n\n # Decorate plot\n for i in range(nd):\n for j in range(nd):\n if i == j:\n # Set the x labels in the diagonal plots\n xycoord = (xmaxs.iloc[i] + xmins.iloc[i]) / 2\n g.axes[i, i].text(\n xycoord, xycoord, f\"$x{i}$\", fontsize=20, ha=\"center\", va=\"center\"\n )\n else:\n # Set appropriate plot intervals and aspect ratio\n g.axes[i, j].set_xlim([xmins.iloc[j], xmaxs.iloc[j]])\n g.axes[i, j].set_ylim([xmins.iloc[i], xmaxs.iloc[i]])\n g.axes[i, j].set_aspect(1)"
]
}
],
Expand Down
23 changes: 15 additions & 8 deletions generated/gallery/plot_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# %%
# ## Import the required libraries

import os
import warnings

import matplotlib.pyplot as plt # type: ignore
import numpy as np
import numpy.typing as npt
Expand All @@ -14,6 +17,10 @@

from pyclugen import Clusters

# Hide annoying warnings when building docs in CI
if os.getenv("CI") != None:
warnings.filterwarnings("ignore")

# %%
# ## clusters2df

Expand Down Expand Up @@ -133,8 +140,8 @@ def plot_examples_2d(
df,
col="example",
hue="cluster",
xlim=(xmins[0], xmaxs[0]),
ylim=(xmins[1], xmaxs[1]),
xlim=(xmins.iloc[0], xmaxs.iloc[0]),
ylim=(xmins.iloc[1], xmaxs.iloc[1]),
aspect=1,
col_wrap=ncols,
)
Expand Down Expand Up @@ -192,9 +199,9 @@ def plot_examples_3d(
axs = axs.reshape(-1)
for ax, e, t in zip(axs, ex, et):
ax.set_title(t, fontsize=10)
ax.set_xlim(xmins[0], xmaxs[0])
ax.set_ylim(xmins[1], xmaxs[1])
ax.set_zlim(xmins[2], xmaxs[2])
ax.set_xlim(xmins.iloc[0], xmaxs.iloc[0])
ax.set_ylim(xmins.iloc[1], xmaxs.iloc[1])
ax.set_zlim(xmins.iloc[2], xmaxs.iloc[2])
ax.set_xlabel("$x$", labelpad=-2)
ax.set_ylabel("$y$", labelpad=-2)
ax.set_zlabel("$z$", labelpad=-2)
Expand Down Expand Up @@ -246,12 +253,12 @@ def plot_examples_nd(
for j in range(nd):
if i == j:
# Set the x labels in the diagonal plots
xycoord = (xmaxs[i] + xmins[i]) / 2
xycoord = (xmaxs.iloc[i] + xmins.iloc[i]) / 2
g.axes[i, i].text(
xycoord, xycoord, f"$x{i}$", fontsize=20, ha="center", va="center"
)
else:
# Set appropriate plot intervals and aspect ratio
g.axes[i, j].set_xlim([xmins[j], xmaxs[j]])
g.axes[i, j].set_ylim([xmins[i], xmaxs[i]])
g.axes[i, j].set_xlim([xmins.iloc[j], xmaxs.iloc[j]])
g.axes[i, j].set_ylim([xmins.iloc[i], xmaxs.iloc[i]])
g.axes[i, j].set_aspect(1)
2 changes: 1 addition & 1 deletion generated/gallery/plot_functions.py.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d3e68d11254136306e38f7585208145e
701e8cef4cfc183879b45c1ea33c0780
Loading

0 comments on commit 6006bb7

Please sign in to comment.