I have encountered some weird shifting of the filled area when using the plt.fill_between()
from pythons matplotlib.pyplot
.
The following is my code:
#!/usr/bin/env python3
from matplotlib import pyplot as plt
import numpy as np
perf_range = np.linspace(0, 17, 17)
print(perf_range)
hsm_low = [22000 for i in perf_range]
hsm_high = [35000 for i in perf_range]
system_base_price = 3000
system_low = 2 * system_base_price * perf_range
system_high = 0.5 * system_base_price * perf_range
ax = plt.gca()
ax.set_xscale('log')
plt.plot(hsm_low)
plt.plot(hsm_high)
plt.plot(system_low)
plt.plot(system_high)
plt.fill_between(perf_range, system_low, system_high, color='green', alpha=0.5)
plt.show()
and I get the following plot:
First of all, as you can see, the green area is kind of shifted and does not really match the green and read line. Furthermore, I would like the green area be between the green, red and blue line. Any help?