Skip to content

Commit 06d0144

Browse files
committed
Merge remote branch 'upstream/v1.3.x'
* upstream/v1.3.x: Update version to 1.3.1 tiny correction of matplotlibrc.template minor docstring fix in dates.py Updated the docs of pyplot.gca. Fix matplotlib#2472: Draw the spines on top of twin axes changes to c++ because gcc 4.8 seems to allow things the compiler on travis will not. added class variable `_fill_color` to RendererAgg to hold the color to use in `clear` calls to the render_base. patch to fix issue matplotlib#2473. Conflicts: lib/matplotlib/__init__.py lib/matplotlib/axes/_axes.py
2 parents cd71bbc + 7fc4476 commit 06d0144

File tree

9 files changed

+52
-25
lines changed

9 files changed

+52
-25
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,13 +3239,13 @@ def twinx(self):
32393239
For those who are 'picking' artists while using twinx, pick
32403240
events are only called for the artists in the top-most axes.
32413241
"""
3242-
3243-
ax2 = self._make_twin_axes(sharex=self, frameon=False)
3242+
ax2 = self._make_twin_axes(sharex=self)
32443243
ax2.yaxis.tick_right()
32453244
ax2.yaxis.set_label_position('right')
32463245
ax2.yaxis.set_offset_position('right')
32473246
self.yaxis.tick_left()
32483247
ax2.xaxis.set_visible(False)
3248+
ax2.patch.set_visible(False)
32493249
return ax2
32503250

32513251
def twiny(self):
@@ -3264,11 +3264,12 @@ def twiny(self):
32643264
events are only called for the artists in the top-most axes.
32653265
"""
32663266

3267-
ax2 = self._make_twin_axes(sharey=self, frameon=False)
3267+
ax2 = self._make_twin_axes(sharey=self)
32683268
ax2.xaxis.tick_top()
32693269
ax2.xaxis.set_label_position('top')
32703270
self.xaxis.tick_bottom()
32713271
ax2.yaxis.set_visible(False)
3272+
ax2.patch.set_visible(False)
32723273
return ax2
32733274

32743275
def get_shared_x_axes(self):

lib/matplotlib/dates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ class AutoDateFormatter(ticker.Formatter):
495495
365.0 : '%Y',
496496
30. : '%b %Y',
497497
1.0 : '%b %d %Y',
498-
1./24. : '%H:%M:%D',
498+
1./24. : '%H:%M:%S',
499499
1. / (24. * 60.): '%H:%M:%S.%f',
500500
}
501501

lib/matplotlib/pyplot.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -792,22 +792,22 @@ def sca(ax):
792792

793793
def gca(**kwargs):
794794
"""
795-
Return the current axis instance. This can be used to control
796-
axis properties either using set or the
797-
:class:`~matplotlib.axes.Axes` methods, for example, setting the
798-
xaxis range::
799-
800-
plot(t,s)
801-
set(gca(), 'xlim', [0,10])
802-
803-
or::
804-
805-
plot(t,s)
806-
a = gca()
807-
a.set_xlim([0,10])
808-
795+
Return the current :class:`~matplotlib.axes.Axes` instance on the
796+
current figure matching the given keyword args, or create one.
797+
798+
Examples
799+
---------
800+
To get the the current polar axes on the current figure::
801+
802+
plt.gca(projection='polar')
803+
804+
If the current axes doesn't exist, or isn't a polar one, the appropriate
805+
axes will be created and then returned.
806+
807+
See Also
808+
--------
809+
matplotlib.figure.Figure.gca : The figure's gca method.
809810
"""
810-
811811
ax = gcf().gca(**kwargs)
812812
return ax
813813

Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2341,6 +2341,27 @@ def make_patch_spines_invisible(ax):
23412341
host.tick_params(axis='x', **tkw)
23422342

23432343

