Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility with latest matplotlib and py3.8 #380

Merged
merged 11 commits into from
Jun 10, 2020
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ matrix:
include:
- os: linux
env: PYENV=py37
# Observed on 9-Jun-20, timeout due to environment conflict
# - os: linux
# env: PYENV=py38
- os: osx
env: PYENV=py37
# Observed on 9-Jun-20, timeout due to environment conflict
# - os: osx
# env: PYENV=py38
# Observed on 10-Feb-19, choclatey builds for miniconda3 break
# see: https://github.com/conda/conda/issues/6064
# It is not clear how/when this can be fixed, so turn this back off for now
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ regenerate-test-figures: $(VENV_DIR) ## re-generate all test figures

.PHONY: test
test: $(VENV_DIR) ## run all the tests
cd tests; $(VENV_DIR)/bin/pytest --cov=pyam --cov-config ../ci/.coveragerc -rfsxEX --cov-report term-missing

.PHONY: test-with-mpl
test-with-mpl: $(VENV_DIR) ## run all the tests including matplotlib
cd tests; $(VENV_DIR)/bin/pytest --mpl --cov=pyam --cov-config ../ci/.coveragerc -rfsxEX --cov-report term-missing

.PHONY: install
Expand Down
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Next Release

- [#380](https://github.com/IAMconsortium/pyam/pull/380) Add compatibility with latest matplotlib and py3.8

# Release v0.6.0

## Highlights
Expand Down
5 changes: 4 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ environment:
- PYTHON_VERSION: "3.7"
MINICONDA: "C:\\Miniconda37-x64"
PYTHON_ARCH: "64"
- PYTHON_VERSION: "3.8"
MINICONDA: "C:\\Miniconda38-x64"
PYTHON_ARCH: "64"

init:
- "ECHO %PYTHON_VERSION% %MINICONDA%"
Expand All @@ -22,7 +25,7 @@ install:
- conda --version
- activate testing
- conda install -y numpy pandas pyyaml seaborn==0.9.0 six requests jupyter nbconvert proj4==5.2.0 pywin32
- conda install -y -c conda-forge matplotlib==3.0.2 pyproj==1.9.6
- conda install -y -c conda-forge matplotlib pyproj==1.9.6

build: false

Expand Down
2 changes: 2 additions & 0 deletions ci/environment-conda-default.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ six
requests
jupyter
nbconvert
matplotlib
matplotlib-base
3 changes: 0 additions & 3 deletions ci/environment-conda-forge.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
freetype=2.9.1
matplotlib==3.0.2
matplotlib-base==3.0.3
seaborn==0.9.0
gdal
fiona
Expand Down
2 changes: 1 addition & 1 deletion doc/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies:
- pip
- pip:
- ipython==7.2.0
- matplotlib==3.0.2
- matplotlib
- seaborn==0.9.0
- cloud_sptheme
- sphinx==1.8.2
Expand Down
5 changes: 3 additions & 2 deletions pyam/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,11 +598,12 @@ def scatter(df, x, y, ax=None, legend=None, title=None,
else:
legend_data.append(' '.join(name))
kwargs.update(pargs)
label = ' '.join(group[g].iloc[0] for g in groupby)
if with_lines:
ax.plot(group[x], group[y], **kwargs)
ax.plot(group[x], group[y], label=label, **kwargs)
else:
kwargs.pop('linestyle') # scatter() can't take a linestyle
ax.scatter(group[x], group[y], **kwargs)
ax.scatter(group[x], group[y], label=label, **kwargs)

# build legend handles and labels
handles, labels = ax.get_legend_handles_labels()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'pandas>=0.25.0',
'pint',
'PyYAML',
'matplotlib<=3.0.2',
'matplotlib',
'seaborn',
'six',
]
Expand Down
Binary file modified tests/expected_figs/test_add_panel_label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_bar_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_bar_plot_h.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_bar_plot_rc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_bar_plot_stacked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_bar_plot_stacked_net_line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_bar_plot_title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_PYAM_COLORS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_color_fill_between.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_color_fill_between_interpolate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_color_final_ranges.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_filter_title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_linestyle_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_marker_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_no_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_plot_1_var.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_plot_2_vars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_plot_bottom_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_plot_cmap_color_arg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_plot_dict_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_rm_legend_label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_single_color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_line_update_rc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/expected_figs/test_pie_plot_labels.png
Binary file modified tests/expected_figs/test_pie_plot_legend.png
Binary file modified tests/expected_figs/test_pie_plot_other.png
Binary file modified tests/expected_figs/test_scatter.png
Binary file modified tests/expected_figs/test_scatter_meta.png
Binary file modified tests/expected_figs/test_scatter_variables_with_meta_color.png
Binary file modified tests/expected_figs/test_scatter_with_lines.png
Binary file modified tests/expected_figs/test_stack_plot.png
Binary file modified tests/expected_figs/test_stack_plot_missing_zero_issue_266.png
Binary file modified tests/expected_figs/test_stack_plot_negative_emissions.png
Binary file modified tests/expected_figs/test_stack_plot_other.png
12 changes: 1 addition & 11 deletions tests/test_plotting.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import matplotlib
import pytest
import os
import copy
Expand All @@ -14,17 +13,8 @@
from pyam import plotting, run_control, reset_rc_defaults
from conftest import IMAGE_BASELINE_DIR

logger = logging.getLogger(__name__)

# on CI, freetype version 2.6.1 works, but 2.8.0 does not
# if we want to move to 2.8.0, then we will need to regenerate images
FREETYPE_VERSION = matplotlib.ft2font.__freetype_version__
if int(FREETYPE_VERSION.replace('.', '')) < 291:
msg = 'Freetype version < 2.9.1: {}'.format(FREETYPE_VERSION)
logger.warning('test_plotting.py is being skipped due to a '
'Freetype Version mismatch: {}'.format(msg))
pytest.skip(msg, allow_module_level=True)

logger = logging.getLogger(__name__)

IS_WINDOWS = os.name == 'nt'
TOLERANCE = 6 if IS_WINDOWS else 2
Expand Down