Skip to content

Commit

Permalink
matplotlib 3.4 hotfix (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
kip-hart committed Aug 7, 2023
1 parent fc69959 commit 79b1423
Show file tree
Hide file tree
Showing 28 changed files with 130 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
Expand Down
34 changes: 22 additions & 12 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Setup Linux Environment
Expand All @@ -36,17 +37,26 @@ jobs:
if [ "${{ matrix.doc-type }}" = html ]; then echo "art_path=docs/build-html" >> $GITHUB_ENV; fi
if [ "${{ matrix.doc-type }}" = latex ]; then echo "art_path=docs/build-latex/MicroStructPy.pdf" >> $GITHUB_ENV; fi
if [ "${{ matrix.doc-type }}" = epub ]; then echo "art_path=docs/build-epub/MicroStructPy.epub" >> $GITHUB_ENV; fi
- name: Build PDF (latex only)
if: matrix.doc-type == 'latex'
run: |
# Update apt
sudo apt-get update
# Build PDF
if [ "${{ matrix.doc-type }}" = latex ]; then sudo apt install texlive-fonts-recommended; fi
if [ "${{ matrix.doc-type }}" = latex ]; then sudo apt install texlive-latex-recommended; fi
if [ "${{ matrix.doc-type }}" = latex ]; then sudo apt install texlive-lang-english; fi
if [ "${{ matrix.doc-type }}" = latex ]; then sudo apt install texlive-xetex; fi
if [ "${{ matrix.doc-type }}" = latex ]; then sudo apt install latexmk; fi
if [ "${{ matrix.doc-type }}" = latex ]; then cd docs/build-latex; fi
if [ "${{ matrix.doc-type }}" = latex ]; then make; fi
if [ "${{ matrix.doc-type }}" = latex ]; then cd -; fi
# Install LaTeX packages
# Recommended by Sphinx on their docs page:
# https://www.sphinx-doc.org/en/master/usage/builders/index.html#sphinx.builders.latex.LaTeXBuilder
sudo apt install texlive-latex-recommended
sudo apt install texlive-fonts-recommended
sudo apt install tex-gyre # (if latex_engine left to default)
sudo apt install texlive-latex-extra
sudo apt install latexmk
# Make
cd docs/build-latex
make
cd -
- name: Upload artifact
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ossar-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
# Checkout your code repository to scan
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/python_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -56,9 +56,9 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Cache pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
28 changes: 28 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

formats: all

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.8"
apt_packages:
- freeglut3-dev

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
15 changes: 0 additions & 15 deletions .readthedocs.yml

This file was deleted.

11 changes: 10 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog`_,
and this project adheres to `Semantic Versioning`_.

`1.5.7`_ - 2023-08-06
--------------------------
Fixed
'''''''
- Errors associated with using keyword arguments in ``plt.gca()`` deprecated in matplotlib 3.4.
- 3D plots now use matplotlib standard for setting equal aspect ratios.


`1.5.6`_ - 2022-09-01
--------------------------
Fixed
Expand Down Expand Up @@ -292,7 +300,8 @@ Added

.. LINKS
.. _`Unreleased`: https://github.com/kip-hart/MicroStructPy/compare/v1.5.6...HEAD
.. _`Unreleased`: https://github.com/kip-hart/MicroStructPy/compare/v1.5.7...HEAD
.. _`1.5.7`: https://github.com/kip-hart/MicroStructPy/compare/v1.5.6...v1.5.7
.. _`1.5.6`: https://github.com/kip-hart/MicroStructPy/compare/v1.5.5...v1.5.6
.. _`1.5.5`: https://github.com/kip-hart/MicroStructPy/compare/v1.5.4...v1.5.5
.. _`1.5.4`: https://github.com/kip-hart/MicroStructPy/compare/v1.5.3...v1.5.4
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include .bumpversion.cfg
include .coveragerc
include .editorconfig
include .pyup.yml
include .readthedocs.yml
include .readthedocs.yaml

include CHANGELOG.rst
include LICENSE.rst
Expand Down
6 changes: 3 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
gmsh==4.10.5
matplotlib==3.5.1
numpy==1.22.0
gmsh==4.11.1
matplotlib==3.7.2
numpy==1.24.4
pybind11==2.4.3
sphinx==4.2.0
sphinx-gallery==0.8.1
8 changes: 3 additions & 5 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@
import os
import sys
sys.path.insert(0, os.path.abspath('../../src/'))
sys.path.insert(0, os.path.abspath('../../src/MicroStructPy/'))

sys.path.insert(0, os.path.abspath('../../src/microstructpy/'))
import sphinx_gallery

import microstructpy


# -- Project information -----------------------------------------------------

project = 'MicroStructPy'
copyright = '2019-2022, Georgia Tech Research Corporation'
copyright = '2019-2023, Georgia Tech Research Corporation'
author = 'Kenneth Hart'

# The short X.Y version
Expand Down Expand Up @@ -138,7 +136,7 @@
'logo_name': True,
'sidebar_width': '230px',
'description': 'Microstructure modeling, mesh generation, analysis, and visualization.',
'analytics_id': 'UA-147258715-1',
'analytics_id': 'G-TK7PBETHC0',
'code_font_size': '12.5px',
}

Expand Down
5 changes: 3 additions & 2 deletions docs/source/sphinx_gallery/geometry/plot_ellipse.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def breakdown():
b = 1
x1 = 0.7

plt.figure(figsize=(14, 6))
fig = plt.figure(figsize=(14, 6))
ellipse = msp.geometry.Ellipse(a=a, b=b)
approx = ellipse.approximate(x1)
ellipse.plot(edgecolor='k', facecolor='none', lw=3)
Expand All @@ -34,8 +34,9 @@ def breakdown():
plt.gca().set_xticklabels([str(round(float(label), 1)) for label in xticks])
plt.axis('scaled')
plt.grid(True, linestyle=':')
plt.tight_layout()


if __name__ == '__main__':
plt.rc('savefig', dpi=300, bbox='tight', pad_inches=0)
plt.rc('savefig', dpi=300, pad_inches=0)
main()
5 changes: 3 additions & 2 deletions docs/source/sphinx_gallery/geometry/plot_rectangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def breakdown(length, width, x1, figsize):
approx = r.approximate(x1=x1)

# Plot rectangle
plt.figure(figsize=figsize)
fig = plt.figure(figsize=figsize)
r.plot(edgecolor='k', facecolor='none', lw=3)

# Plot breakdown
Expand All @@ -38,8 +38,9 @@ def breakdown(length, width, x1, figsize):

plt.axis('scaled')
plt.grid(True, linestyle=':')
plt.tight_layout()


if __name__ == '__main__':
plt.rc('savefig', dpi=300, bbox='tight', pad_inches=0)
plt.rc('savefig', dpi=300, pad_inches=0)
main()
6 changes: 4 additions & 2 deletions docs/source/sphinx_gallery/plot_demos.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def create_welcome():

sub_fname = 'welcome_examples.png'
sub_filename = os.path.join(example_dir, sub_fname)
plt.savefig(sub_filename, pad_inches=0, bbox_inches='tight', dpi=200)
plt.tight_layout()
plt.savefig(sub_filename, pad_inches=0, dpi=200)
plt.close('all')


Expand All @@ -92,7 +93,8 @@ def seed_poly_tri(filepath):

sub_fname = 'joined.png'
sub_filename = os.path.join(ex_path, sub_fname)
plt.savefig(sub_filename, pad_inches=0, bbox_inches='tight', dpi=300)
plt.tight_layout()
plt.savefig(sub_filename, pad_inches=0, dpi=300)
plt.close('all')


Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
aabbtree==2.5.0
matplotlib==3.5.3
matplotlib==3.7.2
pybind11==2.4.3
pygmsh==7.0.2
pygmsh==7.1.17
MeshPy==2018.2.1
numpy==1.23.2
numpy==1.24.4
pyquaternion==0.9.5
pyvoro-mmalahe==1.3.3
scipy==1.9.1
scipy==1.10.1
xmltodict==0.12.0
tox==3.14.0
lsq-ellipse==2.0.1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def find_version(*fname):
'aabbtree>=2.5.0',
'pybind11', # must come before meshpy for successful install
'lsq-ellipse',
'matplotlib>=3.3.0',
'matplotlib>=3.4.0',
'meshpy>=2018.2.1',
'numpy>=1.13.0',
'pygmsh>=7.0.2',
Expand Down
2 changes: 1 addition & 1 deletion src/microstructpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
import microstructpy.seeding
import microstructpy.verification

__version__ = '1.5.6'
__version__ = '1.5.7'
9 changes: 1 addition & 8 deletions src/microstructpy/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,7 @@ def tangent_sphere(points, radii=None, simplices=None):


def axisEqual3D(ax):
'''From stackoverflow: https://stackoverflow.com/a/19248731'''
extents = np.array([getattr(ax, 'get_{}lim'.format(d))() for d in 'xyz'])
sz = extents[:, 1] - extents[:, 0]
centers = np.mean(extents, axis=1)
maxsize = max(abs(sz))
r = maxsize/2
for ctr, dim in zip(centers, 'xyz'):
getattr(ax, 'set_{}lim'.format(dim))(ctr - r, ctr + r)
ax.set_aspect('equal')


def ax_objects(ax):
Expand Down
Loading

0 comments on commit 79b1423

Please sign in to comment.