Skip to content

Style changes omnibus PR #5774

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 33 commits into from
Feb 8, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
14281fd
Change default image interpolation to nearest
jenshnielsen Jul 10, 2015
76c70be
Change docstring to reflect new default interpolation
jenshnielsen Jul 10, 2015
bba003f
fix typo
jenshnielsen Nov 6, 2015
86b7a59
fix #4854: set default numpoints of legend entries to 1
gauteh Sep 24, 2015
d2f6bea
Fix #5419: Set default figure background to white
mdboom Dec 14, 2015
87ba8b0
Don't plot errorbar caps by default
mdboom Dec 14, 2015
38d4e31
Grey solid tick lines
mdboom Nov 8, 2015
5317d35
API: use 'best' for default legend location
tacaswell Nov 9, 2015
5695389
Outward ticks (Fix #4502)
mdboom Nov 16, 2015
3e7471a
Use "new" blue by default
mdboom Nov 16, 2015
28c632f
Change default color map (Fix #875)
mdboom Nov 16, 2015
4472125
Use Vega collection10 colors instead
mdboom Nov 17, 2015
f45e9bc
Rounded corners on legend box
mdboom Dec 14, 2015
4513182
Fix #4700: Use overlay by default
mdboom Nov 17, 2015
09b29d8
Simplify examples to use defaults more often
mdboom Nov 25, 2015
3abcb95
Add what's new
mdboom Dec 14, 2015
f2ac1bb
Document Xtick.minor.visible
mdboom Dec 14, 2015
318a044
Use image.resample == True
mdboom Dec 31, 2015
417db2f
Update test images
mdboom Dec 31, 2015
82558ee
Revert some changes caught by @QuLogic in review
mdboom Jan 21, 2016
c5864ce
Fix typo
mdboom Jan 22, 2016
30b4341
Update test images
mdboom Dec 31, 2015
0f4e3a6
Improve what's new
mdboom Jan 25, 2016
c44bd3d
Fix formatting
mdboom Jan 25, 2016
fa4c56e
Change figure background for real
mdboom Jan 25, 2016
caa711b
More detail in what's new
mdboom Jan 26, 2016
c2580a5
Remove info about Blues colormap -- we're punting
mdboom Jan 26, 2016
f0e98fa
USe tight_layout rather than hardcoded space
mdboom Jan 26, 2016
7718b15
Don't use jet
mdboom Jan 26, 2016
0aae0f0
Don't hardcode linewidth
mdboom Jan 26, 2016
f21d5cf
Fix comment
mdboom Jan 26, 2016
31f28bc
Fix comment
mdboom Jan 26, 2016
b394ae7
Add missing test file
mdboom Jan 27, 2016
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
Simplify examples to use defaults more often
  • Loading branch information
mdboom committed Jan 25, 2016
commit 09b29d80880bc47d43e36aba981743c85f6732b5
6 changes: 3 additions & 3 deletions examples/api/demo_affine_image.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def imshow_affine(ax, z, *kl, **kwargs):

fig, (ax1, ax2) = plt.subplots(1, 2)
Z = get_image()
im1 = imshow_affine(ax1, Z, interpolation='none', cmap=cm.jet,
im1 = imshow_affine(ax1, Z, interpolation='none',
origin='lower',
extent=[-2, 4, -3, 2], clip_on=True)

Expand All @@ -48,15 +48,15 @@ def imshow_affine(ax, z, *kl, **kwargs):
x1, x2, y1, y2 = im1.get_extent()
x3, y3 = x2, y1

ax1.plot([x1, x2, x2, x1, x1], [y1, y1, y2, y2, y1], "r--", lw=3,
ax1.plot([x1, x2, x2, x1, x1], [y1, y1, y2, y2, y1], "--",
transform=trans_data2)

ax1.set_xlim(-3, 5)
ax1.set_ylim(-4, 4)

# image skew

im2 = ax2.imshow(Z, interpolation='none', cmap=cm.jet,
im2 = ax2.imshow(Z, interpolation='none',
origin='lower',
extent=[-2, 4, -3, 2], clip_on=True)
im2._image_skew_coordinate = (3, -2)
Expand Down
8 changes: 6 additions & 2 deletions examples/api/filled_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ def filled_hist(ax, edges, values, bottoms=None, orientation='v',
values = np.r_[values, values[-1]]
bottoms = np.r_[bottoms, bottoms[-1]]
if orientation == 'h':
return ax.fill_betweenx(edges, values, bottoms, **kwargs)
return ax.fill_betweenx(edges, values, bottoms, left_margin=False,
**kwargs)
elif orientation == 'v':
return ax.fill_between(edges, values, bottoms, **kwargs)
return ax.fill_between(edges, values, bottoms, bottom_margin=False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like some sort of suggested change that people should make, but it isn't noted in the change list above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. I'll add this to the existing bullet point about limits.

**kwargs)
else:
raise AssertionError("you should never be here")

Expand Down Expand Up @@ -206,3 +208,5 @@ def stack_hist(ax, stacked_data, sty_cycle, bottoms=None,
ax1.set_xlabel('counts')
ax1.set_ylabel('x')
ax2.set_ylabel('x')

plt.show()
3 changes: 1 addition & 2 deletions examples/api/histogram_path_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
barpath = path.Path.make_compound_path_from_polys(XY)

# make a patch out of it
patch = patches.PathPatch(
barpath, facecolor='blue', edgecolor='gray', alpha=0.8)
patch = patches.PathPatch(barpath, facecolor='blue')
ax.add_patch(patch)

# update the view limits
Expand Down
2 changes: 1 addition & 1 deletion examples/api/image_zcoord.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
X = 10*np.random.rand(5, 3)

fig, ax = plt.subplots()
ax.imshow(X, cmap=cm.jet, interpolation='nearest')
ax.imshow(X, interpolation='nearest')

numrows, numcols = X.shape

Expand Down
2 changes: 1 addition & 1 deletion examples/api/patch_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
patches.append(polygon)

colors = 100*np.random.rand(len(patches))
p = PatchCollection(patches, cmap=matplotlib.cm.jet, alpha=0.4)
p = PatchCollection(patches, alpha=0.4)
p.set_array(np.array(colors))
ax.add_collection(p)
plt.colorbar(p)
Expand Down
5 changes: 3 additions & 2 deletions examples/api/power_norm_demo.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@

for i, gamma in enumerate(gammas):
plt.subplot(xgrid, ygrid, i + 2)
plt.title('Power law normalization\n$(\gamma=%1.1f)$' % gamma)
plt.title('Power law\n$(\gamma=%1.1f)$' % gamma)
plt.hist2d(data[:, 0], data[:, 1],
bins=100, norm=mcolors.PowerNorm(gamma))

plt.subplots_adjust(hspace=0.39)
plt.subplots_adjust(hspace=0.8)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uhm, that's a lot of space...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it's required to make room for the text. I suppose I could use tight_layout instead... that seems to work and it less "tweaky".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think tight_layout makes more sense, too. Should probably consider it in more places, too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than calling plt.tight_layout() perhaps it would be better to use the tight_layout figure kwarg, or the rcParams['figure.autolayout'] setting. The difference, I believe, is that the pyplot function adjusts once, but the kwarg causes readjustment at draw time when the figure is resized.

plt.savefig("test.png")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems unnecessary.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean just the saving, not the spacing change, right? I agree about the saving -- I think that's just left in accidentally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, just the saving.

plt.show()
6 changes: 2 additions & 4 deletions examples/api/sankey_demo_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@
orientations=[-1, 1, 0, 1, 1, 1, -1, -1, 0],
pathlengths=[0.25, 0.25, 0.25, 0.25, 0.25, 0.6, 0.25, 0.25,
0.25],
patchlabel="Widget\nA",
alpha=0.2, lw=2.0) # Arguments to matplotlib.patches.PathPatch()
patchlabel="Widget\nA") # Arguments to matplotlib.patches.PathPatch()
diagrams = sankey.finish()
diagrams[0].patch.set_facecolor('#37c959')
diagrams[0].texts[-1].set_color('r')
diagrams[0].text.set_fontweight('bold')
# Notice:
Expand All @@ -66,7 +64,7 @@
sankey = Sankey(ax=ax, unit=None)
sankey.add(flows=flows, label='one',
orientations=[-1, 1, 0, 1, 1, 1, -1, -1, 0])
sankey.add(flows=[-0.25, 0.15, 0.1], fc='#37c959', label='two',
sankey.add(flows=[-0.25, 0.15, 0.1], label='two',
orientations=[-1, -1, -1], prior=0, connect=(0, 0))
diagrams = sankey.finish()
diagrams[-1].patch.set_hatch('/')
Expand Down
5 changes: 2 additions & 3 deletions examples/api/sankey_demo_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
def side(sankey, n=1):
"""Generate a side chain."""
prior = len(sankey.diagrams)
colors = cycle(['orange', 'b', 'g', 'r', 'c', 'm', 'y'])
for i in range(0, 2*n, 2):
sankey.add(flows=[1, -1], orientations=[-1, -1],
patchlabel=str(prior + i), facecolor=next(colors),
patchlabel=str(prior + i),
prior=prior + i - 1, connect=(1, 0), alpha=0.5)
sankey.add(flows=[1, -1], orientations=[1, 1],
patchlabel=str(prior + i + 1), facecolor=next(colors),
patchlabel=str(prior + i + 1),
prior=prior + i, connect=(1, 0), alpha=0.5)


Expand Down
2 changes: 1 addition & 1 deletion examples/api/sankey_demo_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def put_labels(labels, positions, output=True):

patch, (intexts, outtexts) = sankey(ax, outputs=outputs,
outlabels=outlabels, inputs=inputs,
inlabels=None, fc='g', alpha=0.2)
inlabels=None)
outtexts[1].set_color('r')
outtexts[-1].set_fontweight('bold')

Expand Down
6 changes: 3 additions & 3 deletions examples/api/skewt.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ def _set_lim_and_transforms(self):

# Plot the data using normal plotting functions, in this case using
# log scaling in Y, as dicatated by the typical meteorological plot
ax.semilogy(T, p, 'r')
ax.semilogy(Td, p, 'g')
ax.semilogy(T, p)
ax.semilogy(Td, p)

# An example of a slanted line at constant X
l = ax.axvline(0, color='b')
l = ax.axvline(0)

# Disables the log-formatting that comes with semilogy
ax.yaxis.set_major_formatter(ScalarFormatter())
Expand Down
2 changes: 1 addition & 1 deletion examples/lines_bars_and_markers/barh_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
performance = 3 + 10 * np.random.rand(len(people))
error = np.random.rand(len(people))

plt.barh(y_pos, performance, xerr=error, align='center', alpha=0.4)
plt.barh(y_pos, performance, xerr=error, align='center')
plt.yticks(y_pos, people)
plt.xlabel('Performance')
plt.title('How fast do you want to go today?')
Expand Down
5 changes: 2 additions & 3 deletions examples/lines_bars_and_markers/fill_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import numpy as np
import matplotlib.pyplot as plt


x = np.linspace(0, 1)
x = np.linspace(0, 1, 500)
y = np.sin(4 * np.pi * x) * np.exp(-5 * x)

plt.fill(x, y, 'r')
plt.fill(x, y)
plt.grid(True)
plt.show()
2 changes: 1 addition & 1 deletion examples/lines_bars_and_markers/fill_demo_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0, 2 * np.pi, 100)
x = np.linspace(0, 2 * np.pi, 500)
y1 = np.sin(x)
y2 = np.sin(3 * x)
plt.fill(x, y1, 'b', x, y2, 'r', alpha=0.3)
Expand Down
2 changes: 1 addition & 1 deletion examples/lines_bars_and_markers/line_demo_dash_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import matplotlib.pyplot as plt


x = np.linspace(0, 10)
x = np.linspace(0, 10, 500)
line, = plt.plot(x, np.sin(x), '--', linewidth=2)

dashes = [10, 5, 100, 5] # 10 points on, 5 off, 100 on, 5 off
Expand Down
2 changes: 1 addition & 1 deletion examples/lines_bars_and_markers/line_styles_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def nice_repr(text):

linestyles = ['-', '--', '-.', ':']
for y, linestyle in enumerate(linestyles):
ax.text(-0.5, y, nice_repr(linestyle), **text_style)
ax.text(-0.1, y, nice_repr(linestyle), **text_style)
ax.plot(y * points, linestyle=linestyle, color=color, linewidth=3)
format_axes(ax)
ax.set_title('line styles')
Expand Down
2 changes: 1 addition & 1 deletion examples/mplot3d/lorenz_attractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def lorenz(x, y, z, s=10, r=28, b=2.667):
fig = plt.figure()
ax = fig.gca(projection='3d')

ax.plot(xs, ys, zs)
ax.plot(xs, ys, zs, lw=0.5)
ax.set_xlabel("X Axis")
ax.set_ylabel("Y Axis")
ax.set_zlabel("Z Axis")
Expand Down
2 changes: 1 addition & 1 deletion examples/mplot3d/surface3d_demo3.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
colors[x, y] = colortuple[(x + y) % len(colortuple)]

surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, facecolors=colors,
linewidth=0, antialiased=False)
linewidth=0)

ax.set_zlim3d(-1, 1)
ax.w_zaxis.set_major_locator(LinearLocator(6))
Expand Down
2 changes: 1 addition & 1 deletion examples/mplot3d/trisurf3d_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
fig = plt.figure()
ax = fig.gca(projection='3d')

ax.plot_trisurf(x, y, z, cmap=cm.jet, linewidth=0.2)
ax.plot_trisurf(x, y, z, cmap=cm.jet, linewidth=0.2, antialiased=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably get rid of the use of Jet here. Also, isn't antialiasing turned on by default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

antialiasing is turned off on pcolormesh by default to get around the polygon edge gap problem.

I'll just take the explicit cmap kwarg off here (making it effectively viridis).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. Because we are taking the edges off of the polygons, the gaps would be apparent. How about we make antialiased=True be the default behavior of these functions so that users with existing codebases don't end up with ugly plots.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a change in behavior. pcolormesh has had no borders and antialiased=False for a long time. I don't think it makes sense to change that. The change here is just that it happens to look better with the new colormap on this specific data so why not?


plt.show()
11 changes: 5 additions & 6 deletions examples/pie_and_polar_charts/pie_demo_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
# The slices will be ordered and plotted counter-clockwise.
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sizes = [15, 30, 45, 10]
colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')

plt.pie(sizes, explode=explode, labels=labels, colors=colors,
plt.pie(sizes, explode=explode, labels=labels,
autopct='%1.1f%%', shadow=True, startangle=90)
# Set aspect ratio to be equal so that pie is drawn as a circle.
plt.axis('equal')
Expand All @@ -33,16 +32,16 @@
ax = fig.gca()
import numpy as np

ax.pie(np.random.random(4), explode=explode, labels=labels, colors=colors,
ax.pie(np.random.random(4), explode=explode, labels=labels,
autopct='%1.1f%%', shadow=True, startangle=90,
radius=0.25, center=(0, 0), frame=True)
ax.pie(np.random.random(4), explode=explode, labels=labels, colors=colors,
ax.pie(np.random.random(4), explode=explode, labels=labels,
autopct='%1.1f%%', shadow=True, startangle=90,
radius=0.25, center=(1, 1), frame=True)
ax.pie(np.random.random(4), explode=explode, labels=labels, colors=colors,
ax.pie(np.random.random(4), explode=explode, labels=labels,
autopct='%1.1f%%', shadow=True, startangle=90,
radius=0.25, center=(0, 1), frame=True)
ax.pie(np.random.random(4), explode=explode, labels=labels, colors=colors,
ax.pie(np.random.random(4), explode=explode, labels=labels,
autopct='%1.1f%%', shadow=True, startangle=90,
radius=0.25, center=(1, 0), frame=True)

Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/annotation_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

t = np.arange(0.0, 5.0, 0.01)
s = np.cos(2*np.pi*t)
line, = ax.plot(t, s, lw=3, color='purple')
line, = ax.plot(t, s, lw=3)

ax.annotate('axes center', xy=(.5, .5), xycoords='axes fraction',
horizontalalignment='center', verticalalignment='center')
Expand Down Expand Up @@ -97,7 +97,7 @@
ax = fig.add_subplot(111, projection='polar')
r = np.arange(0, 1, 0.001)
theta = 2*2*np.pi*r
line, = ax.plot(theta, r, color='#ee8d18', lw=3)
line, = ax.plot(theta, r)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linewidth was kept in the previous plot call, why not here, too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably take it off in both cases, actually, so it will take the new defaults. (This example isn't about how to change the linewidth).


ind = 800
thisr, thistheta = r[ind], theta[ind]
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/annotation_demo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

t = np.arange(0.0, 5.0, 0.01)
s = np.cos(2*np.pi*t)
line, = ax.plot(t, s, lw=3, color='purple')
line, = ax.plot(t, s, lw=3)

ax.annotate('arrowstyle', xy=(0, 1), xycoords='data',
xytext=(-50, 30), textcoords='offset points',
Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/bar_stacked.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
ind = np.arange(N) # the x locations for the groups
width = 0.35 # the width of the bars: can also be len(x) sequence

p1 = plt.bar(ind, menMeans, width, color='r', yerr=menStd)
p2 = plt.bar(ind, womenMeans, width, color='y',
p1 = plt.bar(ind, menMeans, width, yerr=menStd)
p2 = plt.bar(ind, womenMeans, width,
bottom=menMeans, yerr=womenStd)

plt.ylabel('Scores')
Expand Down
6 changes: 4 additions & 2 deletions examples/pylab_examples/figure_title.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ def f(t):


plt.subplot(121)
plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k')
plt.plot(t1, f(t1), 'o', t2, f(t2), '-')
plt.title('subplot 1')
plt.ylabel('Damped oscillation')
plt.suptitle('This is a somewhat long figure title', fontsize=16)


plt.subplot(122)
plt.plot(t3, np.cos(2*np.pi*t3), 'r--')
plt.plot(t3, np.cos(2*np.pi*t3), '--')
plt.xlabel('time (s)')
plt.title('subplot 2')
plt.ylabel('Undamped')

plt.subplots_adjust(left=0.2, wspace=0.8, top=0.8)

plt.show()
6 changes: 3 additions & 3 deletions examples/pylab_examples/fill_betweenx_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
ax3 = fig.add_subplot(313, sharex=ax1)

ax1.fill_betweenx(x, 0, y1)
ax1.set_ylabel('between y1 and 0')
ax1.set_ylabel('(y1, 0)')

ax2.fill_betweenx(x, y1, 1)
ax2.set_ylabel('between y1 and 1')
ax2.set_ylabel('(y1, 1)')

ax3.fill_betweenx(x, y1, y2)
ax3.set_ylabel('between y1 and y2')
ax3.set_ylabel('(y1, y2)')
ax3.set_xlabel('x')

# now fill between y1 and y2 where a logical condition is met. Note
Expand Down
12 changes: 8 additions & 4 deletions examples/pylab_examples/geo_demo.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import matplotlib.pyplot as plt

plt.subplot(221, projection="aitoff")
plt.figure()
plt.subplot(111, projection="aitoff")
plt.title("Aitoff")
plt.grid(True)

plt.subplot(222, projection="hammer")
plt.figure()
plt.subplot(111, projection="hammer")
plt.title("Hammer")
plt.grid(True)

plt.subplot(223, projection="lambert")
plt.figure()
plt.subplot(111, projection="lambert")
plt.title("Lambert")
plt.grid(True)

plt.subplot(224, projection="mollweide")
plt.figure()
plt.subplot(111, projection="mollweide")
plt.title("Mollweide")
plt.grid(True)

Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/griddata_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
zi = griddata(x, y, z, xi, yi, interp='linear')
# contour the gridded data, plotting dots at the nonuniform data points.
CS = plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k')
CS = plt.contourf(xi, yi, zi, 15, cmap=plt.cm.rainbow,
CS = plt.contourf(xi, yi, zi, 15,
vmax=abs(zi).max(), vmin=-abs(zi).max())
plt.colorbar() # draw colorbar
# plot data points.
plt.scatter(x, y, marker='o', c='b', s=5, zorder=10)
plt.scatter(x, y, marker='o', s=5, zorder=10)
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.title('griddata test (%d points)' % npts)
Expand Down
4 changes: 2 additions & 2 deletions examples/pylab_examples/legend_demo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# extracts the first element of the list into l1 using tuple
# unpacking. So l1 is a Line2D instance, not a sequence of lines
l1, = plt.plot(t2, np.exp(-t2))
l2, l3 = plt.plot(t2, np.sin(2 * np.pi * t2), '--go', t1, np.log(1 + t1), '.')
l4, = plt.plot(t2, np.exp(-t2) * np.sin(2 * np.pi * t2), 'rs-.')
l2, l3 = plt.plot(t2, np.sin(2 * np.pi * t2), '--o', t1, np.log(1 + t1), '.')
l4, = plt.plot(t2, np.exp(-t2) * np.sin(2 * np.pi * t2), 's-.')

plt.legend((l2, l4), ('oscillatory', 'damped'), loc='upper right', shadow=True)
plt.xlabel('time')
Expand Down
1 change: 1 addition & 0 deletions examples/pylab_examples/legend_demo4.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
bottom_ax.stem([0.3, 1.5, 2.7], [1, 3.6, 2.7], label="stem test")
bottom_ax.legend()

plt.subplots_adjust(hspace=0.7)
plt.show()
2 changes: 1 addition & 1 deletion examples/pylab_examples/mathtext_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
fig = figure()
fig.subplots_adjust(bottom=0.2)

ax = fig.add_subplot(111, facecolor='y')
ax = fig.add_subplot(111)
ax.plot([1, 2, 3], 'r')
x = np.arange(0.0, 3.0, 0.1)

Expand Down
Loading