Skip to content

Commit

Permalink
Improve chr label positition for circos plots
Browse files Browse the repository at this point in the history
  • Loading branch information
e-sollier committed Feb 22, 2024
1 parent 93762ef commit 574a369
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions figeno/figeno.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __init__(self,config=None,config_file=None,reference=None,genes_file=None,ch
t["genes_file"] = self.genes_file
self.tracks_list.append(ase_track(**t))
else:
pass
print("WARNING: unrecognized track type: "+str(t))

self.figure_layout = config["general"]["layout"]
self.output = None
Expand Down Expand Up @@ -256,7 +256,7 @@ def draw_horizontal(self,file,width=183,dpi=150,transparent=False):
current_height+=t.height+t.margin_above
plt.axis('off')
#fig.savefig(outfile,bbox_inches="tight",pad_inches=0.0,dpi=dpi)
plt.tight_layout(pad=0)
plt.tight_layout(pad=0.1)
fig.savefig(file,dpi=dpi,transparent=transparent)
plt.cla()
plt.clf()
Expand Down Expand Up @@ -292,7 +292,7 @@ def draw_stacked(self,file,width=183,dpi=150,transparent=False):
current_height+=t.height+t.margin_above
plt.axis('off')
#fig.savefig(outfile,bbox_inches="tight",pad_inches=0.0,dpi=dpi)
plt.tight_layout(pad=0)
plt.tight_layout(pad=0.1)
fig.savefig(file,dpi=dpi,transparent=transparent)
plt.cla()
plt.clf()
Expand Down Expand Up @@ -337,7 +337,7 @@ def draw_symmetrical(self,file,width=183,dpi=150,transparent=False):

current_height+=t.height
plt.axis('off')
plt.tight_layout(pad=0)
plt.tight_layout(pad=0.1)
fig.savefig(file,dpi=dpi,transparent=transparent)
plt.cla()
plt.clf()
Expand Down Expand Up @@ -383,7 +383,7 @@ def draw_circular(self,file,width=183,dpi=150,transparent=False):
plt.axis('off')
ax.set_rmin(0)
ax.set_rmax(current_r)
plt.tight_layout(pad=0)
plt.tight_layout(pad=0.1)
fig.savefig(file,dpi=dpi,transparent=transparent)
plt.cla()
plt.clf()
Expand Down
6 changes: 3 additions & 3 deletions figeno/track_chr.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ def draw_region_circos(self,region,box):
# label the region (need to rotate the text)
rotation_text,halign,valign = compute_rotation_text((box["left"]+box["right"])/2)

r_text = r_rec+(box["top"]-box["bottom"])*0.1

box["ax"].text((box["left"]+box["right"])/2,r_text,region.chr,rotation=rotation_text,verticalalignment=valign,horizontalalignment=halign,fontsize=22*self.fontscale)
r_text = r_rec+(box["top"]-box["bottom"])*0.4

#box["ax"].text((box["left"]+box["right"])/2,r_text,region.chr,rotation=rotation_text,verticalalignment=valign,horizontalalignment=halign,fontsize=22*self.fontscale)
box["ax"].text((box["left"]+box["right"])/2,r_text,region.chr,rotation=rotation_text,verticalalignment="center",horizontalalignment="center",fontsize=22*self.fontscale)
#,bbox=dict(facecolor='red', alpha=0.4, edgecolor='black')

def get_highlights_offsets(self):
Expand Down

0 comments on commit 574a369

Please sign in to comment.