Skip to main content

A Python package to visualize and analyze microstructures.

Project description

PolyLX - python package to visualize and analyze digitized 2D microstructures

PyPI version Testing Documentation Status DOI



To install PolyLX, just execute

pip install polylx

Alternatively, you download the package manually from the Python Package Index, unzip it, navigate into the package, and use the command:

python install

Upgrading via pip

To upgrade an existing version of PolyLX from PyPI, execute

pip install polylx --upgrade --no-deps

Please note that the dependencies (Matplotlib, NumPy, Pandas, NetworkX, seaborn, shapely, pyshp and SciPy) will also be upgraded if you omit the --no-deps flag; use the --no-deps ("no dependencies") flag if you don't want this.

Installing PolyLX from the source distribution

In rare cases, users reported problems on certain systems with the default pip installation command, which installs PolyLX from the binary distribution ("wheels") on PyPI. If you should encounter similar problems, you could try to install PolyLX from the source distribution instead via

pip install --no-binary :all: polylx

Also, I would appreciate it if you could report any issues that occur when using pip install polylx in hope that we can fix these in future releases.

Master version

The PolyLX version on PyPI may always one step behind; you can install the latest development version from the GitHub repository by executing

pip install git+git://

Or, you can fork the GitHub repository from and install PolyLX from your local drive via

python install

Getting started

Documentation is in progress, but you can see PolyLX in action in accompanied Jupyter notebook


Explore the full features of PolyLX. You can find detailed documentation here.


Most discussion happens on Github. Feel free to open an issue or comment on any open issue or pull request. Check for more details.


PolyLX is free software: you can redistribute it and/or modify it under the terms of the MIT License. A copy of this license is provided in LICENSE file.


0.5.1 (27 May 2021)

  • fourier_ellipse shape method for Grains added
  • eliptic fourier smoothing for Grains added
  • added grainsize plot
  • added accumulate method to Grains and Boundaries
  • simple fiona reader implemented (fiona must be installed)
  • added kde plot

0.5 (29 Jan 2019)

  • rose plot groupped according to classification
  • get_class, class_iter methods added to Grains and Boundaries
  • seaborn added to requirements
  • several seaborn categorical plots are added as methods (swarmplot, boxplot, barplot, countplot)

0.4.9 (12 Dec 2017)

  • getindex method of Grains and Boundaries implemented
  • Grain cdist property return centroid-vertex distance function
  • Grain cdir property return centroid-vertex direction function
  • Grain shape_vector property returns normalized Fourier descriptors
  • Grain regularize method returns Grain with regularly distributed vertices
  • Classification could be based on properties or any other values
  • boundary_segments method added
  • Smoothing, simplification and regularization of boundaries implemented
  • Colortable for legend is persistant trough indexing. Classify method could be used to change it
  • Default color table is seaborn muted for unique classification and matplotlib viridis for continuous classes

0.4.8 (04 Mar 2017)

  • bugfix

0.4.6 (04 Mar 2017)

  • added plots module (initial)
  • representative_point for Grains implemented
  • moments calculation including holes
  • surfor and parror functions added
  • orientation of polygons is unified and checked
  • minbox shape method added

0.4.5 (12 Jan 2017)

  • shell script ipolylx opens interactive console

0.4.4 (12 Jan 2017)

  • Added MAEE (minimum area enclosing ellipse) to grain shape methods
  • Removed embedded IPython and IPython requirements

0.4.3 (02 Sep 2016)

  • IPython added to requirements

0.4.2 (02 Sep 2016)

  • Sample has pairs property(dictionary) to map boundary id to grains id
  • Sample triplets method returns list of grains id creating triple points

0.4.1 (20 Jun 2016)

  • Examples added to distribution

0.4 (20 Jun 2016)

  • Sample neighbors_dist method to calculate neighbors distances
  • Grains and Boundaries nndist to calculate nearest neighbors distances
  • Fancy indexing with slices fixed
  • Affine transformations affine_transform, rotate, scale, skew, translate methods implemented for Grains and Boundaries
  • Sample name atribute added
  • Sample bids method to get boundary id's related to grain added

0.3.2 (04 Jun 2016)

  • PolyShape name forced to be string
  • Creation of boundaries is Grains method

0.3.1 (22 Feb 2016)

  • classification is persitant trough fancy indexing
  • empty classes allowed
  • bootstrap method added to PolySet

0.2 (18 Apr 2015)

  • Smooth and simplify methods for Grains implemented
  • Initial documentation added
  • phase and type properties renamed to name

0.1 (13 Feb 2015)

  • First release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polylx-0.5.1.tar.gz (539.3 kB view hashes)

Uploaded source

Built Distribution

polylx-0.5.1-py2.py3-none-any.whl (525.5 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page