# 1D data
@recipe function f(scan::ScanData; raw=false, isppa=false, ispta=false, mi=false, xslice=NaN, yslice=NaN, zslice=NaN)
    plot_metric_flags = [raw, isppa, ispta, mi]
    num_subplots = count(plot_metric_flags)
    
    if num_subplots == 0
        if isnothing(scan.metrics)
            raw = true
            layout --> 1
        else
            isppa = true
            ispta = true
            mi = true
            layout --> 3
        end
    else
        layout --> num_subplots
    end

    if raw
        @series begin
            seriestype := :heatmap
            title --> "$(scan.axes) scan raw data"
            xguide --> "Linear index"
            yguide --> "Time"
            yflip --> true
            colorbar_title --> "Voltage"

            num_raster_points = prod(size(scan.waveform)[2:end])
            timepoints = uconvert.(u"μs", scan.time)
            waveform = reshape(scan.waveform, size(scan.waveform,1), num_raster_points)

            return 1:num_raster_points, timepoints, waveform
        end
    end

    axes --> scan.axes
    coordinates := scan.coordinates
    if ndims(scan.waveform) == 4
        xslice := xslice
        yslice := yslice
        zslice := zslice
    end    
    if isppa
        @series begin
            return scan.metrics.isppa
        end
    end
    if ispta
        @series begin
            return scan.metrics.ispta
        end
    end
    if mi
        @series begin
            return scan.metrics.mechanical_index
        end
    end
end
