8000 FIX: make the warning a logging.info · matplotlib/matplotlib@5c4c41d · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c4c41d

Browse files
committed
FIX: make the warning a logging.info
1 parent 6bad665 commit 5c4c41d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lib/matplotlib/category.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from collections import OrderedDict
1515
import dateutil.parser
1616
import itertools
17+
import logging
1718

1819
import numpy as np
1920

@@ -22,6 +23,9 @@
2223
import matplotlib.ticker as ticker
2324

2425

26+
_log = logging.getLogger(__name__)
27+
28+
2529
class StrCategoryConverter(units.ConversionInterface):
2630
@staticmethod
2731
def convert(value, unit, axis):
@@ -216,10 +220,10 @@ def update(self, data):
216220
self._mapping[val] = next(self._counter)
217221
# check if we can convert all strings to number or date...
218222
if self._strs_are_convertible(data):
219-
cbook._warn_external('using category units to plot a list of '
220-
'strings that is a;; floats or parsable as dates. '
221-
'If you do not mean these to be categories, cast '
222-
'to the approriate data type before plotting.')
223+
_log.info('using category units to plot a list of '
224+
'strings that is a;; floats or parsable as dates. '
225+
'If you do not mean these to be categories, cast '
226+
'to the approriate data type before plotting.')
223227

224228

225229
# Register the converter with Matplotlib's unit framework

lib/matplotlib/tests/test_category.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ class TestPlotNumlike(object):
203203
@pytest.mark.parametrize("ndata", numlike_data, ids=numlike_ids)
204204
def test_plot_numlike(self, ax, plotter, ndata):
205205
counts = np.array([4, 6, 5])
206-
with pytest.warns(UserWarning, match='using category units to plot'):
207-
plotter(ax, ndata, counts)
206+
plotter(ax, ndata, counts)
208207
axis_test(ax.xaxis, ndata)
209208

210209

@@ -262,14 +261,12 @@ def test_update_plot(self, ax, plotter):
262261

263262
PLOT_BROKEN_IDS = ["scatter", "plot", "bar"]
264263

265-
@pytest.mark.filterwarnings('ignore::UserWarning')
266264
@pytest.mark.parametrize("plotter", PLOT_BROKEN_LIST, ids=PLOT_BROKEN_IDS)
267265
@pytest.mark.parametrize("xdata", fvalues, ids=fids)
268266
def test_mixed_type_exception(self, ax, plotter, xdata):
269267
with pytest.raises(TypeError):
270268
plotter(ax, xdata, [1, 2])
271269

272-
@pytest.mark.filterwarnings('ignore::UserWarning')
273270
@pytest.mark.parametrize("plotter", PLOT_BROKEN_LIST, ids=PLOT_BROKEN_IDS)
274271
@pytest.mark.parametrize("xdata", fvalues, ids=fids)
275272
def test_mixed_type_update_exception(self, ax, plotter, xdata):

0 commit comments

Comments
 (0)
0