Changing MathTex default color does not change y-tick colour in BarChart
Description of bug / unexpected behavior
Setting the default color of MathTex before creating an instance of BarChart does not set the color of the DecimalNumbers that make up the y-ticks. oddly enough, x-ticks are correctly coloured
Expected behavior
Expected the DecimalNumbers of the underlying numberline to be colored black. Trying to pass in decimal_number_config = {"color":BLACK} does not work
How to reproduce the issue
Code for reproducing the problem
config.background_color = WHITE
class graphing (Scene):
def construct(self):
Text.set_default(color=BLACK)
Tex.set_default(color=BLACK)
MathTex.set_default(color=BLACK)
config = {"color": BLACK, "decimal_number_config": {"unit": "k"}}
bitcoin = pd.DataFrame({"Date":[2019,2020,2021,2022,2023,2024], "Price (USD)":[8000, 12000, 18000, 12000, 17000, 2]})
nasdaq = pd.DataFrame({"Date":[2019,2020,2021,2022,2023,2024], "Price (USD)":[8000, 12000, 18000, 12000, 17000, 2]})
ax = BarChart(
values=bitcoin["Price (USD)"].to_numpy(),
bar_names = bitcoin["Date"],
y_range = [0,bitcoin["Price (USD)"].max(), round(bitcoin["Price (USD)"].max() // 10,-3)],
y_length = 6,
x_length = 6,
x_axis_config= {"font_size":36},
bar_width = 0.5,
axis_config = config
)
ax2 = BarChart(
values=nasdaq["Price (USD)"].to_numpy(),
bar_names = nasdaq["Date"],
y_range = [0,bitcoin["Price (USD)"].max(), round(bitcoin["Price (USD)"].max() // 10,-3)],
y_length = 6,
x_length = 6,
x_axis_config= {"font_size":36},
axis_config = config
)
grouped = VGroup (ax,ax2).arrange(RIGHT).scale(0.8)
bitcoin_label = Text("Bitcoin $",font_size = 20).move_to(ax.get_axis(1).get_critical_point(UP)).shift(UP/2)
nasdaq_label = Text("Nasdaq $",font_size = 20).move_to(ax2.get_axis(1).get_critical_point(UP)).shift(UP/2)
year_label = Text("year", font_size=20).move_to(ax.bars[2],DOWN).shift(DOWN)
y2_l = year_label.copy().move_to((ax2.bars[2].get_critical_point(DOWN) + ax2.bars[3].get_critical_point(DOWN))/2).shift(DOWN)
bitcoin_plot = ax.plot(lambda x: 8000 + (x*sqrt(2000))**2, x_range = [0,4.235])
nasdaq_plot = ax2.plot(lambda x: 8000 + (x*(nasdaq["Price (USD)"].iloc[-1] - nasdaq["Price (USD)"].iloc[0] +800) / nasdaq.shape[0]), x_range = [0.15,5.5])
self.add(bitcoin_plot)
self.add(nasdaq_plot)
self.add(year_label)
self.add(bitcoin_label)
self.add(nasdaq_label)
self.add(y2_l)
self.add(grouped)
Additional media files
Images/GIFs
could you please provide an example which does not depend on your external data files - this would allow for quick testing and debugging.
Until then you can check yourself, if setting all the color presets using the following theme solves your problem: https://gist.github.com/abul4fia/353b9a2c3d000088a82175fa64e0ce24
Unfortuantely, your suggestion does not work. I will edit the original post to improve testing as you have suggested.