Closed jksr closed 2 years ago
Yes, it's easy to implement with track customization
code:
from coolbox.core.track.base import Track
from coolbox.core.coverage.base import track_to_coverage
from coolbox.utilities import to_gr
import matplotlib.pyplot as plt
class Text(Track):
def __init__(self, text, fontsize=50, offset=0.45):
super().__init__({
"fontsize": fontsize,
"offset": offset,
"text": text,
})
def fetch_data(self, gr, **kwargs):
return self.properties['text']
def plot(self, ax, gr, **kwargs):
x = gr.start + self.properties['offset'] * (gr.end - gr.start)
text = self.fetch_data(gr)
ax.text(x, 0, text, fontsize=self.properties['fontsize'])
ax.set_xlim(gr.start, gr.end)
TextCov = track_to_coverage(Text)
is there a way to put some text label over tracks?