We're updating the default styles for Matplotlib 2.0

Learn what to expect in the new updates


Previous topic

pylab_examples example code: stix_fonts_demo.py

Next topic

pylab_examples example code: subplot_demo.py

This Page

pylab_examples example code: stock_demo.pyΒΆ

(Source code, png, hires.png, pdf)

import matplotlib.pyplot as plt
import numpy as np

from matplotlib.ticker import MultipleLocator
from data_helper import get_two_stock_data

d1, p1, d2, p2 = get_two_stock_data()

fig, ax = plt.subplots()
lines = plt.plot(d1, p1, 'bs', d2, p2, 'go')
plt.ylabel('Normalized price')
plt.xlim(0, 3)

plt.title('INTC vs AAPL')
plt.legend(('INTC', 'AAPL'))


Keywords: python, matplotlib, pylab, example, codex (see Search examples)