Reputation: 98
My code makes two plots, but I want plot only for Eobl. E must have only points and error bars without line connecting points. How can I do this?
import numpy as np
import pylab as plt
fig = plt.figure()
ax = plt.axes(polar=True)
E = np.array([3.21,3.03,2.69,2.13,1.58,0.98,0.52,0.14,0.03,0.00,0.20,0.63,1.25,2.00,2.60,2.98,3.27,3.32,3.29,3.03,2.71,2.15,1.58,
0.98,0.58,0.12,0.01,0.00,0.15,0.58,1.13,1.78,2.47,2.92,3.17,3.29])
Eobl = np.array([3.25,3.15,2.87,2.44,1.91,1.34,0.81,0.38,0.10,0.00,0.10,0.38,0.81,1.34,1.91,2.44,2.87,3.15,3.25,3.15,2.87,2.44,1.91,
1.34,0.81,0.38,0.10,0.00,0.10,0.38,0.81,1.34,1.91,2.44,2.87,3.15])
theta = 2*np.pi/360 * np.array(list(range(90, 450, 10)))
ax.plot(theta, E, "ro", color = '#000000')
ax.errorbar(theta, E, yerr=0.09, xerr=0.023, capsize=0, color = '#0000ff')
ax.plot(theta, Eobl, "ro")
ax.errorbar(theta, Eobl, color = '#ff0000')
plt.show()
Upvotes: 1
Views: 1387
Reputation: 18657
The fmt
argument controls the format of the line connecting points. you can disable it using the argument 'none'
, i.e.
ax.errorbar(... fmt='none')
So, for your case:
ax.errorbar(theta, E, yerr=0.09, xerr=0.023, capsize=0, color='#0000ff', fmt='none')
Upvotes: 1