diff --git a/README.md b/README.md index 865a586a22a5e11b3e9b87f3859eeae7a843785e..d5d3629d32f0507832d66a49fcd7bb7c1ac88236 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ plotID is a program connected to Research Data Management (RDM). It has two main ## 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. -**Installation is the same for Windows and Unix systems, except** for the **optional** first set of setting up a virtual environment. +**Installation is the same for Windows and Unix systems, except** for the **optional** first step of setting up a virtual environment. 1. [Optional] Create a virtual environment and activate it: ```bash @@ -90,13 +90,14 @@ Save plot, data and measuring script. Modules that are imported in the script wh Optional parameters can be used to customize the publish process. - *data_storage*: str, optional Method how the data should be stored. Available options: - - *centralized*: The raw data will copied only once. All other plots will reference this data via sym link. - - *individual*: The complete raw data will be copied to a folder for every plot, respectively. + - *centralized* (not implemented yet): The raw data will copied only once. All other plots will reference this data via sym link. + - *individual* (default): The complete raw data will be copied to a folder for every plot, respectively. - *plot_names* : str or list of str, optional - Name for the exported plot. If not provided, the corresponding IDs will be used. + name for the exported plot. If not provided, the corresponding IDs will be used. Example: -`publish(figs_and_ids, "/home/user/Documents/research_data", "/home/user/Documents/exported_data", plot_names=["EnergyOverTime-Plot", "TimeOverEnergy-Plot")` - +```python +publish(FIGS_AND_IDS, "/home/user/Documents/research_data", "/home/user/Documents/exported_data", plot_names=["EnergyOverTime-Plot", "TimeOverEnergy-Plot")` +``` ## Build 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): diff --git a/plotid/__init__.py b/plotid/__init__.py index 4ade8ba6d4fc5846779bdda2116ff1429ec13703..541c837d685fc0add5408f3f6ba266bec69a93ee 100644 --- a/plotid/__init__.py +++ b/plotid/__init__.py @@ -10,5 +10,5 @@ research data, the plot is based on. Additionally, the script that created the plot will also be copied to the directory. """ -__version__ = "0.3.1" +__version__ = "0.3.2" __author__ = "Institut Fluidsystemtechnik within nfdi4ing at TU Darmstadt" diff --git a/plotid/tagplot_image.py b/plotid/tagplot_image.py index 6234ab648576346e0c8cbb1eb8ef8bc36629fa0f..5d71ad2b8d6e221457cb9842296294d086661a76 100644 --- a/plotid/tagplot_image.py +++ b/plotid/tagplot_image.py @@ -68,10 +68,12 @@ def tagplot_image(plotid_object: PlotOptions) -> PlotIDTransfer: # Create temporary PIL image to get correct textsize tmp_img = Image.new("L", (100, 100)) tmp_draw = ImageDraw.Draw(tmp_img) - textsize = tmp_draw.textsize(img_id, font) + _, _, textwidth, textheight = tmp_draw.textbbox((0, 0), img_id, font) # Create new image with white background and the size of the textbox - img_txt = Image.new("RGBA", textsize, color=(255, 255, 255, 0)) + img_txt = Image.new( + "RGBA", (textwidth, textheight), color=(255, 255, 255, 0) + ) draw_txt = ImageDraw.Draw(img_txt) draw_txt.text((0, 0), img_id, font=font, fill=color) # Rotate the image by the given angle @@ -90,7 +92,7 @@ def tagplot_image(plotid_object: PlotOptions) -> PlotIDTransfer: if plotid_object.qrcode: qrcode = create_qrcode(img_id) qrcode.thumbnail( - (plotid_object.qr_size, plotid_object.qr_size), Image.ANTIALIAS + (plotid_object.qr_size, plotid_object.qr_size), Image.Resampling.LANCZOS ) img.paste( qrcode, diff --git a/plotid/tagplot_matplotlib.py b/plotid/tagplot_matplotlib.py index c81ef3fa496d023225a320ecfa085e015e2e0b4d..6fded8f0c7bc00d23de5757b6b905f869c63bf26 100644 --- a/plotid/tagplot_matplotlib.py +++ b/plotid/tagplot_matplotlib.py @@ -75,7 +75,7 @@ def tagplot_matplotlib(plotid_object: PlotOptions) -> PlotIDTransfer: if plotid_object.qrcode: qrcode = create_qrcode(fig_id) qrcode.thumbnail( - (plotid_object.qr_size, plotid_object.qr_size), Image.ANTIALIAS + (plotid_object.qr_size, plotid_object.qr_size), Image.Resampling.LANCZOS ) fig.figimage( qrcode, diff --git a/pyproject.toml b/pyproject.toml index 9dfe32d75870d07ebed66c50130d145534913f00..3584424a8f102e84f2a4fd7359caa134194ab21c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=43", "wheel"] +requires = ["setuptools>=61", "wheel"] build-backend = "setuptools.build_meta" [project] diff --git a/requirements.txt b/requirements.txt index c803da6b677eff2762dc89dd4722bb2a10aa8404..ddb80f74e6a65ffc1a8ee9f9244b862aec3d1790 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,16 @@ -coverage==6.3.2 +coverage==7.3.0 cycler==0.11.0 -fonttools==4.32.0 -kiwisolver==1.4.2 -matplotlib==3.5.2 -myst-parser==0.18.0 -numpy==1.22.3 -packaging==21.3 -Pillow==9.3.0 -pyparsing==3.0.8 +fonttools==4.42.1 +kiwisolver==1.4.5 +matplotlib==3.7.2 +myst-parser==2.0.0 +numpy==1.25.2 +packaging==23.1 +Pillow==10.0.0 +pyparsing==3.0.9 python-dateutil==2.8.2 -qrcode==7.3.1 +qrcode==7.4.2 six==1.16.0 -Sphinx==5.0.2 -sphinx-autoapi==1.8.4 -sphinx-rtd-theme==1.0.0 +Sphinx==7.2.5 +sphinx-autoapi==2.1.1 +sphinx-rtd-theme==1.3.0