Plotting

Plotting

Authors:

Orion Cohen and Lauren Lee

Year:

2023

Copyright:

GNU Public License v3

The plotting functions are a convenient way to visualize data by taking solutions as their input and generating a Plotly.Figure object.

solvation_analysis.plotting.plot_network_size_histogram(networking)[source]

Plot a histogram of network sizes.

Parameters:

networking (Networking | Solution)

Returns:

fig

Return type:

Plotly.Figure

solvation_analysis.plotting.plot_shell_composition_by_size(speciation)[source]

Plot the composition of shells broken down by shell size.

Parameters:

speciation (Speciation | Solution)

Returns:

fig

Return type:

Plotly.Figure

solvation_analysis.plotting.plot_co_occurrence(speciation, colorscale=None)[source]

Plot the co-occurrence matrix of the solute using Plotly.

Co-occurrence represents the extent to which solvents occur with eachother relative to random. Values higher than 1 mean that solvents occur together more often than random and values lower than 1 mean solvents occur together less often than random. “Random” is calculated based on the total number of solvents participating in solvation, it ignores solvents in the diluent.

Parameters:
  • speciation (Speciation | Solution)

  • colorscale (any valid argument to Plotly colorscale.)

Returns:

fig

Return type:

plotly.graph_objs.Figure

solvation_analysis.plotting.compare_solvent_dicts(property_dict, rename_solvent_dict, solvents_to_plot, legend_label, x_axis='solvent', series=False)[source]

A generic plotting function that can compare dictionary data between multiple solutes.

Parameters:
  • property_dict (dict of {str: dict}) – a dictionary with the solution name as keys and a dict of {str: float} as values, where each key is the name of the solvent of each solution and each value is the property of interest

  • rename_solvent_dict (dict of {str: str}) – Renames solvents within the plot, useful for comparing similar solvents in different solutes. The keys are the original solvent names and the values are the new name e.g. {“EAf” : “EAx”, “fEAf” : “EAx”}

  • solvents_to_plot (List[str]) – List of solvent names to be plotted, they will be plotted in given order. The solvents must be common to all systems in question. Renaming in rename_solvent_dicts is applied first, so the solvent names in solvents_to_plot should match the `values of that dict.

  • legend_label (str) – title of legend as a string

  • x_axis (str) – the value must be “solvent” or “solute” and decides which to plot the x_axis

  • series (bool) – False for a bar graph, True for a line graph

Returns:

fig

Return type:

Plotly.Figure

solvation_analysis.plotting.compare_pairing(solutions, rename_solvent_dict=None, solvents_to_plot=None, x_axis='solvent', series=False, title='Fractional Pairing of Solvents', x_label=None, y_label='Solvent Pairing', legend_label=None)

Compare the solute-solvent pairing.

property_dictdict of {str: dict}

a dictionary with the solution name as keys and a dict of {str: float} as values, where each key is the name of the solvent of each solution and each value is the property of interest

rename_solvent_dictdict of {str: str}

Renames solvents within the plot, useful for comparing similar solvents in different solutes. The keys are the original solvent names and the values are the new name e.g. {“EAf” : “EAx”, “fEAf” : “EAx”}

solvents_to_plotList[str]

List of solvent names to be plotted, they will be plotted in given order. The solvents must be common to all systems in question. Renaming in rename_solvent_dicts is applied first, so the solvent names in solvents_to_plot should match the `values of that dict.

x_axisstr

the value must be “solvent” or “solute” and decides which to plot the x_axis

seriesbool

False for a bar graph, True for a line graph

x_labelstr

title of the x-axis

y_labelstr

title of the y-axis

titlestr

title of figure

legend_labelstr

title of legend

Returns:

fig

Return type:

Plotly.Figure

solvation_analysis.plotting.compare_free_solvents(solutions, rename_solvent_dict=None, solvents_to_plot=None, x_axis='solvent', series=False, title='Free Solvents in Solutes', x_label=None, y_label='Fraction Free Solvents', legend_label=None)

Compare the relative fraction of free solvents.

property_dictdict of {str: dict}

a dictionary with the solution name as keys and a dict of {str: float} as values, where each key is the name of the solvent of each solution and each value is the property of interest

rename_solvent_dictdict of {str: str}

Renames solvents within the plot, useful for comparing similar solvents in different solutes. The keys are the original solvent names and the values are the new name e.g. {“EAf” : “EAx”, “fEAf” : “EAx”}

solvents_to_plotList[str]

