Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2051814

Browse files
committed
FIX: make the warning a logging.info
1 parent f39b81c commit 2051814

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):
@@ -210,10 +214,10 @@ def update(self, data):
210214
self._mapping[val] = next(self._counter)
211215
# check if we can convert all strings to number or date...
212216
if self._strs_are_convertible(data):
213-
cbook._warn_external('using category units to plot a list of '
214-
'strings that is a;; floats or parsable as dates. '
215-
'If you do not mean these to be categories, cast '
216-
'to the approriate data type before plotting.')
217+
_log.info('using category units to plot a list of '
218+
'strings that is a;; floats or parsable as dates. '
219+
'If you do not mean these to be categories, cast '
220+
'to the approriate data type before plotting.')
217221

218222

219223
# Connects the convertor to matplotlib

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)