<jupyter_start><jupyter_text>[<NAME>](http://www.sebastianraschka.com)[back](https://github.com/rasbt/matplotlib-gallery) to the `matplotlib-gallery` at [https://github.com/rasbt/matplotlib-gallery](https://github.com/rasbt/matplotlib-gallery)<jupyter_code>%load_ext watermark
%watermark -u -v -d -p matplotlib,numpy<jupyter_output>Last updated: 16/08/2014 

CPython 3.4.1
IPython 2.0.0

matplotlib 1.3.1
numpy 1.8.2<jupyter_text>[More info](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/ipython_magic/watermark.ipynb) about the `%watermark` extension<jupyter_code>%matplotlib inline<jupyter_output><empty_output><jupyter_text>Special plots in matplotlib  Sections - [Basic pie chart](Basic-pie-chart)- [Basic triangulation](Basic-triangulation)- [xkcd-style plots](xkcd-style-plots)   Basic pie chart [[back to top](Sections)]<jupyter_code>from matplotlib import pyplot as plt
import numpy as np

plt.pie(
    (10,5),
    labels=('spam','ham'),
    shadow=True,
    colors=('yellowgreen', 'lightskyblue'),
    explode=(0,0.15), # space between slices 
    startangle=90,    # rotate conter-clockwise by 90 degrees
    autopct='%1.1f%%',# display fraction as percentage
    )
plt.legend(fancybox=True)
plt.axis('equal')     # plot pyplot as circle
plt.tight_layout()
plt.show()<jupyter_output><empty_output><jupyter_text>Basic triangulation [[back to top](Sections)]<jupyter_code>from matplotlib import pyplot as plt
import matplotlib.tri as tri
import numpy as np

rand_data = np.random.randn(50, 2)

triangulation = tri.Triangulation(rand_data[:,0], rand_data[:,1])

plt.triplot(triangulation)

plt.show()<jupyter_output><empty_output><jupyter_text>xkcd-style plots [[back to top](Sections)]<jupyter_code>import matplotlib.pyplot as plt

x = [1, 2, 3]

y_1 = [50, 60, 70]
y_2 = [20, 30, 40]

with plt.xkcd():

    plt.plot(x, y_1, marker='x')
    plt.plot(x, y_2, marker='^')

    plt.xlim([0, len(x)+1])
    plt.ylim([0, max(y_1+y_2) + 10])
    plt.xlabel('x-axis label')
    plt.ylabel('y-axis label')
    plt.title('Simple line plot')
    plt.legend(['sample 1', 'sample2'], loc='upper left')

    plt.show()
import numpy as np
import random
from matplotlib import pyplot as plt

data = np.random.normal(0, 20, 1000) 
bins = np.arange(-100, 100, 5) # fixed bin size

with plt.xkcd():
    plt.xlim([min(data)-5, max(data)+5])

    plt.hist(data, bins=bins, alpha=0.5)
    plt.title('Random Gaussian data (fixed bin size)')
    plt.xlabel('variable X (bin size = 5)')
    plt.ylabel('count')

    plt.show()
from matplotlib import pyplot as plt
import numpy as np

with plt.xkcd():
    X = np.random.random_integers(1,5,5) # 5 random integers within 1-5
    cols = ['b', 'g', 'r', 'y', 'm']
    plt.pie(X, colors=cols)
    plt.legend(X)

    plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15806336774652902, 'fraction_numerical': 0.032395870416518334, 'mean_word_length': 4.6882591093117405, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '532308', 'license': 'MIT', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1085, 'n_words': 226, 'path': 'Unit02/extension_studies/Matplotlib_gallery/ipynb/specialplots.ipynb', 'repo_name': 'appletime81/IMLP', 'size': '2820'}