Blue Week Special Offer | Brighten your week!
days
hours
minutes
seconds

Solution Notebook - Prison Break

Guided Project Link: https://app.dataquest.io/c/114/m/610/guided-project%3A-prison-break/1/jupyter-notebook

Solution Notebook: https://github.com/dataquestio/solutions/blob/master/Mission610Solutions.ipynb

3 Likes

Hi Sahil,

Thanks so much for sharing the guided project. I have a question. Can you please explain to me what is going on in this statement:

ax = plt.barh(*zip(*d.items()), height=.5)

Basically, this part of the code has me really stumped

rectangles = ax.patches
    for rectangle in rectangles:
        x_value = rectangle.get_width()
        y_value = rectangle.get_y() + rectangle.get_height() / 2
        space = 5
        ha = 'left'
        label = "{}".format(x_value)
        if x_value > 0:
            plt.annotate(
                label,
                (x_value, y_value),
                xytext=(space, 0),
                textcoords="offset points",
                va='center',
                ha=ha)

    axes.tick_params(tick1On=False)

Thank you!