8000 [examples] final pep8 fixes by twmr · Pull Request #3774 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

[examples] final pep8 fixes #3774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Nov 15, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5cba226
fix trailing whitespace
twmr Nov 9, 2014
8cae397
fix multiple whitespace issues in svg_*.py examples (E293, E291)
twmr Nov 9, 2014
2f5b1e1
pep8 fix E201
twmr Nov 9, 2014
cc7fc7f
pep8 fix e2* in examples dir part 1/2
twmr Nov 9, 2014
b680680
pep8 fix e2* in examples dir part 2/2
twmr Nov 9, 2014
b081c92
pep8 fix E701
twmr Nov 9, 2014
0130bb9
pep8 fix E502 (redundant backslash)
twmr Nov 9, 2014
b959c79
pep8 fix e702,e703
twmr Nov 9, 2014
7122484
pep8 fix E302
twmr Nov 9, 2014
fa2ee50
remove blacklisted examples from coding style unittest
twmr Nov 9, 2014
eef2efc
ignore line to long errors for pep8 unit tests in examples/
twmr Nov 9, 2014
6289558
pep8 fix E124-E129
twmr Nov 9, 2014
16e1566
pep fix E401
twmr Nov 9, 2014
1e822e9
fix all issues in the output of the pep8 unit test
twmr Nov 9, 2014
85519f0
decrease the number of ignored pep8 error classes
twmr Nov 9, 2014
111cdab
consider @weathergods suggestions
twmr Nov 9, 2014
192a26c
prettify instantiation of ellipsecollection object
twmr Nov 9, 2014
e53ba3e
avoid triple quoted string
twmr Nov 9, 2014
3bd0f57
fix mutable default arguments
twmr Nov 9, 2014
2da662b
don't use implicit tuple assignment
twmr Nov 9, 2014
cb0467d
prettify instantiation of Linecollection obj even further
twmr Nov 9, 2014
2cb5403
Revert "pep8 fix E201"
twmr Nov 10, 2014
a79053c
fix pep8 unit tests
twmr Nov 15, 2014
9591cb8
minor cleanup in pipong example (0 + value)
twmr Nov 15, 2014
eab5b52
fixed extraneous whitespace
twmr Nov 15, 2014
2303939
fix pep8 violations in the new boxplot examples
twmr Nov 15, 2014
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
pep8 fix E502 (redundant backslash)
  • Loading branch information
