ManimCommunity / ManimCommunity/manim
Changing MathTex default color does not change y-tick colour in BarChart
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from BarChart construction and the underlying numberline that creates the y-tick DecimalNumbers; reproduce the mismatch with the provided example and compare it with the correctly colored x-ticks. Done means y-ticks honor the MathTex default color or the supplied decimal_number_config without regressing x-tick coloring.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100