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

Skip to content

Commit b64652d

Browse files
committed
added tims spectral patch
svn path=/trunk/matplotlib/; revision=2942
1 parent 571c94d commit b64652d

File tree

6 files changed

+84
-32
lines changed

6 files changed

+84
-32
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2006-12-19 Added Tim Leslie's spectral patch - JDH
2+
13
2006-12-17 Added rc param 'axes.formatter.limits' to control
24
the default threshold for switching to scientific
35
notation. Added convenience method

boilerplate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def %(name)s():
153153
'spring',
154154
'summer',
155155
'winter',
156+
'spectral'
156157
)
157158
# add all the colormaps (autumn, hsv, ....)
158159
for name in cmaps:

lib/matplotlib/_cm.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515

1616

17+
1718
_bone_data = {'red': ((0., 0., 0.),(1.0, 1.0, 1.0)),
1819
'green': ((0., 0., 0.),(1.0, 1.0, 1.0)),
1920
'blue': ((0., 0., 0.),(1.0, 1.0, 1.0))}
@@ -338,6 +339,41 @@
338339
'green': ((0., 0., 0.),(1.0, 1.0, 1.0)),
339340
'blue': ((0., 1., 1.),(1.0, 0.5, 0.5))}
340341

342+
_spectral_data = {'red': [(0.0, 0.0, 0.0), (0.05, 0.4667, 0.4667),
343+
(0.10, 0.5333, 0.5333), (0.15, 0.0, 0.0),
344+
(0.20, 0.0, 0.0), (0.25, 0.0, 0.0),
345+
(0.30, 0.0, 0.0), (0.35, 0.0, 0.0),
346+
(0.40, 0.0, 0.0), (0.45, 0.0, 0.0),
347+
(0.50, 0.0, 0.0), (0.55, 0.0, 0.0),
348+
(0.60, 0.0, 0.0), (0.65, 0.7333, 0.7333),
349+
(0.70, 0.9333, 0.9333), (0.75, 1.0, 1.0),
350+
(0.80, 1.0, 1.0), (0.85, 1.0, 1.0),
351+
(0.90, 0.8667, 0.8667), (0.95, 0.80, 0.80),
352+
(1.0, 0.80, 0.80)],
353+
'green': [(0.0, 0.0, 0.0), (0.05, 0.0, 0.0),
354+
(0.10, 0.0, 0.0), (0.15, 0.0, 0.0),
355+
(0.20, 0.0, 0.0), (0.25, 0.4667, 0.4667),
356+
(0.30, 0.6000, 0.6000), (0.35, 0.6667, 0.6667),
357+
(0.40, 0.6667, 0.6667), (0.45, 0.6000, 0.6000),
358+
(0.50, 0.7333, 0.7333), (0.55, 0.8667, 0.8667),
359+
(0.60, 1.0, 1.0), (0.65, 1.0, 1.0),
360+
(0.70, 0.9333, 0.9333), (0.75, 0.8000, 0.8000),
361+
(0.80, 0.6000, 0.6000), (0.85, 0.0, 0.0),
362+
(0.90, 0.0, 0.0), (0.95, 0.0, 0.0),
363+
(1.0, 0.80, 0.80)],
364+
'blue': [(0.0, 0.0, 0.0), (0.05, 0.5333, 0.5333),
365+
(0.10, 0.6000, 0.6000), (0.15, 0.6667, 0.6667),
366+
(0.20, 0.8667, 0.8667), (0.25, 0.8667, 0.8667),
367+
(0.30, 0.8667, 0.8667), (0.35, 0.6667, 0.6667),
368+
(0.40, 0.5333, 0.5333), (0.45, 0.0, 0.0),
369+
(0.5, 0.0, 0.0), (0.55, 0.0, 0.0),
370+
(0.60, 0.0, 0.0), (0.65, 0.0, 0.0),
371+
(0.70, 0.0, 0.0), (0.75, 0.0, 0.0),
372+
(0.80, 0.0, 0.0), (0.85, 0.0, 0.0),
373+
(0.90, 0.0, 0.0), (0.95, 0.0, 0.0),
374+
(1.0, 0.80, 0.80)]}
375+
376+
341377
autumn = colors.LinearSegmentedColormap('autumn', _autumn_data, LUTSIZE)
342378
bone = colors.LinearSegmentedColormap('bone ', _bone_data, LUTSIZE)
343379
cool = colors.LinearSegmentedColormap('cool', _cool_data, LUTSIZE)
@@ -352,7 +388,7 @@
352388
spring = colors.LinearSegmentedColormap('spring', _spring_data, LUTSIZE)
353389
summer = colors.LinearSegmentedColormap('summer', _summer_data, LUTSIZE)
354390
winter = colors.LinearSegmentedColormap('winter', _winter_data, LUTSIZE)
355-
391+
spectral = colors.LinearSegmentedColormap('spectral', _spectral_data, LUTSIZE)
356392