List of solvent names to be plotted, they will be plotted in given order. The solvents must be common to all systems in question. Renaming in rename_solvent_dicts is applied first, so the solvent names in solvents_to_plot should match the `values of that dict.

x_axisstr

the value must be “solvent” or “solute” and decides which to plot the x_axis

seriesbool

False for a bar graph, True for a line graph

x_labelstr

title of the x-axis

y_labelstr

title of the y-axis

titlestr

title of figure

legend_labelstr

title of legend

Returns:

fig

Return type:

Plotly.Figure

solvation_analysis.plotting.compare_diluent(solutions, rename_solvent_dict=None, solvents_to_plot=None, x_axis='solvent', series=False, title='Diluent Composition of Solutes', x_label=None, y_label='Diluent Composition', legend_label=None)

Compare the diluent composition.

property_dictdict of {str: dict}

a dictionary with the solution name as keys and a dict of {str: float} as values, where each key is the name of the solvent of each solution and each value is the property of interest

rename_solvent_dictdict of {str: str}

Renames solvents within the plot, useful for comparing similar solvents in different solutes. The keys are the original solvent names and the values are the new name e.g. {“EAf” : “EAx”, “fEAf” : “EAx”}

solvents_to_plotList[str]

List of solvent names to be plotted, they will be plotted in given order. The solvents must be common to all systems in question. Renaming in rename_solvent_dicts is applied first, so the solvent names in solvents_to_plot should match the `values of that dict.

x_axisstr

the value must be “solvent” or “solute” and decides which to plot the x_axis

seriesbool

False for a bar graph, True for a line graph

x_labelstr

title of the x-axis

y_labelstr

title of the y-axis

titlestr

title of figure

legend_labelstr

title of legend

Returns:

fig

Return type:

Plotly.Figure

solvation_analysis.plotting.compare_coordination_numbers(solutions, rename_solvent_dict=None, solvents_to_plot=None, x_axis='solvent', series=False, title='Coordination Numbers of Solvents', x_label=None, y_label='Coordination Numbers', legend_label=None)

Compare the coordination numbers.

property_dictdict of {str: dict}

a dictionary with the solution name as keys and a dict of {str: float} as values, where each key is the name of the solvent of each solution and each value is the property of interest

rename_solvent_dictdict of {str: str}

Renames solvents within the plot, useful for comparing similar solvents in different solutes. The keys are the original solvent names and the values are the new name e.g. {“EAf” : “EAx”, “fEAf” : “EAx”}

solvents_to_plotList[str]

List of solvent names to be plotted, they will be plotted in given order. The solvents must be common to all systems in question. Renaming in rename_solvent_dicts is applied first, so the solvent names in solvents_to_plot should match the `values of that dict.

x_axisstr

the value must be “solvent” or “solute” and decides which to plot the x_axis

seriesbool

False for a bar graph, True for a line graph

x_labelstr

title of the x-axis

y_labelstr

title of the y-axis

titlestr

title of figure

legend_labelstr

title of legend

Returns:

fig

Return type:

Plotly.Figure

solvation_analysis.plotting.compare_residence_times_cutoff(solutions, rename_solvent_dict=None, solvents_to_plot=None, x_axis='solvent', series=False, title='Solute-Solvent Residence Time', x_label=None, y_label='Residence Times Cutoff', legend_label=None)

Compare the solute-solvent residence times.

property_dictdict of {str: dict}

a dictionary with the solution name as keys and a dict of {str: float} as values, where each key is the name of the solvent of each solution and each value is the property of interest

rename_solvent_dictdict of {str: str}

Renames solvents within the plot, useful for comparing similar solvents in different solutes. The keys are the original solvent names and the values are the new name e.g. {“EAf” : “EAx”, “fEAf” : “EAx”}

solvents_to_plotList[str]

List of solvent names to be plotted, they will be plotted in given order. The solvents must be common to all systems in question. Renaming in rename_solvent_dicts is applied first, so the solvent names in solvents_to_plot should match the `values of that dict.

x_axisstr

the value must be “solvent” or “solute” and decides which to plot the x_axis

seriesbool

False for a bar graph, True for a line graph

x_labelstr

title of the x-axis

y_labelstr

title of the y-axis

titlestr

title of figure

legend_labelstr

title of legend

Returns:

fig

Return type:

Plotly.Figure

solvation_analysis.plotting.compare_residence_times_fit(solutions, rename_solvent_dict=None, solvents_to_plot=None, x_axis='solvent', series=False, title='Solute-Solvent Residence Time.', x_label=None, y_label='Residence Times Fit', legend_label=None)

Compare the solute-solvent residence times.

property_dictdict of {str: dict}

a dictionary with the solution name as keys and a dict of {str: float} as values, where each key is the name of the solvent of each solution and each value is the property of interest

rename_solvent_dictdict of {str: str}

Renames solvents within the plot, useful for comparing similar solvents in different solutes. The keys are the original solvent names and the values are the new name e.g. {“EAf” : “EAx”, “fEAf” : “EAx”}

solvents_to_plotList[str]

List of solvent names to be plotted, they will be plotted in given order. The solvents must be common to all systems in question. Renaming in rename_solvent_dicts is applied first, so the solvent names in solvents_to_plot should match the `values of that dict.

x_axisstr

the value must be “solvent” or “solute” and decides which to plot the x_axis

seriesbool

False for a bar graph, True for a line graph

x_labelstr

title of the x-axis

y_labelstr

title of the y-axis

titlestr

title of figure

legend_labelstr

title of legend

Returns:

fig

Return type:

Plotly.Figure