pandas tests fail when matplotlib is headless
#### Reproduce

Run pandas in a Windows Subsystem Linux and have matplotlib installed.

#### Problem description

Several tests fail with `_tkinter.TclError: no display name and no $DISPLAY environment variable`. Sometimes try/catch blocks are nested in a way that (most likely for the same reason) variables are not declared etc.

#### Expected Output

Skip matplotlib tests or set up a functioning backend when issues with its setup are detected.

#### Output of ``pd.show_versions()``

<details>

INSTALLED VERSIONS
------------------
commit: 8a2176ddb52a8e0ada623d06329f77ad468c7c9b
python: 3.6.3.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-43-Microsoft
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.22.0.dev0+292.g8a2176d
pytest: 3.2.5
pip: 9.0.1
setuptools: 36.7.2
Cython: 0.27.3
numpy: 1.13.3
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 6.2.1
sphinx: 1.6.5
patsy: None
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: None
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.1.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999999999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

</details>