357393

358394

@@ -370,7 +406,8 @@
370406
'prism': _prism_data,
371407
'spring': _spring_data,
372408
'summer': _summer_data,
373-
'winter': _winter_data
409+
'winter': _winter_data,
410+
'spectral': _spectral_data
374411
}
375412

376413
# 34 colormaps based on color specifications and designs

lib/matplotlib/backends/backend_ps.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""
2-
A PostScript backend, which can produce both PostScript .ps and
3-
2+
A PostScript backend, which can produce both PostScript .ps and .eps
43
"""
54

65
from __future__ import division

lib/matplotlib/pylab.py

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
spring - set the default colormap to spring
103103
summer - set the default colormap to summer
104104
winter - set the default colormap to winter
105+
spectral - set the default colormap to spectral
105106
106107
_Event handling
107108
@@ -513,6 +514,7 @@ def plotting():
513514
spring - set the default colormap to spring
514515
summer - set the default colormap to summer
515516
winter - set the default colormap to winter
517+
spectral - set the default colormap to spectral
516518
517519
"""
518520
pass
@@ -522,7 +524,7 @@ def colormaps():
522524
matplotlib provides the following colormaps.
523525
524526
autumn bone cool copper flag gray hot hsv jet pink prism
525-
spring summer winter
527+
spring summer winter spectral
526528
527529
You can set the colormap for an image, pcolor, scatter, etc,
528530
either as a keyword argumentdef con
@@ -1558,7 +1560,7 @@ def arrow(*args, **kwargs):
15581560
except:
15591561
hold(b)
15601562
raise
1561-
1563+
15621564
hold(b)
15631565
return ret
15641566
if Axes.arrow.__doc__ is not None:
@@ -1579,7 +1581,7 @@ def axhline(*args, **kwargs):
15791581
except:
15801582
hold(b)
15811583
raise
1582-
1584+
15831585
hold(b)
15841586
return ret
15851587
if Axes.axhline.__doc__ is not None:
@@ -1600,7 +1602,7 @@ def axhspan(*args, **kwargs):
16001602
except:
16011603
hold(b)
16021604
raise
1603-
1605+
16041606
hold(b)
16051607
return ret
16061608
if Axes.axhspan.__doc__ is not None:
@@ -1621,7 +1623,7 @@ def axvline(*args, **kwargs):
16211623
except:
16221624
hold(b)
16231625
raise
1624-
1626+
16251627
hold(b)
16261628
return ret
16271629
if Axes.axvline.__doc__ is not None:
@@ -1642,7 +1644,7 @@ def axvspan(*args, **kwargs):
16421644
except:
16431645
hold(b)
16441646
raise
1645-
1647+
16461648
hold(b)
16471649
return ret
16481650
if Axes.axvspan.__doc__ is not None:
@@ -1663,7 +1665,7 @@ def bar(*args, **kwargs):
16631665
except:
16641666
hold(b)
16651667
raise
1666-
1668+
16671669
hold(b)
16681670
return ret
16691671
if Axes.bar.__doc__ is not None:
@@ -1684,7 +1686,7 @@ def barh(*args, **kwargs):
16841686
except:
16851687
hold(b)
16861688
raise
1687-
1689+
16881690
hold(b)
16891691
return ret
16901692
if Axes.barh.__doc__ is not None:
@@ -1705,7 +1707,7 @@ def broken_barh(*args, **kwargs):
17051707
except:
17061708
hold(b)
17071709
raise
1708-
1710+
17091711
hold(b)
17101712
return ret
17111713
if Axes.broken_barh.__doc__ is not None:
@@ -1726,7 +1728,7 @@ def boxplot(*args, **kwargs):
17261728
except:
17271729
hold(b)
17281730
raise
1729-
1731+
17301732
hold(b)
17311733
return ret
17321734
if Axes.boxplot.__doc__ is not None:
@@ -1747,7 +1749,7 @@ def cohere(*args, **kwargs):
17471749
except:
17481750
hold(b)
17491751
raise
1750-
1752+
17511753
hold(b)
17521754
return ret
17531755
if Axes.cohere.__doc__ is not None:
@@ -1768,7 +1770,7 @@ def clabel(*args, **kwargs):
17681770
except:
17691771
hold(b)
17701772
raise
1771-
1773+
17721774
hold(b)
17731775
return ret
17741776
if Axes.clabel.__doc__ is not None:
@@ -1831,7 +1833,7 @@ def csd(*args, **kwargs):
18311833
except:
18321834
hold(b)
18331835
raise
1834-
1836+
18351837
hold(b)
18361838
return ret
18371839
if Axes.csd.__doc__ is not None:
@@ -1852,7 +1854,7 @@ def errorbar(*args, **kwargs):
18521854
except:
18531855
hold(b)
18541856
raise
1855-
1857+
18561858
hold(b)
18571859
return ret
18581860
if Axes.errorbar.__doc__ is not None:
@@ -1873,7 +1875,7 @@ def fill(*args, **kwargs):
18731875
except:
18741876
hold(b)
18751877
raise
1876-
1878+
18771879
hold(b)
18781880
return ret
18791881
if Axes.fill.__doc__ is not None:
@@ -1894,7 +1896,7 @@ def hist(*args, **kwargs):
18941896
except:
18951897
hold(b)
18961898
raise
1897-
1899+
18981900
hold(b)
18991901
return ret
19001902
if Axes.hist.__doc__ is not None:
@@ -1915,7 +1917,7 @@ def hlines(*args, **kwargs):
19151917
except:
19161918
hold(b)
19171919
raise
1918-
1920+
19191921
hold(b)
19201922
return ret
19211923
if Axes.hlines.__doc__ is not None:
@@ -1957,7 +1959,7 @@ def loglog(*args, **kwargs):
19571959
except:
19581960
hold(b)
19591961
raise
1960-
1962+
19611963
hold(b)
19621964
return ret
19631965
if Axes.loglog.__doc__ is not None:
@@ -2020,7 +2022,7 @@ def pie(*args, **kwargs):
20202022
except:
20212023
hold(b)
20222024
raise
2023-
2025+
20242026
hold(b)
20252027
return ret
20262028
if Axes.pie.__doc__ is not None:
@@ -2041,7 +2043,7 @@ def plot(*args, **kwargs):
20412043
except:
20422044
hold(b)
20432045
raise
2044-
2046+
20452047
hold(b)
20462048
return ret
20472049
if Axes.plot.__doc__ is not None:
@@ -2062,7 +2064,7 @@ def plot_date(*args, **kwargs):
20622064
except:
20632065
hold(b)
20642066
raise
2065-
2067+
20662068
hold(b)
20672069
return ret
20682070
if Axes.plot_date.__doc__ is not None:
@@ -2083,7 +2085,7 @@ def psd(*args, **kwargs):
20832085
except:
20842086
hold(b)
20852087
raise
2086-
2088+
20872089
hold(b)
20882090
return ret
20892091
if Axes.psd.__doc__ is not None:
@@ -2125,7 +2127,7 @@ def semilogx(*args, **kwargs):
21252127
except:
21262128
hold(b)
21272129
raise
2128-
2130+
21292131
hold(b)
21302132
return ret
21312133
if Axes.semilogx.__doc__ is not None:
@@ -2146,7 +2148,7 @@ def semilogy(*args, **kwargs):
21462148
except:
21472149
hold(b)
21482150
raise
2149-
2151+
21502152
hold(b)
21512153
return ret
21522154
if Axes.semilogy.__doc__ is not None:
@@ -2209,7 +2211,7 @@ def stem(*args, **kwargs):
22092211
except:
22102212
hold(b)
22112213
raise
2212-
2214+
22132215
hold(b)
22142216
return ret
22152217
if Axes.stem.__doc__ is not None:
@@ -2230,7 +2232,7 @@ def vlines(*args, **kwargs):
22302232
except:
22312233
hold(b)
22322234
raise
2233-
2235+
22342236
hold(b)
22352237
return ret
22362238
if Axes.vlines.__doc__ is not None:
@@ -2293,7 +2295,7 @@ def quiverkey(*args, **kwargs):
22932295
except:
22942296
hold(b)
22952297
raise
2296-
2298+
22972299
hold(b)
22982300
return ret
22992301
if Axes.quiverkey.__doc__ is not None:
@@ -2542,4 +2544,16 @@ def winter():
25422544
draw_if_interactive()
25432545

25442546

2547+
# This function was autogenerated by boilerplate.py. Do not edit as
2548+
# changes will be lost
2549+
def spectral():
2550+
'set the default colormap to spectral and apply to current image if any. See help(colormaps) for more information'
2551+
rc('image', cmap='spectral')
2552+
im = gci()
2553+
2554+
2555+
if im is not None:
2556+
im.set_cmap(cm.spectral)
2557+
draw_if_interactive()
2558+
25452559

src/_image.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#include <iostream>
32
#include <fstream>
43
#include <cmath>

0 commit comments

Comments
 (0)