Skip to content

Commit 574a369

Browse files
committed
Improve chr label positition for circos plots
1 parent 93762ef commit 574a369

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

figeno/figeno.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def __init__(self,config=None,config_file=None,reference=None,genes_file=None,ch
138138
t["genes_file"] = self.genes_file
139139
self.tracks_list.append(ase_track(**t))
140140
else:
141-
pass
141+
print("WARNING: unrecognized track type: "+str(t))
142142

143143
self.figure_layout = config["general"]["layout"]
144144
self.output = None
@@ -256,7 +256,7 @@ def draw_horizontal(self,file,width=183,dpi=150,transparent=False):
256256
current_height+=t.height+t.margin_above
257257
plt.axis('off')
258258
#fig.savefig(outfile,bbox_inches="tight",pad_inches=0.0,dpi=dpi)
259-
plt.tight_layout(pad=0)
259+
plt.tight_layout(pad=0.1)
260260
fig.savefig(file,dpi=dpi,transparent=transparent)
261261
plt.cla()
262262
plt.clf()
@@ -292,7 +292,7 @@ def draw_stacked(self,file,width=183,dpi=150,transparent=False):
292292
current_height+=t.height+t.margin_above
293293
plt.axis('off')
294294
#fig.savefig(outfile,bbox_inches="tight",pad_inches=0.0,dpi=dpi)
295-
plt.tight_layout(pad=0)
295+
plt.tight_layout(pad=0.1)
296296
fig.savefig(file,dpi=dpi,transparent=transparent)
297297
plt.cla()
298298
plt.clf()
@@ -337,7 +337,7 @@ def draw_symmetrical(self,file,width=183,dpi=150,transparent=False):
337337

338338
current_height+=t.height
339339
plt.axis('off')
340-
plt.tight_layout(pad=0)
340+
plt.tight_layout(pad=0.1)
341341
fig.savefig(file,dpi=dpi,transparent=transparent)
342342
plt.cla()
343343
plt.clf()
@@ -383,7 +383,7 @@ def draw_circular(self,file,width=183,dpi=150,transparent=False):
383383
plt.axis('off')
384384
ax.set_rmin(0)
385385
ax.set_rmax(current_r)
386-
plt.tight_layout(pad=0)
386+
plt.tight_layout(pad=0.1)
387387
fig.savefig(file,dpi=dpi,transparent=transparent)
388388
plt.cla()
389389
plt.clf()

figeno/track_chr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,10 @@ def draw_region_circos(self,region,box):
289289
# label the region (need to rotate the text)
290290
rotation_text,halign,valign = compute_rotation_text((box["left"]+box["right"])/2)
291291

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

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

298298
def get_highlights_offsets(self):

0 commit comments

Comments
 (0)