Yunjiang Qiu
2015-07-03 02:41:30 UTC
Such as example below. I want to put a new ax at data coordinates
[(45,45),(50,50)], but the transform fail to transform data coordinates to
axes.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.transforms as mtrans
%matplotlib inline
fig = plt.figure()
ax = fig.add_subplot(121,aspect=0.5)
ax.plot(np.linspace(0,100))
ax.set_ylim(0,50)
pbcb = mtrans.Bbox(ax.transLimits.transform([(45,45),(50,50)]))
cbax = fig.add_axes(pbcb)
[(45,45),(50,50)], but the transform fail to transform data coordinates to
axes.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.transforms as mtrans
%matplotlib inline
fig = plt.figure()
ax = fig.add_subplot(121,aspect=0.5)
ax.plot(np.linspace(0,100))
ax.set_ylim(0,50)
pbcb = mtrans.Bbox(ax.transLimits.transform([(45,45),(50,50)]))
cbax = fig.add_axes(pbcb)