@@ -264,7 +264,11 @@ define([
264264code . appendLine ( "with warnings.catch_warnings():" ) ;
265265code . appendLine ( " warnings.simplefilter(action='ignore', category=Warning)" ) ;
266266if ( this . distList [ 0 ] . child . includes ( distType ) ) {
267- code . appendFormatLine ( " sns.countplot(x={0})" , allocateTo ) ;
267+ if ( distType === 'multinomial' ) {
268+ code . appendFormatLine ( " plt.boxplot(x={0})" , allocateTo ) ;
269+ } else {
270+ code . appendFormatLine ( " sns.countplot(x={0})" , allocateTo ) ;
271+ }
268272} else {
269273code . appendFormatLine ( " sns.histplot({0}, stat='density', kde=True)" , allocateTo ) ;
270274}
@@ -291,15 +295,23 @@ define([
291295code . appendLine ( "plt.xlabel('$x$')" ) ;
292296code . appendLine ( "plt.ylabel('$p(x)$')" ) ;
293297code . append ( "plt.show()" ) ;
294- } else if ( distType === 'binomial' || distType === 'multinomial' ) {
295- let { n= 10 } = this . state ;
298+ } else if ( distType === 'binomial' ) {
299+ var { n= 10 } = this . state ;
296300code . appendFormatLine ( "plt.bar(range(0,{0}), _rv.pmf(range(0,{1})))" , n , n ) ;
297301code . appendFormatLine ( "plt.title('Probability mass function: {0}')" , label . replace ( "'" , "\\'" ) ) ;
298302code . appendFormatLine ( "plt.xlim(-1, {0})" , n ) ;
299303code . appendFormatLine ( "plt.xticks(range(0, {0}), ['x='+str(i) for i in range(0, {1})])" , n , n ) ;
300304code . appendLine ( "plt.xlabel('$x$')" ) ;
301305code . appendLine ( "plt.ylabel('$p(x)$')" ) ;
302306code . append ( "plt.show()" ) ;
307+ } else if ( distType === 'multinomial' ) {
308+ code . appendFormatLine ( "for i in range(0, {0}.shape[1]):" , allocateTo ) ;
309+ code . appendLine ( " plt.subplot(2, 2, i+1)" ) ;
310+ code . appendLine ( " plt.title('$x$=' + str(i))" ) ;
311+ code . appendFormatLine ( " sns.countplot(x=[ x[i] for x in {0} ])" , allocateTo ) ;
312+ code . appendLine ( "plt.suptitle('Probability mass function: Multinomial')" ) ;
313+ code . appendLine ( "plt.tight_layout()" ) ;
314+ code . appendLine ( "plt.show()" ) ;
303315}
304316}
305317} else {