#NEWLINE# def draw( self , equation ) : #NEWLINE# #INDENT# if ( not self . parent . x_data ) : #NEWLINE# #INDENT# self . parent . x_data = equation . dataCache . allDataCacheDictionary [ 'IndependentData' ] [ 0 ] #NEWLINE# #UNINDENT# if ( not self . parent . y_data ) : #NEWLINE# #INDENT# self . parent . y_data = equation . dataCache . allDataCacheDictionary [ 'IndependentData' ] [ 1 ] #NEWLINE# #UNINDENT# if ( not self . parent . z_data ) : #NEWLINE# #INDENT# self . parent . z_data = tempcache . dataCache . allDataCacheDictionary [ 'DependentData' ] #NEWLINE# #UNINDENT# from mpl_toolkits.mplot3d import Axes3D #NEWLINE# from matplotlib import cm #NEWLINE# if ( not self . parent . Z ) : #NEWLINE# #INDENT# xModel = numpy . linspace ( min ( self . parent . x_data ) , max ( self . parent . x_data ) , 20 ) #NEWLINE# yModel = numpy . linspace ( min ( self . parent . y_data ) , max ( self . parent . y_data ) , 20 ) #NEWLINE# ( self . parent . X , self . parent . Y ) = numpy . meshgrid ( xModel , yModel ) #NEWLINE# tempcache = equation . dataCache #NEWLINE# equation . dataCache = pyeq2 . dataCache ( ) #NEWLINE# equation . dataCache . allDataCacheDictionary [ 'IndependentData' ] = numpy . array ( [ self . parent . X , self . parent . Y ] ) #NEWLINE# equation . dataCache . FindOrCreateAllDataCache ( equation ) #NEWLINE# self . parent . Z = equation . CalculateModelPredictions ( equation . solvedCoefficients , equation . dataCache . allDataCacheDictionary ) #NEWLINE# equation . dataCache = tempcache #NEWLINE# #UNINDENT# self . axes = self . figure . gca ( projection = '3d' ) #NEWLINE# self . axes . plot_surface ( self . parent . X , self . parent . Y , self . parent . Z , rstride = 1 , cstride = 1 , cmap = cm . coolwarm , linewidth = 1 , antialiased = True ) #NEWLINE# self . axes . scatter ( self . parent . x_data , self . parent . y_data , self . parent . z_data ) #NEWLINE# self . axes . set_title ( 'Surface Plot (click-drag with mouse)' ) #NEWLINE# self . axes . set_xlabel ( 'X Data' ) #NEWLINE# self . axes . set_ylabel ( 'Y Data' ) #NEWLINE# self . axes . set_zlabel ( 'Z Data' )