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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plotID
plotID_python
Merge requests
!17
Fallback engine implementation
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Fallback engine implementation
fallback
into
dev
Overview
1
Commits
12
Pipelines
1
Changes
16
Merged
Mayr, Hannes
requested to merge
fallback
into
dev
2 years ago
Overview
1
Commits
12
Pipelines
1
Changes
16
Expand
Tagging and publishing images should now work with the "image" engine. See
#48 (closed)
0
0
Merge request reports
Compare
dev
dev (base)
and
latest version
latest version
ee6e488e
12 commits,
2 years ago
16 files
+
362
−
66
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
16
Search (e.g. *.vue) (Ctrl+P)
plotid/example.py
+
19
−
19
Options
@@ -2,14 +2,13 @@
"""
Example workflow for integrating plotID.
With tagplot an ID can be generated an printed on the plot. To export the
plot
along with the corresponding research data and the plot generating
script use
the function publish.
With tagplot
()
an ID can be generated an
d
printed on the plot. To export the
plot
along with the corresponding research data and the plot generating
script use
the function publish
()
.
"""
# %% Import modules
import
numpy
as
np
# import h5py as h5
import
matplotlib.pyplot
as
plt
from
plotid.tagplot
import
tagplot
from
plotid.publish
import
publish
@@ -17,44 +16,45 @@ from plotid.publish import publish
# %% Set Project ID
PROJECT_ID
=
"
MR04_
"
# %% Choose Plot engine
PLOT_ENGINE
=
"
matplotlib
"
# %% Create sample data
x
=
np
.
linspace
(
0
,
10
,
100
)
y
=
np
.
random
.
rand
(
100
)
+
2
y_2
=
np
.
sin
(
x
)
+
2
# %% Create figures
# %% Create
sample
figures
# 1. figure
IMG1
=
'
image1.png
'
FIG1
=
plt
.
figure
()
plt
.
plot
(
x
,
y
,
color
=
'
black
'
)
plt
.
plot
(
x
,
y_2
,
color
=
'
yellow
'
)
plt
.
savefig
(
IMG1
)
# 2. figure
IMG2
=
'
image2.png
'
FIG2
=
plt
.
figure
()
plt
.
plot
(
x
,
y
,
color
=
'
blue
'
)
plt
.
plot
(
x
,
y_2
,
color
=
'
red
'
)
plt
.
savefig
(
IMG2
)
# %% TagPlot
# If multiple figures should be tagged, figures must be provided as list.
FIGS_AS_LIST
=
[
FIG1
,
FIG2
]
IMGS_AS_LIST
=
[
IMG1
,
IMG2
]
[
TAGGED_FIGS
,
ID
]
=
tagplot
(
FIGS_AS_LIST
,
PLOT_ENGINE
,
prefix
=
PROJECT_ID
,
id_method
=
'
random
'
,
location
=
'
west
'
)
# Example for how to use tagplot with matplotlib figures
[
TAGGED_FIGS
,
ID
]
=
tagplot
(
'
FIGS_AS_LIST
'
,
'
matplotlib
'
,
prefix
=
PROJECT_ID
,
id_method
=
'
time
'
,
location
=
'
west
'
)
# %% 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)
# Example for how to use tagplot with image files
# [TAGGED_FIGS, ID] = tagplot(IMGS_AS_LIST, 'image', prefix=PROJECT_ID,
# id_method='random', location='west')
# %% Publish
# Arguments: Source directory, destination directory, figure
, plot name
,
# p
ublish-mode)
.
# Arguments: Source directory
or files as list
, destination directory, figure
s
,
# p
lots or images
.
publish
([
'
../README.md
'
,
'
../
te
st
s
'
,
'
../LICENSE
'
],
publish
([
'
../README.md
'
,
'
../
di
st
'
,
'
../LICENSE
'
],
'
/home/chief/Dokumente/fst/plotid_python/data
'
,
FIGS_AS_LIST
,
'
Bild
'
,
'
individual
'
)
TAGGED_FIGS
,
'
Bild
'
)
Loading