FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib.github.com/examples/pyplots/boxplot_demo.py at master · HalidMahama/matplotlib.github.com · GitHub
HalidMahama
matplotlib.github.com
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib.github.com
/
examples
/
pyplots
/
boxplot_demo.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
64 lines (51 loc) · 1.73 KB
Breadcrumbs
matplotlib.github.com
/
examples
/
pyplots
/
boxplot_demo.py
Copy path
File metadata and controls
64 lines (51 loc) · 1.73 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/python
#
# Example boxplot code
#
import
numpy
as
np
import
matplotlib
.
pyplot
as
plt
# Fixing random state for reproducibility
np
.
random
.
seed
(
19680801
)
# fake up some data
spread
=
np
.
random
.
rand
(
50
)
*
100
center
=
np
.
ones
(
25
)
*
50
flier_high
=
np
.
random
.
rand
(
10
)
*
100
+
100
flier_low
=
np
.
random
.
rand
(
10
)
*
-
100
data
=
np
.
concatenate
((
spread
,
center
,
flier_high
,
flier_low
),
0
)
fig1
,
ax1
=
plt
.
subplots
()
ax1
.
set_title
(
'Basic Plot'
)
ax1
.
boxplot
(
data
)
fig2
,
ax2
=
plt
.
subplots
()
ax2
.
set_title
(
'Notched boxes'
)
ax2
.
boxplot
(
data
,
notch
=
True
)
green_diamond
=
dict
(
markerfacecolor
=
'g'
,
marker
=
'D'
)
fig3
,
ax3
=
plt
.
subplots
()
ax3
.
set_title
(
'Changed Outlier Symbols'
)
ax3
.
boxplot
(
data
,
flierprops
=
green_diamond
)
fig4
,
ax4
=
plt
.
subplots
()
ax4
.
set_title
(
'Hide Outlier Points'
)
ax4
.
boxplot
(
data
,
showfliers
=
False
)
red_square
=
dict
(
markerfacecolor
=
'r'
,
marker
=
's'
)
fig5
,
ax5
=
plt
.
subplots
()
ax5
.
set_title
(
'Horizontal Boxes'
)
ax5
.
boxplot
(
data
,
vert
=
False
,
flierprops
=
red_square
)
fig6
,
ax6
=
plt
.
subplots
()
ax6
.
set_title
(
'Shorter Whisker Length'
)
ax6
.
boxplot
(
data
,
flierprops
=
red_square
,
vert
=
False
,
whis
=
0.75
)
# fake up some more data
spread
=
np
.
random
.
rand
(
50
)
*
100
center
=
np
.
ones
(
25
)
*
40
flier_high
=
np
.
random
.
rand
(
10
)
*
100
+
100
flier_low
=
np
.
random
.
rand
(
10
)
*
-
100
d2
=
np
.
concatenate
((
spread
,
center
,
flier_high
,
flier_low
),
0
)
data
.
shape
=
(
-
1
,
1
)
d2
.
shape
=
(
-
1
,
1
)
# Making a 2-D array only works if all the columns are the
# same length. If they are not, then use a list instead.
# This is actually more efficient because boxplot converts
# a 2-D array into a list of vectors internally anyway.
data
=
[
data
,
d2
,
d2
[::
2
,
0
]]
fig7
,
ax7
=
plt
.
subplots
()
ax7
.
set_title
(
'Multiple Samples with Different sizes'
)
ax7
.
boxplot
(
data
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL