Maxima – 234 – descriptive – 11


Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.734.

barsplot_description (...)
Function barsplot_description creates a graphic object suitable for creating complex scenes, together with other graphic objects.

barsplot in a multiplot context.

(%i1) load ("descriptive")$

(%i2) l1:makelist(random(10),k,1,50)$

(%i3) l2:makelist(random(10),k,1,100)$

(%i4) bp1 :
          box_width = 1,
          fill_density = 0.5,
          bars_colors = [blue],
          frequency = relative)$

(%i5) bp2 :
        box_width = 1,
        fill_density = 0.5,
        bars_colors = [red],
        frequency = relative)$

(%i6) draw(gr2d(bp1), gr2d(bp2))$


boxplot (data, option_1, option_2, ...)
This function plots box-and-whisker diagrams. Argument data can be a list, which is not of great interest, since these diagrams are mainly used for comparing different samples, or a matrix, so it is possible to compare two or more components of a multivariate statistical variable. But it is also allowed data to be a list of samples with possible different sample sizes, in fact this is the only function in package descriptive that admits this type of data structure.

The box is plotted from the first quartile to the third, with an horizontal segment situated at the second quartile or median. By default, lower and upper whiskers are plotted at the minimum and maximum values, respectively.

Option range can be used to indicate that values greater than quantile(x, 3/4) + range*(quantile(x, 3/4) - quantile(x,1/4)) or less than quantile(x, 1/4) - range*(quantile(x, 3/4) - quantile(x,1/4)) must be considered as outliers, in which case they are plotted as isolated points, and the whiskers are located at the extremes of the rest of the sample.

Available options are:

  • box_width (default, 3/4): relative width of boxes. This value must be in the range [0,1].
  • box_orientation (default, vertical): possible values: vertical and horizontal.
  • range (default, inf): positive coefficient of the interquartilic range to set outliers boundaries.
  • outliers_size (default, 1): circle size for isolated outliers.
  • All draw options, except points_joined, point_size, point_type, xtics, ytics, xrange, and yrange, which are internally assigned by boxplot. If you want to set your own values for this options or want to build complex scenes, make use of boxplot_description.
  • The following local draw options: key, color, and line_width.

There is also a function wxboxplot for creating embedded histograms in interfaces wxMaxima and iMaxima.

Box-and-whisker diagram from a multivariate sample.

(%i7) s2 : read_matrix(file_search(""))$

(%i8) boxplot(s2,
        box_width = 0.2,
        title = "Windspeed in knots",
        xlabel = "Stations",
        color = red,
        line_width = 2)$


Box-and-whisker diagram from three samples of different sizes.

(%i9) A :
        [[6, 4, 6, 2, 4, 8, 6, 4, 6, 4, 3, 2],
         [8, 10, 7, 9, 12, 8, 10],
         [16, 13, 17, 12, 11, 18, 13, 18, 14, 12]]$

(%i10) boxplot (A, box_orientation = horizontal)$


Option range can be used to handle outliers.

(%i11) B: [[7, 15, 5, 8, 6, 5, 7, 3, 1],
           [10, 8, 12, 8, 11, 9, 20],
           [23, 17, 19, 7, 22, 19]] $

(%i12) boxplot (B, range=1)$

(%i13) boxplot (B, range=1.5, box_orientation = horizontal)$

(%i14) draw2d(
            range = 1.5,
            line_width = 3,
            outliers_size = 2,
            color = red,
            background_color = light_gray),
            xtics = {["Low",1],["Medium",2],["High",3]}) $



boxplot_description (...)
Function boxplot_description creates a graphic object suitable for creating complex scenes, together with other graphic objects.

Posta un commento o usa questo indirizzo per il trackback.



Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:


Stai commentando usando il tuo account Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d blogger hanno fatto clic su Mi Piace per questo: