Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
e622e200
Commit
e622e200
authored
Sep 12, 2017
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a few custom color maps
parent
67202b48
Pipeline
#18100
passed with stage
in 11 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
nifty2go/plotting/plot.py
nifty2go/plotting/plot.py
+52
-0
No files found.
nifty2go/plotting/plot.py
View file @
e622e200
...
...
@@ -82,9 +82,61 @@ def _limit_xy(**kwargs):
y2
=
kwargs
.
get
(
"ymax"
)
plt
.
axis
((
x1
,
x2
,
y1
,
y2
))
def
_register_cmaps
():
try
:
if
_register_cmaps
.
_cmaps_registered
:
return
except
AttributeError
:
_register_cmaps
.
_cmaps_registered
=
True
from
matplotlib.colors
import
LinearSegmentedColormap
import
matplotlib.pyplot
as
plt
planckcmap
=
{
'red'
:
((
0.0
,
0.0
,
0.0
),
(
0.4
,
0.0
,
0.0
),
(
0.5
,
1.0
,
1.0
),
(
0.7
,
1.0
,
1.0
),
(
0.8
,
0.83
,
0.83
),
(
0.9
,
0.67
,
0.67
),
(
1.0
,
0.5
,
0.5
)),
'green'
:((
0.0
,
0.0
,
0.0
),
(
0.2
,
0.0
,
0.0
),
(
0.3
,
0.3
,
0.3
),
(
0.4
,
0.7
,
0.7
),
(
0.5
,
1.0
,
1.0
),
(
0.6
,
0.7
,
0.7
),
(
0.7
,
0.3
,
0.3
),
(
0.8
,
0.0
,
0.0
),
(
1.0
,
0.0
,
0.0
)),
'blue'
:
((
0.0
,
0.5
,
0.5
),
(
0.1
,
0.67
,
0.67
),
(
0.2
,
0.83
,
0.83
),
(
0.3
,
1.0
,
1.0
),
(
0.5
,
1.0
,
1.0
),
(
0.6
,
0.0
,
0.0
),
(
1.0
,
0.0
,
0.0
))
}
he_cmap
=
{
'red'
:
((
0.0
,
0.0
,
0.0
),
(
0.167
,
0.0
,
0.0
),
(
0.333
,
0.5
,
0.5
),
(
0.5
,
1.0
,
1.0
),
(
1.0
,
1.0
,
1.0
)),
'green'
:((
0.0
,
0.0
,
0.0
),
(
0.5
,
0.0
,
0.0
),
(
0.667
,
0.5
,
0.5
),
(
0.833
,
1.0
,
1.0
),
(
1.0
,
1.0
,
1.0
)),
'blue'
:
((
0.0
,
0.0
,
0.0
),
(
0.167
,
1.0
,
1.0
),
(
0.333
,
0.5
,
0.5
),
(
0.5
,
0.0
,
0.0
),
(
1.0
,
1.0
,
1.0
))
}
plt
.
register_cmap
(
cmap
=
LinearSegmentedColormap
(
"Planck-like"
,
planckcmap
))
plt
.
register_cmap
(
cmap
=
LinearSegmentedColormap
(
"High Energy"
,
he_cmap
))
def
plot
(
f
,
**
kwargs
):
import
matplotlib.pyplot
as
plt
_register_cmaps
()
if
not
isinstance
(
f
,
Field
):
raise
TypeError
(
"incorrect data type"
)
if
len
(
f
.
domain
)
!=
1
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment