# -*- coding: utf-8 -*- """ Created on Thu Aug 11 16:22:27 2022 @author: Rene """ import numpy as np import matplotlib.pyplot as plt plt.rc('font', family='serif', size='10') Figure = plt.figure() Figure.set_figwidth(10) Figure.set_figheight(4) Figure.subplots_adjust(hspace=0.4, wspace=0.4) #******************************************************** LB_x = 1 UB_x = 10 off_set_x = 1 LB_y = 1 UB_y = 10 off_set_y = 1 x_lims = (LB_x-off_set_x,UB_x+off_set_x) y_lims = (LB_y-off_set_y,UB_y+off_set_y) Panel = Figure.add_subplot(1,2,1) n = 10 x = np.random.choice(a=n, size=n, replace=False) x = x + 1 plt.xlim(x_lims) plt.ylim(y_lims) plt.xlabel('i') plt.ylabel('$X_i$') ticks = np.arange(1,11) plt.xticks(ticks) plt.yticks(ticks) plt.grid(b=None, which='major', axis='both',ls='--',lw=0.5) Panel.title.set_text('Example 1: Sampling without Replacement') plt.scatter(ticks,x) for i in np.arange(0,10): text_str = str(x[i]) plt.text(ticks[i]+0.25,x[i],text_str,color='red', size = 15, horizontalalignment = 'left', verticalalignment = 'center') Panel = Figure.add_subplot(1,2,2) n = 10 x = np.random.choice(a=n, size=n, replace=False) x = x + 1 plt.xlim(x_lims) plt.ylim(y_lims) plt.xlabel('i') plt.ylabel('$X_i$') ticks = np.arange(1,11) plt.xticks(ticks) plt.yticks(ticks) plt.grid(b=None, which='major', axis='both',ls='--',lw=0.5) Panel.title.set_text('Example 2: Sampling without Replacement') plt.scatter(ticks,x) for i in np.arange(0,10): text_str = str(x[i]) plt.text(ticks[i]+0.25,x[i],text_str,color='red', size = 15, horizontalalignment = 'left', verticalalignment = 'center') plt.savefig("Example_sampling_without_replacement.png", dpi=300)