twmr committed Nov 15, 2014
commit 0130bb90e0d1257e7c51a0a3dc75911217ee08a7
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
big_im_path = cbook.get_sample_data('necked_tensile_specimen.png')
big_im = plt.imread(big_im_path)
# Define small image
small_im = np.array([[0.25, 0.75, 1.0, 0.75], [0.1, 0.65, 0.5, 0.4], \
small_im = np.array([[0.25, 0.75, 1.0, 0.75], [0.1, 0.65, 0.5, 0.4],
[0.6, 0.3, 0.0, 0.2], [0.7, 0.9, 0.4, 0.6]])

# Create a 2x2 table of plots
Expand All @@ -32,7 +32,7 @@
ax.imshow(small_im, interpolation='none')
ax = plt.subplot(2, 2, 4)
ax.imshow(small_im, interpolation='nearest')
plt.subplots_adjust(left=0.24, wspace=0.2, hspace=0.1, \
plt.subplots_adjust(left=0.24, wspace=0.2, hspace=0.1,
bottom=0.05, top=0.86)

# Label the rows and columns of the table
Expand Down
32 changes: 16 additions & 16 deletions examples/pylab_examples/arrow_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""
from pylab import *

rates_to_bases = {'r1': 'AT', 'r2': 'TA', 'r3': 'GA', 'r4': 'AG', 'r5': 'CA', 'r6': 'AC', \
rates_to_bases = {'r1': 'AT', 'r2': 'TA', 'r3': 'GA', 'r4': 'AG', 'r5': 'CA', 'r6': 'AC',
'r7': 'GT', 'r8': 'TG', 'r9': 'CT', 'r10': 'TC', 'r11': 'GC', 'r12': 'CG'}
numbered_bases_to_rates = dict([(v, k) for k, v in rates_to_bases.items()])
lettered_bases_to_rates = dict([(v, 'r' + v) for k, v in rates_to_bases.items()])
Expand All @@ -24,10 +24,10 @@ def add_dicts(d1, d2):
return result


def make_arrow_plot(data, size=4, display='length', shape='right', \
max_arrow_width=0.03, arrow_sep=0.02, alpha=0.5, \
normalize_data=False, ec=None, labelcolor=None, \
head_starts_at_zero=True, rate_labels=lettered_bases_to_rates,\
def make_arrow_plot(data, size=4, display='length', shape='right',
max_arrow_width=0.03, arrow_sep=0.02, alpha=0.5,
normalize_data=False, ec=None, labelcolor=None,
head_starts_at_zero=True, rate_labels=lettered_bases_to_rates,
**kwargs):
"""Makes an arrow plot.

Expand All @@ -53,11 +53,11 @@ def make_arrow_plot(data, size=4, display='length', shape='right', \
max_text_size = size*12
min_text_size = size
label_text_size = size*2.5
text_params = {'ha': 'center', 'va': 'center', 'family': 'sans-serif',\
text_params = {'ha': 'center', 'va': 'center', 'family': 'sans-serif',
'fontweight': 'bold'}
r2 = sqrt(2 8000 )

deltas = {\
deltas = {
'AT': (1, 0),
'TA': (-1, 0),
'GA': (0, 1),
Expand All @@ -72,7 +72,7 @@ def make_arrow_plot(data, size=4, display='length', shape='right', \
'CG': (-1, 0)
}

colors = {\
colors = {
'AT': 'r',
'TA': 'k',
'GA': 'g',
Expand All @@ -87,7 +87,7 @@ def make_arrow_plot(data, size=4, display='length', shape='right', \
'CG': 'b'
}

label_positions = {\
label_positions = {
'AT': 'center',
'TA': 'center',
'GA': 'center',
Expand All @@ -103,7 +103,7 @@ def make_arrow_plot(data, size=4, display='length', shape='right', \
}

def do_fontsize(k):
return float(clip(max_text_size*sqrt(data[k]),\
return float(clip(max_text_size*sqrt(data[k]),
min_text_size, max_text_size))

A = text(0, 1, '$A_3$', color='r', size=do_fontsize('A'), **text_params)
Expand All @@ -117,7 +117,7 @@ def do_fontsize(k):
max_arrow_width = max_arrow_width
max_head_width = 2.5*max_arrow_width
max_head_length = 2*max_arrow_width
arrow_params = {'length_includes_head': True, 'shape': shape, \
arrow_params = {'length_includes_head': True, 'shape': shape,
'head_starts_at_zero': head_starts_at_zero}
ax = gca()
sf = 0.6 # max arrow size represents this in data coords
Expand All @@ -126,7 +126,7 @@ def do_fontsize(k):
r2v = arrow_sep/r2 # offset for diags

# tuple of x, y for start position
positions = {\
positions = {
'AT': (arrow_h_offset, 1 + arrow_sep),
'TA': (1 - arrow_h_offset, 1 - arrow_sep),
'GA': (-arrow_sep, arrow_h_offset),
Expand Down Expand Up @@ -179,8 +179,8 @@ def draw_arrow(pair, alpha=alpha, ec=ec, labelcolor=labelcolor):

x_scale, y_scale = deltas[pair]
x_pos, y_pos = positions[pair]
arrow(x_pos, y_pos, x_scale*length, y_scale*length, \
fc=fc, ec=ec, alpha=alpha, width=width, head_width=head_width, \
arrow(x_pos, y_pos, x_scale*length, y_scale*length,
fc=fc, ec=ec, alpha=alpha, width=width, head_width=head_width,
head_length=head_length, **arrow_params)

# figure out coordinates for text
Expand Down Expand Up @@ -209,14 +209,14 @@ def draw_arrow(pair, alpha=alpha, ec=ec, labelcolor=labelcolor):
orig_label = rate_labels[pair]
label = '$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:])

text(x, y, label, size=label_text_size, ha='center', va='center', \
text(x, y, label, size=label_text_size, ha='center', va='center',
color=labelcolor or fc)

for p in positions.keys():
draw_arrow(p)

# test data
all_on_max = dict([(i, 1) for i in 'TCAG'] + \
all_on_max = dict([(i, 1) for i in 'TCAG'] +
[(i + j, 0.6) for i in 'TCAG' for j in 'TCAG'])

realistic_data = {
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/line_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# See matplotlib.collections.LineCollection for more information
line_segments = LineCollection(segs,
linewidths=(0.5, 1, 1.5, 2),
colors = [colorConverter.to_rgba(i) \
colors = [colorConverter.to_rgba(i)
for i in ('b', 'g', 'r', 'c', 'm', 'y', 'k')],
linestyle = 'solid')
ax.add_collection(line_segments)
Expand Down
12 changes: 6 additions & 6 deletions examples/user_interfaces/fourier_demo_wx.py
< 4E00 td class="blob-code blob-code-context js-file-line"> verticalalignment='top', transform=self.subplot1.transAxes)
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,16 @@ def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)

self.fourierDemoWindow = FourierDemoWindow(self)
self.frequencySliderGroup = SliderGroup(self, label='Frequency f0:', \
self.frequencySliderGroup = SliderGroup(self, label='Frequency f0:',
param=self.fourierDemoWindow.f0)
self.amplitudeSliderGroup = SliderGroup(self, label=' Amplitude a:', \
self.amplitudeSliderGroup = SliderGroup(self, label=' Amplitude a:',
param=self.fourierDemoWindow.A)

sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.fourierDemoWindow, 1, wx.EXPAND)
sizer.Add(self.frequencySliderGroup.sizer, 0, \
sizer.Add(self.frequencySliderGroup.sizer, 0,
wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5)
sizer.Add(self.amplitudeSliderGroup.sizer, 0, \
sizer.Add(self.amplitudeSliderGroup.sizer, 0,
wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5)
self.SetSizer(sizer)

Expand Down Expand Up @@ -183,9 +183,9 @@ def draw(self):
self.subplot1.set_ylim([0, 1])
self.subplot2.set_xlim([-2, 2])
self.subplot2.set_ylim([-2, 2])
self.subplot1.text(0.05, .95, r'$X(f) = \mathcal{F}\{x(t)\}$', \
self.subplot1.text(0.05, .95, r'$X(f) = \mathcal{F}\{x(t)\}$',
self.subplot2.text(0.05, .95, r'$x(t) = a \cdot \cos(2\pi f_0 t) e^{-\pi t^2}$', \
self.subplot2.text(0.05, .95, r'$x(t) = a \cdot \cos(2\pi f_0 t) e^{-\pi t^2}$',
verticalalignment='top', transform=self.subplot2.transAxes)

def compute(self, f0, A):
Expand Down
0