The -plot
option of the exiftool application is used to generate
SVG-format output plot files from the values of tags. This feature has many
applications, including plotting timed metadata when combined with the
-ee
(ExtractEmbedded) option, and plotting values of one or more tags
across a set of images.
Any tag with a numerical value may be plotted, including strings and lists of numbers.
The plot may be viewed by opening the SVG file in your favourite web browser or SVG-aware image viewer. Most modern web browsers support display of SVG images.
Three basic plot types are provided: Line, Scatter and Histogram. Examples of each are given in the Examples section below.
Plot settings are changed via the API Plot option. Multiple options may be set at the same time either by stringing them together in a comma-separated list, or through multiple API Plot options.
The syntax for each setting is NAME=VALUE
. Case is
not significant for setting names. Using NAME=
without a value sets the value to undef. Using NAME
alone sets the value to 1. For example, to set the plot title and color
for the first data line, a command could be:
exiftool -plot -api plot="title=some title,cols=turquoise" ...
ExifTool Plot Settings Name Description Value Default Type Type of plot 'Line', 'Scatter' or 'Histogram' 1 'Line' Style Style of plot data points String of names: 2,3
'Line', 'Marker' and/or 'Fill''Line' Title Title of the plot Any string 4 '' (auto-generated) 5 XLabel X-axis label string Any string 4 '' (auto-generated) 5 YLabel Y-axis label string Any string 4 '' (auto-generated) 5 XMin, XMax X-axis minimum and maximum A number undef (autoscaling) YMin, YMax Y-axis minimum and maximum A number undef (autoscaling) NBins Number of bins for histogram plot A number '20' Split Split strings of numbers into separate plot lines Number of lines to create,
or 1 to split all 6undef Size Width and height of output image String of 2 numbers 7 '800 600' Margin Left, right, top, bottom margins around plotting area String of 4 numbers 7 '60 15 15 30' Legend X and Y shift of legend from default location String of 2 numbers 7 '0 0' TxtPad Padding between text and X/Y scales String of 2 numbers 7 '10 10' LineSpacing Text line spacing A number '20' Cols Colors of plot lines/markers for each dataset String of SVG color codes 2 'red green blue black orange
gray purple cyan brown pink'Grid Grid color SVG color code 'darkgray' Text Color of text and plot border SVG color code 'black' Bkg Background color SVG color code or undef undef (transparent)
Notes:
1 The scatter plot uses the first specified tag as the X coordinate and the remaining tags as the plot data. 2 Strings of names may use whitespace, slash ( /
) or a plus sign (+
) as a delimiter.3 The Fill
style applies only for theHistogram
plot style, or whenMarker
style is also used. WithoutFill
, histogram bars and markers are hollow.Line
andMarker
may also be used together (eg.Line+Marker
). For brevity, only the first letter of each setting is required (eg.L+M
).4 Commas in labels must be escaped as either " ,
" or ",
". No other characters require escaping, but other XML numeric character references may be used.5 The auto-generation of labels applies only in limited situations, and may be disabled with SETTING=
.6 For example, if a tag contains a set of N accelerometer readings, each composed of 3 values (X, Y and Z directions), then these could be plotted as 3 separate lines by setting Split=3
.7 Strings of numbers may use either whitespace or slash ( /
) as a delimiter.
The first example plots AmbientTemperature and CameraTemperature from a set of
images in a directory. The -fileOrder
option is used to order the
files (and hence the data points) chronologically. Here is the command that was used:
exiftool C:/pics "-*temperature" -plot -fileorder createdate > plot1.svg
And this is the resulting SVG plot (plot1.svg):
This example shows a histogram of the number of pictures taken at different
focal lengths for a set of images. It also demonstrates the use of the
API Plot option to change various plot settings.
The YMax
setting was used to limit the Y scale because otherwise the
effect of the autoscaling with the tall 20-25 mm bar would have made the other bars
too small. With this rescaling, the 20-25 mm bar extends off the top of the plot.
Unlike the other plot types, the histogram type supports plotting of only a single dataset (ie. you may specify only one tag on the command line).
The -w
option was used to write the output file
(plot2.svg) instead of using shell redirection. Note that when the -plot
option is used, the -w
option takes a full file name instead of
just an extension.
exiftool C:/my_trip -focallength35efl# -w plot2.svg \ -api plot="type=hist,style=fill,nbins=40,ymax=50,cols=blue"
This example uses the same data set as example 1, but using the Scatter
plot type to show the correlation betweent CameraTemperature and AmbientTemperature.
The first tag specified on the command line is the independent variable (plotted
along the X axis), and the rest are the dependent variables (Y axis). Note that
the legend doesn't appear in this plot because there is only one dependent
variable, so instead the Y-axis is labelled with its name. The plot Style
has been changed to Marker
to show markers for the data points
instead of connecting them with lines, and Fill
has been added to
show filled markers instead of outlines.
exiftool C:/pics -w plot3.svg "-*temperature" -plot -api plot="type=scatter,style=marker+fill"
To plot timed accelerometer readings from a video where the Accelerometer values are
strings of numbers, the Split
setting of the
API Plot option must be used to split the values into
separate lines in the plot. Here is an example of the first Accelerometer value in the
file:
> exiftool test.mp4 -ee -accelerometer -s2 --a Accelerometer: +0.12 +0.96 -0.09
And this command was used to generate the following plot:
exiftool test.mp4 -w plot4.svg -ee -accelerometer -plot -api plot="split,legend=30 190" \ -api plot="title=Accelerometer Readings,ylabel=G Force,xlabel=Sample Number"