I have a long text in manim and it renderes very distorted. in fact, it not readable when it renders.
can you fix it please
# fast test for manim
from manim import *
from manim_ml.neural_network.layers import FeedForwardLayer
from manim_ml.neural_network.neural_network import NeuralNetwork
config.pixel_height = 900
config.pixel_width = 1400
config.frame_height = 7.0
config.frame_width = 7.0
class test(Scene):
def construct(self):
# Make the text
NN_text ="""
import keras
from keras.models import Sequential
from keras.layers import Dense
model = Sequential ()
n_cols = concrete_data. shape [1]
model.add (Dense (5, activation=\'relu\',
model.add (Dense(5, activations'relu\', input_shape=(n_ (cols, )))
model.add (Dense (1))
model.compile (optimizer=\'adam\', loss=\'mean_squared_error\')
model.fit (predictors, target)
predictions = model.predict(test_data)}
"""
desc = Text(NN_text,font_size=7,
t2c={"import": YELLOW, "from":RED,"add":GREEN,"model":BLUE,"compile":PURPLE,"fit":YELLOW,"predict":RED},
disable_ligatures=True,)
desc=desc.next_to(ORIGIN)
self.add(desc)
self.play(Write(desc))
The screenshot of rendered file
proper text with nice alignment.
There is a function
code
in manim for handling the text for codes.