Commit 3a4d0067 authored by Alexis Prel's avatar Alexis Prel

Test upload GUI

parent 55da6195
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Réglages pour l'affichage : behind the scenes\n",
"\n",
"![behind the scenes](http://a.dilcdn.com/bl/wp-content/uploads/sites/6/2016/10/Luke-BTS-1536x512.jpg)\n",
"\n",
"Ce module contient quelques réglages pour l'affichage. Il est appelé par les autres notebooks pour produire de jolis graphiques et défini un certain nombre de paramètres par défaut, en plus d'importer les modules utiles.\n",
"\n",
"Je vous conseille de ne pas y toucher, à moins que vous sachiez ce que vous faites."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Modules"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Using matplotlib backend: Qt5Agg\n",
"Populating the interactive namespace from numpy and matplotlib\n"
]
}
],
"source": [
"%pylab\n",
"#['GTK', 'GTKAgg', 'GTKCairo', 'MacOSX', 'Qt4Agg', 'Qt5Agg', 'TkAgg', 'WX', 'WXAgg', 'GTK3Cairo', 'GTK3Agg', 'WebAgg', 'nbAgg', 'agg', 'cairo', 'gdk', 'pdf', 'pgf', 'ps', 'svg', 'template']\n",
"from collections import defaultdict\n",
"from matplotlib import patheffects\n",
"#import matplotlib.animation as animation # pour les animations.\n",
"from mpl_toolkits.mplot3d import Axes3D # pour afficher des graphes en 3D.\n",
"from matplotlib.patches import FancyArrowPatch # dessiner les flèches vectorielles.\n",
"from mpl_toolkits.mplot3d import proj3d # autre outil 3D"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Géometrie"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def mediatrice(pos_1, pos_2):\n",
" \"\"\"Renvoie la médiatrice de deux points. \n",
" En 3D : trois points P, Q, R formant le plan médiateur entre pos_1 et pos_2\n",
" En 2D : deux points P, Q formant la droite médiatrice entre pos_1 et pos_2\n",
" En 1D : le point M au milieu du segment [pos_1 : pos_2]\"\"\"\n",
" pos_1, pos_2 = np.array(pos_1), np.array(pos_2)\n",
" n_dim = len(pos_1)\n",
" print(n_dim)\n",
" milieu = (pos_1 + pos_2)/2.\n",
" difference = (pos_2 - pos_1)/2.\n",
" if (n_dim == 1) or not np.any(difference):\n",
" # La médiatrice entre un point et lui même peut être vue comme le point en question.\n",
" return [milieu]*n_dim\n",
" elif n_dim == 2:\n",
" # La droite médiatrice est perpendiculaire au segment et passe par son milieu.\n",
" dx, dy = difference\n",
" P, Q = milieu + np.array([dy, -dx]), milieu + np.array([-dy, dx])\n",
" return [P, Q]\n",
" elif n_dim == 3:\n",
" # Calcule la position de 3 points du plan.\n",
" P, Q, R = [milieu + np.cross(difference, basis_vec) for basis_vec in np.eye(3)]\n",
" \n",
" # Translation dans le plan pour que le centre de gravité de PQR coincide avec milieu.\n",
" translation = milieu - (P+Q+R)/3.\n",
" #P, Q, R = [pt + translation for pt in [P, Q, R]]\n",
" return [P, Q, R]\n",
" else:\n",
" print(\"Je ne sais pas encore travailler dans l'espace-temps ... \")"
]
},
{
"cell_type": "code",
"execution_count": 90,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3\n"
]
}
],
"source": [
"#dessiner_plan(mediatrice([1,0,0],[2,0,0]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Paramètres d'affichage"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"nombre_d_or = (1 + sqrt(5))/2."
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"base = 4\n",
"matplotlib.rcParams['figure.figsize'] = (nombre_d_or*base, base)\n",
"matplotlib.rcParams['font.family'] = 'Century Gothic' # c'est vraiment plus joli.\n",
"matplotlib.rcParams['font.size'] = 12\n",
"configuration_basique = matplotlib.rcParams.copy() # pour revenir aux rcParams initiaux dans le futur."
]
},
{
"cell_type": "code",
"execution_count": 91,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def joli_graphe(N_col=1, N_lin=1, n_dim=3):\n",
" \"\"\"Produit une figure contenant N axes en 1D, 2D ou 3D, agencés joliment.\"\"\"\n",
" #n_cols_max = 5\n",
" base = defaultdict(lambda: 6,\n",
" {'module://ipykernel.pylab.backend_inline': 6,\n",
" 'Qt5Agg':7})[matplotlib.rcParams['backend']]\n",
"\n",
" #n_lignes = 1 + int((N-1)/n_cols_max)\n",
" #n_cols = min(N, n_cols_max)\n",
" N = N_col * N_lin\n",
" \n",
" matplotlib.rcParams['figure.figsize'] = (base * N_col, base * N_lin)\n",
" if n_dim == 1:\n",
" matplotlib.rcParams['figure.figsize'] = ( 12 * N_col, 2* N_lin)\n",
" xkcd_custom(font='Century Gothic')\n",
" fig = plt.figure()\n",
" ax = []\n",
" proj = ['rectilinear','rectilinear','3d'][n_dim-1]\n",
" for n in range(N):\n",
" ax.append(fig.add_subplot(N_lin, N_col, n+1, projection=proj))\n",
" ax[-1].set_aspect('equal')\n",
" return fig, ax"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x1d0ebd50cc0>]"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#xkcd_reverse()\n",
"#plt.figure()\n",
"#plt.plot(range(9), range(9))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Dessins géométriques"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"################################################################################\n",
"def dessiner_points(XYZ, m='o', c='r', t=20, a=None, s=0, labels=['x','y','z']):\n",
" # Nombre de dimensions.\n",
" if (len(XYZ)==1) or (len(XYZ[1])==0): n_dim=1\n",
" elif (len(XYZ)==2) or (len(XYZ[2])==0): n_dim=2\n",
" else: n_dim = 3\n",
" \n",
" proj = ('rectilinear', '3d')[n_dim==3]\n",
" if n_dim==1: X = XYZ[0]\n",
" if n_dim==2: X, Y = XYZ[0], XYZ[1]\n",
" if n_dim==3: X, Y, Z = XYZ\n",
" # Si aucun axe où plotter les données n'a été spécifié, il faut en créer un.\n",
" if not a: a = [plt.figure().add_subplot(1, 1, 1, projection=proj)]\n",
" \n",
" axe = a[s] # On sélectionne l'axe s parmis les subplots. \n",
" \n",
" # Affichage.\n",
" xkcd_custom(font='Century Gothic')\n",
" axe.set_xlabel(labels[0])\n",
" if n_dim == 3:\n",
" axe.set_ylabel(labels[1])\n",
" axe.set_zlabel(labels[2])\n",
" axe.scatter(X, Y, Z, c=c, marker=m, s=t)\n",
" # Create cubic bounding box to simulate equal aspect ratio\n",
" # Just trust that fucking code okay ? \n",
" x1, x2, y1, y2, z1, z2 = axe.get_w_lims()\n",
" max_range = max(x2-x1, y2-y1, z2-z1)/2.\n",
" Xb = max_range*np.array([-1, -1, -1, -1, 1, 1, 1, 1]) + (x1+x2)/2.\n",
" Yb = max_range*np.array([-1, -1, 1, 1, -1, -1, 1, 1]) + (y1+y2)/2.\n",
" Zb = max_range*np.array([-1, 1, -1, 1, -1, 1, -1, 1]) + (z1+z2)/2.\n",
" for xb, yb, zb in zip(Xb, Yb, Zb):\n",
" axe.plot([xb], [yb], [zb])\n",
" else:\n",
" x1, x2 = axe.get_xlim()\n",
" y1, y2 = axe.get_ylim()\n",
" if n_dim == 1:\n",
" Y = [0]*len(X) # On crée une liste de zéros pour les Y\n",
" axe.set_aspect('auto')\n",
" axe.yaxis.set_visible(False)\n",
" axe.set_ylim([-0.15,0.15])\n",
" axe.spines['top'].set_visible(False)\n",
" axe.spines['right'].set_visible(False)\n",
" axe.spines['left'].set_visible(False)\n",
" \n",
" axe.plot(X, Y, 'o', marker=m, markersize=t, linewidth=0,\n",
" markerfacecolor=c, markeredgecolor=c)\n",
" axe.set_xlim([min(x1, min(X)-1), max(x2, max(X)+1)])\n",
" if n_dim ==2:\n",
" axe.set_aspect('equal')\n",
" axe.set_ylim([min(y1, min(Y)-1), max(y2, max(Y)+1)])\n",
" axe.set_ylabel(labels[1])\n",
" xkcd_reverse()\n",
"################################################################################"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Le code ci-dessous a été emprunté depuis :\n",
"# https://stackoverflow.com/questions/22867620/putting-arrowheads-on-vectors-in-matplotlibs-3d-plot\n",
"############################################\n",
"class Arrow3D(FancyArrowPatch):\n",
" def __init__(self, xs, ys, zs, *args, **kwargs):\n",
" FancyArrowPatch.__init__(self, (0,0), (0,0), *args, **kwargs)\n",
" self._verts3d = xs, ys, zs\n",
"\n",
" def draw(self, renderer):\n",
" xs3d, ys3d, zs3d = self._verts3d\n",
" xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)\n",
" self.set_positions((xs[0],ys[0]),(xs[1],ys[1]))\n",
" FancyArrowPatch.draw(self, renderer)"
]
},
{
"cell_type": "code",
"execution_count": 100,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"################################################################################\n",
"def dessiner_ligne(vertex_1, vertex_2, c='black', e=2, a=None, s=0):\n",
" # Nombre de dimensions.\n",
" n_dim = len(vertex_1)\n",
" proj = ['rectilinear','rectilinear','3d'][n_dim-1]\n",
" \n",
" # Si aucun axe où plotter les données n'a été spécifié, il faut en créer un.\n",
" if not a:\n",
" fig = plt.figure()\n",
" a = [fig.add_subplot(1, 1, 1, projection=proj)]\n",
" \n",
" # On sélectionne l'axe s parmis les subplots. \n",
" axe = a[s] \n",
" \n",
" # Affichage.\n",
" if n_dim == 3:\n",
" xkcd_reverse(font='Century Gothic')\n",
" X, Y, Z = [[vertex_1[i], vertex_2[i]] for i in range(3)]\n",
" axe.plot(X, Y, Z, c, linewidth=e)\n",
" else:\n",
" if n_dim == 1:\n",
" vertex_1, vertex_2 = np.array([vertex_1[0], 0]), np.array([vertex_2[0], 0])\n",
" X, Y = [[vertex_1[i], vertex_2[i]] for i in range(2)]\n",
" axe.plot(X, Y, c, linewidth=e)\n",
" #xkcd_reverse()\n",
"\n",
"def dessiner_vecteur(point_de_depart, vecteur, c='black', e=2, a=None, s=0):\n",
" dessiner_ligne(np.array(point_de_depart), \n",
" np.array(point_de_depart)+np.array(vecteur), \n",
" c, e, a, s)\n",
" n_dim = len(point_de_depart)\n",
" if n_dim == 3:\n",
" x, y, z = point_de_depart\n",
" dx, dy, dz = vecteur\n",
" fleche = Arrow3D([x, dx], [y, dy], [z, dz],\n",
" mutation_scale=20, lw=e, arrowstyle=\"-|>\", color=c)\n",
" a[s].add_artist(fleche)\n",
" else:\n",
" if n_dim == 1:\n",
" x, y = point_de_depart, 0\n",
" dx, dy = vecteur[0], 0\n",
" else:\n",
" x, y = point_de_depart\n",
" dx, dy = vecteur\n",
" a[s].arrow(x, y, dx, dy, fc=c)\n",
"\n",
"def dessiner_droite(droite, ax=None, sub=0, *args, **kwargs):\n",
" A, B = droite\n",
" n_dim = len(A)\n",
" if not ax:\n",
" fig, ax = joli_graphe(n_dim=n_dim)\n",
" sub = 0\n",
" axe = ax[sub]\n",
" \n",
" if n_dim == 3:\n",
" axe.plot([A[0], B[0]], [A[1], B[1]], [A[2], B[2]], c='indigo')\n",
" else:\n",
" axe.plot([A[0], B[0]], [A[1], B[1]], 'indigo')\n",
"\n",
"def dessiner_plan(plan, opacite=0.7, ax=None, sub=0, *args, **kwargs ):\n",
" \"\"\"Dessine un plan dans la figure courante à partir de trois points P, Q et R.\n",
" Pour obtenir un plan transparent, faire varier l'opacité entre 0 et 1. \"\"\"\n",
" if not ax:\n",
" fig, ax = joli_graphe(n_dim=3)\n",
" sub = 0\n",
" axe = ax[sub]\n",
" P, Q, R = plan\n",
" xP, yP, zP = P\n",
" xQ, yQ, zQ = Q\n",
" xR, yR, zR = R\n",
" #axe.plot_trisurf([xP, xQ, xR], [yP, yQ, yR], [zP, zQ, zR], args, kwargs, alpha=opacite)\n",
" axe.plot_trisurf([plan[0][0], plan[1][0], plan[2][0]], \n",
" [plan[0][1], plan[1][1], plan[2][1]], \n",
" [plan[0][2], plan[1][2], plan[2][2]], args, kwargs, alpha=opacite)\n",
" #axe.plot_trisurf([1,2,3],[0.2,0,0],[1,1.1,1])\n",
"\n",
"def dessiner_sphere(centre, rayon, ax=None, sub=0, *args, **kwargs):\n",
" n_dim = len(centre)\n",
" if n_dim == 3:\n",
" theta, phi = np.mgrid[0:2*np.pi:20j, 0:np.pi:10j]\n",
" x = rayon*np.cos(phi)*np.sin(theta) + centre[0]\n",
" y = rayon*np.sin(phi)*np.sin(theta) + centre[1]\n",
" z = rayon*np.cos(theta) + centre[2]\n",
" ax.plot_wireframe(x, y, z, color=\"r\")"
]
},
{
"cell_type": "code",
"execution_count": 107,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3\n"
]
}
],
"source": [
"#fig, ax = joli_graphe(n_dim=3)\n",
"#P, Q, R = np.eye(3)\n",
"#dessiner_plan([P,Q,R], ax=ax, sub=0)\n",
"#dessiner_plan([(0,0,0), (0,1,1), (1,1,0)], ax=ax, sub=0, c='red')\n",
"#dessiner_droite([[0,0,0],[1,1,0.1]], ax=ax, sub=0)\n",
"#dessiner_plan(mediatrice([0,0,0], [1,1,0.1]), ax=ax, sub=0, c='green')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Marqueurs légumes"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Marqueurs en forme de pomme de terre et d'oigons.\n",
"dessin_pdt = (np.array([[0,0,5,14,21,33,39,39,34,28,7,0],[0,6,12,12,14,14,5,0,-5, -7,-7,0]])- np.array([[29],[6]])).transpose()\n",
"dessin_pdt_v2 = np.array([[-6,-11,-16,-11,-1,4,-6,-16,-6,14,14,24,19,4,-6],[19,19,14,-1,-1,-6,-6,16,-30,-25,-8,-6,14,14,19]]).T\n",
"dessin_oignon = np.array([[-15,-35],[-40,-25],[-45,0],[-30,25],[-10,35],[-5,45],[-10,50],[-20,75],[-5,55],[0,95],[5,55],[25,85],[5,45],[10,35],[30,25],[45,0],[40,-25],[15,-35],[15,-40],[0,-45],[-15,-40],[-15,-35]])\n",
"\n",
"pomme_de_terre = matplotlib.path.Path(100*dessin_pdt)\n",
"oignon = matplotlib.path.Path(100*dessin_oignon)\n",
"\n",
"# Vous pouvez vous amuser à dessiner votre propre marqueur en définissant un vecteur de taille (N,2) \n",
"# dont la première colonne contient les X et la 2e contient les Y. Dans ce cas on peut centrer le marqueur en faisant:\n",
"# X = X - np.mean(X)\n",
"# Y = Y - np.mean(Y)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def annoter(axe, position, texte):\n",
" \"\"\"Annote un graphe avec du texte, que le graphe soit en 1D, 2D ou 3D. \"\"\"\n",
" n_dim = len(position)\n",
" if n_dim is 3: \n",
" axe.text(position[0], position[1], position[2], texte)\n",
" if n_dim is 2:\n",
" axe.annotate(texte, position)\n",
" if n_dim is 1: \n",
" axe.annotate(texte, [position[0],0])"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def xkcd_custom(scale=1, length=100, randomness=2, font='xkcd'):\n",
" \"\"\"\n",
" Implementation locale de matplotlib.pyplot.xkcd() pour éviter des\n",
" soucis de compatibilité et customiser la police plus librement.\n",
" \n",
" Les commentaires ci-dessous sont la doc officielle, non modifiée.\n",
" \n",
" ------------------------------------------------------------------\n",
" \n",
" Turns on `xkcd <http://xkcd.com/>`_ sketch-style drawing mode.\n",
" This will only have effect on things drawn after this function is\n",
" called.\n",
"\n",
" For best results, the \"Humor Sans\" font should be installed: it is\n",
" not included with matplotlib.\n",
"\n",
" Parameters\n",
" ----------\n",
" scale : float, optional\n",
" The amplitude of the wiggle perpendicular to the source line.\n",
" length : float, optional\n",
" The length of the wiggle along the line.\n",
" randomness : float, optional\n",
" The scale factor by which the length is shrunken or expanded.\n",
"\n",
" Notes\n",
" -----\n",
" This function works by a number of rcParams, so it will probably\n",
" override others you have set before.\n",
"\n",
" If you want the effects of this function to be temporary, it can\n",
" be used as a context manager, for example::\n",
"\n",
" with plt.xkcd():\n",
" # This figure will be in XKCD-style\n",
" fig1 = plt.figure()\n",
" # ...\n",
"\n",
" # This figure will be in regular style\n",
" fig2 = plt.figure()\n",
" \"\"\"\n",
" if rcParams['text.usetex']:\n",
" raise RuntimeError(\n",
" \"xkcd mode is not compatible with text.usetex = True\")\n",
" rcParams['font.family'] = [font, 'xkcd', 'Humor Sans', 'Comic Sans MS']\n",
" rcParams['font.size'] = 14.0\n",
" rcParams['path.sketch'] = (scale, length, randomness)\n",
" rcParams['path.effects'] = [patheffects.withStroke(linewidth=4, foreground=\"w\")]\n",
" rcParams['axes.linewidth'] = 1.5\n",
" rcParams['lines.linewidth'] = 2.0\n",
" rcParams['figure.facecolor'] = 'white'\n",
" rcParams['grid.linewidth'] = 0.50 # 0.0 dans la version originale\n",
" rcParams['axes.grid'] = True\n",
" rcParams['axes.unicode_minus'] = False\n",
" rcParams['axes.edgecolor'] = 'black'\n",
" rcParams['xtick.major.size' ] = 8.0 # 8 dans la version originale\n",
" rcParams['xtick.major.width'] = 1.5 # 3 dans la version originale\n",
" rcParams['ytick.major.size' ] = 8.0 # 8 dans la version originale\n",
" rcParams['ytick.major.width'] = 1.5 # 3 dans la version originale\n",
"\n",
"def xkcd_reverse(font='Century Gothic'):\n",
" \"\"\"Implémentation locale pour annuler l'effet de xkcd_custom()\n",
" et revenir aux paramètres d'affichage par défaut.\"\"\"\n",
" rcParams['font.family'] = [font]\n",
" rcParams['font.size'] = 14.0\n",
" rcParams['path.sketch'] = None\n",
" rcParams['path.effects'] = []\n",
" rcParams['axes.linewidth'] = 0.8\n",
" rcParams['lines.linewidth'] = 1.5\n",
" rcParams['figure.facecolor'] = (1, 1, 1, 0)\n",
" rcParams['grid.linewidth'] = 0.8\n",
" rcParams['axes.grid'] = False\n",
" rcParams['axes.unicode_minus'] = True\n",
" rcParams['axes.edgecolor'] = 'black'\n",
" rcParams['xtick.major.size'] = 3.5\n",
" rcParams['xtick.major.width'] = 0.8\n",
" rcParams['ytick.major.size'] = 3.5\n",
" rcParams['ytick.major.width'] = 0.8"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Tests\n",
"Les cellules ci-dessous ont été désactivées car elles sont seulement utilisées pour des tests."
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"################################################################################\n",
"#print(matplotlib.rcParams['ytick.major.width'])"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"#fig, ax = joli_graphe(n_dim=2)\n",
"#dessiner_points([0,0,3,3,0,0,3,3], [0,1,0,1,0,1,0,1], [0,0,0,0,1,1,1,1], a=ax, t=20)"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"#help(axe)"
]
},
{
"cell_type": "code",
"execution_count": 85,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"\n",
"#n_radii = 8\n",
"#n_angles = 36\n",
"\n",
"# Make radii and angles spaces (radius r=0 omitted to eliminate duplication).\n",
"#radii = np.linspace(0.125, 1.0, n_radii)\n",
"#angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)\n",
"\n",
"# Repeat all angles for each radius.\n",
"#angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)\n",
"\n",
"# Convert polar (radii, angles) coords to cartesian (x, y) coords.\n",
"# (0, 0) is manually added at this stage, so there will be no duplicate\n",
"# points in the (x, y) plane.\n",
"#x = np.append(0, (radii*np.cos(angles)).flatten())\n",
"#y = np.append(0, (radii*np.sin(angles)).flatten())\n",
"\n",
"# Compute z to make the pringle surface.\n",
"#z = np.sin(-x*y)\n",
"\n",
"#fig = plt.figure()\n",
"#ax = fig.gca(projection='3d')\n",
"\n",
"#ax.plot_trisurf(x, y, z, linewidth=0.2, antialiased=True)\n",
"\n",
"#plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"#axe = ax[0]\n",
"#axe.properties()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"#axe.properties()['proj']\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#class joliGraphe:\n",
"# \"\"\"Classe pour l'affichage de graphes en 1D/2D ou 3D avec un joli style.\"\"\"\n",
"# def dessiner_point(self, x, y=0, z=0, marqueur='o', couleur='r', taille=30, *arg_optionnels, **mots_clef_optionnels):\n",
"# if self.ndim ==3:\n",
"# self.ax.scatter(x,y,z,marker=marqueur,c=couleur,s=taille, *arg_optionnels, **mots_clef_optionnels)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
"autocomplete": true,
"bibliofile": "biblio.bib",
"cite_by": "apalike",
"current_citInitial": 1,
"eqLabelWithNumbers": true,
"eqNumInitial": 1,
"hotkeys": {
"equation": "Ctrl-E",
"itemize": "Ctrl-I"
},
"labels_anchors": false,
"latex_user_defs": false,
"report_style_numbering": false,
"user_envs_cfg": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment