Reputation: 159
My setup_axes method that is inside my class shown below. But I don't know how to set the label sizes
def setup_axes(self):
GraphScene.setup_axes(self)
init_label_x = 1970
end_label_x = 2018
step_x = 2
init_label_y = 100
end_label_y = 600
step_y = 100
self.x_axis.add_numbers(
*range(init_label_x, end_label_x + step_x, step_x),
)
self.y_axis.add_numbers(*range(init_label_y, end_label_y + step_y, step_y))
self.play(ShowCreation(self.x_axis), ShowCreation(self.y_axis))
Upvotes: 1
Views: 1633
Reputation: 159
I figured it out.
graph_scene.py
uses NumberLine
to make its axes. And NumberLine
has a config entry called 'number_scale_val'
To be able to set this, go into graph_scene.py
and in config, add the line
"x_label_font_size": 0.75,
Then within setup_axes, x_axis, around line 78 (I have already made edits so it may differ), add this line
number_scale_val = self.x_label_font_size,
So it looks like this:
self.x_leftmost_tick = self.x_min
x_axis = NumberLine(x_min=self.x_min,
x_max=self.x_max,
unit_size=self.space_unit_to_x,
number_scale_val=self.x_label_font_size, #<== this line added
tick_frequency=self.x_tick_frequency
)
Do the same for the Y axis and then in your class, add these lines in the config (change 0.5 to whatever you like):
"x_label_font_size": 0.5,
"y_label_font_size": 0.5,
Then you're good to go - you can set the size of the font in your axes
Upvotes: 1