Skip to content

Do not use camel case for variables in examples #16199

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 1 commit into from
Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions examples/animation/random_walk.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def gen_rand_line(length, dims=2):
return line_data


def update_lines(num, dataLines, lines):
for line, data in zip(lines, dataLines):
def update_lines(num, data_lines, lines):
for line, data in zip(lines, data_lines):
# NOTE: there is no .set_data() for 3 dim data...
line.set_data(data[0:2, :num])
line.set_3d_properties(data[2, :num])
Expand Down
4 changes: 2 additions & 2 deletions examples/axisartist/demo_parasite_axes2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
the :doc:`/gallery/ticks_and_spines/multiple_yaxis_with_spines` example.
"""
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
from mpl_toolkits import axisartist
import matplotlib.pyplot as plt

host = host_subplot(111, axes_class=AA.Axes)
host = host_subplot(111, axes_class=axisartist.Axes)
plt.subplots_adjust(right=0.75)

par1 = host.twinx()
Expand Down
4 changes: 2 additions & 2 deletions examples/axisartist/simple_axisartist1.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

"""
import matplotlib.pyplot as plt
import mpl_toolkits.axisartist as AA
from mpl_toolkits import axisartist

fig = plt.figure()
fig.subplots_adjust(right=0.85)
ax = AA.Subplot(fig, 1, 1, 1)
ax = axisartist.Subplot(fig, 1, 1, 1)
fig.add_subplot(ax)

# make some axis invisible
Expand Down
16 changes: 8 additions & 8 deletions examples/misc/patheffect_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"""
import matplotlib.pyplot as plt
import matplotlib.patheffects as PathEffects
from matplotlib import patheffects
import numpy as np

plt.figure(figsize=(8, 3))
Expand All @@ -15,13 +15,13 @@
arrowprops=dict(arrowstyle="->",
connectionstyle="angle3", lw=2),
size=20, ha="center",
path_effects=[PathEffects.withStroke(linewidth=3,
path_effects=[patheffects.withStroke(linewidth=3,
foreground="w")])
txt.arrow_patch.set_path_effects([
PathEffects.Stroke(linewidth=5, foreground="w"),
PathEffects.Normal()])
patheffects.Stroke(linewidth=5, foreground="w"),
patheffects.Normal()])

pe = [PathEffects.withStroke(linewidth=3,
pe = [patheffects.withStroke(linewidth=3,
foreground="w")]
ax1.grid(True, linestyle="-", path_effects=pe)

Expand All @@ -31,16 +31,16 @@
cntr = ax2.contour(arr, colors="k")

plt.setp(cntr.collections, path_effects=[
PathEffects.withStroke(linewidth=3, foreground="w")])
patheffects.withStroke(linewidth=3, foreground="w")])

clbls = ax2.clabel(cntr, fmt="%2.0f", use_clabeltext=True)
plt.setp(clbls, path_effects=[
PathEffects.withStroke(linewidth=3, foreground="w")])
patheffects.withStroke(linewidth=3, foreground="w")])

# shadow as a path effect
ax3 = plt.subplot(133)
p1, = ax3.plot([0, 1], [0, 1])
leg = ax3.legend([p1], ["Line 1"], fancybox=True, loc='upper left')
leg.legendPatch.set_path_effects([PathEffects.withSimplePatchShadow()])
leg.legendPatch.set_path_effects([patheffects.withSimplePatchShadow()])

plt.show()
8 changes: 4 additions & 4 deletions examples/statistics/barchart_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def plot_student_results(student, scores, cohort_size):
# Set the right-hand Y-axis ticks and labels
ax2 = ax1.twinx()

scoreLabels = [format_score(scores[k].score, k) for k in test_names]
score_labels = [format_score(scores[k].score, k) for k in test_names]

# set the tick locations
ax2.set_yticks(pos)
Expand All @@ -104,7 +104,7 @@ def plot_student_results(student, scores, cohort_size):
ax2.set_ylim(ax1.get_ylim())

# set the tick labels
ax2.set_yticklabels(scoreLabels)
ax2.set_yticklabels(score_labels)

ax2.set_ylabel('Test Scores')

Expand All @@ -122,7 +122,7 @@ def plot_student_results(student, scores, cohort_size):
# converting width to int type
width = int(rect.get_width())

rankStr = attach_ordinal(width)
rank_str = attach_ordinal(width)
# The bars aren't wide enough to print the ranking inside
if width < 40:
# Shift the text to the right side of the right edge
Expand All @@ -139,7 +139,7 @@ def plot_student_results(student, scores, cohort_size):

# Center the text vertically in the bar
yloc = rect.get_y() + rect.get_height() / 2
label = ax1.annotate(rankStr, xy=(width, yloc), xytext=(xloc, 0),
label = ax1.annotate(rank_str, xy=(width, yloc), xytext=(xloc, 0),
textcoords="offset points",
ha=align, va='center',
color=clr, weight='bold', clip_on=True)
Expand Down
13 changes: 7 additions & 6 deletions examples/subplots_axes_and_figures/secondary_axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,21 @@ def yday2date(x):
return y


secaxx = ax.secondary_xaxis('top', functions=(date2yday, yday2date))
secaxx.set_xlabel('yday [2018]')
secax_x = ax.secondary_xaxis('top', functions=(date2yday, yday2date))
secax_x.set_xlabel('yday [2018]')


def CtoF(x):
def celsius_to_fahrenheit(x):
return x * 1.8 + 32


def FtoC(x):
def fahrenheit_to_celsius(x):
return (x - 32) / 1.8


secaxy = ax.secondary_yaxis('right', functions=(CtoF, FtoC))
secaxy.set_ylabel(r'$T\ [^oF]$')
secax_y = ax.secondary_yaxis(
'right', functions=(celsius_to_fahrenheit, fahrenheit_to_celsius))
secax_y.set_ylabel(r'$T\ [^oF]$')

plt.show()

Expand Down