Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b6ab3a4

Browse files
committed
Merge branch 'v1.5.x' into v2.0.x
2 parents 334aee1 + e74ae79 commit b6ab3a4

8 files changed

Lines changed: 21 additions & 6 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ install:
8686
# Neihter is installed as a dependency of IPython since they are not used by the IPython console.
8787
- |
8888
if [[ $BUILD_DOCS == true ]]; then
89-
pip install $PRE numpydoc ipython jsonschema mistune
89+
pip install $PRE numpydoc ipython jsonschema mistune colorspacious
9090
pip install -q $PRE linkchecker
9191
wget https://github.com/google/fonts/blob/master/ofl/felipa/Felipa-Regular.ttf?raw=true -O Felipa-Regular.ttf
9292
wget http://mirrors.kernel.org/ubuntu/pool/universe/f/fonts-humor-sans/fonts-humor-sans_1.0-1_all.deb

doc/users/plotting/colormaps/lightness.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import matplotlib.pyplot as plt
1515
from matplotlib import cm
1616
import matplotlib as mpl
17+
from colorspacious import cspace_converter
1718

1819
mpl.rcParams.update({'font.size': 12})
1920

@@ -46,16 +47,16 @@
4647
# Get rgb values for colormap
4748
rgb = cm.get_cmap(cmap)(x)[np.newaxis,:,:3]
4849

49-
# Get colormap in CIE LAB. We want the L here.
50-
lab = color.rgb2lab(rgb)
50+
# Get colormap in CAM02-UCS colorspace. We want the lightness.
51+
lab = cspace_converter("sRGB1", "CAM02-UCS")(rgb)
5152

5253
# Plot colormap L values
5354
# Do separately for each category so each plot can be pretty
5455
# to make scatter markers change color along plot:
5556
# http://stackoverflow.com/questions/8202605/matplotlib-scatterplot-colour-as-a-function-of-a-third-variable
5657
if cmap_category=='Perceptually Uniform Sequential':
5758
dc = 1.15 # spacing between colormaps
58-
ax.scatter(x+j*dc, lab[0,::-1,0], c=x, cmap=cmap,
59+
ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap,
5960
s=300, linewidths=0.)
6061
if i==2:
6162
ax.axis([-0.1,4.1,0,100])
@@ -65,7 +66,9 @@
6566

6667
elif cmap_category=='Sequential':
6768
dc = 0.6 # spacing between colormaps
68-
ax.scatter(x+j*dc, lab[0,::-1,0], c=x, cmap=cmap + '_r',
69+
# These colormaps all start at high lightness but we want them
70+
# reversed to look nice in the plot, so reverse the order.
71+
ax.scatter(x+j*dc, lab[0,::-1,0], c=x[::-1], cmap=cmap,
6972
s=300, linewidths=0.)
7073
if i==2:
7174
ax.axis([-0.1,4.1,0,100])

lib/matplotlib/stackplot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from matplotlib.externals import six
1313
from matplotlib.externals.six.moves import xrange
1414

15+
from cycler import cycler
1516
import numpy as np
1617

1718
__all__ = ['stackplot']
@@ -63,7 +64,7 @@ def stackplot(axes, x, *args, **kwargs):
6364

6465
colors = kwargs.pop('colors', None)
6566
if colors is not None:
66-
axes.set_color_cycle(colors)
67+
axes.set_prop_cycle(cycler('color', colors))
6768

6869
baseline = kwargs.pop('baseline', 'zero')
6970
# Assume data passed has not been 'stacked', so stack it here.
1.27 KB
Loading
-173 Bytes
Loading
-471 Bytes
Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4007,12 +4007,15 @@ def test_rc_spines():
40074007
def test_rc_grid():
40084008
fig = plt.figure()
40094009
rc_dict0 = {
4010+
'axes.grid': True,
40104011
'axes.grid.axis': 'both'
40114012
}
40124013
rc_dict1 = {
4014+
'axes.grid': True,
40134015
'axes.grid.axis': 'x'
40144016
}
40154017
rc_dict2 = {
4018+
'axes.grid': True,
40164019
'axes.grid.axis': 'y'
40174020
}
40184021
dict_list = [rc_dict0, rc_dict1, rc_dict2]

src/_backend_agg.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ inline void RendererAgg::draw_markers(GCAgg &gc,
516516

517517
// Deal with the difference in y-axis direction
518518
marker_trans *= agg::trans_affine_scaling(1.0, -1.0);
519+
519520
trans *= agg::trans_affine_scaling(1.0, -1.0);
520521
trans *= agg::trans_affine_translation(0.5, (double)height + 0.5);
521522

@@ -527,6 +528,13 @@ inline void RendererAgg::draw_markers(GCAgg &gc,
527528
points_to_pixels(gc.linewidth));
528529
curve_t marker_path_curve(marker_path_snapped);
529530

531+
if (!marker_path_snapped.is_snapping()) {
532+
// If the path snapper isn't in effect, at least make sure the marker
533+
// at (0, 0) is in the center of a pixel. This, importantly, makes
534+
// the circle markers look centered around the point they refer to.
535+
marker_trans *= agg::trans_affine_translation(0.5, 0.5);
536+
}
537+
530538
transformed_path_t path_transformed(path, trans);
531539
nan_removed_t path_nan_removed(path_transformed, false, false);
532540
snap_t path_snapped(path_nan_removed, SNAP_FALSE, path.total_vertices(), 0.0);

0 commit comments

Comments
 (0)