Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
empyre
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dieter Weber
empyre
Commits
9f0bc84f
Commit
9f0bc84f
authored
5 years ago
by
Jan Caron
Browse files
Options
Downloads
Patches
Plain Diff
plottools: added plot_ellipse function
(in future, avrg_kern_field should not plot itself, outsource plotting!)
parent
19315881
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyramid/diagnostics.py
+1
-2
1 addition, 2 deletions
pyramid/diagnostics.py
pyramid/plottools.py
+13
-4
13 additions, 4 deletions
pyramid/plottools.py
with
14 additions
and
6 deletions
pyramid/diagnostics.py
+
1
−
2
View file @
9f0bc84f
...
@@ -20,8 +20,7 @@ from pyramid import reconstruction
...
@@ -20,8 +20,7 @@ from pyramid import reconstruction
from
pyramid
import
plottools
from
pyramid
import
plottools
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
from
matplotlib
import
patches
from
matplotlib
import
patches
,
patheffects
from
matplotlib
import
patheffects
from
matplotlib.ticker
import
FuncFormatter
from
matplotlib.ticker
import
FuncFormatter
from
matplotlib.colors
import
LogNorm
from
matplotlib.colors
import
LogNorm
import
numpy
as
np
import
numpy
as
np
...
...
This diff is collapsed.
Click to expand it.
pyramid/plottools.py
+
13
−
4
View file @
9f0bc84f
...
@@ -14,7 +14,7 @@ import matplotlib as mpl
...
@@ -14,7 +14,7 @@ import matplotlib as mpl
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
import
matplotlib.font_manager
as
fm
# TODO: Everywhere or managed through stylesheets!
import
matplotlib.font_manager
as
fm
# TODO: Everywhere or managed through stylesheets!
from
matplotlib.offsetbox
import
AnchoredOffsetbox
,
TextArea
from
matplotlib.offsetbox
import
AnchoredOffsetbox
,
TextArea
from
matplotlib
import
patheffects
from
matplotlib
import
patches
,
patheffects
from
matplotlib.ticker
import
MaxNLocator
,
FuncFormatter
from
matplotlib.ticker
import
MaxNLocator
,
FuncFormatter
from
mpl_toolkits.axes_grid1.inset_locator
import
inset_axes
from
mpl_toolkits.axes_grid1.inset_locator
import
inset_axes
...
@@ -392,12 +392,9 @@ def plot_3d_to_2d(dim_uv, axis=None, figsize=None, dpi=100, mag=1, close_3d=True
...
@@ -392,12 +392,9 @@ def plot_3d_to_2d(dim_uv, axis=None, figsize=None, dpi=100, mag=1, close_3d=True
# IF resolution of mayavi image is smaller than screen resolution:
# IF resolution of mayavi image is smaller than screen resolution:
tmpdir
=
tempfile
.
mkdtemp
()
tmpdir
=
tempfile
.
mkdtemp
()
temp_path
=
os
.
path
.
join
(
tmpdir
,
'
temp.png
'
)
temp_path
=
os
.
path
.
join
(
tmpdir
,
'
temp.png
'
)
print
(
'
Temp file created
'
)
try
:
try
:
mlab
.
savefig
(
temp_path
,
magnification
=
mag
)
mlab
.
savefig
(
temp_path
,
magnification
=
mag
)
print
(
f
'
SAVED with mag=
{
mag
}
!
'
)
imgmap
=
np
.
asarray
(
Image
.
open
(
temp_path
))
imgmap
=
np
.
asarray
(
Image
.
open
(
temp_path
))
print
(
'
LOADED!
'
)
except
Exception
as
e
:
except
Exception
as
e
:
raise
e
raise
e
finally
:
finally
:
...
@@ -413,6 +410,18 @@ def plot_3d_to_2d(dim_uv, axis=None, figsize=None, dpi=100, mag=1, close_3d=True
...
@@ -413,6 +410,18 @@ def plot_3d_to_2d(dim_uv, axis=None, figsize=None, dpi=100, mag=1, close_3d=True
return
format_axis
(
axis
,
**
kwargs
)
return
format_axis
(
axis
,
**
kwargs
)
def
plot_ellipse
(
axis
,
pos_2d
,
width
,
height
):
xy
=
(
pos_2d
[
1
],
pos_2d
[
0
])
rect
=
axis
.
add_patch
(
patches
.
Rectangle
(
xy
,
1
,
1
,
fill
=
False
,
edgecolor
=
'
w
'
,
linewidth
=
2
,
alpha
=
0.5
))
rect
.
set_path_effects
([
patheffects
.
withStroke
(
linewidth
=
4
,
foreground
=
'
k
'
,
alpha
=
0.5
)])
xy
=
((
xy
[
0
]
+
0.5
),
(
xy
[
1
]
+
0.5
))
artist
=
axis
.
add_patch
(
patches
.
Ellipse
(
xy
,
width
,
height
,
fill
=
False
,
edgecolor
=
'
w
'
,
linewidth
=
2
,
alpha
=
0.5
))
artist
.
set_path_effects
([
patheffects
.
withStroke
(
linewidth
=
4
,
foreground
=
'
k
'
,
alpha
=
0.5
)])
return
axis
# TODO: Florians way of shifting axes labels (should already be in somewhere):
# TODO: Florians way of shifting axes labels (should already be in somewhere):
# for i in [1, 3]:
# for i in [1, 3]:
# axs[i].yaxis.set_label_position('right')
# axs[i].yaxis.set_label_position('right')
...
...
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