2344+
@image_comparison(baseline_images=['twin_spines_on_top'], extensions=['png'],
2345+
remove_text=True)
2346+
def test_twin_spines_on_top():
2347+
matplotlib.rcParams['axes.linewidth'] = 48.0
2348+
matplotlib.rcParams['lines.linewidth'] = 48.0
2349+
2350+
fig = plt.figure()
2351+
ax1 = fig.add_subplot(1, 1, 1)
2352+
2353+
data = np.array([[1000, 1100, 1200, 1250],
2354+
[310, 301, 360, 400]])
2355+
2356+
ax2 = ax1.twinx()
2357+
2358+
ax1.plot(data[0], data[1]/1E3, color='#BEAED4')
2359+
ax1.fill_between(data[0], data[1]/1E3, color='#BEAED4', alpha=.8)
2360+
2361+
ax2.plot(data[0], data[1]/1E3, color='#7FC97F')
2362+
ax2.fill_between(data[0], data[1]/1E3, color='#7FC97F', alpha=.5)
2363+
2364+
23442365
@cleanup
23452366
def test_rcparam_grid_minor():
23462367
orig_grid = matplotlib.rcParams['axes.grid']

lib/matplotlib/tests/test_image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def test_imsave_color_alpha():
151151
# Wherever alpha values were rounded down to 0, the rgb values all get set
152152
# to 0 during imsave (this is reasonable behaviour).
153153
# Recreate that here:
154-
data[data[:, :, 3] == 0] = 0
154+
for j in range(3):
155+
data[data[:, :, 3] == 0, j] = 1
155156

156157
assert_array_equal(data, arr_buf)
157158

matplotlibrc.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ backend : %(backend)s
181181
# correction off. None will try and
182182
# guess based on your dvipng version
183183

184-
#text.hinting : 'auto' # May be one of the following:
184+
#text.hinting : auto # May be one of the following:
185185
# 'none': Perform no hinting
186186
# 'auto': Use freetype's autohinter
187187
# 'native': Use the hinting information in the

src/_backend_agg.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,8 @@ RendererAgg::RendererAgg(unsigned int width, unsigned int height, double dpi,
421421
rendererAA(),
422422
rendererBin(),
423423
theRasterizer(),
424-
debug(debug)
424+
debug(debug),
425+
_fill_color(agg::rgba(1, 1, 1, 0))
425426
{
426427
_VERBOSE("RendererAgg::RendererAgg");
427428
unsigned stride(width*4);
@@ -430,7 +431,7 @@ RendererAgg::RendererAgg(unsigned int width, unsigned int height, double dpi,
430431
renderingBuffer.attach(pixBuffer, width, height, stride);
431432
pixFmt.attach(renderingBuffer);
432433
rendererBase.attach(pixFmt);
433-
rendererBase.clear(agg::rgba(0, 0, 0, 0));
434+
rendererBase.clear(_fill_color);
434435
rendererAA.attach(rendererBase);
435436
rendererBin.attach(rendererBase);
436437
hatchRenderingBuffer.attach(hatchBuffer, HATCH_SIZE, HATCH_SIZE,
@@ -1285,7 +1286,7 @@ void RendererAgg::_draw_path(path_t& path, bool has_clippath,
12851286
pixfmt hatch_img_pixf(hatchRenderingBuffer);
12861287
renderer_base rb(hatch_img_pixf);
12871288
renderer_aa rs(rb);
1288-
rb.clear(agg::rgba(0.0, 0.0, 0.0, 0.0));
1289+
rb.clear(_fill_color);
12891290
rs.color(gc.color);
12901291

12911292
try {
@@ -2441,7 +2442,7 @@ RendererAgg::clear(const Py::Tuple& args)
24412442
_VERBOSE("RendererAgg::clear");
24422443

24432444
args.verify_length(0);
2444-
rendererBase.clear(agg::rgba(0, 0, 0, 0));
2445+
rendererBase.clear(_fill_color);
24452446

24462447
return Py::Object();
24472448
}

src/_backend_agg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ class RendererAgg: public Py::PythonExtension<RendererAgg>
241241

242242
const int debug;
243243

244+
agg::rgba _fill_color;
245+
246+
244247
protected:
245248
double points_to_pixels(const Py::Object& points);
246249
agg::rgba rgb_to_color(const Py::SeqBase<Py::Object>& rgb, double alpha);

0 commit comments

Comments
 (0)