Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
plotID_python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plotID
plotID_python
Commits
b50c36b2
Commit
b50c36b2
authored
Jul 27, 2022
by
Mayr, Hannes
Browse files
Options
Downloads
Patches
Plain Diff
Publish plots with fallback/picture/PIL engine.
parent
8513e4bb
No related branches found
No related tags found
2 merge requests
!19
merge dev for new release v.0.1.2
,
!17
Fallback engine implementation
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
plotid/example.py
+3
-7
3 additions, 7 deletions
plotid/example.py
plotid/save_plot.py
+12
-8
12 additions, 8 deletions
plotid/save_plot.py
plotid/tagplot_image.py
+0
-1
0 additions, 1 deletion
plotid/tagplot_image.py
with
15 additions
and
16 deletions
plotid/example.py
+
3
−
7
View file @
b50c36b2
...
...
@@ -48,13 +48,9 @@ FIGS_AS_LIST = [FIG1, FIG2]
IMGS_AS_LIST
=
[
img1
,
img2
]
[
TAGGED_FIGS
,
ID
]
=
tagplot
(
IMGS_AS_LIST
,
PLOT_ENGINE
,
prefix
=
PROJECT_ID
,
id_method
=
'
random
'
,
location
=
'
north
'
)
id_method
=
'
random
'
,
location
=
'
west
'
)
print
(
type
(
TAGGED_FIGS
[
0
]))
# %% Save figure as tiff-file, but publish also exports the plot to a picture
# file in the destination folder.
# for i, figure in enumerate(TAGGED_FIGS):
# NAME = "Test"+str(i)+".tiff"
# figure.savefig(NAME)
# %% Publish
# Arguments: Source directory, destination directory, figure, plot name,
...
...
@@ -62,4 +58,4 @@ print(type(TAGGED_FIGS[0]))
publish
([
'
../README.md
'
,
'
../tests
'
,
'
../LICENSE
'
],
'
/home/chief/Dokumente/fst/plotid_python/data
'
,
FIGS_AS_LIST
,
'
Bild
'
,
'
individual
'
)
TAGGED_FIGS
,
'
Bild
'
,
'
individual
'
)
This diff is collapsed.
Click to expand it.
plotid/save_plot.py
+
12
−
8
View file @
b50c36b2
...
...
@@ -53,13 +53,17 @@ def save_plot(figures, plot_names, extension='png'):
raise
IndexError
(
'
There are more plot names than figures.
'
)
plot_path
=
[]
# match type(figures):
# case matplotlib.figure.Figure:
# PIL has different classes for different file formats. Therefore, the
# type is checked to contain 'PIL' and 'ImageFile'.
if
all
(
x
in
str
(
type
(
figure
))
for
x
in
[
'
PIL
'
,
'
ImageFile
'
]):
figure
.
save
(
plot_path
)
elif
'
matplotlib.figure.Figure
'
in
str
(
type
(
figure
)):
for
i
,
fig
in
enumerate
(
figures
):
plt
.
figure
(
fig
)
plot_path
.
append
(
plot_names
[
i
]
+
'
.
'
+
extension
)
plt
.
savefig
(
plot_path
[
i
])
# case _
:
#
raise TypeError('The given figure is not a valid figure object.')
else
:
raise
TypeError
(
'
The given figure is not a valid figure object.
'
)
return
plot_path
This diff is collapsed.
Click to expand it.
plotid/tagplot_image.py
+
0
−
1
View file @
b50c36b2
...
...
@@ -51,5 +51,4 @@ def tagplot_image(plotid_object):
int
(
img
.
height
*
(
1
-
plotid_object
.
position
[
1
]))),
txt
)
plotid_object
.
figs
[
i
]
=
img
# img.save(f'hello_{i}.png')
return
[
plotid_object
.
figs
,
ids_as_list
]
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