Skip to content

Commit 079f1c0

Browse files
committed
Tweak probabilistic labels example
1 parent e04e292 commit 079f1c0

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

examples/plot_probabilistic_label.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""
2+
============================
23
Display Probabilistic Labels
34
============================
45
@@ -16,37 +17,39 @@
1617
config_opts=dict(cortex="low_contrast"))
1718

1819
"""
19-
The simplest way is to use add_label.
20+
The easiest way to label any vertex that could be in the region is with
21+
add_label.
2022
"""
21-
brain.add_label("BA1", color="darkblue")
23+
brain.add_label("BA1", color="#A6BDDB")
2224

2325
"""
24-
You can also threshold based on the probability of that
25-
region being at each vertex.
26+
You can also threshold based on the probability of that region being at each
27+
vertex.
2628
"""
27-
brain.add_label("BA1", color="dodgerblue", scalar_thresh=.5)
29+
brain.add_label("BA1", color="#2B8CBE", scalar_thresh=.5)
2830

2931
"""
30-
It's also possible to plot just the label boundary, in case
31-
you wanted to overlay the label on an activation plot to
32-
asses whether it falls within that region.
32+
It's also possible to plot just the label boundary, in case you wanted to
33+
overlay the label on an activation plot to asses whether it falls within that
34+
region.
3335
"""
34-
brain.add_label("BA45", color="firebrick", borders=True)
35-
brain.add_label("BA45", color="salmon", borders=True, scalar_thresh=.5)
36+
brain.add_label("BA45", color="#F0F8FF", borders=True, scalar_thresh=.5)
37+
brain.add_label("BA45", color="#F0F8FF", alpha=.3, scalar_thresh=.5)
3638

3739
"""
3840
Finally, with a few tricks, you can display the whole probabilistic map.
3941
"""
40-
label_file = join(environ["SUBJECTS_DIR"],
41-
"fsaverage", "label", "lh.BA6.label")
42+
subjects_dir = environ["SUBJECTS_DIR"]
43+
label_file = join(subjects_dir, "fsaverage", "label", "lh.BA6.label")
44+
4245
prob_field = np.zeros_like(brain._geo.x)
4346
ids, probs = io.read_label(label_file, read_scalars=True)
4447
prob_field[ids] = probs
45-
brain.add_data(prob_field, thresh=1e-5)
48+
brain.add_data(prob_field, thresh=1e-5, colormap="RdPu")
4649

4750
"""
48-
Adjust the colorbar to represent the coarseness of the probability
49-
estimates more closely.
51+
Adjust the colorbar to represent the coarseness of the probability estimates
52+
more closely.
5053
"""
5154
brain.data["colorbar"].number_of_colors = 10
5255
brain.data["colorbar"].number_of_labels = 11

0 commit comments

Comments
 (0)