Skip to content

Instantly share code, notes, and snippets.

@abhi18av
Created July 17, 2015 12:27
Show Gist options
  • Save abhi18av/0ea8d081a2748066dc4c to your computer and use it in GitHub Desktop.
Save abhi18av/0ea8d081a2748066dc4c to your computer and use it in GitHub Desktop.
The Learning Curve
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 15 22:13:03 2015
@author: abhinav
"""
import matplotlib.pyplot as plt
import numpy as np
with plt.xkcd():
# This initializes the grid
fig = plt.figure()
# This is the position of the grid in the screen
ax = fig.add_axes((0.3, 0.3, 0.5, 0.5))
# This portion takes care of the colors ofthe Grid Boundary
ax.spines['right'].set_color('blue')
ax.spines['left'].set_color('darkred')
ax.spines['bottom'].set_color('green')
ax.spines['top'].set_color('purple')
# The ticks for the axes
plt.xticks([])
plt.yticks([])
# This sets the limits for the grid
ax.set_ylim([0, 50])
ax.set_xlim([0,100])
# This is the arrow which is used to point-out imp. stuff
# x = np.linspace(0,1)
# y = np.sin(4*np.pi*x)
# plt.plot(x,y,'r')
# x = np.linspace(0,100)
# plt.plot( np.log(x), 'r')
# y = np.linspace(-3*np.pi, 3*np.pi)
# plt.plot(np.sin(y))
#
#
# z = np.linspace(20,40)
# plt.plot(np.sqrt(z))
# y = np.linspace(-3*np.pi, 2*np.pi)
# x = np.linspace(2*np.pi,20)
# plt.plot(np.sqrt(x))
# plt.plot(np.sin(y))
# arr1 = np.arange(0,8,0.5)
# arr2 = np.arange(8,14, 0.2)
# arr3 = np.arange(14,20,0.09)
# data_points = np.append(arr1, arr2)
# plt.plot(data_points, linestyle = ':')
arr1 = np.arange(0,8,0.9)
arr2 = np.arange(8,14, 0.4)
arr3 = np.arange(14,20,0.09)
arr4 = np.arange(20, 80, 0.005)
data_points_1 = np.append(arr1, arr2)
data_points_2 = np.append(data_points_1, arr3)
data_points_3 = np.append(data_points_2, arr4)
plt.plot(data_points_3, linestyle = '--', color = "skyblue")
# plt.plot(np.append(np.append(arr1, arr2) + np.append(arr2, arr3))
# plt.plot(np.append(arr1, arr2)) + plt.plot(np.append(arr2, arr3))
ax.plot([8],[9],"ro")
plt.annotate(
'THE STEEP CURVE ENDS\n RIGHT HERE',
xy=(7, 9), arrowprops=dict(arrowstyle='->'),
xytext=(15, 30))
ax.plot([26],[15],"ro")
plt.annotate(
'NOW IT STARTS TO FLATTEN',
xy=(26, 15), arrowprops=dict(arrowstyle='->'),
xytext=(15, -15))
plt.annotate(
'THE LONG ROAD TO PERFECTION',
xy=(50, 25),
xytext=(50, 13))
# These are the labels which are to be placed along the axes
plt.xlabel('Time')
plt.ylabel('The amount of learning')
# This is the Subscript banner
fig.text(
0.5, 0.05,
'THE LEARNING CURVE',
ha='center')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment