Du kannst nicht mehr als 25 Themen auswählen
Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
14 Zeilen
967 B
TeX
14 Zeilen
967 B
TeX
In the next step, the parsed 2D-array is plotted in \texttt{ddrescue\_tui\_plotter.py}.
|
|
This code uses the module \texttt{matplotlib}\cite{matplotlib} to generate a plot
|
|
and \texttt{PIL}\cite{pil} to load the generated plot into the memory.
|
|
|
|
The plot is generated as a heat map with \texttt{matplotlib.pylot.imshow}.
|
|
Each numerical value of the 2D array representing the rescueing status from the parsing step
|
|
is assigned a colour value via the \texttt{COLORS} constant.
|
|
The plot is set up without any decorators such as labels or ticks
|
|
and then drawn in memory using the figure's \texttt{canvas.draw} function.
|
|
|
|
Using the figure's \texttt{canvas.get\_renderer().buffer\_rgba},
|
|
a binary representation of the plot is copied from memory and loaded using PIL's \texttt{Image.frombytes}.
|
|
Finally, the remnants of the plot are cleaned up and the PIL image is returned for display.
|
|
The following section described how the display was implemented in a terminal application. |