mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-21 14:05:14 +02:00
[plotting] got the old way in again
This commit is contained in:
parent
327ed46c6e
commit
b236896fbd
4 changed files with 10 additions and 5 deletions
|
|
@ -13,6 +13,7 @@ def change_plotting_library(lib):
|
||||||
if lib == 'matplotlib':
|
if lib == 'matplotlib':
|
||||||
import matplotlib
|
import matplotlib
|
||||||
from .matplot_dep.plot_definitions import MatplotlibPlots
|
from .matplot_dep.plot_definitions import MatplotlibPlots
|
||||||
|
from .matplot_dep import visualize, mapping_plots, priors_plots, ssgplvm, svig_plots, variational_plots, img_plots
|
||||||
current_lib[0] = MatplotlibPlots()
|
current_lib[0] = MatplotlibPlots()
|
||||||
if lib == 'plotly':
|
if lib == 'plotly':
|
||||||
import plotly
|
import plotly
|
||||||
|
|
@ -22,6 +23,7 @@ def change_plotting_library(lib):
|
||||||
current_lib[0] = None
|
current_lib[0] = None
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
except (ImportError, NameError):
|
except (ImportError, NameError):
|
||||||
|
raise
|
||||||
config.set('plotting', 'library', 'none')
|
config.set('plotting', 'library', 'none')
|
||||||
import warnings
|
import warnings
|
||||||
warnings.warn(ImportWarning("{} not available, install newest version of {} for plotting".format(lib, lib)))
|
warnings.warn(ImportWarning("{} not available, install newest version of {} for plotting".format(lib, lib)))
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,10 @@ def get_x_y_var(model):
|
||||||
else:
|
else:
|
||||||
X = model.X.values
|
X = model.X.values
|
||||||
X_variance = None
|
X_variance = None
|
||||||
Y = model.Y.values
|
try:
|
||||||
|
Y = model.Y.values
|
||||||
|
except AttributeError:
|
||||||
|
Y = model.Y
|
||||||
if sparse.issparse(Y): Y = Y.todense().view(np.ndarray)
|
if sparse.issparse(Y): Y = Y.todense().view(np.ndarray)
|
||||||
return X, X_variance, Y
|
return X, X_variance, Y
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ try:
|
||||||
from matplotlib import pyplot as pb
|
from matplotlib import pyplot as pb
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
from .base_plots import x_frame1D, x_frame2D
|
|
||||||
|
|
||||||
|
|
||||||
def plot_mapping(self, plot_limits=None, which_data='all', which_parts='all', resolution=None, levels=20, samples=0, fignum=None, ax=None, fixed_inputs=[], linecol=Tango.colorsHex['darkBlue']):
|
def plot_mapping(self, plot_limits=None, which_data='all', which_parts='all', resolution=None, levels=20, samples=0, fignum=None, ax=None, fixed_inputs=[], linecol=Tango.colorsHex['darkBlue']):
|
||||||
|
|
@ -52,6 +51,7 @@ def plot_mapping(self, plot_limits=None, which_data='all', which_parts='all', re
|
||||||
ax = fig.add_subplot(111)
|
ax = fig.add_subplot(111)
|
||||||
|
|
||||||
plotdims = self.input_dim - len(fixed_inputs)
|
plotdims = self.input_dim - len(fixed_inputs)
|
||||||
|
from ..gpy_plot.plot_util import x_frame1D, x_frame2D
|
||||||
|
|
||||||
if plotdims == 1:
|
if plotdims == 1:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ def plot_SpikeSlab(parameterized, fignum=None, ax=None, colors=None, side_by_sid
|
||||||
a.set_xticklabels('')
|
a.set_xticklabels('')
|
||||||
# binary prob plot
|
# binary prob plot
|
||||||
a = fig.add_subplot(*sub2)
|
a = fig.add_subplot(*sub2)
|
||||||
a.bar(x,gamma[:,i],bottom=0.,linewidth=0,width=1.0,align='center')
|
a.bar(x,gamma[:,i],bottom=0.,linewidth=1.,width=1.0,align='center')
|
||||||
a.set_xlim(x.min(), x.max())
|
a.set_xlim(x.min(), x.max())
|
||||||
a.set_ylim([0.,1.])
|
a.set_ylim([0.,1.])
|
||||||
pb.draw()
|
pb.draw()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue