Commit e9a6db50 authored by Hock, Martin's avatar Hock, Martin 🤹
Browse files

Merge branch 'dev' into 'main'

Update documentation with new naming.

See merge request !13
parents 8abe8e6a 30700c18
Pipeline #751552 passed with stages
in 1 minute and 2 seconds
# PlotID for Python
# plotID for Python
This is the python PlotID project.
PlotID is a program connected to Research Data Management (RDM). It has two main functionalities:
This is the python plotID project.
plotID is a program connected to Research Data Management (RDM). It has two main functionalities:
1. Tag your plot with an identifier.
2. Export the resulting file to a specified directory along the corresponding research data, the plot is based on. Additionally, the script that created the plot will also be copied to the directory.
**Note:** To run PlotID python version ≥ 3.10 is required.
**Note:** To run plotID python version ≥ 3.10 is required.
## Installation
Currently there are two options to run PlotID. Either install it via pip from the Python Package Index (PyPi) or install PlotID from the source code.
Currently there are two options to run plotID. Either install it via pip from the Python Package Index (PyPi) or install plotID from the source code.
### From PyPi with pip
1. [Optional] Create a virtual environment and activate it:
```bash
pip install venv
mkdir venv
python3 -m venv
source venv/bin/activate
python3 -m venv venv
source venv/bin/activate # Unix
```
```cmd
venv\Scripts\activate.bat # Windows Command Prompt
venv\Scripts\Activate.ps1 # Windows PowerShell
```
2. Install PlotID
`pip install --upgrade --index-url https://test.pypi.org/simple/ example-package-plotid-test`
### From PyPi with pip
2. Install plotID
`pip install plotid --extra-index-url=https://test.pypi.org/simple/`
If you also want to run the unittests use `plotid[test]` instead of `plotid`.
### From source
1. Download the source code from [Gitlab](https://git.rwth-aachen.de/plotid/plotid_python):
2. Download the source code from [Gitlab](https://git.rwth-aachen.de/plotid/plotid_python):
`git clone https://git.rwth-aachen.de/plotid/plotid_python.git`
`cd plotid_python`
2. [Optional] Create a virtual environment:
```bash
pip install venv
mkdir venv
python3 -m venv
source venv/bin/activate
```
3. Install dependencies
`pip install -r requirements.txt`
4. Install PlotID
4. Install plotID
`pip install .`
## Usage
PlotID has two main functionalities:
plotID has two main functionalities:
1. Tag your plot with an identifier.
2. Export the resulting file to a specified directory along the corresponding research data, the plot is based on. Additionally, the script that created the plot will also be copied to the directory.
......@@ -46,7 +46,7 @@ PlotID has two main functionalities:
Tag your figure/plot with an ID.
`tagplot(figures, plot_engine)`
The variable "figures" can be a single figure or a list of multiple figures.
The argument "plot_engine" defines which plot engine was used to create the figures. It also determines which plot engine PlotID uses to place the ID on the plot. Currently supported plot engines are:
The argument "plot_engine" defines which plot engine was used to create the figures. It also determines which plot engine plotID uses to place the ID on the plot. Currently supported plot engines are:
- 'matplotlib'
tagplot returns a list that contains two lists each with as many entries as figures were given. The first list contains the tagged figures. The second list contains the corresponding IDs as strings
......@@ -86,22 +86,16 @@ Example:
`publish('/home/user/Documents/research_data', '/home/user/Documents/exported_data', FIG1, 'EnergyOverTime-Plot')
## Build
If you want to build PlotID yourself, follow these steps:
If you want to build plotID yourself, follow these steps:
1. Download the source code from [Gitlab](https://git.rwth-aachen.de/plotid/plotid_python):
`git clone https://git.rwth-aachen.de/plotid/plotid_python.git`
`cd plotid_python`
2. [Optional] Create a virtual environment:
```bash
pip install venv
mkdir venv
python3 -m venv
source venv/bin/activate
```
2. [Optional] Create a virtual environment (see Installation).
3. [Optional] Run unittests and coverage:
`python3 tests/runner_tests.py`
4. Build the package
`python3 -m build`
## Documentation
If you have more questions about PlotID, please have a look at the [documentation](link-to-docs).
Also have a look at the example.py that is shipped with PlotID.
If you have more questions about plotID, please have a look at the [documentation](link-to-docs).
Also have a look at the example.py that is shipped with plotID.
......@@ -8,7 +8,7 @@ Functions:
import matplotlib
import matplotlib.pyplot as plt
import plotid.create_id as create_id
from plotid.create_id import create_id
from plotid.plotoptions import PlotOptions
......@@ -16,9 +16,9 @@ def tagplot_matplotlib(plotid_object):
"""
Add IDs to figures with matplotlib.
The ID is placed visual on the figure window and
as Tag (Property of figure).
TagPlot can tag multiple figures at once
The ID is placed visual on the figure window and returned as string in a
list together with the figures.
TagPlot can tag multiple figures at once.
"""
# Check if plotid_object is a valid instance of PlotOptions
if not isinstance(plotid_object, PlotOptions):
......@@ -36,13 +36,13 @@ def tagplot_matplotlib(plotid_object):
fontsize = 'small'
color = 'grey'
all_ids_as_list = []
ids_as_list = []
# Loop to create and position the IDs
for fig in plotid_object.figs:
figure_id = create_id.create_id(plotid_object.id_method)
figure_id = create_id(plotid_object.id_method)
figure_id = plotid_object.prefix + str(figure_id)
all_ids_as_list.append(figure_id)
ids_as_list.append(figure_id)
plt.figure(fig.number)
plt.figtext(x=plotid_object.position[0], y=plotid_object.position[1],
......@@ -50,4 +50,4 @@ def tagplot_matplotlib(plotid_object):
rotation=plotid_object.rotation,
fontsize=fontsize, color=color)
fig.tight_layout()
return [plotid_object.figs, all_ids_as_list]
return [plotid_object.figs, ids_as_list]
......@@ -4,6 +4,8 @@ version = 0.1.0
author = Institut Fluidsystemtechnik within nfdi4ing at TU Darmstadt
author_email = nfdi4ing@fst.tu-darmstadt.de
description = The plotID toolkit supports researchers in tracking and storing relevant data in plots. Plots are labelled with an ID and the corresponding data is stored.
license = Apache License, Version 2.0
license_files = file: LICENSE
long_description = file: README.md
long_description_content_type = text/markdown
url = https://git.rwth-aachen.de/plotid/plotid_python
......
......@@ -6,7 +6,7 @@ Unittests for tagplot
import unittest
import matplotlib.pyplot as plt
from tagplot import tagplot
from plotid.tagplot import tagplot
# Constants for tests
FIG1 = plt.figure()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment