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

Skip to content

Commit a953845

Browse files
committed
Merge remote-tracking branch 'matplotlib/v2.x'
2 parents 7a20bfe + cd0921c commit a953845

File tree

9 files changed

+110
-12
lines changed

9 files changed

+110
-12
lines changed

examples/color/colormaps_reference.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral',
5252
'seismic']),
5353
('Qualitative', ['Accent', 'Dark2', 'Paired', 'Pastel1',
54-
'Pastel2', 'Set1', 'Set2', 'Set3']),
54+
'Pastel2', 'Set1', 'Set2', 'Set3', 'Vega10',
55+
'Vega20', 'Vega20b', 'Vega20c']),
5556
('Miscellaneous', ['gist_earth', 'terrain', 'ocean', 'gist_stern',
5657
'brg', 'CMRmap', 'cubehelix',
5758
'gnuplot', 'gnuplot2', 'gist_ncar',

lib/matplotlib/_cm.py

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,94 @@ def gfunc32(x):
12771277
}
12781278

12791279

1280+
# Categorical palettes from Vega:
1281+
# https://github.com/vega/vega/wiki/Scales
1282+
# (divided by 255)
1283+
#
1284+
1285+
_Vega10_data = (
1286+
(0.12156862745098039, 0.4666666666666667, 0.7058823529411765 ), # 1f77b4
1287+
(1.0, 0.4980392156862745, 0.054901960784313725), # ff7f0e
1288+
(0.17254901960784313, 0.6274509803921569, 0.17254901960784313 ), # 2ca02c
1289+
(0.8392156862745098, 0.15294117647058825, 0.1568627450980392 ), # d62728
1290+
(0.5803921568627451, 0.403921568627451, 0.7411764705882353 ), # 9467bd
1291+
(0.5490196078431373, 0.33725490196078434, 0.29411764705882354 ), # 8c564b
1292+
(0.8901960784313725, 0.4666666666666667, 0.7607843137254902 ), # e377c2
1293+
(0.4980392156862745, 0.4980392156862745, 0.4980392156862745 ), # 7f7f7f
1294+
(0.7372549019607844, 0.7411764705882353, 0.13333333333333333 ), # bcbd22
1295+
(0.09019607843137255, 0.7450980392156863, 0.8117647058823529), # 17becf
1296+
)
1297+
1298+
_Vega20_data = (
1299+
(0.12156862745098039, 0.4666666666666667, 0.7058823529411765 ), # 1f77b4
1300+
(0.6823529411764706, 0.7803921568627451, 0.9098039215686274 ), # aec7e8
1301+
(1.0, 0.4980392156862745, 0.054901960784313725), # ff7f0e
1302+
(1.0, 0.7333333333333333, 0.47058823529411764 ), # ffbb78
1303+
(0.17254901960784313, 0.6274509803921569, 0.17254901960784313 ), # 2ca02c
1304+
(0.596078431372549, 0.8745098039215686, 0.5411764705882353 ), # 98df8a
1305+
(0.8392156862745098, 0.15294117647058825, 0.1568627450980392 ), # d62728
1306+
(1.0, 0.596078431372549, 0.5882352941176471 ), # ff9896
1307+
(0.5803921568627451, 0.403921568627451, 0.7411764705882353 ), # 9467bd
1308+
(0.7725490196078432, 0.6901960784313725, 0.8352941176470589 ), # c5b0d5
1309+
(0.5490196078431373, 0.33725490196078434, 0.29411764705882354 ), # 8c564b
1310+
(0.7686274509803922, 0.611764705882353, 0.5803921568627451 ), # c49c94
1311+
(0.8901960784313725, 0.4666666666666667, 0.7607843137254902 ), # e377c2
1312+
(0.9686274509803922, 0.7137254901960784, 0.8235294117647058 ), # f7b6d2
1313+
(0.4980392156862745, 0.4980392156862745, 0.4980392156862745 ), # 7f7f7f
1314+
(0.7803921568627451, 0.7803921568627451, 0.7803921568627451 ), # c7c7c7
1315+
(0.7372549019607844, 0.7411764705882353, 0.13333333333333333 ), # bcbd22
1316+
(0.8588235294117647, 0.8588235294117647, 0.5529411764705883 ), # dbdb8d
1317+
(0.09019607843137255, 0.7450980392156863, 0.8117647058823529 ), # 17becf
1318+
(0.6196078431372549, 0.8549019607843137, 0.8980392156862745), # 9edae5
1319+
)
1320+
1321+
_Vega20b_data = (
1322+
(0.2235294117647059, 0.23137254901960785, 0.4745098039215686 ), # 393b79
1323+
(0.3215686274509804, 0.32941176470588235, 0.6392156862745098 ), # 5254a3
1324+
(0.4196078431372549, 0.43137254901960786, 0.8117647058823529 ), # 6b6ecf
1325+
(0.611764705882353, 0.6196078431372549, 0.8705882352941177 ), # 9c9ede
1326+
(0.38823529411764707, 0.4745098039215686, 0.2235294117647059 ), # 637939
1327+
(0.5490196078431373, 0.6352941176470588, 0.3215686274509804 ), # 8ca252
1328+
(0.7098039215686275, 0.8117647058823529, 0.4196078431372549 ), # b5cf6b
1329+
(0.807843137254902, 0.8588235294117647, 0.611764705882353 ), # cedb9c
1330+
(0.5490196078431373, 0.42745098039215684, 0.19215686274509805), # 8c6d31
1331+
(0.7411764705882353, 0.6196078431372549, 0.2235294117647059 ), # bd9e39
1332+
(0.9058823529411765, 0.7294117647058823, 0.3215686274509804 ), # e7ba52
1333+
(0.9058823529411765, 0.796078431372549, 0.5803921568627451 ), # e7cb94
1334+
(0.5176470588235295, 0.23529411764705882, 0.2235294117647059 ), # 843c39
1335+
(0.6784313725490196, 0.28627450980392155, 0.2901960784313726 ), # ad494a
1336+
(0.8392156862745098, 0.3803921568627451, 0.4196078431372549 ), # d6616b
1337+
(0.9058823529411765, 0.5882352941176471, 0.611764705882353 ), # e7969c
1338+
(0.4823529411764706, 0.2549019607843137, 0.45098039215686275), # 7b4173
1339+
(0.6470588235294118, 0.3176470588235294, 0.5803921568627451 ), # a55194
1340+
(0.807843137254902, 0.42745098039215684, 0.7411764705882353 ), # ce6dbd
1341+
(0.8705882352941177, 0.6196078431372549, 0.8392156862745098 ), # de9ed6
1342+
)
1343+
1344+
_Vega20c_data = (
1345+
(0.19215686274509805, 0.5098039215686274, 0.7411764705882353 ), # 3182bd
1346+
(0.4196078431372549, 0.6823529411764706, 0.8392156862745098 ), # 6baed6
1347+
(0.6196078431372549, 0.792156862745098, 0.8823529411764706 ), # 9ecae1
1348+
(0.7764705882352941, 0.8588235294117647, 0.9372549019607843 ), # c6dbef
1349+
(0.9019607843137255, 0.3333333333333333, 0.050980392156862744), # e6550d
1350+
(0.9921568627450981, 0.5529411764705883, 0.23529411764705882 ), # fd8d3c
1351+
(0.9921568627450981, 0.6823529411764706, 0.4196078431372549 ), # fdae6b
1352+
(0.9921568627450981, 0.8156862745098039, 0.6352941176470588 ), # fdd0a2
1353+
(0.19215686274509805, 0.6392156862745098, 0.32941176470588235 ), # 31a354
1354+
(0.4549019607843137, 0.7686274509803922, 0.4627450980392157 ), # 74c476
1355+
(0.6313725490196078, 0.8509803921568627, 0.6078431372549019 ), # a1d99b
1356+
(0.7803921568627451, 0.9137254901960784, 0.7529411764705882 ), # c7e9c0
1357+
(0.4588235294117647, 0.4196078431372549, 0.6941176470588235 ), # 756bb1
1358+
(0.6196078431372549, 0.6039215686274509, 0.7843137254901961 ), # 9e9ac8
1359+
(0.7372549019607844, 0.7411764705882353, 0.8627450980392157 ), # bcbddc
1360+
(0.8549019607843137, 0.8549019607843137, 0.9215686274509803 ), # dadaeb
1361+
(0.38823529411764707, 0.38823529411764707, 0.38823529411764707 ), # 636363
1362+
(0.5882352941176471, 0.5882352941176471, 0.5882352941176471 ), # 969696
1363+
(0.7411764705882353, 0.7411764705882353, 0.7411764705882353 ), # bdbdbd
1364+
(0.8509803921568627, 0.8509803921568627, 0.8509803921568627 ), # d9d9d9
1365+
)
1366+
1367+
12801368
datad = {
12811369
'afmhot': _afmhot_data,
12821370
'autumn': _autumn_data,
@@ -1358,3 +1446,8 @@ def gfunc32(x):
13581446
datad['Set1'] = {'listed': _Set1_data}
13591447
datad['Set2'] = {'listed': _Set2_data}
13601448
datad['Set3'] = {'listed': _Set3_data}
1449+
1450+
datad['Vega10'] = {'listed': _Vega10_data}
1451+
datad['Vega20'] = {'listed': _Vega20_data}
1452+
datad['Vega20b'] = {'listed': _Vega20b_data}
1453+
datad['Vega20c'] = {'listed': _Vega20c_data}

lib/matplotlib/backends/backend_webagg_core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import numpy as np
2525
import tornado
26+
import datetime
2627

2728
from matplotlib.backends import backend_agg
2829
from matplotlib.figure import Figure

lib/matplotlib/mpl-data/stylelib/bmh.mplstyle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,11 @@ axes.titlesize: x-large
1919
axes.labelsize: large
2020
axes.prop_cycle: cycler('color', ['348ABD', 'A60628', '7A68A6', '467821', 'D55E00', 'CC79A7', '56B4E9', '009E73', 'F0E442', '0072B2'])
2121

22+
grid.color: b2b2b2
23+
grid.linestyle: --
24+
grid.linewidth: 0.5
25+
2226
legend.fancybox: True
2327

28+
xtick.direction: in
29+
ytick.direction: in

lib/matplotlib/mpl-data/stylelib/fivethirtyeight.mplstyle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ savefig.edgecolor: f0f0f0
3535
savefig.facecolor: f0f0f0
3636

3737
figure.subplot.left: 0.08
38-
figure.subplot.right: 0.95
38+
figure.subplot.right: 0.95
3939
figure.subplot.bottom: 0.07
4040
figure.facecolor: f0f0f0

lib/matplotlib/tests/test_transforms.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,7 @@ def test_clipping_of_log():
209209
simplify=False)
210210

211211
tpoints, tcodes = list(zip(*result))
212-
# Because y coordinate -99 is outside the clip zone, the first
213-
# line segment is effectively removed. That means that the closepoly
214-
# operation must be replaced by a move to the first point.
215-
assert np.allclose(tcodes, [M, M, L, L, L, C])
212+
assert np.allclose(tcodes, [M, L, L, L, C])
216213

217214

218215
class NonAffineForTest(mtrans.Transform):

src/_backend_agg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ RendererAgg::draw_path(GCAgg &gc, PathIterator &path, agg::trans_affine &trans,
484484

485485
transformed_path_t tpath(path, trans);
486486
nan_removed_t nan_removed(tpath, true, path.has_curves());
487-
clipped_t clipped(nan_removed, clip, width, height);
487+
clipped_t clipped(nan_removed, clip && !path.has_curves(), width, height);
488488
snapped_t snapped(clipped, gc.snap_mode, path.total_vertices(), snapping_linewidth);
489489
simplify_t simplified(snapped, simplify, path.simplify_threshold());
490490
curve_t curve(simplified);
@@ -1009,7 +1009,7 @@ inline void RendererAgg::_draw_path_collection_generic(GCAgg &gc,
10091009

10101010
transformed_path_t tpath(path, trans);
10111011
nan_removed_t nan_removed(tpath, true, has_curves);
1012-
clipped_t clipped(nan_removed, do_clip, width, height);
1012+
clipped_t clipped(nan_removed, do_clip && !has_curves, width, height);
10131013
snapped_t snapped(
10141014
clipped, gc.snap_mode, path.total_vertices(), points_to_pixels(gc.linewidth));
10151015
if (has_curves) {

src/_path.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ void convert_path_to_polygons(PathIterator &path,
885885

886886
transformed_path_t tpath(path, trans);
887887
nan_removal_t nan_removed(tpath, true, path.has_curves());
888-
clipped_t clipped(nan_removed, do_clip, width, height);
888+
clipped_t clipped(nan_removed, do_clip && !path.has_curves(), width, height);
889889
simplify_t simplified(clipped, simplify, path.simplify_threshold());
890890
curve_t curve(simplified);
891891

@@ -950,7 +950,7 @@ void cleanup_path(PathIterator &path,
950950

951951
transformed_path_t tpath(path, trans);
952952
nan_removal_t nan_removed(tpath, remove_nans, path.has_curves());
953-
clipped_t clipped(nan_removed, do_clip, rect);
953+
clipped_t clipped(nan_removed, do_clip && !path.has_curves(), rect);
954954
snapped_t snapped(clipped, snap_mode, path.total_vertices(), stroke_width);
955955
simplify_t simplified(snapped, do_simplify, path.simplify_threshold());
956956

@@ -1156,7 +1156,7 @@ int convert_to_string(PathIterator &path,
11561156

11571157
transformed_path_t tpath(path, trans);
11581158
nan_removal_t nan_removed(tpath, true, path.has_curves());
1159-
clipped_t clipped(nan_removed, do_clip, clip_rect);
1159+
clipped_t clipped(nan_removed, do_clip && !path.has_curves(), clip_rect);
11601160
simplify_t simplified(clipped, simplify, path.simplify_threshold());
11611161

11621162
*buffersize = path.total_vertices() * (precision + 5) * 4;

src/path_cleanup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class PathCleanupIterator
4343
: m_transform(trans),
4444
m_transformed(m_path_iter, m_transform),
4545
m_nan_removed(m_transformed, remove_nans, m_path_iter.has_curves()),
46-
m_clipped(m_nan_removed, do_clip, rect),
46+
m_clipped(m_nan_removed, do_clip && !m_path_iter.has_curves(), rect),
4747
m_snapped(m_clipped, snap_mode, m_path_iter.total_vertices(), stroke_width),
4848
m_simplify(m_snapped,
4949
do_simplify && m_path_iter.should_simplify(),

0 commit comments

Comments
 (0)