import genomenotebook as gn
import os
import pandas as pd
Exporting plots
You can save the current view of a plot using the interactive save tool from Bokeh. Depending on the size of your plot you might need to click on the three little dots to see the tool in the menu.
You can also save plots programmatically using the GenomeBrowser.save
function. Note that this function will only save the initial version of the plot and not the current view.
Saving plots requires selenium and geckodriver. Please refer to the Bokeh documentation in case of problem.
Saving to svg
Plots can only be saved to svg if you initialise your GenomeBrowser using output_backend="svg"
. When mutliple tracks are displayed, an individual svg file will be saved for each track, as well as a combined svg file.
= gn.get_example_data_dir()
data_path = os.path.join(data_path, "MG1655_U00096.gff3")
gff_path
=pd.DataFrame(dict(x=np.arange(0,5000,100),
data=np.sin(np.arange(0,5000,100))))
y
=gn.GenomeBrowser(gff_path=gff_path,
g=(0,5000),
bounds="svg",
output_backend=False)
search
= g.add_track(height=100)
track =data, pos="x", y="y")
track.scatter(data
g.show()"test.svg") g.save(
Saving to png
You can increase the height and width to obtain a better resolution.
=gn.GenomeBrowser(gff_path=gff_path,
g=(0,5000),
bounds=False,
search=200,
height=2000,
width="20pt")
label_font_size"test.png") g.save(