8000 MEP12-on-barchart_demo2.py by domspad · Pull Request #4685 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pylab to plt and np
  • Loading branch information
domspad committed Jul 14, 2015
commit 72989de9bcfebeaaa2f4af2f4ce9492b657372b0
57 changes: 26 additions & 31 deletions examples/pylab_examples/boxplot_demo.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,42 @@
#!/usr/bin/python

#
# Example boxplot code
#

from pylab import *
import matplotlib.pyplot as plt
import numpy as np

# fake up some data
spread = rand(50) * 100
center = ones(25) * 50
flier_high = rand(10) * 100 + 100
flier_low = rand(10) * -100
data = concatenate((spread, center, flier_high, flier_low), 0)
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)

# basic plot
boxplot(data)
plt.boxplot(data)

# notched plot
figure()
boxplot(data, 1)
plt.figure()
plt.boxplot(data, 1)

# change outlier point symbols
figure()
boxplot(data, 0, 'gD')
plt.figure()
plt.boxplot(data, 0, 'gD')

# don't show outlier points
figure()
boxplot(data, 0, '')
plt.figure()
plt.boxplot(data, 0, '')

# horizontal boxes
figure()
boxplot(data, 0, 'rs', 0)
plt.figure()
plt.boxplot(data, 0, 'rs', 0)

# change whisker length
figure()
boxplot(data, 0, 'rs', 0, 0.75)
plt.figure()
plt.boxplot(data, 0, 'rs', 0, 0.75)

# fake up some more data
spread = rand(50) * 100
center = ones(25) * 40
flier_high = rand(10) * 100 + 100
flier_low = rand(10) * -100
d2 = concatenate((spread, center, flier_high, flier_low), 0)
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)
#data = concatenate( (data, d2), 1 )
Expand All @@ -51,7 +46,7 @@
# a 2-D array into a list of vectors internally anyway.
data = [data, d2, d2[::2, 0]]
# multiple box plots on one figure
figure()
boxplot(data)
plt.figure()
plt.boxplot(data)

show()
plt.show()
0