Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f3585ef + e27da80 commit 4b77763Copy full SHA for 4b77763
lib/matplotlib/tests/test_datetime.py
@@ -134,11 +134,26 @@ def test_axvspan(self):
134
ax3.set_xlabel('Date')
135
ax3.set_ylabel('Date')
136
137
- @pytest.mark.xfail(reason="Test for bar not written yet")
138
@mpl.style.context("default")
139
def test_bar(self):
140
- fig, ax = plt.subplots()
141
- ax.bar(...)
+ mpl.rcParams["date.converter"] = "concise"
+
+ fig, (ax1, ax2) = plt.subplots(2, 1, layout="constrained")
142
143
+ x_dates = np.array(
144
+ [
145
+ datetime.datetime(2020, 6, 30),
146
+ datetime.datetime(2020, 7, 22),
147
+ datetime.datetime(2020, 8, 3),
148
+ datetime.datetime(2020, 9, 14),
149
+ ],
150
+ dtype=np.datetime64,
151
+ )
152
+ x_ranges = [8800, 2600, 8500, 7400]
153
154
+ x = np.datetime64(datetime.datetime(2020, 6, 1))
155
+ ax1.bar(x_dates, x_ranges, width=np.timedelta64(4, "D"))
156
+ ax2.bar(np.arange(4), x_dates - x, bottom=x)
157
158
@pytest.mark.xfail(reason="Test for bar_label not written yet")
159
0 commit comments