Saving image file?
cossio opened this issue · 1 comments
cossio commented
Is it possible to specify an output filename (e.g. png) to save the plot?
betteridiot commented
Sorry, I didn't see this in my flood of emails. Yes, you can save it if you define a filename
parameter when you use seqlogo.seqlogo()
Here is an example:
$ mkdir example
$ cd example
import numpy as np
import pandas as pd
import seqlogo as sl
# Setting seed for demonstration purposes
np.random.seed(42)
# Making a fake PWM
random_ppm = np.random.dirichlet(np.ones(4), size=6)
ppm = sl.Ppm(random_ppm)
>>> sl.seqlogo(ppm, ic_scale = False, format = 'svg', size = 'medium')
$ ls
# Setting seed for demonstration purposes
np.random.seed(42)
# Making a fake PWM
random_ppm = np.random.dirichlet(np.ones(4), size=6)
ppm = sl.Ppm(random_ppm)
sl.seqlogo(ppm, ic_scale = False, format = 'svg', size = 'medium', filename = 'example.svg')
$ ls
example.svg