Skip to content

Commit

Permalink
Remove images2gif and use PIL instead
Browse files Browse the repository at this point in the history
  • Loading branch information
dhadka committed Sep 5, 2024
1 parent 25f7d10 commit 5033d4d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Rhodium has several optional dependencies that enable additional graphical and a
2. `pip install pywin32` - Required to connect to Excel models (`ExcelModel`)
3. `pip install openmdao` - Required to connect to OpenMDAO models (`OpenMDAOModel`)
4. `pip install pyper` - Required to connect to R models (`RModel`)
4. `pip install images2gif` - Required to produce 3D animated GIFs (`animate3d`)
5. [J3Py](https://github.com/Project-Platypus/J3Py) - Interactive 3D visualizations

## Resources
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dynamic = ["version"] # Version is read from rhodium/__init__.py
[project.optional-dependencies]
test = ["pytest", "mock", "rhodium[examples]"]
openmdao = ["openmdao"]
examples = ["pandas[excel]", "images2gif", "pyper<=1.1.2"]
examples = ["pandas[excel]", "pyper<=1.1.2"]

[tool.setuptools.dynamic]
version = {attr = "rhodium.__version__"}
Expand Down
7 changes: 3 additions & 4 deletions rhodium/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@ def animate3d(prefix, dir="images/", steps=36, transform=(10, 0, 0), **kwargs):
import math
import inspect
from PIL import Image
from images2gif import writeGif

base_dir = os.path.join(dir, prefix)

Expand All @@ -690,15 +689,15 @@ def animate3d(prefix, dir="images/", steps=36, transform=(10, 0, 0), **kwargs):
else:
ax.azim += transform[0]
ax.elev += transform[1]
ax.dist += transform[2]
# ax.dist += transform[2] # This is deprecated, use ax.set_box_aspect(None, zoom=2) instead

filename = os.path.join(base_dir, 'img' + str(n).zfill(digits) + '.png')
plt.savefig(filename, bbox_inches='tight')
files.append(filename)

images = [Image.open(file) for file in files]
file_path_name = os.path.join(dir, prefix + '.gif')
writeGif(file_path_name, images, **kwargs)
images[0].save(file_path_name, save_all=True, append_images=images[1:], **kwargs)

def parallel_coordinates(model, data, c=None, cols=None, ax=None, colors=None,
use_columns=False, xticks=None, colormap=None,
Expand Down

0 comments on commit 5033d4d

Please sign in to comment.