Reputation: 69
I'm making a simple plot of an exponentially decaying cos curve in python. The code is below, there's no problem with the code actually running, I was just wondering if there's a way to change the way python displays the graph so rather than being enclosed by the axes like this it has the axes like this. It's not an urgent problem, it's just to make the plot match more closely with other parts of my report.
import matplotlib as mpl
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
t = np.linspace(0, 4, 10000)
r=1
x = t
y = r * np.exp(-t)*np.cos(10*t)
plt.plot(x,y,'-')
plt.plot(x,np.zeros(10000),'k-')
plt.show()
Upvotes: 3
Views: 1481
Reputation: 2318
Take a look at the Axis line style demo from the matplotlib gallery.
Specifically, the lines:
ax = SubplotZero(fig, 111)
...
for direction in ["left", "right", "bottom", "top"]:
ax.axis[direction].set_visible(False)
Upvotes: 2