asaplib.plot package

Submodules

asaplib.plot.plot_colors module

Color functions

class asaplib.plot.plot_colors.COLOR_PALETTE(style=1)[source]

Bases: object

asaplib.plot.plot_colors.set_color_function(fcolor='none', asapxyz=None, colorscol=0, n_samples=0, peratom=False, project_atomic=False, use_atomic_species=None, color_from_zero=False, extensive=False)[source]

obtain the essential informations to define the colors of data points :param fcolor: the name of the file or the tag in the xyz to define the colors :type fcolor: str :param asapxyz: :type asapxyz: ASAPXYZ object, (optional) :param colorscol: if the color file has more than one column, which column to use :type colorscol: int, (optional). :param n_samples: The number of data points :type n_samples: int, (optional). :param peratom: return atomic color :type peratom: bool :param project_atomic: the samples are atomic descriptors :type project_atomic: bool :param use_atomic_species: the atomic number of the selected species :type use_atomic_species: int :param color_from_zero: set the min color to zero :type color_from_zero: bool :param extensive: normalize the quatity by number of atoms :type extensive: bool

asaplib.plot.plot_styles module

I adapt some of the suff from: Copyright 2017 Alexandre Day

asaplib.plot.plot_styles.add_subplot_axes(ax, rect, axisbg='w')[source]

e.g. fig = plt.figure(figsize=(10,10)) ax = fig.add_subplot(111) rect = [0.2,0.2,0.7,0.7] ax1 = add_subplot_axes(ax,rect) ax1.plot(x,np.sin(x)) plt.show()

asaplib.plot.plot_styles.plot_cluster_w_label(X, y, Xcluster=None, show=True, savefile=None, fontsize=15, psize=20, title=None, w_label=True, figsize=None, dpi=200, alpha=0.7, edgecolors=None, cp_style=1, w_legend=False, outlier=True)[source]

Plots a 2D clustering plot given x,y coordinates and a label z for every data point

Parameters
  • X (array-like, shape=[n_samples,2]) – Input points.

  • y (array-like, shape=[n_samples]) – label for every point

  • Xcluster (center of each cluster) –

asaplib.plot.plot_styles.plot_cluster_w_size(X, y, c, s=None, xlabel=None, ylabel=None, clabel=None, title=None, w_size=True, w_label=False, circle_size=20, alpha=0.7, edgecolors=None, cmap='coolwarm', vmax=None, vmin=None, psize=2, show=True, savefile=None, fontsize=15, figsize=None, rasterized=True, remove_tick=True, dpi=200, outlier=True)[source]

Plots a 2D clustering plot given x,y coordinates and a label z for every data point

Parameters
  • X (array-like, shape=[n_samples,2]) – Input points.

  • y (array-like, shape=[n_samples]) – label for every point

  • c (array-like, shape=[n_samples]) – color for every point

asaplib.plot.plot_styles.plot_density_map(X, z, fig=None, ax=None, xlabel=None, ylabel=None, clabel=None, label=None, xaxis=True, yaxis=True, centers=None, psize=20, out_file=None, title=None, show=True, cmap='coolwarm', remove_tick=False, use_perc=False, rasterized=True, fontsize=15, vmax=None, vmin=None)[source]

Plots a 2D density map given x,y coordinates and an intensity z for every data point

Parameters
  • X (array-like, shape=[n_samples,2]) – Input points.

  • z (array-like, shape=[n_samples]) – Density at every point

asaplib.plot.plot_styles.plot_outlier_scatter(x, y, z, ax)[source]
asaplib.plot.plot_styles.plot_scatter_w_label(x, y, z, psize=20, label=None)[source]

Plots a 2D scatter plot given x,y coordinates and a label z for every data point

Parameters
  • x,y (array-like, shape=[n_samples]) – Input points.

  • z (array-like, shape=[n_samples]) – label for every point

  • plot style only looks nice when there're limited type of labels (This) –

asaplib.plot.plot_styles.set_nice_font(usetex=False)[source]

asaplib.plot.plotters module

Wrappers to do plots

class asaplib.plot.plotters.Plot_Function_Annotate(p_spec)[source]

Bases: asaplib.plot.plotters.Plot_Function_Base

create(fig, ax, X, z=[], labels=[], tags=[])[source]

annotate samples using tags. :param X: :type X: array-like, shape=[n_samples,2] :param Input points.: :param tags: :type tags: array-like, str, shape=[n_samples] :param tags for each point.: :param labels and z are not used for this plot style:

class asaplib.plot.plotters.Plot_Function_Base(p_spec)[source]

Bases: object

create(fig, ax, X, colors, labels, tags)[source]
get_acronym()[source]
class asaplib.plot.plotters.Plot_Function_Cluster(p_spec)[source]

Bases: asaplib.plot.plotters.Plot_Function_Base

Plots a 2D clustering plot given x,y coordinates and a label z for every data point. Basically we draw a circle centered arround the mean position of the samples belonging to each cluster, with a size propotional to log(cluster_size)

create(fig, ax, X, z=[], y=[], tags=[])[source]
Parameters
  • X (array-like, shape=[n_samples,2]) –

  • points. (Input) –

  • y (array-like, shape=[n_samples]) –

  • for every point (label) –

  • and tags are not used for this plot style (z) –

class asaplib.plot.plotters.Plot_Function_Scatter(p_spec)[source]

Bases: asaplib.plot.plotters.Plot_Function_Base

create(fig, ax, X, z, labels=[], tags=[])[source]

Plots a 2D scatter map given x,y coordinates and a color for every data point

Parameters
  • X (array-like, shape=[n_samples,2]) –

  • points. (Input) –

  • z (array-like, shape=[n_samples]) –

  • for each point. (color) –

  • and tags are not used for this plot style (labels) –

class asaplib.plot.plotters.Plotters(fig_spec_dict={})[source]

Bases: object

Object handing the making of plots. Notice that we make all the plots on the same graph. A good way of using this is to 1. make a scatter plot 2. add clustering results (if any) 3. add tags to annotate important points

add(p_spec, tag)[source]

adding the specifications of a new kernel function :param p_spec: specify which atomic descriptor to use :type p_spec: dictionary

bind()[source]

binds the objects that actually make the plots these objects need to have .create() method to compute

get_acronym()[source]
pack()[source]
plot(X, colors=[], labels=[], tags=[])[source]

Plots a 2D density map given 2D coordinates X and properties and tags for every data point.

Parameters
  • X (array-like, shape=[n_samples,2]) – Input points.

  • colors (array-like, float or integer, shape=[n_samples]) – properties used to color each point

  • labels (array-like, float or integer, shape=[n_samples]) – additional properties for each point

  • tags (array-like, str, shape=[n_samples]) – tags used to annotate selected points

Module contents