| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
| 2 | "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> |
| 3 | <html> |
| 4 | <head> |
| 5 | <meta http-equiv="content-type" content="text/html; charset=utf-8"> |
| 6 | <title>ExifTool Plot Feature</title> |
| 7 | <link rel=stylesheet type='text/css' href='style.css' title='Style'> |
| 8 | <style type="text/css"> |
| 9 | <!-- |
| 10 | pre { color: #800; margin-left: 4em } |
| 11 | .nr { white-space: nowrap } |
| 12 | .prog { padding: 0.5em; border: 1px solid gray; background: #fee } |
| 13 | .indent { margin-left: 22% } |
| 14 | --> |
| 15 | </style> |
| 16 | </head> |
| 17 | <body> |
| 18 | <h1>The ExifTool Plot Feature</h1> |
| 19 | <p>The <code>-plot</code> option of the exiftool application is used to generate |
| 20 | SVG-format output plot files from the values of tags. This feature has many uses, |
| 21 | including plotting timed metadata when combined with the <code>-ee</code> |
| 22 | (ExtractEmbedded) option, and plotting values of one or more tags across a set of |
| 23 | images.</p> |
| 24 | |
| 25 | <p>Any tag with a numerical value may be plotted, including strings and lists of numbers. |
| 26 | Up to 20 datasets (eg. tags) may be plotted together in the same plot, except for |
| 27 | histogram plots which are limited to only one (but the <code>Multi</code> setting may be |
| 28 | used to draw multiple plots at once). Attempting to plot too many tags at once will result |
| 29 | in a warning and the extra datasets will be ignored. The X and Y scales are common to |
| 30 | all datasets within each plot (ie. multiple datasets in a single plot all use the same |
| 31 | scales).</p> |
| 32 | |
| 33 | <p>The plot may be viewed by opening the SVG file in your favourite web browser or |
| 34 | SVG-aware image viewer. Most modern web browsers support display of SVG images.</p> |
| 35 | |
| 36 | <p>Three basic plot types are provided: Line, Scatter and Histogram. Examples of each |
| 37 | are given in the <a href="#examples">Examples section</a> below.</p> |
| 38 | |
| 39 | <h2>Plot Settings</h2> |
| 40 | |
| 41 | <p>Plot settings are changed via the <a href="ExifTool.html#Plot">API Plot option</a>. |
| 42 | Multiple options may be set at the same time either by stringing them together in a |
| 43 | comma-separated list, or through multiple API Plot options.</p> |
| 44 | |
| 45 | <p>The syntax for each setting is <code><i>NAME</i>=<i>VALUE</i></code>. Case is not |
| 46 | significant for setting names. Using <code><i>NAME</i>=</code> without a value sets the |
| 47 | value to <i>undef</i>. Using <code><i>NAME</i></code> alone sets the value to 1. For |
| 48 | example, to set the plot title and color for the first data line, a command could be:</p> |
| 49 | |
| 50 | <pre>exiftool -plot -api plot="title=some title,cols=pink" ...</pre> |
| 51 | |
| 52 | <blockquote> |
| 53 | <table class='norm'> |
| 54 | <tr><th colspan=6 bgcolor='#dddddd'><font size='+1'>ExifTool Plot Settings</font></th></tr> |
| 55 | <tr><th>Name</th><th>Description</th><th colspan=2>Value</th><th colspan=2>Default</th></tr> |
| 56 | <tr><td>Type</td><td>Type of plot</td> |
| 57 | <td align=center colspan=2>'Line', 'Scatter' or 'Histogram' <sup>1</sup></td> |
| 58 | <td align=center colspan=2>'Line'</td></tr> |
| 59 | <tr><td>Style</td><td>Style of plot data points</td> |
| 60 | <td align=center colspan=2>String of names: <sup>2,3</sup> 'Line', 'Marker' and/or 'Fill'</td> |
| 61 | <td align=center colspan=2>'Line+Fill' for Histogram plots, or 'Line' otherwise</td></tr> |
| 62 | <tr><td>Title</td><td>Title of the plot</td> |
| 63 | <td align=center colspan=2>Any string <sup>4</sup></td> |
| 64 | <td align=center colspan=2>'' (auto-generated) <sup>5</sup></td></tr> |
| 65 | <tr><td>XLabel</td><td>X-axis label string</td> |
| 66 | <td align=center colspan=2>Any string <sup>4</sup></td> |
| 67 | <td align=center colspan=2>'' (auto-generated) <sup>5</sup></td></tr> |
| 68 | <tr><td>YLabel</td><td>Y-axis label string</td> |
| 69 | <td align=center colspan=2>Any string <sup>4</sup></td> |
| 70 | <td align=center colspan=2>'' (auto-generated) <sup>5</sup></td></tr> |
| 71 | <tr><td>XMin, XMax</td><td>X-axis minimum and maximum for Scatter and Histogram plot types</td> |
| 72 | <td align=center colspan=2>A number</td> |
| 73 | <td align=center colspan=2><i>undef</i> (autoscaling)</td></tr> |
| 74 | <tr><td>YMin, YMax</td><td>Y-axis minimum and maximum (the YMin setting does not apply to Histogram plots)</td> |
| 75 | <td align=center colspan=2>A number</td> |
| 76 | <td align=center colspan=2><i>undef</i> (autoscaling)</td></tr> |
| 77 | <tr><td>NBins</td><td>Number of bins for histogram plot</td> |
| 78 | <td align=center colspan=2>A number</td> |
| 79 | <td align=center colspan=2>'20'</td></tr> |
| 80 | <tr><td>Multi</td><td>Flag to draw multiple plots, one for each dataset</td> |
| 81 | <td align=center colspan=2>Number of plots per row in output image <sup>6</sup></td> |
| 82 | <td align=center colspan=2><i>undef</i></td></tr> |
| 83 | <tr><td>Split</td><td>Split strings of numbers into separate datasets</td> |
| 84 | <td align=center colspan=2>Number of datasets, or 1 to split all <sup>7</sup></td> |
| 85 | <td align=center colspan=2><i>undef</i></td></tr> |
| 86 | <tr><td>Size</td><td>Width and height of output image</td> |
| 87 | <td align=center colspan=2>String of 2 numbers <sup>2</sup></td> |
| 88 | <td align=center colspan=2>'800 600'</td></tr> |
| 89 | <tr><td>Margin</td><td>Left, right, top, bottom margins around plotting area</td> |
| 90 | <td align=center colspan=2>String of 4 numbers <sup>2</sup></td> |
| 91 | <td align=center colspan=2>'60 15 15 30'</td></tr> |
| 92 | <tr><td>Legend</td><td>X and Y shift of legend from default location</td> |
| 93 | <td align=center colspan=2>String of 2 numbers <sup>2</sup></td> |
| 94 | <td align=center colspan=2>'0 0'</td></tr> |
| 95 | <tr><td>TxtPad</td><td>Padding between text and X/Y scales</td> |
| 96 | <td align=center colspan=2>String of 2 numbers <sup>2</sup></td> |
| 97 | <td align=center colspan=2>'10 10'</td></tr> |
| 98 | <tr><td>LineSpacing</td><td>Text line spacing</td> |
| 99 | <td align=center colspan=2>A number</td> |
| 100 | <td align=center colspan=2>'20'</td></tr> |
| 101 | <tr><td>Stroke</td><td>Scaling factor for plot stroke width and marker size</td> |
| 102 | <td align=center colspan=2>A number</td> |
| 103 | <td align=center colspan=2>'1'</td></tr> |
| 104 | <tr><td>Marks</td><td>Marker characteristics for each dataset</td> |
| 105 | <td align=center>String of marker names (or 'none') with optional fill style, color and opacity <sup>2,8</sup></td> |
| 106 | <td rowspan=2 colspan=2><img alt="markers" src="markers.svg" width=90 height=200></td> |
| 107 | <td align=center>'circle square triangle diamond star plus pentagon left down right'</td></tr> |
| 108 | <tr><td>Cols</td><td>Colors of plot lines/markers for each dataset</td> |
| 109 | <td align=center>String of SVG color codes or 'none' for no line or marker border <sup>2</sup></td> |
| 110 | <td align=center>'red green blue black orange gray fuchsia brown turquoise gold'</td></tr> |
| 111 | <tr><td>Grid</td><td>Grid color</td> |
| 112 | <td align=center colspan=2>SVG color code</td> |
| 113 | <td align=center colspan=2>'darkgray'</td></tr> |
| 114 | <tr><td>Text</td><td>Color of text and plot border</td> |
| 115 | <td align=center colspan=2>SVG color code</td> |
| 116 | <td align=center colspan=2>'black'</td></tr> |
| 117 | <tr><td>Bkg</td><td>Background color</td> |
| 118 | <td align=center colspan=2>SVG color code or <i>undef</i></td> |
| 119 | <td align=center colspan=2><i>undef</i> (transparent)</td></tr> |
| 120 | </table> |
| 121 | </blockquote> |
| 122 | |
| 123 | <p>Notes:</p> |
| 124 | <blockquote><table class='clear'> |
| 125 | <tr><td valign=top><sup>1</sup></td><td>The scatter plot uses the first specified |
| 126 | tag as the X coordinate and the remaining tags as the datasets for the Y values.</td></tr> |
| 127 | <tr><td valign=top><sup>2</sup></td><td>Strings of names or numbers may use |
| 128 | whitespace, slash (<code>/</code>) or a plus sign (<code>+</code>) as a |
| 129 | delimiter. The numbers themselves should not contain a plus sign. Numbers |
| 130 | may also use '<code>x</code>' as a delimiter (eg. '<code>size=320x200</code>').</td></tr> |
| 131 | <tr><td valign=top><sup>3</sup></td><td>The <code>Fill</code> |
| 132 | style applies only for the <code>Histogram</code> plot style, or when <code>Marker</code> |
| 133 | style is also used. Without <code>Fill</code>, histogram bars and markers are hollow. |
| 134 | <code>Line</code> and <code>Marker</code> may also be used together (eg. '<code>Style=Line+Marker</code>'). |
| 135 | For brevity, only the first letter of each setting is required (eg. '<code>Style=L+M</code>').</td></tr> |
| 136 | <tr><td valign=top><sup>4</sup></td><td>Commas in labels must be escaped as either '<code>&#44;</code>' |
| 137 | or '<code>&#x2c;</code>'. No other characters require escaping, but other XML numeric |
| 138 | character references may be used.</td></tr> |
| 139 | <tr><td valign=top><sup>5</sup></td><td>The auto-generation of labels applies only in limited |
| 140 | situations, and may be disabled with <code><i>NAME</i>=</code>.</td></tr> |
| 141 | <tr><td valign=top><sup>6</sup></td><td>Multiple plots are drawn together in the same SVG |
| 142 | image with the specified number of columns within the width of the output image. The image |
| 143 | height is adjusted to fit the required number of rows. The X axes of all plots are the |
| 144 | same, but the Y axes are independent. May be followed by the number of datasets |
| 145 | for each plot, using any separator. For example, '<code>Multi=1.3.3</code>' draws |
| 146 | the plots in a single column, with 3 datasets each in the first and second plots. |
| 147 | <a href='#EX5'>Example 5</a> shows a simple usage.</td></tr> |
| 148 | <tr><td valign=top><sup>7</sup></td><td>For example, if a tag contains a set of N accelerometer |
| 149 | readings, each composed of 3 values (X, Y and Z directions), then these could be plotted |
| 150 | as 3 separate datasets by setting <code>Split=3</code>. See <a href='#EX4'>example 4</a> |
| 151 | for a demonstration of the <code>Split</code> setting.</td></tr> |
| 152 | <tr><td valign=top><sup>8</sup></td><td>A value of 'none' may be used to override the plot |
| 153 | <code>Style</code> <code>Marker</code> setting to disable marks for a specific dataset. |
| 154 | For brevity, only the first letter of the marker name is required, except for 'star', |
| 155 | 'pentagon', and 'down' which require 2 letters to distinguish them from 'square', 'plus' |
| 156 | and 'diamond' respectively. An optional fill style, color and opacity may be appended to |
| 157 | the marker name, separated by dashes. The fill style overrides the plot |
| 158 | <code>Style</code> <code>Fill</code> setting for the specific dataset, and may be 'Fill' |
| 159 | (or just 'F') for filled markers, or 'none' for hollow markers. Filled markers may also |
| 160 | specify a fill color and opacity (ranging from 1 to 100 percent). For example, to use a |
| 161 | right-pointing triangle for dataset 1, and the default marker with solid black fill for |
| 162 | dataset 3: '<code>marks=r++-f-black-100</code>'. The default opacity for marker and |
| 163 | histogram fill is 20% if they have a border, or 50% otherwise.</td></tr> |
| 164 | </table></blockquote> |
| 165 | |
| 166 | <a name="examples"></a> |
| 167 | <h2>Examples</h2> |
| 168 | |
| 169 | <a name="EX1"></a> |
| 170 | <h3>Example 1 - Line Plot</h3> |
| 171 | |
| 172 | <p>The first example plots AmbientTemperature and CameraTemperature from a set of |
| 173 | images in a directory. The <code>-fileOrder</code> option is used to order the |
| 174 | files (and hence the data points) chronologically. Here is the command that was used:</p> |
| 175 | |
| 176 | <pre>exiftool C:/pics "-*temperature" -plot -fileorder createdate > plot1.svg |
| 177 | </pre> |
| 178 | |
| 179 | <p>And this is the resulting SVG plot (plot1.svg):</p> |
| 180 | |
| 181 | <blockquote><img src="plot1.svg" alt="SVG-format plot" width=800 height=600></blockquote> |
| 182 | |
| 183 | <a name="EX2"></a> |
| 184 | <h3>Example 2 - Histogram Plot</h3> |
| 185 | |
| 186 | <p>This example shows a histogram of the number of pictures taken at different |
| 187 | focal lengths for a set of images. It also demonstrates the use of the |
| 188 | <a href="ExifTool.html#Plot">API Plot option</a> to change various plot settings. |
| 189 | The <code>YMax</code> setting was used to limit the Y scale because otherwise the |
| 190 | effect of the autoscaling with the tall 20-25 mm bar would have made the other bars |
| 191 | too small. With this rescaling, the 20-25 mm bar extends off the top of the plot.</p> |
| 192 | |
| 193 | <p>The default histogram plot <code>Style</code> is <code>Line+Fill</code>. The fill |
| 194 | is partially transparent, with a default 20% opacity if the <code>Line</code> style is |
| 195 | used, or 50% otherwise, but this may be changed with the <code>Marks</code> setting.</p> |
| 196 | |
| 197 | <p>Unlike the other plot types, the histogram type supports plotting of only |
| 198 | a single dataset (ie. only the first tag specified on the command line is used |
| 199 | unless the <code>Multi</code> plot setting is used to generate multiple plots).</p> |
| 200 | |
| 201 | <p>The <code>-w</code> option was used to write the output file |
| 202 | (plot2.svg) instead of using shell redirection. Note that when the <code>-plot</code> |
| 203 | option is used, the <code>-w</code> option takes a full file name instead of |
| 204 | just an extension.</p> |
| 205 | |
| 206 | <pre>exiftool C:/my_trip -focallength35efl# -w plot2.svg \ |
| 207 | -api plot="type=hist,nbins=40,ymax=50,cols=blue"</pre> |
| 208 | |
| 209 | <blockquote><img src="plot2.svg" alt="SVG-format plot" width=800 height=600></blockquote> |
| 210 | |
| 211 | <a name="EX3"></a> |
| 212 | <h3>Example 3 - Scatter Plot</h3> |
| 213 | |
| 214 | <p>This example uses the same data set as example 1, but using the <code>Scatter</code> |
| 215 | plot type to show the correlation betweent CameraTemperature and AmbientTemperature. |
| 216 | The first tag specified on the command line is the independent variable (plotted |
| 217 | along the X axis), and the rest are the dependent variables (Y axis). Note that |
| 218 | the legend doesn't appear in this plot because there is only one dependent |
| 219 | variable, so instead the Y-axis is labelled with its name.</p> |
| 220 | |
| 221 | <p>The plot <code>Style</code> |
| 222 | has been changed to <code>Marker</code> to show markers for the data points |
| 223 | instead of connecting them with lines, and <code>Fill</code> has been added to |
| 224 | show filled markers instead of outlines. The fill is partially transparent with a |
| 225 | default opacity of 20%, but this has been changed to 10% via the <code>Marks</code> |
| 226 | setting so points which occur few times in the dataset will show a noticably lighter |
| 227 | color.</p> |
| 228 | |
| 229 | <pre>exiftool C:/pics -w plot3.svg "-*temperature" -plot \ |
| 230 | -api plot="type=scatter,style=marker+fill,stroke=1.5,marks=---10"</pre> |
| 231 | |
| 232 | <blockquote><img src="plot3.svg" alt="SVG-format plot" width=800 height=600></blockquote> |
| 233 | |
| 234 | <a name="EX4"></a> |
| 235 | <h3>Example 4 - Splitting Values</h3> |
| 236 | |
| 237 | <p>To plot timed accelerometer readings from a video where the Accelerometer values are |
| 238 | strings of numbers, the <code>Split</code> setting of the |
| 239 | <a href="ExifTool.html#Plot">API Plot option</a> must be used to split the values into |
| 240 | separate lines in the plot. Here is an example of the first Accelerometer value in the |
| 241 | file:</p> |
| 242 | |
| 243 | <pre><span class='blk'>> </span>exiftool test.mp4 -ee -accelerometer -s2 --a |
| 244 | <span class='blk'>Accelerometer: +0.12 +0.96 -0.09</span></pre> |
| 245 | |
| 246 | <p>And this command was used to generate the following plot:</p> |
| 247 | |
| 248 | <pre>exiftool test.mp4 -w plot4.svg -ee -accelerometer -plot -api plot="split,legend=30 107" \ |
| 249 | -api plot="title=Accelerometer Readings,ylabel=G Force,xlabel=Sample Number" |
| 250 | </pre> |
| 251 | |
| 252 | <blockquote><img src="plot4.svg" alt="SVG-format plot" width=800 height=600></blockquote> |
| 253 | |
| 254 | <a name="EX5"></a> |
| 255 | <h3>Example 5 - Multi Plots</h3> |
| 256 | |
| 257 | <p>This example demonstrates the <code>Multi</code> setting to draw multiple |
| 258 | <code>Histogram</code> plots in 2 columns. The <a href="ExifTool.html#Filter">API Filter</a> |
| 259 | option is used to convert shutter speed from a value like 1/640 to 640 so the denominator |
| 260 | of the value is plotted.</p> |
| 261 | |
| 262 | <pre>exiftool C:\my_trip -w! plot5.svg -fnumber -focallength35efl# -shutterspeed -iso -plot \ |
| 263 | -api filter="s(1/)()" -api plot="multi=2,type=hist,style=fill,cols=green,ylabel="</pre> |
| 264 | |
| 265 | <blockquote><img src="plot5.svg" alt="SVG-format plot" width=800 height=600></blockquote> |
| 266 | |
| 267 | <hr> |
| 268 | <i>Created Feb 19, 2025</i><br> |
| 269 | <i>Last revised Apr 22, 2025</i><br> |
| 270 | <p class='lf'><a href="index.html"><-- Back to ExifTool home page</a></p> |
| 271 | </body> |
| 272 | </html> |
| 273 |