Esempio n. 1
0
def _draw_click_instructions(subplot: plt_axes.Subplot,
                             doubleclick=True, singleclck=True):
    instruction_texts = list()
    instruction_texts.append("Interactive instructions:")
    if singleclck:
        instruction_texts.append(
            "Click once on nucleotide to see its information")
    if doubleclick:
        instruction_texts.append(
            "Make double clock on nucleotide to cut the subgraph with its "
            "incoming and outgoing nucleotides in new figure")

    instruction_text = "\n".join(instruction_texts)
    subplot.annotate(
        instruction_text, (0.5, 0.01), xycoords="figure fraction",
        ha="center", va="bottom", ma="left",
        bbox=dict(facecolor='white', edgecolor='blue', pad=5.0))
Esempio n. 2
0
def _draw_key_text(text: str, center, theta1, theta2, radius, width,
                   subplot: plt_axes.Subplot, **text_kwargs):
    text_center, theta = _get_wedge_center_and_angle(
        center, radius, theta1, theta2, width)
    text_angle = theta - 90
    if text_angle > 90:
        text_angle = text_angle - 180
    if len(text) > 10:
        text = text.replace("_", "_\n")
    text_object = subplot.annotate(text, xy=text_center,
                                   verticalalignment="center",
                                   horizontalalignment="center",
                                   rotation=text_angle, **text_kwargs)
    text_object.draw(subplot.figure.canvas.renderer)
    return text_object