Skip to content

Commit

Permalink
Merge branch 'devel' of github.com:SheffieldML/GPy into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
nfusi committed Jun 19, 2013
2 parents 18285bd + d61d379 commit 782cd2c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions GPy/util/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,36 @@ def align_subplots(N,M,xlim=None, ylim=None):
else:
removeUpperTicks()

def align_subplot_array(axes,xlim=None, ylim=None):
"""make all of the axes in the array hae the same limits, turn off unnecessary ticks
use pb.subplots() to get an array of axes
"""
#find sensible xlim,ylim
if xlim is None:
xlim = [np.inf,-np.inf]
for ax in axes.flatten():
xlim[0] = min(xlim[0],ax.get_xlim()[0])
xlim[1] = max(xlim[1],ax.get_xlim()[1])
if ylim is None:
ylim = [np.inf,-np.inf]
for ax in axes.flatten():
ylim[0] = min(ylim[0],ax.get_ylim()[0])
ylim[1] = max(ylim[1],ax.get_ylim()[1])

N,M = axes.shape
for i,ax in enumerate(axes.flatten()):
ax.set_xlim(xlim)
ax.set_ylim(ylim)
if (i)%M:
ax.set_yticks([])
else:
removeRightTicks(ax)
if i<(M*(N-1)):
ax.set_xticks([])
else:
removeUpperTicks(ax)

def x_frame1D(X,plot_limits=None,resolution=None):
"""
Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits
Expand Down

0 comments on commit 782cd2c

Please sign in to comment.