def _plot_sec_eval(sec_eval): figure = CFigure(height=5, width=5) figure.sp.plot_sec_eval(sec_eval.sec_eval_data, label='SVM', marker='o', show_average=True, mean=True) figure.sp.title(sec_eval.attack.__class__.__name__) figure.subplots_adjust() figure.show()
def _plot_sec_eval(self): # figure creation figure = CFigure(height=5, width=5) sec_eval_data = [ sec_eval.sec_eval_data for sec_eval in self.sec_eval] # plot security evaluation figure.sp.plot_sec_eval(sec_eval_data, label='SVM', marker='o', show_average=True, mean=True) figure.subplots_adjust() figure.show()
from secml.array import CArray from secml.figure import CFigure n = 5 fig = CFigure() x = CArray.arange(100) y = 3. * CArray.sin(x * 2. * 3.14 / 100.) for i in range(n): temp = 510 + i sp = fig.subplot(n, 1, i) fig.sp.plot(x, y) # for add space from the figure's border you must increased default value parameters fig.subplots_adjust(bottom=0.4, top=0.85, hspace=0.001) fig.sp.xticklabels(()) fig.sp.yticklabels(()) fig.show()
from secml.array import CArray from secml.figure import CFigure fig = CFigure(fontsize=14) # example data mu = 100 # mean of distribution sigma = 15 # standard deviation of distribution x = mu + sigma * CArray.randn((10000, )) num_bins = 50 # the histogram of the data n, bins, patches = fig.sp.hist(x, num_bins, density=1, facecolor='green', alpha=0.5) # add a 'best fit' line y = bins.normpdf(mu, sigma) fig.sp.plot(bins, y, 'r--') fig.sp.xlabel('Smarts') fig.sp.ylabel('Probability') fig.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$') # Tweak spacing to prevent clipping of ylabel fig.subplots_adjust(left=0.15) fig.sp.grid() fig.show()