Section outline

    • A common graphical representation of data is the box plot, which can be created using boxplot().

      signature boxplot

      Parameter name Explanations Required type Example
      data

      Table you are planning to use

      DataFrame, Series, dict, array, or list of arrays data=tableau
      x Variable of the table for the x-axis string corresponding to a variable of the table x="weight"
      y Variable of the table for the y-axis string corresponding to a variable of the table y=”height”
      hue Variable of the table to distinguish with colors string corresponding to a variable of the table hue=”age”
      dodge Variable allowing to choose if the content overlap Boolean dodge=False
      width Variable allowing to control the width of the boxes Float value  width=0.5
      gap Variable allowing to control the size of the gap between the "dodged" boxes Float value gap=0.1

      Here is an example of code that you can modify and run:

      Importation Code
      ← Running
      Cell 2
      ← Running


      By default, gap is set to 0. The orientation is handled automatically by Seaborn, but if the plot is two-dimensional with two numerical variables, it can be specified using orient, which can be set to "h" or "v".

      Cell 3
      ← Running

       

      log_scale allows you to change the scale. A numerical value specifies the base, which is 10 by default. If the plot is two-dimensional, two values can be provided, one for each axis.


      The violin plot is also available through violinplot().

      signature violinplot

      Parameter name Explanations Required type Example
      data

      Table you are planning to use

      DataFrame, Series, dict, array, or list of arrays data=tableau
      x Variable of the table for the x-axis string corresponding to a variable of the table x="weight"
      y Variable of the table for the y-axis string corresponding to a variable of the table y=”height”
      hue Variable of the table to distinguish with colors string corresponding to a variable of the table hue=”age”
      inner Variable allowing to choose the inner representation of the violin string corresponding to a type of representation inner=”box”,inner=”quart”,inner=”point”
      split Variable allowing to choose if the violin will be symetric Boolean split=True
      width Variable allowing to control the width of the violin Float value width=0.5
      dodge Variable allowing to choose if the content overlap Boolean dodge=False
      gap Variable allowing to control the size of the gap between the "dodged" violins Float value gap=0.1

      Here is an example of code to run:

      Cell 4
      ← Running
      split allows two distributions to be displayed on the same violin plot, as they are symmetrical. linewidth controls the thickness of the outline.

      We displayed the individual data points inside the violin plot, but we can instead choose to display a miniature box plot using inner="box":


      Cellule 5
      ← Running