polypy.plotting

Plotting functions included with polypy.

polypy.plotting.combined_density_plot(x, y, z, xlab='X Coordinate ($\\AA$)', ylab='Y Coordinate ($\\AA$)', y2_lab='Number Density', palette='viridis', linecolor='black', figsize=(10, 6), log=False)[source]

Plots the distribution of an atom species in two dimensions and overlays the one dimensional density on top. Think of it as a combination of the two_dimensional_density_plot and one_dimensional_density_plot functions

Parameters:
  • x (array like) – x axis points - x axis coordinates.
  • y (array like) – y axis points - y axis coordinates.
  • z (array like) – z axis points - 2D array of points.
  • xlab (str) – x axis label. Default is "X Coordinate ($AA$)"
  • ylab (str) – y axis label. Default is "Y Coordinate ($AA$)"
  • y2_lab (str) – second y axis label. Default is "Particle Density"
  • fig_size (tuple) – Horizontal and veritcal size for figure (in inches). Default is (10, 6).
  • log (bool) – Log the z data or not? This can sometimes be useful but obviously one needs to be careful
  • drawing conclusions from the data. (when) –
Returns:

Figure object (list): List of axes objects.

Return type:

(matplotlib.Fig)

polypy.plotting.combined_density_plot_multiple_species(x_list, y_list, z_list, palette_list, label_list, color_list, xlab='X Coordinate ($\\AA$)', ylab='Y Coordinate ($\\AA$)', figsize=(10, 6), log=False)[source]

Plots the distribution of a list of atom species in two dimensions. Returns heatmaps for each species stacking on top of one another. It also plots the same density in one dimension on top of the heatmaps.

Parameters:
  • x (list) – x axis points - x axis coordinates.
  • y (list) – y axis points - y axis coordinates.
  • z (list) – z axis points - 2D array of points.
  • palette_list (list) – Color palletes for each atom species.
  • label_list (list) – List of species labels.
  • color_list (list) – List of colors for one dimensional plot.
  • xlab (str) – x axis label. Default is "X Coordinate ($AA$)"
  • ylab (str) – y axis label. Default is "Y Coordinate ($AA$)"
  • fig_size (tuple) – Horizontal and veritcal size for figure (in inches). Default is (10, 6).
Returns:

Figure object (list): List of axes objects.

Return type:

(matplotlib.Fig)

polypy.plotting.electric_field_plot(x, y, xlab='X Coordinate ($\\AA$)', ylab='Electric Field (V)', figsize=(10, 6))[source]

Gathers the data and creates a line plot for the electric field in one dimension.

Parameters:
  • x (array like) – x axis points - position in simulation cell
  • y (array like) – y axis points - electric field
  • xlab (str) – x axis label. Default is "X Coordinate ($AA$)"
  • ylab (str) – y axis label. Default is "Electric Field (V)"
  • fig_size (tuple) – Horizontal and veritcal size for figure (in inches). Default is (10, 6).
Returns:

The axes with new plots.

Return type:

(matplotlib.axes.Axes)

polypy.plotting.electrostatic_potential_plot(x, y, xlab='X Coordinate ($\\AA$)', ylab='Electrostatic Potential (V)', figsize=(10, 6))[source]

Gathers the data and creates a line plot for the electrostatic potential in one dimension.

Parameters:
  • x (array like) – x axis points - position in simulation cell
  • y (array like) – y axis points - electrostatic potential
  • xlab (str) – x axis label. Default is "X Coordinate ($AA$)"
  • ylab (str) – y axis label. Default is "Electrostatic Potential (V)"
  • fig_size (tuple) – Horizontal and veritcal size for figure (in inches). Default is (10, 6).
Returns:

The axes with new plots.

Return type:

(matplotlib.axes.Axes)

polypy.plotting.line_plot(x, y, xlab, ylab, figsize=(10, 6))[source]

Simple line plotting function. Designed to be generic and used in several different applications.

Parameters:
  • x (array like) – x axis points.
  • y (array like) – y axis points.
  • xlab (str) – x axis label.
  • ylab (str) – y axis label.
  • fig_size (tuple) – Horizontal and veritcal size for figure (in inches). Default is (10, 6).
Returns:

The axes with new plots.

Return type:

(matplotlib.axes.Axes)

polypy.plotting.msd_plot(msd_data, show_all_dimensions=True, figsize=(10, 6))[source]

Plotting function for the mean squared displacements (MSD).

Parameters:
  • msd_data ():py:class:polypy.msd.MSDContainer) – MSD data.
  • show_all_dimensions (bool) – Display all MSD data or the total MSD. Default is bool
  • fig_size (tuple) – Horizontal and veritcal size for figure (in inches). Default is (10, 6).
Returns:

The axes with new plots.

Return type:

(matplotlib.axes.Axes)

polypy.plotting.one_dimensional_charge_density_plot(x, y, xlab='X Coordinate ($\\AA$)', ylab='Charge Density', figsize=(10, 6))[source]

Gathers the data and creates a line plot for the charge density in one dimension.

