artists

Module Contents

class artists.ArtistBase(project)

Base class for artists. Contains methods to help determine the positions of the tasks

project

Project – The project to draw

Parameters:project (Project) – The project to draw
__init__(project)
_date_to_timestamp()
_find_optimal_distance(stats)

Finds the best distance between nodes.

This is determined from the number of tasks in the longest path between all starting tasks and all terminal tasks. The optimal distance is the difference between the earliest latest finish date mean and the latest latest finish date mean divided by the number of nodes in the path.

Parameters:(dict{Task (stats) – TaskStatistics}): The statistics used to derive the optimal distance
Returns:The optimal distance between nodes.
Return type:float
_find_longest_path_length(start_tasks, terminal_tasks)
get_positions(stats)
_find_best_y_position(optimal_distance, positions, task, x_position)

The optimal Y position is found by first finding the best task for the new task to be positioned near and solving the equation for a circle centered at that task’s position with a radius equal to the optimal_distance for the y-variable.

_calculate_y_position(x_position, optimal_distance)
_get_relevant_positions(task, positions, x_position, optimal_distance)
_find_best_neighbor_task()
class artists.MatplotlibArtist(project)

Draws a project using Matplotlib

Note

There are still several issues with this artist. The task labels only fit a single letter, so the names often overflow. And the labels are too long and are improperly oriented.

project

Project – The project to draw

Parameters:project (Project) – The project to draw
__init__(project)
_get_color_converter(bounds, low_better, colormap)
draw(shade="total_float", stats=None, current_time=None, iterations=1000, colormap="Spectral", show_plot=True, show_variance=True, show_current_time=True)

Draws a project and shades it by derived stats.

The X position of the tasks is determined by their latest start date

Parameters:
  • shade (str) – Shades the nodes by a derived stat. Accepted values are ‘total_float’, ‘latest_start’, or ‘earliest_finish’
  • stats (list[TaskStatistics], optional) – The statistics used to draw the Project. If none are supplied, the Project will be sampled.
  • current_time (datetime, optional) – The current time to sample the Project. Only used if stats is not specified. Defaults to the current (UTC) time.
  • iterations (int, optional) – The number of iterations to sample the Project from. Only used if stats is not specified. Defaults to 1000
  • colormap (str, optional) – The matplotlib color map to use. Defaults to ‘Spectral’
  • show_plot (bool, optional) – Show the plot? Defaults to True.
  • show_variance (bool, optional) – Show the variance of the latest start date? Defaults to True.
  • show_current_time (bool, optional) – Show the current time as a vertical line? Defaults to True.
Returns:

The figure and axis of the plot

Return type:

tuple

_adjust_ticks()
_create_color_converter(colormap, shade, stats)
_add_variance_bars(positions, stats)