@staticmethod
def _calculate_coordinates(data):
    """
        Calculate inital x, y coordinates for each node in given DataFrame.
        Node are startified by type along the y axis.

        Args:
            pandas.DataFrame: DataFrame of nodes.

        Returns:
            pandas.DataFrame: DataFrame with x and y coordinate columns.
        """
    data['y'] = 0
    for item in ['module', 'subpackage', 'library']:
        mask = data.node_type == item
        n = data[mask].shape[0]
        index = data[mask].index
        data.loc[index, 'x'] = list(range(n))
        if item != 'library':
            data.loc[index, 'y'] = data.loc[index, 'node_name'].apply(lambda
                x: len(x.split('.')))
    max_ = data[data.node_type == 'subpackage'].y.max()
    index = data[data.node_type == 'module'].index
    data.loc[index, 'y'] += max_
    data.loc[index, 'y'] += data.loc[index, 'subpackages'].apply(len)
    max_ = data.y.max()
    data.y = -1 * data.y + max_
    return data
