Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gregory Ashton
PyFstat
Commits
d7f2a89f
Commit
d7f2a89f
authored
Oct 07, 2016
by
Gregory Ashton
Browse files
Adds ability to 2D plot data in higher dimension
parent
50d905d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
pyfstat.py
View file @
d7f2a89f
...
...
@@ -1487,7 +1487,7 @@ class GridSearch(BaseSearchClass):
fig
.
savefig
(
'{}/{}_1D.png'
.
format
(
self
.
outdir
,
self
.
label
))
def
plot_2D
(
self
,
xkey
,
ykey
,
ax
=
None
,
save
=
True
,
vmin
=
None
,
vmax
=
None
,
add_mismatch
=
None
,
xN
=
None
,
yN
=
None
):
add_mismatch
=
None
,
xN
=
None
,
yN
=
None
,
flat_keys
=
[]
):
""" Plots a 2D grid of 2F values
Parameters
...
...
@@ -1500,12 +1500,19 @@ class GridSearch(BaseSearchClass):
fig
,
ax
=
plt
.
subplots
()
xidx
=
self
.
keys
.
index
(
xkey
)
yidx
=
self
.
keys
.
index
(
ykey
)
flat_idxs
=
[
self
.
keys
.
index
(
k
)
for
k
in
flat_keys
]
x
=
np
.
unique
(
self
.
data
[:,
xidx
])
y
=
np
.
unique
(
self
.
data
[:,
yidx
])
flat_vals
=
[
np
.
unique
(
self
.
data
[:,
j
])
for
j
in
flat_idxs
]
z
=
self
.
data
[:,
-
1
]
Y
,
X
=
np
.
meshgrid
(
y
,
x
)
Z
=
z
.
reshape
(
X
.
shape
)
shape
=
[
len
(
x
),
len
(
y
)]
+
[
len
(
v
)
for
v
in
flat_vals
]
Z
=
z
.
reshape
(
shape
)
while
Z
.
ndim
>
2
:
Z
=
np
.
mean
(
Z
,
axis
=-
1
)
pax
=
ax
.
pcolormesh
(
X
,
Y
,
Z
,
cmap
=
plt
.
cm
.
viridis
,
vmin
=
vmin
,
vmax
=
vmax
)
plt
.
colorbar
(
pax
,
ax
=
ax
)
...
...
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