def transform(data):
    """Prepare the data for plotting

    Parameters
    ----------
    data : list
        A list of tuples. First element is the title of the question and the
        second one is a dictionary which maps the possible answer to the number
        of times the answer was given.
        [("Question1", {"yes":3, "no":4}, ("Question2", {"a":1, "no":2})]

    Returns
    -------
    tuple
        First element is a list of the titles of the questions. Second one is
        a dictionary mapping the possible answer to a list of the quantities
        the answer was given.
        (["Question1", "Question2"], {"yes":[3, 0], "no":[4, 2], "a":[0, 1]})
    """
    questions = [t for t, v in data]
    answers = list(set([k for t, v in data for k in v.keys()]))

    quantities = {}
    for answer in answers:
        quantities[answer] = [v[answer] if answer in v else 0 for t, v in data]

    return questions, quantities