Skip to content
Snippets Groups Projects
Commit af487519 authored by Mayr, Hannes's avatar Mayr, Hannes
Browse files

Resolve conflict in mpl_example.py.

parents fe551ae4 ff690e1c
No related branches found
No related tags found
7 merge requests!41Include latest changes in main branch,!37Merge dev upstream changes into improve/metadata,!34Include architecture diagram in docs,!32SAST implementation,!27Update documentation and version number,!26Merge !23, !24, !25 into main,!25Rework examples
Pipeline #808096 waiting for manual action
examples/example_image1.png

26.8 KiB

examples/example_image2.png

26 KiB

# -*- coding: utf-8 -*-
"""
Example workflow for integrating plotID with jpg or png images.
With tagplot() an ID can be generated and 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
from plotid.tagplot import tagplot
from plotid.publish import publish
# %% Set optional Project ID, which will be placed in front of the generated ID
PROJECT_ID = "MR05_"
# %% Read example images
IMG1 = 'example_image1.png'
IMG2 = 'example_image2.png'
# %% TagPlot
# If multiple images should be tagged, they must be provided as list.
IMGS_AS_LIST = [IMG1, IMG2]
# Example for how to use tagplot with image files
FIGS_AND_IDS = tagplot(IMGS_AS_LIST, 'image', prefix=PROJECT_ID,
id_method='time', location='west')
# Required arguments: tagplot(images as list, desired plot engine)
# %% Publish
# Export your tagged images, copy the research data that generated the images,
# specify the destination folder and give a name for the exported image files.
publish(FIGS_AND_IDS, ['../README.md', '../docs', '../LICENSE'],
'./data', 'my_image')
# Required arguments: publish(output of tagplot(), list of files,
# path to destination folder, name(s) for the resulting images)
# -*- coding: utf-8 -*-
"""
Example workflow for integrating plotID.
Example workflow for integrating plotID with matplotlib figures.
With tagplot() an ID can be generated and printed on the plot. To export the
plot along with the corresponding research data and the plot generating
......@@ -24,37 +24,28 @@ y_2 = np.sin(x) + 2
# %% 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]
# Example for how to use tagplot with matplotlib figures
# FIGS_AND_IDS = tagplot(FIGS_AS_LIST, 'matplotlib', location='west',
# id_method='random', prefix=PROJECT_ID)
# Example for how to use tagplot with image files
FIGS_AND_IDS = tagplot(IMGS_AS_LIST, 'image', prefix=PROJECT_ID,
id_method='time', location='west')
FIGS_AND_IDS = tagplot(FIGS_AS_LIST, 'matplotlib', location='west',
id_method='random', prefix=PROJECT_ID)
# Required arguments: tagplot(images as list, desired plot engine)
# %% Publish
# Arguments: Source directory or files as list, destination directory, figures,
# plots or images.
publish(FIGS_AND_IDS, ['../README.md', '../docs', '../LICENSE'],
'/home/chief/Dokumente/fst/plotid_python/data/', 'image')
'./data', 'my_plot')
# Required arguments: publish(output of tagplot(), list of files,
# path to destination folder, name(s) for the resulting images)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment