-
Anton Akhmerov authoredAnton Akhmerov authored
common.py 966 B
import os
import numpy as np
import matplotlib
import mpl_toolkits
matplotlib.rcParams['text.usetex'] = True
matplotlib.rcParams['figure.figsize'] = (8, 5)
matplotlib.rcParams['font.size'] = 16
matplotlib.rcParams['savefig.transparent'] = True
def draw_classic_axes(ax, x=0, y=0, xlabeloffset=.1, ylabeloffset=.07):
ax.set_axis_off()
x0, x1 = ax.get_xlim()
y0, y1 = ax.get_ylim()
ax.annotate(ax.get_xlabel(), xytext=(x1, y), xy=(x0, y),
arrowprops=dict(arrowstyle="<-"), va='center')
ax.annotate(ax.get_ylabel(), xytext=(x, y1), xy=(x, y0),
arrowprops=dict(arrowstyle="<-"), ha='center')
for pos, label in zip(ax.get_xticks(), ax.get_xticklabels()):
ax.text(pos, y - xlabeloffset, label.get_text(),
ha='center', va='bottom')
for pos, label in zip(ax.get_yticks(), ax.get_yticklabels()):
ax.text(x - ylabeloffset, pos, label.get_text(),
ha='right', va='center')