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
Daniel Boeckenhoff
tfields
Commits
ae9b671b
Commit
ae9b671b
authored
Nov 30, 2018
by
Daniel Boeckenhoff
Browse files
added a plotting method
parent
bfcced83
Changes
3
Hide whitespace changes
Inline
Side-by-side
tfields/core.py
View file @
ae9b671b
...
...
@@ -1254,7 +1254,7 @@ class Tensors(AbstractNdarray):
"""
# weights = self.getNormedWeightedAreas(weights=weights)
weights
=
self
.
_weights
(
weights
)
mean
=
self
.
m
oments
(
1
)
mean
=
np
.
array
(
self
)
.
m
ean
(
axis
=
0
)
relative_coords
=
self
-
mean
cov
=
np
.
cov
(
relative_coords
.
T
,
ddof
=
0
,
...
...
tfields/lib/in_out.py
View file @
ae9b671b
...
...
@@ -6,7 +6,17 @@ import shutil
import
subprocess
import
contextlib
import
logging
from
pathlib
import
Path
try
:
from
pathlib
import
Path
as
PathlibPath
PathlibPath
().
expanduser
()
# not existing in python2 version of pathlib
except
(
ImportError
,
AttributeError
):
from
pathlib2
import
Path
as
PathlibPath
class
Path
(
type
(
PathlibPath
())):
def
resolve
(
self
):
new_path
=
self
.
expanduser
()
return
super
(
Path
,
new_path
).
resolve
()
def
resolve
(
path
):
...
...
tfields/plotting/mpl.py
View file @
ae9b671b
...
...
@@ -445,6 +445,50 @@ def plot_function(fun, **kwargs):
return
artist
def
plot_errorbar
(
points
,
errors_up
,
errors_down
=
None
,
**
kwargs
):
"""
Args:
axis (matplotlib.Axis) object
Returns:
Artist or list of Artists (imitating the axis.scatter/plot behaviour).
Better Artist not list of Artists
"""
po
=
tfields
.
plotting
.
PlotOptions
(
kwargs
)
po
.
set_default
(
'marker'
,
'_'
)
if
errors_down
is
None
:
errors_down
=
errors_up
artists
=
[]
# plot points
# artists.append(po.axis.plot(points, **po.plotKwargs))
# plot errorbars
for
i
in
range
(
len
(
points
)):
artists
.
append
(
po
.
axis
.
plot
([
points
[
i
,
0
]
+
errors_up
[
i
,
0
],
points
[
i
,
0
]
-
errors_down
[
i
,
0
]],
[
points
[
i
,
1
],
points
[
i
,
1
]],
[
points
[
i
,
2
],
points
[
i
,
2
]],
**
po
.
plotKwargs
))
artists
.
append
(
po
.
axis
.
plot
([
points
[
i
,
0
],
points
[
i
,
0
]],
[
points
[
i
,
1
]
+
errors_up
[
i
,
1
],
points
[
i
,
1
]
-
errors_down
[
i
,
1
]],
[
points
[
i
,
2
],
points
[
i
,
2
]],
**
po
.
plotKwargs
))
artists
.
append
(
po
.
axis
.
plot
([
points
[
i
,
0
],
points
[
i
,
0
]],
[
points
[
i
,
1
],
points
[
i
,
1
]],
[
points
[
i
,
2
]
+
errors_up
[
i
,
2
],
points
[
i
,
2
]
-
errors_down
[
i
,
2
]],
**
po
.
plotKwargs
))
return
artists
"""
Color section
"""
...
...
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