I wrote a previous blogpost on making a plot using pysvg.
Now I want to do something a bit more tricky, to adjust the font styles.
I found a tutorial online, but the commands in it don't seem to work with the current pysvg that's installed on the Sanger farm.
However, I found another file on github that gave me some hints...
Adjusting font style and alignment with pysvg
You need something like this in the Python:
# define the text style
style = pysvg.builders.StyleBuilder()
style.style_dict["alignment-baseline"] = "middle" # there doesn't seem to be a setAlignmentBaseline function
Then you can add text using something like this:
# add some text to our svg picture for this chromosome:
t=pysvg.text.Text(mychr, x = mychrlen*xscale + 30, y = chrcnt*yscale + 30)