Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wela
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Swain Lab
wela
Commits
f6d6eefc
Commit
f6d6eefc
authored
1 year ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
renamed and added cmap to plot2Dhist
parent
09b10703
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plotting.py
+13
-2
13 additions, 2 deletions
plotting.py
with
13 additions
and
2 deletions
plotting.py
+
13
−
2
View file @
f6d6eefc
...
@@ -297,7 +297,7 @@ def plot_replicate_array(
...
@@ -297,7 +297,7 @@ def plot_replicate_array(
plt
.
show
(
block
=
False
)
plt
.
show
(
block
=
False
)
def
plothist
(
def
plot
2D
hist
(
x
,
x
,
y
,
y
,
bins
=
[
20
,
20
],
bins
=
[
20
,
20
],
...
@@ -305,7 +305,9 @@ def plothist(
...
@@ -305,7 +305,9 @@ def plothist(
figsize
=
None
,
figsize
=
None
,
xlabel
=
"
time
"
,
xlabel
=
"
time
"
,
ylabel
=
None
,
ylabel
=
None
,
xmax
=
None
,
ymax
=
None
,
ymax
=
None
,
cmap
=
None
,
**
kwargs
,
**
kwargs
,
):
):
"""
"""
...
@@ -332,8 +334,12 @@ def plothist(
...
@@ -332,8 +334,12 @@ def plothist(
Label for the x-axis.
Label for the x-axis.
ylabel: str (optional)
ylabel: str (optional)
Label for the y-axis.
Label for the y-axis.
xmax: float (optional)
The maximal value on the x-axis.
ymax: float (optional)
ymax: float (optional)
The maximal value on the y-axis.
The maximal value on the y-axis.
cmap: matplotlib.colormap (optional)
Color map for the shading.
**kwargs:
**kwargs:
Passed to plt.pcolormesh.
Passed to plt.pcolormesh.
...
@@ -374,7 +380,10 @@ def plothist(
...
@@ -374,7 +380,10 @@ def plothist(
# bin
# bin
h
,
xedges
,
yedges
=
np
.
histogram2d
(
xn
,
yn
,
bins
=
bins
)
h
,
xedges
,
yedges
=
np
.
histogram2d
(
xn
,
yn
,
bins
=
bins
)
# make histogram
# make histogram
cmap
=
copy
(
plt
.
cm
.
viridis
)
if
cmap
is
None
:
cmap
=
copy
(
plt
.
cm
.
viridis
)
else
:
cmap
=
copy
(
cmap
)
cmap
.
set_bad
(
cmap
(
0
))
cmap
.
set_bad
(
cmap
(
0
))
# plot using pcolormesh
# plot using pcolormesh
if
figsize
is
not
None
:
if
figsize
is
not
None
:
...
@@ -394,6 +403,8 @@ def plothist(
...
@@ -394,6 +403,8 @@ def plothist(
plt
.
ylabel
(
ylabel
)
plt
.
ylabel
(
ylabel
)
if
ymax
is
not
None
:
if
ymax
is
not
None
:
plt
.
ylim
(
top
=
ymax
)
plt
.
ylim
(
top
=
ymax
)
if
xmax
is
not
None
:
plt
.
xlim
(
right
=
xmax
)
if
title
:
if
title
:
plt
.
title
(
title
)
plt
.
title
(
title
)
plt
.
tight_layout
()
plt
.
tight_layout
()
...
...
This diff is collapsed.
Click to expand it.
Arin Wongprommoon
@s1947236
mentioned in issue
#3 (closed)
·
1 year ago
mentioned in issue
#3 (closed)
mentioned in issue #3
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment