Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcc81df7

Browse files
committed
minor changes for multivariate colormaps
1 parent2117ed4 commitcc81df7

File tree

6 files changed

+12
-90
lines changed

6 files changed

+12
-90
lines changed

‎doc/api/colors_api.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ Colormaps
4242
Colormap
4343
LinearSegmentedColormap
4444
ListedColormap
45+
Colormap
46+
MultivarColormap
47+
BivarColormap
48+
SegmentedBivarColormap
49+
BivarColormapFromImage
4550

4651
Other classes
4752
-------------

‎lib/matplotlib/_cm_multivar.py

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,9 @@
11
# auto-genreated by https://github.com/trygvrad/multivariate_colormaps
2-
# date: 2024-05-24
2+
# date: 2024-05-28
33

44
from .colorsimportLinearSegmentedColormap,MultivarColormap
55
importmatplotlibasmpl
66
_LUTSIZE=mpl.rcParams['image.lut']
7-
_4VarAddA0_data= [[0.000,0.000,0.000],
8-
[0.023,0.021,0.032],
9-
[0.046,0.048,0.073],
10-
[0.068,0.075,0.115],
11-
[0.087,0.100,0.155],
12-
[0.104,0.123,0.196],
13-
[0.119,0.146,0.236],
14-
[0.133,0.167,0.277],
15-
[0.145,0.187,0.318],
16-
[0.156,0.207,0.360],
17-
[0.165,0.225,0.403],
18-
[0.174,0.243,0.447],
19-
[0.184,0.263,0.487],
20-
[0.194,0.283,0.526],
21-
[0.203,0.303,0.566],
22-
[0.212,0.322,0.606],
23-
[0.221,0.341,0.647],
24-
[0.229,0.361,0.688],
25-
[0.237,0.380,0.730]]
26-
27-
_4VarAddA1_data= [[0.000,0.000,0.000],
28-
[0.012,0.026,0.026],
29-
[0.028,0.058,0.053],
30-
[0.041,0.090,0.078],
31-
[0.051,0.119,0.100],
32-
[0.056,0.147,0.120],
33-
[0.057,0.174,0.138],
34-
[0.052,0.198,0.153],
35-
[0.039,0.221,0.165],
36-
[0.028,0.244,0.177],
37-
[0.029,0.271,0.192],
38-
[0.031,0.297,0.206],
39-
[0.032,0.324,0.220],
40-
[0.032,0.351,0.233],
41-
[0.033,0.378,0.245],
42-
[0.033,0.405,0.257],
43-
[0.032,0.433,0.269],
44-
[0.032,0.461,0.281],
45-
[0.031,0.489,0.292]]
46-
47-
_4VarAddA2_data= [[0.000,0.000,0.000],
48-
[0.021,0.023,0.012],
49-
[0.052,0.050,0.025],
50-
[0.083,0.076,0.036],
51-
[0.113,0.100,0.045],
52-
[0.142,0.122,0.050],
53-
[0.169,0.143,0.052],
54-
[0.196,0.162,0.052],
55-
[0.223,0.180,0.049],
56-
[0.249,0.198,0.044],
57-
[0.274,0.214,0.036],
58-
[0.299,0.230,0.027],
59-
[0.326,0.247,0.024],
60-
[0.354,0.265,0.022],
61-
[0.382,0.282,0.019],
62-
[0.410,0.300,0.016],
63-
[0.438,0.317,0.012],
64-
[0.466,0.335,0.007],
65-
[0.495,0.352,0.002]]
66-
67-
_4VarAddA3_data= [[0.000,0.000,0.000],
68-
[0.033,0.019,0.019],
69-
[0.071,0.041,0.046],
70-
[0.111,0.062,0.074],
71-
[0.149,0.080,0.099],
72-
[0.187,0.096,0.123],
73-
[0.226,0.109,0.146],
74-
[0.267,0.120,0.166],
75-
[0.310,0.128,0.184],
76-
[0.352,0.135,0.202],
77-
[0.386,0.145,0.224],
78-
[0.420,0.154,0.245],
79-
[0.454,0.162,0.266],
80-
[0.487,0.169,0.287],
81-
[0.520,0.175,0.307],
82-
[0.553,0.181,0.328],
83-
[0.586,0.185,0.349],
84-
[0.618,0.189,0.369],
85-
[0.650,0.192,0.390]]
867

878
_2VarAddA0_data= [[0.000,0.000,0.000],
889
[0.020,0.026,0.031],
@@ -226,10 +147,6 @@
226147

227148
cmaps= {
228149
name:LinearSegmentedColormap.from_list(name,data,_LUTSIZE)forname,datain [
229-
('4VarAddA0',_4VarAddA0_data),
230-
('4VarAddA1',_4VarAddA1_data),
231-
('4VarAddA2',_4VarAddA2_data),
232-
('4VarAddA3',_4VarAddA3_data),
233150
('2VarAddA0',_2VarAddA0_data),
234151
('2VarAddA1',_2VarAddA1_data),
235152
('2VarSubA0',_2VarSubA0_data),
@@ -246,6 +163,4 @@
246163
iinrange(2)],'Sub'),
247164
'3VarAddA':MultivarColormap('3VarAddA', [cmaps['3VarAddA'+str(i)]for
248165
iinrange(3)],'Add'),
249-
'4VarAddA':MultivarColormap('4VarAddA', [cmaps['4VarAddA'+str(i)]for
250-
iinrange(4)],'Add'),
251166
}

‎lib/matplotlib/cm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def __init__(self, norm=None, cmap=None):
351351
self.scalars= [ScalarMappable(norm,cmap)]
352352
# it would be tempting to just use one layer of callbacks here
353353
# i.e. self.callbacks = self.scalars[0].callbacks
354-
# but this will require morereformating as it fails in cleanup
354+
# but this will require morereformatting as it fails in cleanup
355355
# if a colorbar is removed
356356
self.scalars[0].callbacks.connect('changed',self._on_changed)
357357

@@ -697,6 +697,7 @@ def _on_changed(self, obj=None):
697697
"""
698698
self.changed()
699699

700+
700701
classScalarMappable:
701702
"""
702703
A mixin class to map scalar data to RGBA.

‎lib/matplotlib/colors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@ class BivarColormapFromImage(BivarColormap):
18191819
18201820
"""
18211821

1822-
def__init__(self,lut,name,shape='square'):
1822+
def__init__(self,lut,name='',shape='square'):
18231823
self._lut=lut
18241824
super().__init__(name,lut.shape[0],lut.shape[1],shape)
18251825

‎lib/matplotlib/figure.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,8 @@ def colorbar_2D(self, mappable, fraction=0.25, pad=0.1):
13651365
extent= [*mappable.scalars[1].get_clim(),*mappable.scalars[0].get_clim()]
13661366
cim=cax.imshow(mappable._cmap.lut,origin='lower',
13671367
extent=(0,1,0,1),
1368-
transform=cax.transAxes)
1368+
transform=cax.transAxes,
1369+
interpolation='nearest')
13691370

13701371
# scale the x and y axis according to the norm
13711372
# i.e. for use with `matplotlib.colors.LogNorm` etc.

‎lib/matplotlib/tests/test_multivariate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ def test_bivariate_repr_html():
534534

535535

536536
deftest_multivariate_repr_html():
537-
cmap=mpl.multivar_colormaps['4VarAddA']
537+
cmap=mpl.multivar_colormaps['3VarAddA']
538538
html=cmap._repr_html_()
539539
assertlen(html)>0
540540
forcincmap.colormaps:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp