Skip to content

Instantly share code, notes, and snippets.

@Opiprog
Created May 2, 2013 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Opiprog/5502158 to your computer and use it in GitHub Desktop.
Save Opiprog/5502158 to your computer and use it in GitHub Desktop.
Ipython-Matplotlib-Pylab 2D Two-line graph
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import *
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import matplotlib.pyplot as plt
import numpy as np
import sys
from pylab import *
rcParams['legend.loc'] = 'best'
ae = 10
be = 4
pe = 101
ne = 0.5
xe = linspace(0,10)
ye = linspace(0,4)
ge1 = p * (1-((xe/ae)**2)-((0/be)**2))**0.5
ge2 = p * (1-((0/ae)**2)-((ye/be)**2))**0.5
fig = plt.figure()
axe = fig.add_subplot(111)
plot(xe,ge1, label='major axis')
plot(ye,ge2, label='minor axis')
legend()
font = {'fontname':'Times New Roman}','fontsize':'16'}
axe.set_xlabel('Distance from centre of contact (mm)', **font)
axe.set_ylabel('Contact Pressure (MPa)', **font)
axe.grid(True)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment