def plotGrainDataIPF(self, direction, mapData=None, grainData=None, grainIds=-1, **kwargs): """ Plot IPF of grain reference (average) orientations with points coloured by grain average values from map data. Parameters ---------- mapData : numpy.ndarray Array of map data to grain average. This must be cropped! direction : numpy.ndarray Vector of reference direction for the IPF. plotColourBar : bool, optional Set to False to exclude the colour bar from the plot. vmin : float, optional Minimum value of colour scale. vmax : float, optional Maximum value for colour scale. cLabel : str, optional Colour bar label text. """ # Set default plot parameters then update with any input plotParams = {} plotParams.update(kwargs) if grainData is None: if mapData is None: raise ValueError("Either 'mapData' or 'grainData' must " "be supplied.") else: grainData = self.calcGrainAv(mapData, grainIds=grainIds) # Check that grains have been detected in the map self.checkGrainsDetected() if type(grainIds) is int and grainIds == -1: grainIds = range(len(self)) if len(grainData) != len(grainIds): raise Exception("Must be 1 value for each grain in grainData.") grainOri = np.empty(len(grainIds), dtype=Quat) for i, grainId in enumerate(grainIds): grain = self[grainId] grainOri[i] = grain.refOri plot = Quat.plotIPF(grainOri, direction, self.crystalSym, c=grainData, **plotParams) return plot
def plotOriSpread(self, direction=np.array([0, 0, 1]), **kwargs): plotParams = {'marker': '.'} plotParams.update(kwargs) return Quat.plotIPF(self.quatList, direction, self.crystalSym, **plotParams)
def plotRefOri(self, direction=np.array([0, 0, 1]), **kwargs): plotParams = {'marker': '+'} plotParams.update(kwargs) return Quat.plotIPF([self.refOri], direction, self.crystalSym, **plotParams)