Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
mantidproject
mantid
Commits
ea0acd15
Commit
ea0acd15
authored
4 years ago
by
Phil Colebrooke
Browse files
Options
Downloads
Patches
Plain Diff
Re #28534 add checks for plot being surface
parent
cd9bb6df
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
Framework/PythonInterface/mantid/plots/mantidaxes.py
+24
-17
24 additions, 17 deletions
Framework/PythonInterface/mantid/plots/mantidaxes.py
qt/applications/workbench/workbench/plotting/figuremanager.py
+5
-2
5 additions, 2 deletions
...pplications/workbench/workbench/plotting/figuremanager.py
with
29 additions
and
19 deletions
Framework/PythonInterface/mantid/plots/mantidaxes.py
+
24
−
17
View file @
ea0acd15
...
...
@@ -10,6 +10,8 @@ try:
except
ImportError
:
# check Python 2 location
from
collections
import
Iterable
import
copy
import
numpy
as
np
from
matplotlib.axes
import
Axes
from
matplotlib.collections
import
Collection
,
PolyCollection
...
...
@@ -1133,31 +1135,31 @@ class MantidAxes3D(Axes3D):
self
.
figure
.
canvas
.
mpl_disconnect
(
self
.
_cids
[
1
])
def
set_xlim3d
(
self
,
*
args
):
import
numpy
as
np
min
,
max
=
super
().
set_xlim3d
(
*
args
)
x
=
self
.
original_data
[
0
].
copy
()
x
[
np
.
less
(
x
,
min
,
where
=~
np
.
isnan
(
x
))]
=
np
.
nan
x
[
np
.
greater
(
x
,
max
,
where
=~
np
.
isnan
(
x
))]
=
np
.
nan
self
.
collections
[
0
].
_vec
[
0
]
=
x
if
hasattr
(
self
,
'
original_data
'
):
x
=
self
.
original_data
[
0
].
copy
()
x
[
np
.
less
(
x
,
min
,
where
=~
np
.
isnan
(
x
))]
=
np
.
nan
x
[
np
.
greater
(
x
,
max
,
where
=~
np
.
isnan
(
x
))]
=
np
.
nan
self
.
collections
[
0
].
_vec
[
0
]
=
x
def
set_ylim3d
(
self
,
*
args
):
import
numpy
as
np
min
,
max
=
super
().
set_ylim3d
(
*
args
)
y
=
self
.
original_data
[
1
].
copy
()
y
[
np
.
less
(
y
,
min
,
where
=~
np
.
isnan
(
y
))]
=
np
.
nan
y
[
np
.
greater
(
y
,
max
,
where
=~
np
.
isnan
(
y
))]
=
np
.
nan
self
.
collections
[
0
].
_vec
[
1
]
=
y
if
hasattr
(
self
,
'
original_data
'
):
y
=
self
.
original_data
[
1
].
copy
()
y
[
np
.
less
(
y
,
min
,
where
=~
np
.
isnan
(
y
))]
=
np
.
nan
y
[
np
.
greater
(
y
,
max
,
where
=~
np
.
isnan
(
y
))]
=
np
.
nan
self
.
collections
[
0
].
_vec
[
1
]
=
y
def
set_zlim3d
(
self
,
*
args
):
import
numpy
as
np
min
,
max
=
super
().
set_zlim3d
(
*
args
)
z
=
self
.
original_data
[
2
].
copy
()
z
[
np
.
less
(
z
,
min
,
where
=~
np
.
isnan
(
z
))]
=
np
.
nan
z
[
np
.
greater
(
z
,
max
,
where
=~
np
.
isnan
(
z
))]
=
np
.
nan
self
.
collections
[
0
].
_vec
[
2
]
=
z
if
hasattr
(
self
,
'
original_data
'
):
z
=
self
.
original_data
[
2
].
copy
()
z
[
np
.
less
(
z
,
min
,
where
=~
np
.
isnan
(
z
))]
=
np
.
nan
z
[
np
.
greater
(
z
,
max
,
where
=~
np
.
isnan
(
z
))]
=
np
.
nan
self
.
collections
[
0
].
_vec
[
2
]
=
z
def
plot
(
self
,
*
args
,
**
kwargs
):
"""
...
...
@@ -1255,9 +1257,14 @@ class MantidAxes3D(Axes3D):
"""
if
datafunctions
.
validate_args
(
*
args
):
logger
.
debug
(
'
using plotfunctions3D
'
)
return
axesfunctions3D
.
plot_surface
(
self
,
*
args
,
**
kwargs
)
polyc
=
axesfunctions3D
.
plot_surface
(
self
,
*
args
,
**
kwargs
)
else
:
return
Axes3D
.
plot_surface
(
self
,
*
args
,
**
kwargs
)
polyc
=
Axes3D
.
plot_surface
(
self
,
*
args
,
**
kwargs
)
# Create a copy of the original data points because data are set to nan when the axis limits are changed.
self
.
original_data
=
copy
.
deepcopy
(
polyc
.
_vec
)
return
polyc
def
contour
(
self
,
*
args
,
**
kwargs
):
"""
...
...
This diff is collapsed.
Click to expand it.
qt/applications/workbench/workbench/plotting/figuremanager.py
+
5
−
2
View file @
ea0acd15
...
...
@@ -8,6 +8,7 @@
#
#
"""
Provides our custom figure manager to wrap the canvas, window and our custom toolbar
"""
import
copy
import
sys
from
functools
import
wraps
...
...
@@ -428,8 +429,10 @@ class FigureManagerWorkbench(FigureManagerBase, QObject):
if
ax
.
lines
:
# Relim causes issues with colour plots, which have no lines.
ax
.
relim
()
elif
isinstance
(
ax
,
Axes3D
):
import
copy
ax
.
collections
[
0
].
_vec
=
copy
.
deepcopy
(
ax
.
original_data
)
if
hasattr
(
ax
,
'
original_data
'
):
ax
.
collections
[
0
].
_vec
=
copy
.
deepcopy
(
ax
.
original_data
)
else
:
ax
.
view_init
()
ax
.
autoscale
()
...
...
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