I have a simple bar chart with a line chart over it.
import numpy as np
import matplotlib.pyplot as plt
x = np.array(["one", "two", "three", "four"])
a = np.array([1, 2, 3, 4])
b = np.array([2, 4, 3, 1])
fig, ax1 = plt.subplots()
ax2 = ax1.twinx()
ax1.bar(x, a, color="g")
ax2.plot(x, b, color="r")
# Problem is here.
ax1.set_xticklabels(x, rotation="vertical", size=12)
plt.show()
When I run it, it works fine. But I get this warning:
"""
<ipython-input-65-9b40369b760b>:15: UserWarning: FixedFormatter should only be used together with
FixedLocator
ax1.set_xticklabels(x, rotation="vertical", size=12)
"""
All I need to know is how to avoid this warning.