Parameters:
  • x (array like) – x axis points - position in simulation cell
  • y (array like) – y axis points - charge density
  • xlab (str) – x axis label. Default is "X Coordinate ($AA$)"
  • ylab (str) – y axis label. Default is "Charge Density"
  • fig_size (tuple) – Horizontal and veritcal size for figure (in inches). Default is (10, 6).
Returns:

The axes with new plots.

Return type:

(matplotlib.axes.Axes)

polypy.plotting.one_dimensional_density_plot(x, y, data_labels, xlab='X Coordinate ($\\AA$)', ylab='Particle Density', figsize=(10, 6))[source]

Plots the number density of all given species in one dimension.

Parameters:
  • x (list) – x axis points - list of numpy arrays containing x axis coordinates.
  • y (list) – y axis points - list of numpy arrays containing y axis coordinates.
  • data_labels (list) – List of labels for legend.
  • xlab (str) – x axis label. Default is "X Coordinate ($AA$)"
  • ylab (str) – y axis label. Default is "Particle Density"
  • fig_size (tuple) – Horizontal and veritcal size for figure (in inches). Default is (10, 6).
Returns:

The axes with new plots.

Return type:

(matplotlib.axes.Axes)

polypy.plotting.two_dimensional_charge_density_plot(x, y, z, xlab='X Coordinate ($\\AA$)', ylab='Y Coordinate ($\\AA$)', palette='viridis', figsize=(10, 6), colorbar=True, log=False)[source]

Plots the charge density in two dimensions.

Parameters:
  • x (array like) – x axis points - x axis coordinates.
  • y (array like) – y axis points - y axis coordinates.
  • z (array like) – z axis points - 2D array of points.
  • xlab (str) – x axis label. Default is "X Coordinate ($AA$)"
  • ylab (str) – y axis label. Default is "Y Coordinate ($AA$)"
  • fig_size (tuple) – Horizontal and veritcal size for figure (in inches). Default is (10, 6).
  • colorbar (bool) – Include the colorbar or not.
Returns:

Figure object (matplotlib.axes.Axes): The axes with new plots.

Return type:

(matplotlib.Fig)

polypy.plotting.two_dimensional_density_plot(x, y, z, xlab='X Coordinate ($\\AA$)', ylab='Y Coordinate ($\\AA$)', palette='viridis', figsize=(10, 6), colorbar=True, log=False)[source]

Plots the distribution of an atom species in two dimensions.

Parameters:
  • x (array like) – x axis points - x axis coordinates.
  • y (array like) – y axis points - y axis coordinates.
  • z (array like) – z axis points - 2D array of points.
  • xlab (str) – x axis label. Default is "X Coordinate ($AA$)"
  • ylab (str) – y axis label. Default is "Y Coordinate ($AA$)"
  • fig_size (tuple) – Horizontal and veritcal size for figure (in inches). Default is (10, 6).
  • colorbar (bool) – Include the colorbar or not.
  • log (bool) – Log the z data or not? This can sometimes be useful but obviously one needs to be careful
  • drawing conclusions from the data. (when) –
Returns:

Figure object (matplotlib.axes.Axes): The axes with new plots.

Return type:

(matplotlib.Fig)

polypy.plotting.two_dimensional_density_plot_multiple_species(x_list, y_list, z_list, palette_list, xlab='X Coordinate ($\\AA$)', ylab='Y Coordinate ($\\AA$)', y2_lab='Number Density', figsize=(10, 6), log=False)[source]

Plots the distribution of a list of atom species in two dimensions. Returns heatmaps for each species stacking on top of one another. This is limited to four species.

Parameters:
  • x_list (array like) – x axis points - x axis coordinates.
  • y_list (array like) – y axis points - y axis coordinates.
  • z_list (array like) – z axis points - 2D array of points.
  • palette_list (array like) – Color palletes for each atom species.
  • xlab (str) – x axis label. Default is "X Coordinate ($AA$)"
  • ylab (str) – y axis label. Default is "Y Coordinate ($AA$)"
  • y2_lab (str) – second y axis label. Default is "Particle Density"
  • fig_size (tuple) – Horizontal and veritcal size for figure (in inches). Default is (10, 6).
  • log (bool) – Log the z data or not? This can sometimes be useful but obviously one needs to be careful
  • drawing conclusions from the data. (when) –
Returns:

Figure object (matplotlib.axes.Axes): The axes with new plots.

Return type:

(matplotlib.Fig)

polypy.plotting.volume_plot(x, y, xlab='Timestep (ps)', ylab='System Volume ($\\AA$)', figsize=(10, 6))[source]

Gathers the data and creates a line plot for the system volume as a function of simulation timesteps

Parameters:
  • x (array like) – x axis points - simulation timesteps
  • y (array like) – y axis points - Volume
  • xlab (str) – x axis label. Default is "Timestep (ps)"
  • ylab (str) – y axis label. Default is "System Volume ($AA$)"
  • fig_size (tuple) – Horizontal and veritcal size for figure (in inches). Default is (10, 6).
Returns:

The axes with new plots.

Return type:

(matplotlib.axes.Axes)