From 42307c7af1038ac1af27328af7bfaac0a9936dd4 Mon Sep 17 00:00:00 2001
From: Jan Lemmer <jan.lemmer@fst.tu-darmstadt.de>
Date: Tue, 22 Feb 2022 08:51:24 +0100
Subject: [PATCH] Add example file and further doc

---
 +PlotID/TagPlot.m        |  5 +++--
 +PlotID/plotQR.m         |  2 +-
 Examples/PlotID_QRcode.m | 14 ++++++++++++++
 3 files changed, 18 insertions(+), 3 deletions(-)
 create mode 100644 Examples/PlotID_QRcode.m

diff --git a/+PlotID/TagPlot.m b/+PlotID/TagPlot.m
index e955632..b2e5b56 100644
--- a/+PlotID/TagPlot.m
+++ b/+PlotID/TagPlot.m
@@ -24,8 +24,8 @@ arguments
     options.Position (1,2) {mustBeVector} = [1,0.4] % default for east
     options.Rotation (1,1) {mustBeReal} = NaN
     options.ConfigFileName (1,:) {mustBeText} = 'config.json'
-    options.QRcode (1,1) {mustBeNumericOrLogical} = false %experimentally
-    options.QRsize (1,1) {mustBeNonnegative} = 0.15
+    options.QRcode (1,1) {mustBeNumericOrLogical} = false %experimental
+    options.QRsize (1,1) {mustBeNonnegative} = 0.15 % size of the QRCode
 end
 
 if isempty(options.ProjectID)
@@ -87,6 +87,7 @@ for n = 1:numel(figs)
     set(figs(n),'Tag', IDs{n}); 
 
     if options.QRcode
+        % this should be seen and use as a proof of concept
         qrCode = PlotID.plotQR(IDs{n});
         size = options.QRsize;
         axes('Position',[position(1)-.05 position(2)+0.1 size size]);
diff --git a/+PlotID/plotQR.m b/+PlotID/plotQR.m
index 1b30acb..4e44b97 100644
--- a/+PlotID/plotQR.m
+++ b/+PlotID/plotQR.m
@@ -1,5 +1,5 @@
 function img = plotQR(data, size)
-%QR reads a QR code from qrserver
+%QR reads a QR code from qrserver (depends on API)
 % created by J.Stifter
     arguments
         data {mustBeTextScalar} = 'example';
diff --git a/Examples/PlotID_QRcode.m b/Examples/PlotID_QRcode.m
new file mode 100644
index 0000000..c330898
--- /dev/null
+++ b/Examples/PlotID_QRcode.m
@@ -0,0 +1,14 @@
+clear; close all; clc;
+%%  Tag the plot with a QR code (experimental)
+% here the work flow for tagging the plot with a QR code is shown
+% the content of the qr code is the ID
+
+% plots and data
+fig(1) = figure;
+[x1, y1, datapath1] = createExampleData('matlab');
+plot(x1,y1,'-b'); box off; hold on; set(gca, 'TickDir', 'out', 'YLim', [0,4]);
+
+
+%% 1. Tag plot with QRcode
+% QR size is the relative size of the QR code (0.15 default)
+[fig, IDs] = PlotID.TagPlot(fig,'Location','southeast','QRcode',true, 'QRsize', 0.18);
-- 
GitLab