Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
win-pytreat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
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
FSL
win-pytreat
Commits
162ce137
Commit
162ce137
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
plotting prac
parent
7ee8c4a3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
getting_started/06_plotting.ipynb
+45
-198
45 additions, 198 deletions
getting_started/06_plotting.ipynb
getting_started/06_plotting.md
+19
-4
19 additions, 4 deletions
getting_started/06_plotting.md
with
64 additions
and
202 deletions
getting_started/06_plotting.ipynb
+
45
−
198
View file @
162ce137
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
getting_started/06_plotting.md
+
19
−
4
View file @
162ce137
...
...
@@ -109,7 +109,7 @@ there is also an alternative: `scatter()`
```
fig, ax = plt.subplots()
# setup some sizes for each point (arbitrarily example here)
ssize = 100*abs(samp1-samp2) + 10
ssize = 100*abs(samp1-samp2) + 10
ax.scatter(samp1, samp2, s=ssize, alpha=0.5)
# now add the y=x line
allsamps = np.hstack((samp1,samp2))
...
...
@@ -153,11 +153,28 @@ import nibabel as nib
import os.path as op
nim = nib.load(op.expandvars('${FSLDIR}/data/standard/MNI152_T1_1mm.nii.gz'), mmap=False)
imdat = nim.get_data().astype(float)
plt.imshow(imdat[:,:,70], cmap=plt.cm.gray)
imslc = imdat[:,:,70]
plt.imshow(imslc, cmap=plt.cm.gray)
plt.colorbar()
plt.grid('off')
```
Note that matplotlib will use the
**voxel data orientation**
, and that
configuring the plot orientation is
**your responsibility**
. To rotate a
slice, simply transpose the data (
`.T`
). To invert the data along along an
axis, you don't need to modify the data - simply swap the axis limits around:
```
plt.imshow(imslc, cmap=plt.cm.gray)
plt.xlim(reversed(plt.xlim()))
plt.ylim(reversed(plt.ylim()))
plt.colorbar()
plt.grid('off')
```
<a
class=
"anchor"
id=
"3D-plots"
></a>
### 3D plots
...
...
@@ -208,5 +225,3 @@ example code from the docs).
```
# Make up some data and do the funky plot
```
This diff is collapsed.
Click to expand it.
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