Debian Codegraph @

bqplot/examples/Marks/Pyplot/Boxplot.ipynb

raw
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": null,
6 "metadata": {
7 "collapsed": true,
8 "deletable": true,
9 "editable": true,
10 "input_collapsed": false
11 },
12 "outputs": [],
13 "source": [
14 "import numpy as np\n",
15 "import bqplot.pyplot as plt"
16 ]
17 },
18 {
19 "cell_type": "code",
20 "execution_count": null,
21 "metadata": {
22 "collapsed": true,
23 "deletable": true,
24 "editable": true,
25 "input_collapsed": false
26 },
27 "outputs": [],
28 "source": [
29 "x_data = [1, 2, 3, 4, 5, 6, 7]\n",
30 "\n",
31 "y_data = [\n",
32 " [160.10, 162.34, 161.82, 162.24, 161.44, 158.51, 157.68, 151.93, 151.41, 153.06, 155.38, 161.07, 160.51, 162.99, 161.86, 163.27, 164.05, 164.52, 162.67],\n",
33 " [161.54, 162.17, 161.95, 161.76, 162.15, 160.92, 160.64, 161.43, 161.89, 164.16, 164.16, 162.79, 161.92, 163.30, 163.49, 162.07, 161.46, 161.82, 162.65],\n",
34 " [164.40, 164.35, 163.46, 163.60, 161.87, 162.08, 162.18, 161.79, 163.23, 169.10, 182.05, 179.84, 181.75, 183.80, 183.52, 185.93, 186.42, 189.36, 185.71],\n",
35 " [188.67, 186.91, 187.17, 189.83, 189.64, 190.06, 189.01, 192.31, 191.62, 193.11, 194.00, 193.75, 192.80, 192.96, 191.81, 191.28, 191.72, 191.20, 190.68],\n",
36 " [191.95, 191.56, 192.30, 192.00, 192.25, 192.99, 191.16, 190.41, 191.23, 190.10, 190.07, 189.36, 187.38, 187.88, 191.81, 191.28, 191.72, 189.99, 190.14],\n",
37 " [187.95, 187.34, 187.47, 186.63, 184.30, 185.97, 187.10, 189.64, 189.15, 191.67, 194.00, 194.57, 195.78, 194.40, 195.24, 193.63, 190.85, 192.5, 192.49],\n",
38 " [192.36, 188.49, 189.86, 188.00, 187.70, 188.42, 187.22, 188.04, 188.53, 188.39, 186.35, 181.27, 181.71, 180.37, 180.72, 180.88, 182.14, 181.55, 182.82]\n",
39 "]"
40 ]
41 },
42 {
43 "cell_type": "code",
44 "execution_count": null,
45 "metadata": {
46 "collapsed": false,
47 "deletable": true,
48 "editable": true
49 },
50 "outputs": [],
51 "source": [
52 "fig = plt.figure()\n",
53 "# add x and y labels using axes_options\n",
54 "axes_options = {'x': {'label': 'X'}, 'y': {'label': 'Y'}}\n",
55 "boxes = plt.boxplot(x_data, y_data, box_fill_color='gray', outlier_fill_color='black', axes_options=axes_options)\n",
56 "fig"
57 ]
58 },
59 {
60 "cell_type": "code",
61 "execution_count": null,
62 "metadata": {
63 "collapsed": true,
64 "deletable": true,
65 "editable": true,
66 "input_collapsed": false
67 },
68 "outputs": [],
69 "source": [
70 "## setting the stroke and fill_color of the boxes and the outliers\n",
71 "boxes.stroke = 'red'\n",
72 "boxes.box_fill_color = 'blue'\n",
73 "boxes.outlier_fill_color = 'red'"
74 ]
75 },
76 {
77 "cell_type": "code",
78 "execution_count": null,
79 "metadata": {
80 "collapsed": true,
81 "deletable": true,
82 "editable": true
83 },
84 "outputs": [],
85 "source": [
86 "## changing the opacities of some of the boxes\n",
87 "boxes.opacities = [0.1, 0.2]"
88 ]
89 },
90 {
91 "cell_type": "code",
92 "execution_count": null,
93 "metadata": {
94 "collapsed": true,
95 "deletable": true,
96 "editable": true
97 },
98 "outputs": [],
99 "source": [
100 "## changing the width of the boxes\n",
101 "boxes.box_width = 10"
102 ]
103 }
104 ],
105 "metadata": {
106 "anaconda-cloud": {},
107 "kernelspec": {
108 "display_name": "Python 3",
109 "language": "python",
110 "name": "python3"
111 },
112 "language_info": {
113 "codemirror_mode": {
114 "name": "ipython",
115 "version": 3
116 },
117 "file_extension": ".py",
118 "mimetype": "text/x-python",
119 "name": "python",
120 "nbconvert_exporter": "python",
121 "pygments_lexer": "ipython3",
122 "version": "3.6.4"
123 }
124 },
125 "nbformat": 4,
126 "nbformat_minor": 1
127 }