Description
Describe the bug
the background_color_threshold
parameters is not used inside the plot
mehtod in the ArrayGlyph
class to change the color of the plotted values in each cells.
The same parameter is used in the method animate
, as the method checks the value of each cell and compare it with the parameter then decide on the color of the value .
This comparison in the animate
function is done in the update_cell_value
function which does not loop over the cells but the FuncAnimation
function does , and for the plot
method we need to implement the loop to properly compare the parameter with each value.
To Reproduce
- plot any array with the
display_cell_value = True
num_size = 8
background_color_threshold = None
the displayed values will be white no matter what.
in the _plot_text
function
@staticmethod
def _plot_text(
ax: Axes, arr: np.ndarray, indices, default_options_dict: dict
) -> list:
#TODO: the `background_color_threshold` parameter should be used here the same way as in the animate function
# to change the color of the text based on the value of the cell.
add_text = lambda elem: ax.text(
elem[1],
elem[0],
round(arr[elem[0], elem[1]], 2),
ha="center",
va="center",
color="w",
fontsize=default_options_dict["num_size"],
)
return list(map(add_text, indices))
the color should be decided based on the value of each cell, where the cell value is vals[x]
text_colors=("white", "black")
text_colors[int(im.norm(vals[x]) > background_color_threshold)]
Expected behavior
the displayed values should switch to black when the value of the cell is greater than the threshold parameter.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.