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
5d0c77ba
Commit
5d0c77ba
authored
6 years ago
by
Gigg, Martyn Anthony
Browse files
Options
Downloads
Patches
Plain Diff
Include matplotlib collections as Image figure types.
Refs #0
parent
892a7b1b
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
qt/applications/workbench/workbench/plotting/figuretype.py
+5
-11
5 additions, 11 deletions
qt/applications/workbench/workbench/plotting/figuretype.py
with
5 additions
and
11 deletions
qt/applications/workbench/workbench/plotting/figuretype.py
+
5
−
11
View file @
5d0c77ba
...
@@ -32,7 +32,7 @@ class FigureType(Enum):
...
@@ -32,7 +32,7 @@ class FigureType(Enum):
Line
=
1
Line
=
1
# Line plot with error bars
# Line plot with error bars
Errorbar
=
2
Errorbar
=
2
# An image plot from imshow, pcolor
# An image plot from imshow, pcolor
, pcolormesh
Image
=
3
Image
=
3
# Any other type of plot
# Any other type of plot
Other
=
100
Other
=
100
...
@@ -53,23 +53,17 @@ def axes_type(ax):
...
@@ -53,23 +53,17 @@ def axes_type(ax):
if
nrows
==
1
and
ncols
==
1
:
if
nrows
==
1
and
ncols
==
1
:
if
len
(
ax
.
lines
)
>
0
:
if
len
(
ax
.
lines
)
>
0
:
axtype
=
FigureType
.
Line
axtype
=
FigureType
.
Line
elif
len
(
ax
.
images
)
>
0
:
elif
len
(
ax
.
images
)
>
0
or
len
(
ax
.
collections
)
>
0
:
axtype
=
FigureType
.
Image
axtype
=
FigureType
.
Image
return
axtype
return
axtype
def
figure_type
(
fig
):
def
figure_type
(
fig
):
"""
Return the type of the figure
"""
Return the type of the figure. It inspects the axes
return by fig.gca()
:param fig: A matplotlib figure instance
:param fig: A matplotlib figure instance
:return: An enumeration defining the plot type
:return: An enumeration defining the plot type
"""
"""
all_axes
=
fig
.
axes
return
axes_type
(
fig
.
gca
())
all_axes_length
=
len
(
all_axes
)
if
all_axes_length
==
0
:
return
FigureType
.
Empty
elif
all_axes_length
==
1
:
return
axes_type
(
all_axes
[
0
])
else
:
return
FigureType
.
Other
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