Quick P2CPs#

hiveplotlib.p2cp_n_axes(data: DataFrame, indices: List[int] | List[List[int]] | List[ndarray] | str = 'all', split_on: Hashable | List[Hashable] | None = None, axes: List[Hashable] | None = None, vmins: List[float | None] | None = None, vmaxes: List[float | None] | None = None, orient_angle: float = 0, all_edge_kwargs: Dict | None = None, indices_list_kwargs: List[Dict | None] | None = None) P2CP#

Generate a P2CP instance with an arbitrary number of axes for an arbitrary dataframe.

Can specify a desired subset of column names, each of which will become an axis in the resulting P2CP. Default grabs all columns in the dataframe, unless split_on is a column name, in which case that specified column will be excluded from the list of axes in the final P2CP instance. Note, repeat axes (e.g. repeated column names) are allowed here.

Axes will be added in counterclockwise order. Axes will all be the same length and position from the origin.

In deciding what edges of data get drawn (and how they get drawn), the user has several options. The default behavior plots all data points in data with the same keyword arguments. If one instead wanted to plot a subset of data points, one can provide a list of a subset of indices from the dataframe to the indices parameter.

If one wants to plot multiple sets of edges in different styles, there are two means of doing this. The more automated means is to split on the unique values of a column in the provided data. By specifying a column name to the split_on parameter, data will be added in chunks according to the unique values of the specified column. If one instead includes a list of values corresponding to the records in data, data will be added according to the unique values of this provided list. Each subset of data corresponding to a unique column value will be given a separate tag, with the tag being the unique column value. Note, however, this only works when indices="all". If one prefers to split indices manually, one can instead provide a list of lists to the indices parameter, allowing for arbitrary splitting of the data. Regardless of how one chooses to split the data, one can then assign different keyword arguments to each subset of data.

Changes to all the edge kwargs can be affected with the all_edge_kwargs parameter. If providing multiple sets of edges though in one of the ways discussed above, one can also provide unique kwargs for each set of edges by specifying a corresponding list of dictionaries of kwargs with the indices_list_kwargs parameter.

Specific edge kwargs can also be changed later by running the add_edge_kwargs() method on the returned P2CP instance. If one only added a single set of indices (e.g. indices="all" or indices was provided as a flat list of index values), then this method can simply be called with kwargs. However, if multiple subsets of edges were specified, then one will need to be precise about which tag of edge kwargs to change. If multiple sets were provided via the indices parameter, then the resulting tag for each subset will correspond to the index value in the list of lists in indices. If instead split_on_column was specified as not None, then tags will be the unique values in the specified column / list of values. Regardless of splitting methodology, existing tags can be found under the returned P2CP.tags.

There is a hierarchy to these kwarg arguments. That is, if redundant / overlapping kwargs are provided for different kwarg parameters, a warning will be raised and priority will be given according to the below hierarchy:

indices_list_kwargs > all_edge_kwargs.

Parameters:
  • data – dataframe to add.

  • indiceslist of index values from the index of the added dataframe data. Default “all” creates edges for every row in data, but a list input creates edges for only the specified subset. Alternatively, one can provide a list of lists of indices, which will allow for plotting different sets of edges with different kwargs. These subsets will be added to the resulting P2CP instance with tags corresponding to the index value in indices.

  • split_on – column name from data or list of values corresponding to the records of data. If specified as not None, the resulting P2CP instance will split data according to unique values with respect to the column of data / the list of provided values, with each subset of data given a tag of the unique value corresponding to each subset. When specifying a column in data, this column will be excluded from consideration if axes is None. Note: this subsetting can only be run when indices="all". Default None plots all the records in data with the same line kwargs.

  • axes – list of Hashable column names in data. Each column name will be assigned to a separate axis in the resulting P2CP instance, built out in counterclockwise order. Default None grabs all columns in the dataframe, unless split_on is a column name, in which case that specified column will be excluded from the list of axes in the final P2CP instance. Note, repeat axes (e.g. repeated column names) are allowed here.

  • vmins – list of float values (or None values) specifying the vmin for each axis, where the ith index value corresponds to the ith index axis in axes (e.g. the ith axis of the resulting P2CP instance). A None value infers the global min for that axis. Default None uses the global min for all the axes.

  • vmaxes – list of float values (or None values) specifying the vmax for each axis, where the ith index value corresponds to the ith index axis in axes (e.g. the ith axis of the resulting P2CP instance). A None value infers the global max for that axis. Default None uses the global max for all the axes.

  • orient_angle – rotates all axes counterclockwise from their initial angles (default 0 degrees).

  • all_edge_kwargs – kwargs for all edges. Default None specifies no additional kwargs.

  • indices_list_kwargs – list of dictionaries of kwargs for each element of indices when indices is a list of lists or split_on is not None. The ith set of kwargs in indices_list_kwargs will only be applied to index values corresponding to the ith list in indices or to index values which have the ith unique value in a sorted list of unique values in split_on. Default None provides no additional kwargs. Note, this list must be same length as indices or the same number of values as the number of unique values in split_on.

Returns:

P2CP instance.