figure_utils.py 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. from matplotlib import pyplot as plt
  2. def remove_frame(ax, dirs=None):
  3. if dirs is None:
  4. dirs = ["right", "left", "top", "bottom"]
  5. for dir in dirs:
  6. ax.spines[dir].set_visible(False)
  7. def remove_ticks(ax):
  8. ax.xaxis.set_ticks([])
  9. ax.yaxis.set_ticks([])
  10. def add_length_scale(ax, scale_length, start_scale_x, end_scale_x, start_scale_y, end_scale_y):
  11. scale_bar = ax.add_artist(plt.Line2D([start_scale_x, end_scale_x], [start_scale_y, end_scale_y], linewidth=2,
  12. color='black'))
  13. scale_bar.set_clip_on(False)
  14. # axes[0].text(start_scale_x+scale_length/2.0, start_scale_y, , va="top",
  15. # ha="center", color="k")
  16. ax.annotate("{:.0f} um".format(scale_length), xy=(start_scale_x + scale_length / 2.0, start_scale_y),
  17. xytext=(0, -3),
  18. xycoords="data", textcoords="offset points", va="top", ha="center", annotation_clip=False)
  19. cm_per_inch = 2.54
  20. number_of_panels = 4.0
  21. page_size = 11.4
  22. panel_size = page_size / number_of_panels / cm_per_inch
  23. head_direction_input_colormap = 'hsv'