Modify axis options when using Plots.jl with pgfplotsx backend

I am using Plots.jl with the pgfplotsx() backend for emitting .tikz files. Together with the tikzscale LaTeX package this makes for nice plots for a TeX document.
However, in the emitted plots there are a lot of options on each axis. Amongst them are height and width as well as font={{..}} for the title, legend, labels and ticks. These all interfere with tikzscale, as the width will be set only when including the file and the font size should match the surrounding document style.

Is there a way to modify or delete these options before any PGFPlotsX code starts assembling the .tikz file? As I understand they are defaults being passed from Plots.jl. Suppose I have a single axis created by p = plot(...), then p.subplots[1].attr holds all these options even before PGFPlotsX generated the plot. Deleting them from this Dict leads to errors though:

julia> delete!(p.subplots[1].attr, :titlefontsize);

julia> p
Error showing value of type Plots.Plot{Plots.PGFPlotsXBackend}:
ERROR: KeyError: key :titlefontsize not found

is there a way to remove some options? My current alternative would be some sed command or something to remove it from the .tikz file after generation.

I know this could be easily controlled when using PGFPlotsX.jl directly, however I am changing the plots regularily and like being able to switch back and forth between gr() for plot modifications and pgfplotsx() for checking how it looks in the final document.

Just in case anybody is interested, here is the function I use to remove above mentioned options from the generated .tikz file:

function clean_tikz(path)
    # match plot width and height attributes
    re_size = r"width={\d+\.\d+mm}, height={\d+\.\d+mm}, "

    # match font attributes
    re_font = r"font={{.+?}}, "

    # match colormap for heatmaps, commented out with default PGFPlotsX options
    re_colormap = r"%\\pgfplotsset{\n(% (colormap|rgb).+\n)+%}"

    tikz_plot = read(path, String)

    # remove size and font matches
    tikz_plot = replace(tikz_plot, re_size => "")
    tikz_plot = replace(tikz_plot, re_font => "")

    # uncomment colormap
    tikz_plot = replace(tikz_plot, re_colormap => x->replace(x, "%"=>""))

    # overwrite original file
    open(path, "w") do f
        write(f, tikz_plot)
    end

    nothing
end