The ExifTool Plot Feature

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

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
NameDescriptionValueDefault
TypeType of plot 'Line', 'Scatter' or 'Histogram' 1'Line'
StyleStyle of plot data points String of names: 2,3
'Line', 'Marker' and/or 'Fill'
'Line'
TitleTitle of the plot Any string 4'' (auto-generated) 5
XLabelX-axis label string Any string 4'' (auto-generated) 5
YLabelY-axis label string Any string 4'' (auto-generated) 5
XMin, XMaxX-axis minimum and maximum A numberundef (autoscaling)
YMin, YMaxY-axis minimum and maximum A numberundef (autoscaling)
NBinsNumber of bins for histogram plot A number'20'
SplitSplit strings of numbers into separate plot lines Number of lines to create,
or 1 to split all 6
undef
SizeWidth and height of output image String of 2 numbers 7'800 600'
MarginLeft, right, top, bottom margins around plotting area String of 4 numbers 7'60 15 15 30'
LegendX and Y shift of legend from default location String of 2 numbers 7'0 0'
TxtPadPadding between text and X/Y scales String of 2 numbers 7'10 10'
LineSpacingText line spacing A number'20'
ColsColors of plot lines/markers for each dataset String of SVG color codes 2 'red green blue black orange
gray purple cyan brown pink'
GridGrid color SVG color code'darkgray'
TextColor of text and plot border SVG color code'black'
BkgBackground color SVG color code or undefundef (transparent)

Notes:

1The scatter plot uses the first specified tag as the X coordinate and the remaining tags as the plot data.
2Strings of names may use whitespace, slash (/) or a plus sign (+) as a delimiter.
3The Fill style applies only for the Histogram plot style, or when Marker style is also used. Without Fill, histogram bars and markers are hollow. Line and Marker may also be used together (eg. Line+Marker). For brevity, only the first letter of each setting is required (eg. L+M).
4Commas in labels must be escaped as either "," or ",". No other characters require escaping, but other XML numeric character references may be used.
5The auto-generation of labels applies only in limited situations, and may be disabled with SETTING=.
6For 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.
7Strings of numbers may use either whitespace or slash (/) as a delimiter.

Examples

Example 1 - Line Plot

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):

SVG-format plot

Example 2 - Histogram Plot

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"
SVG-format plot

Example 3 - Scatter Plot

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"
SVG-format plot

Example 4 - Splitting Values

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"
SVG-format plot

Created Feb 19, 2025
Last revised Feb 20, 2025

<-- Back to ExifTool home page