File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ def fit(self, hspy_data: np.ndarray):
130130 print ("Fit complete." )
131131 return self .components_ , self .abundance_maps_
132132
133- def plot_results (self , ** kwargs ):
133+ def plot_results (self , x_axis_vals = None , x_axis_units = None , ** kwargs ):
134134 if self .components_ is None :
135135 print ("You must run .fit() first." )
136136 return
@@ -143,9 +143,10 @@ def plot_results(self, **kwargs):
143143
144144 for i in range (self .n_components ):
145145 # Plot component spectrum
146- axes [0 , i ].plot (self .components_ [i , :])
146+ xaxis = x_axis_vals if x_axis_vals is not None else np .arange (0 , self .components_ .shape [- 1 ])
147+ axes [0 , i ].plot (xaxis , self .components_ [i , :])
147148 axes [0 , i ].set_title (f'{ self .method .upper ()} Component { i + 1 } ' )
148- axes [0 , i ].set_xlabel ('Energy Bin' )
149+ axes [0 , i ].set_xlabel (x_axis_units if x_axis_units is not None else 'Energy Bin' )
149150 if i == 0 :
150151 axes [0 , i ].set_ylabel ('Intensity' )
151152
You can’t perform that action at this time.
0 commit comments