Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
c5832e8b
Commit
c5832e8b
authored
May 12, 2017
by
Theo Steininger
Browse files
Made availability of plotly optional.
parent
6a9178dc
Pipeline
#12351
failed with stage
in 4 minutes and 59 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/plotting/plotter/plotter.py
View file @
c5832e8b
...
...
@@ -5,21 +5,22 @@ import os
import
numpy
as
np
import
plotly
import
plotly.offline
as
plotly_offline
from
keepers
import
Loggable
from
nifty.config
import
dependency_injector
as
gdi
from
nifty.spaces.space
import
Space
from
nifty.field
import
Field
import
nifty.nifty_utilities
as
utilities
from
nifty.plotting.figures
import
Figure
2D
,
\
Figure3D
,
\
MultiFigure
from
nifty.plotting.figures
import
Multi
Figure
plotly
=
gdi
.
get
(
'plotly'
)
plotly
.
offline
.
init_notebook_mode
()
try
:
plotly
.
offline
.
init_notebook_mode
()
except
AttributeError
:
pass
from
mpi4py
import
MPI
comm
=
MPI
.
COMM_WORLD
...
...
@@ -30,6 +31,8 @@ class Plotter(Loggable, object):
__metaclass__
=
abc
.
ABCMeta
def
__init__
(
self
,
interactive
=
False
,
path
=
'.'
,
title
=
""
):
if
'plotly'
not
in
gdi
:
raise
ImportError
(
"The module plotly is needed but not available."
)
self
.
interactive
=
interactive
self
.
path
=
path
self
.
title
=
str
(
title
)
...
...
@@ -120,5 +123,5 @@ class Plotter(Loggable, object):
else
:
final_figure
=
figures
[
0
]
plotly
_
offline
.
plot
(
final_figure
.
to_plotly
(),
plotly
.
offline
.
plot
(
final_figure
.
to_plotly
(),
filename
=
os
.
path
.
join
(
self
.
path
,
self
.
title
))
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment