# Buggy code
def compute_initial_figure(self):
    self.axes.cla()
    self.axes.set_title("MBytes given/taken over time", color="#e0e0e0")
    self.axes.set_xlabel("Date")
    self.axes.set_ylabel("Given/taken data (MBytes)")

    self.axes.xaxis.set_major_formatter(DateFormatter("%d-%m-%y"))

    self.axes.plot(
        self.plot_data[1], self.plot_data[0][0], label="MBytes given", marker="o"
    )
    self.axes.plot(
        self.plot_data[1], self.plot_data[0][1], label="MBytes taken", marker="o"
    )
    self.axes.grid(True)

    for line in self.axes.get_xgridlines() + self.axes.get_ygridlines():
        line.set_linestyle("--")

    # Color the axes
    if hasattr(self.axes, "set_facecolor"):  # Not available on Linux
        self.axes.set_facecolor("#464646")
    self.axes.xaxis.label.set_color("#e0e0e0")
    self.axes.yaxis.label.set_color("#e0e0e0")
    self.axes.tick_params(axis="x", colors="#e0e0e0")
    self.axes.tick_params(axis="y", colors="#e0e0e0")

    # Create the legend
    handles, labels = self.axes.get_legend_handles_labels()
    self.axes.legend(handles, labels)

    self.draw()


# Traceback (RuntimeError)
Traceback (most recent call last):
File "TriblerGUI\event_request_manager.py", line 92, in on_read_data
RuntimeError: Unhandled Error
Traceback (most recent call last):
File "lib\multiprocessing\process.py", line 114, in run

File "TriblerGUI\core_manager.py", line 63, in start_tribler_core

File "lib\site-packages\twisted\internet\base.py", line 1195, in run

File "lib\site-packages\twisted\internet\base.py", line 1204, in mainLoop

--- <exception caught here> ---
File "lib\site-packages\twisted\internet\base.py", line 798, in runUntilCurrent

File "Tribler\dispersy\endpoint.py", line 253, in dispersythread_data_came_in

File "Tribler\dispersy\dispersy.py", line 1488, in on_incoming_packets

File "Tribler\dispersy\dispersy.py", line 685, in get_community

File "Tribler\dispersy\community.py", line 226, in init_community

File "Tribler\community\tunnel\tunnel_community.py", line 316, in initialize

File "Tribler\community\tunnel\Socks5\server.py", line 309, in start

File "lib\site-packages\twisted\internet\posixbase.py", line 478, in listenTCP

File "lib\site-packages\twisted\internet\tcp.py", line 983, in startListening

twisted.internet.error.CannotListenError: Couldn't listen on any:55661: [Errno 10048] Elk socketadres (protocol/netwerkadres/poort) kan normaal slechts n keer worden gebruikt.

# Fixed code
def compute_initial_figure(self):
    self.axes.cla()
    self.axes.set_title("MBytes given/taken over time", color="#e0e0e0")
    self.axes.set_xlabel("Date")
    self.axes.set_ylabel("Given/taken data (MBytes)")

    self.axes.xaxis.set_major_formatter(DateFormatter("%d-%m-%y"))

    self.axes.plot(
        self.plot_data[1], self.plot_data[0][0], label="MBytes given", marker="o"
    )
    self.axes.plot(
        self.plot_data[1], self.plot_data[0][1], label="MBytes taken", marker="o"
    )
    self.axes.grid(True)

    for line in self.axes.get_xgridlines() + self.axes.get_ygridlines():
        line.set_linestyle("--")

    # Color the axes
    if hasattr(self.axes, "set_facecolor"):  # Not available on Linux
        self.axes.set_facecolor("#464646")
    self.axes.xaxis.label.set_color("#e0e0e0")
    self.axes.yaxis.label.set_color("#e0e0e0")
    self.axes.tick_params(axis="x", colors="#e0e0e0")
    self.axes.tick_params(axis="y", colors="#e0e0e0")

    # Create the legend
    handles, labels = self.axes.get_legend_handles_labels()
    self.axes.legend(handles, labels)

    if (
        len(self.plot_data[0][0]) == 1
    ):  # If we only have one data point, don't show negative axis
        self.axes.set_ylim(-0.3, 10)
        self.axes.set_xlim(
            datetime.datetime.now() - datetime.timedelta(hours=1),
            datetime.datetime.now() + datetime.timedelta(days=4),
        )

    self.draw()