5. Plot Controls

5.1. XML Input File

The basename for this file is intro_5_plotting.xml. The file can be run using this command:

microstructpy --demo=intro_5_plotting.xml

The full text of the file is given below.

<?xml version="1.0" encoding="UTF-8"?>
<input>
    <material>
        <material_type> matrix </material_type>
        <fraction> 2 </fraction>

        <shape> circle </shape>
        <size>
            <dist_type> uniform </dist_type>
            <loc> 0 </loc>
            <scale> 1.5 </scale>
        </size>
        <color> pink </color>
    </material>

    <material>
        <fraction> 1 </fraction>
        <shape> circle </shape>
        <diameter> 2 </diameter>
        <color> lime </color>
    </material>

    <domain>
        <shape> square </shape>
        <side_length> 20 </side_length>
        <corner> (0, 0) </corner>
    </domain>

    <settings>
        <filetypes>
            <seeds_plot> png </seeds_plot>
            <poly_plot> png, pdf </poly_plot>
            <tri_plot> png </tri_plot>
            <tri_plot> eps </tri_plot>
            <tri_plot> pdf </tri_plot>
        </filetypes>

        <directory> intro_5_plotting </directory>
        <verbose> True </verbose>

        <seeds_kwargs>
            <alpha> 0.5 </alpha>
            <edgecolors> none </edgecolors>
        </seeds_kwargs>

        <poly_kwargs>
            <linewidth> 3 </linewidth>
            <edgecolors> #A4058F </edgecolors>
        </poly_kwargs>

        <tri_kwargs>
            <linewidth> 0.2 </linewidth>
            <edgecolor> navy </edgecolor>
        </tri_kwargs>

        <plot_axes> False </plot_axes>
    </settings>
</input>

5.2. Materials

There are two materials, in a 2:1 ratio based on volume. The first is a pink matrix, which is represented with small circles.

The second material consists of lime green circular inclusions with diameter 2.

5.3. Domain Geometry

These two materials fill a square domain. The bottom-left corner of the rectangle is the origin, which puts the rectangle in the first quadrant. The side length is 20, which is 10x the size of the inclusions.

5.4. Settings

PNG files of each step in the process will be output, as well as the intermediate text files. They are saved in a folder named intro_5_plotting, in the current directory (i.e ./intro_5_plotting). PDF files of the poly and tri mesh are also generated, plus an EPS file for the tri mesh.

The seeds are plotted with transparency to show the overlap between them. The poly mesh is plotted with thick purple edges and the tri mesh is plotted with thin navy edges.

In all of the plots, the axes are toggles off, creating image files with minimal borders.

5.5. Output Files

The three plots that this file generates are the seeding, the polygon mesh, and the triangular mesh. These three plots are shown in Fig. 5.1 - Fig. 5.3.

Seed geometries.

Fig. 5.1 Introduction 5 - seed geometries.

Polygonal mesh.

Fig. 5.2 Introduction 5 - polygonal mesh.

Triangular mesh.

Fig. 5.3 Introduction 5 - triangular mesh.