#+OPTIONS: ':nil *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline author:t c:nil
#+OPTIONS: creator:nil d:(not "LOGBOOK") date:t e:t email:nil f:t inline:t
#+OPTIONS: num:nil p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t timestamp:t
#+OPTIONS: title:t toc:nil todo:t |:t
#+TITLE: Julien Chastang
#+DATE: <2016-12-06 Tue>
#+AUTHOR: Julien Chastang
#+EMAIL: julien dot c dot chastang at gmail
#+LANGUAGE: en
#+SELECT_TAGS: export
#+EXCLUDE_TAGS: noexport
#+CREATOR: Emacs 25.1.2 (Org mode 8.3.6)

#+SETUPFILE: ../templates/level-0.org
#+INCLUDE: ../templates/level-0.org

#+BEGIN_SRC emacs-lisp :results silent :exports none
  (setq org-confirm-babel-evaluate nil)
  (setq org-export-babel-evaluate nil)
#+END_SRC

#+BEGIN_SRC ipython :session :exports results :file ../static/shell.png 
  import matplotlib.pyplot as plt
  import numpy as np
  import matplotlib.patches as mpatches
  from matplotlib.collections import PatchCollection

  plt.rcdefaults()


  def fib(n):
      if n < 2:
          return n
      else:
          return fib(n - 1) + fib(n - 2)


  def label(xy, text, j):
      y = xy[1] - 0.025  # shift y-value to center label
      plt.text(xy[0], y, text, ha="center", family='sans-serif', size=j)


  fig, ax = plt.subplots()
  patches = []

  xy = np.array([0, 0])
  c = xy
  i = 1
  t = np.array([270, 0])

  for j in range(1, 7 + 4):
      t += 90
      if i == 5:
          i = 1
      if i == 1:
          xy = xy + [-fib(j - 2), fib(j - 1)]
          c = c + [-fib(j - 2), 0]
      if i == 2:
          xy = xy + [-fib(j), -fib(j - 2)]
          c = c + [0, -fib(j - 2)]
      elif i == 3:
          xy = xy + [0, -fib(j)]
          c = c + [fib(j - 2), 0]
      elif i == 4:
          xy = xy + [fib(j - 1), 0]
          c = c + [0, fib(j - 2)]
      # Add a wedge
      rect = mpatches.Wedge([c[0], c[1]], fib(j), t[0], t[1], ec="none")
      patches.append(rect)
      # Add a rectangle
      rect = mpatches.Rectangle([xy[0], xy[1]], fib(j), fib(j), ec="none")
      patches.append(rect)
      i += 1
      label(xy + [0.5 * fib(j), 0.5 * fib(j)], "%s" % fib(j), j * 2)


  colors = np.linspace(0, 1, len(patches))
  collection = PatchCollection(patches, cmap=plt.cm.hsv, alpha=0.3)
  collection.set_array(np.array(colors))
  ax.add_collection(collection)

  plt.axis('equal')
  plt.axis('off')
  plt.grid('off')
  plt.show()
#+END_SRC

#+RESULTS:
file:../static/shell.png
 
* Notes

 ** <2017-03-01 Wed> Plotting Time Series of Weather Observations in Emacs
 
 
** <2017-02-01 Wed> Exploring GOES 13 Satellite Data with Python and Emacs
 
 
** <2016-12-12 Mon> Running Emacs in Docker

 
** <2016-12-08 Thu> This Web Site