Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
TopFarm2
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
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TOPFARM
TopFarm2
Commits
698b2c79
Commit
698b2c79
authored
6 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
pause without show in plotting.py
parent
ef592541
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
topfarm/plotting.py
+23
-3
23 additions, 3 deletions
topfarm/plotting.py
with
23 additions
and
3 deletions
topfarm/plotting.py
+
23
−
3
View file @
698b2c79
import
time
import
matplotlib
from
openmdao.core.explicitcomponent
import
ExplicitComponent
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
numpy
as
np
def
mypause
(
interval
):
# pause without show
backend
=
plt
.
rcParams
[
'
backend
'
]
if
backend
in
matplotlib
.
rcsetup
.
interactive_bk
:
figManager
=
matplotlib
.
_pylab_helpers
.
Gcf
.
get_active
()
if
figManager
is
not
None
:
canvas
=
figManager
.
canvas
if
canvas
.
figure
.
stale
:
canvas
.
draw
()
canvas
.
start_event_loop
(
interval
)
return
class
PlotComp
(
ExplicitComponent
):
"""
Evaluates the equation f(x,y) = (x-3)^2 + xy + (y+4)^2 - 3.
...
...
@@ -57,6 +74,9 @@ class PlotComp(ExplicitComponent):
plt
.
plot
(
history_arr
[:,
0
,
i
],
history_arr
[:,
1
,
i
],
'
.-
'
,
color
=
c
,
lw
=
1
)
plt
.
plot
(
x_
,
y_
,
'
o
'
,
color
=
c
,
ms
=
5
)
plt
.
plot
(
x_
,
y_
,
'
x
'
+
'
k
'
,
ms
=
4
)
plt
.
pause
(.
01
)
if
self
.
counter
==
0
:
plt
.
pause
(.
01
)
mypause
(
0.01
)
self
.
counter
+=
1
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