Skip to content

Commit f0d995f

Browse files
committed
speedup site plot
1 parent 82e0a7c commit f0d995f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

trackplot/plot_func.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ def plot_site_plot(
889889
max_height, min_height = max(plus), min(minus)
890890
max_val = max(max_height, abs(min_height))
891891

892+
patches = []
892893
for label, array_plot in zip(['plus', 'minus'], [plus, minus]):
893894
if strand_choice != "all" and label != strand_choice:
894895
continue
@@ -903,11 +904,14 @@ def plot_site_plot(
903904
continue
904905

905906
fit_value = fit_value / fit_value.max()
906-
ax.bar(graph_coords, array_plot, color=color, rasterized=raster)
907+
908+
for x, y in zip(graph_coords, array_plot):
909+
patches.append(plt.Rectangle((x, 0), height=y, width=.6, color=color, rasterized=raster))
907910
ax.plot(graph_coords,
908911
fit_value * array_plot.max() if label == 'plus' else fit_value * array_plot.min(),
909912
c=color, lw=1)
910913

914+
ax.add_collection(PatchCollection(patches, match_original=True))
911915
# set the y limit
912916
# set y ticks, y label and label
913917
set_y_ticks(

0 commit comments

Comments
 (0)