apply formatter

This commit is contained in:
Simon Christ 2021-10-20 11:45:35 +02:00
parent c001048ff6
commit 85e9ceeb9f
5 changed files with 473 additions and 208 deletions

View File

@ -489,7 +489,7 @@ const _subplot_defaults = KW(
:colorbar_titlefontcolor => :match,
:framestyle => :axes,
:camera => (30, 30),
:extra_kwargs => Dict()
:extra_kwargs => Dict(),
)
const _axis_defaults = KW(
@ -551,7 +551,6 @@ const _suppress_warnings = Set{Symbol}([
:relative_bbox,
])
is_subplot_attr(k) = k in _all_subplot_args
is_series_attr(k) = k in _all_series_args
is_axis_attr(k) = Symbol(chop(string(k); head = 1, tail = 0)) in _all_axis_args
@ -585,12 +584,40 @@ aliases(aliasMap::Dict{Symbol,Symbol}, val) =
# -----------------------------------------------------------------------------
# legend
add_aliases(:legend_position, :legend, :leg, :key, :legends)
add_aliases(:legend_background_color, :bg_legend, :bglegend, :bgcolor_legend, :bg_color_legend, :background_legend,
:background_colour_legend, :bgcolour_legend, :bg_colour_legend, :background_color_legend)
add_aliases(:legend_foreground_color, :fg_legend, :fglegend, :fgcolor_legend, :fg_color_legend, :foreground_legend,
:foreground_colour_legend, :fgcolour_legend, :fg_colour_legend, :foreground_color_legend)
add_aliases(
:legend_background_color,
:bg_legend,
:bglegend,
:bgcolor_legend,
:bg_color_legend,
:background_legend,
:background_colour_legend,
:bgcolour_legend,
:bg_colour_legend,
:background_color_legend,
)
add_aliases(
:legend_foreground_color,
:fg_legend,
:fglegend,
:fgcolor_legend,
:fg_color_legend,
:foreground_legend,
:foreground_colour_legend,
:fgcolour_legend,
:fg_colour_legend,
:foreground_color_legend,
)
add_aliases(:legend_font_pointsize, :legendfontsize)
add_aliases(:legend_title, :key_title, :keytitle, :label_title, :labeltitle, :leg_title, :legtitle)
add_aliases(
:legend_title,
:key_title,
:keytitle,
:label_title,
:labeltitle,
:leg_title,
:legtitle,
)
add_aliases(:legend_title_font_pointsize, :legendtitlefontsize)
# margin
add_aliases(:left_margin, :leftmargin)
@ -607,33 +634,155 @@ add_aliases(:markerstrokecolor, :msc, :mscolor, :mscolour, :markerstrokecolour)
add_aliases(:markerstrokewidth, :msw, :mswidth)
add_aliases(:fillcolor, :fc, :fcolor, :fcolour, :fillcolour)
add_aliases(:background_color, :bg, :bgcolor, :bg_color, :background,
:background_colour, :bgcolour, :bg_colour)
add_aliases(:background_color_subplot, :bg_subplot, :bgsubplot, :bgcolor_subplot, :bg_color_subplot, :background_subplot,
:background_colour_subplot, :bgcolour_subplot, :bg_colour_subplot)
add_aliases(:background_color_inside, :bg_inside, :bginside, :bgcolor_inside, :bg_color_inside, :background_inside,
:background_colour_inside, :bgcolour_inside, :bg_colour_inside)
add_aliases(:background_color_outside, :bg_outside, :bgoutside, :bgcolor_outside, :bg_color_outside, :background_outside,
:background_colour_outside, :bgcolour_outside, :bg_colour_outside)
add_aliases(:foreground_color, :fg, :fgcolor, :fg_color, :foreground,
:foreground_colour, :fgcolour, :fg_colour)
add_aliases(
:background_color,
:bg,
:bgcolor,
:bg_color,
:background,
:background_colour,
:bgcolour,
:bg_colour,
)
add_aliases(
:background_color_subplot,
:bg_subplot,
:bgsubplot,
:bgcolor_subplot,
:bg_color_subplot,
:background_subplot,
:background_colour_subplot,
:bgcolour_subplot,
:bg_colour_subplot,
)
add_aliases(
:background_color_inside,
:bg_inside,
:bginside,
:bgcolor_inside,
:bg_color_inside,
:background_inside,
:background_colour_inside,
:bgcolour_inside,
:bg_colour_inside,
)
add_aliases(
:background_color_outside,
:bg_outside,
:bgoutside,
:bgcolor_outside,
:bg_color_outside,
:background_outside,
:background_colour_outside,
:bgcolour_outside,
:bg_colour_outside,
)
add_aliases(
:foreground_color,
:fg,
:fgcolor,
:fg_color,
:foreground,
:foreground_colour,
:fgcolour,
:fg_colour,
)
add_aliases(:foreground_color_subplot, :fg_subplot, :fgsubplot, :fgcolor_subplot, :fg_color_subplot, :foreground_subplot,
:foreground_colour_subplot, :fgcolour_subplot, :fg_colour_subplot)
add_aliases(:foreground_color_grid, :fg_grid, :fggrid, :fgcolor_grid, :fg_color_grid, :foreground_grid,
:foreground_colour_grid, :fgcolour_grid, :fg_colour_grid, :gridcolor)
add_aliases(:foreground_color_minor_grid, :fg_minor_grid, :fgminorgrid, :fgcolor_minorgrid, :fg_color_minorgrid, :foreground_minorgrid,
:foreground_colour_minor_grid, :fgcolour_minorgrid, :fg_colour_minor_grid, :minorgridcolor)
add_aliases(:foreground_color_title, :fg_title, :fgtitle, :fgcolor_title, :fg_color_title, :foreground_title,
:foreground_colour_title, :fgcolour_title, :fg_colour_title, :titlecolor)
add_aliases(:foreground_color_axis, :fg_axis, :fgaxis, :fgcolor_axis, :fg_color_axis, :foreground_axis,
:foreground_colour_axis, :fgcolour_axis, :fg_colour_axis, :axiscolor)
add_aliases(:foreground_color_border, :fg_border, :fgborder, :fgcolor_border, :fg_color_border, :foreground_border,
:foreground_colour_border, :fgcolour_border, :fg_colour_border, :bordercolor)
add_aliases(:foreground_color_text, :fg_text, :fgtext, :fgcolor_text, :fg_color_text, :foreground_text,
:foreground_colour_text, :fgcolour_text, :fg_colour_text, :textcolor)
add_aliases(:foreground_color_guide, :fg_guide, :fgguide, :fgcolor_guide, :fg_color_guide, :foreground_guide,
:foreground_colour_guide, :fgcolour_guide, :fg_colour_guide, :guidecolor)
add_aliases(
:foreground_color_subplot,
:fg_subplot,
:fgsubplot,
:fgcolor_subplot,
:fg_color_subplot,
:foreground_subplot,
:foreground_colour_subplot,
:fgcolour_subplot,
:fg_colour_subplot,
)
add_aliases(
:foreground_color_grid,
:fg_grid,
:fggrid,
:fgcolor_grid,
:fg_color_grid,
:foreground_grid,
:foreground_colour_grid,
:fgcolour_grid,
:fg_colour_grid,
:gridcolor,
)
add_aliases(
:foreground_color_minor_grid,
:fg_minor_grid,
:fgminorgrid,
:fgcolor_minorgrid,
:fg_color_minorgrid,
:foreground_minorgrid,
:foreground_colour_minor_grid,
:fgcolour_minorgrid,
:fg_colour_minor_grid,
:minorgridcolor,
)
add_aliases(
:foreground_color_title,
:fg_title,
:fgtitle,
:fgcolor_title,
:fg_color_title,
:foreground_title,
:foreground_colour_title,
:fgcolour_title,
:fg_colour_title,
:titlecolor,
)
add_aliases(
:foreground_color_axis,
:fg_axis,
:fgaxis,
:fgcolor_axis,
:fg_color_axis,
:foreground_axis,
:foreground_colour_axis,
:fgcolour_axis,
:fg_colour_axis,
:axiscolor,
)
add_aliases(
:foreground_color_border,
:fg_border,
:fgborder,
:fgcolor_border,
:fg_color_border,
:foreground_border,
:foreground_colour_border,
:fgcolour_border,
:fg_colour_border,
:bordercolor,
)
add_aliases(
:foreground_color_text,
:fg_text,
:fgtext,
:fgcolor_text,
:fg_color_text,
:foreground_text,
:foreground_colour_text,
:fgcolour_text,
:fg_colour_text,
:textcolor,
)
add_aliases(
:foreground_color_guide,
:fg_guide,
:fgguide,
:fgcolor_guide,
:fg_color_guide,
:foreground_guide,
:foreground_colour_guide,
:fgcolour_guide,
:fg_colour_guide,
:guidecolor,
)
add_aliases(
:foreground_color_title,
@ -807,7 +956,16 @@ add_aliases(:zlims, :zlim, :zlimit, :zlimits)
add_aliases(:zticks, :ztick)
add_aliases(:zrotation, :zrot, :zr)
add_aliases(:guidefontsize, :labelfontsize)
add_aliases(:fill_z, :fillz, :fz, :surfacecolor, :surfacecolour, :sc, :surfcolor, :surfcolour)
add_aliases(
:fill_z,
:fillz,
:fz,
:surfacecolor,
:surfacecolour,
:sc,
:surfcolor,
:surfcolour,
)
add_aliases(:colorbar, :cb, :cbar, :colorkey)
add_aliases(
:colorbar_title,
@ -895,7 +1053,6 @@ function parse_axis_kw(s::Symbol)
return nothing
end
# update the defaults globally
"""
@ -1393,7 +1550,8 @@ function RecipesPipeline.preprocess_attributes!(plotattributes::AKW)
# legends
if haskey(plotattributes, :legend_position)
plotattributes[:legend_position] = convertLegendValue(plotattributes[:legend_position])
plotattributes[:legend_position] =
convertLegendValue(plotattributes[:legend_position])
end
if haskey(plotattributes, :colorbar)
plotattributes[:colorbar] = convertLegendValue(plotattributes[:colorbar])
@ -2149,7 +2307,8 @@ function _splitdef!(blk, key_dict)
type = lhs.args[2]
if @isdefined type
for field in fieldnames(getproperty(Plots, type))
key_dict[Symbol(var, "_", field)] = :(getfield($(ei.args[2]), $(QuoteNode(field))))
key_dict[Symbol(var, "_", field)] =
:(getfield($(ei.args[2]), $(QuoteNode(field))))
end
end
else

View File

@ -310,9 +310,14 @@ _initialize_backend(pkg::GRBackend) = nothing
const _gr_attr = merge_with_base_supported([
:annotations,
:legend_background_color, :background_color_inside, :background_color_outside,
:legend_foreground_color, :foreground_color_grid, :foreground_color_axis,
:foreground_color_text, :foreground_color_border,
:legend_background_color,
:background_color_inside,
:background_color_outside,
:legend_foreground_color,
:foreground_color_grid,
:foreground_color_axis,
:foreground_color_text,
:foreground_color_border,
:label,
:seriescolor,
:seriesalpha,
@ -332,20 +337,52 @@ const _gr_attr = merge_with_base_supported([
:fillalpha,
:bins,
:layout,
:title, :window_title,
:guide, :lims, :ticks, :scale, :flip,
:titlefontfamily, :titlefontsize, :titlefonthalign, :titlefontvalign,
:titlefontrotation, :titlefontcolor,
:legend_font_family, :legend_font_pointsize, :legend_font_halign, :legend_font_valign,
:legend_font_rotation, :legend_font_color,
:tickfontfamily, :tickfontsize, :tickfonthalign, :tickfontvalign,
:tickfontrotation, :tickfontcolor,
:guidefontfamily, :guidefontsize, :guidefonthalign, :guidefontvalign,
:guidefontrotation, :guidefontcolor,
:grid, :gridalpha, :gridstyle, :gridlinewidth,
:legend_position, :legend_title, :colorbar, :colorbar_title, :colorbar_entry,
:fill_z, :line_z, :marker_z, :levels,
:ribbon, :quiver,
:title,
:window_title,
:guide,
:lims,
:ticks,
:scale,
:flip,
:titlefontfamily,
:titlefontsize,
:titlefonthalign,
:titlefontvalign,
:titlefontrotation,
:titlefontcolor,
:legend_font_family,
:legend_font_pointsize,
:legend_font_halign,
:legend_font_valign,
:legend_font_rotation,
:legend_font_color,
:tickfontfamily,
:tickfontsize,
:tickfonthalign,
:tickfontvalign,
:tickfontrotation,
:tickfontcolor,
:guidefontfamily,
:guidefontsize,
:guidefonthalign,
:guidefontvalign,
:guidefontrotation,
:guidefontcolor,
:grid,
:gridalpha,
:gridstyle,
:gridlinewidth,
:legend_position,
:legend_title,
:colorbar,
:colorbar_title,
:colorbar_entry,
:fill_z,
:line_z,
:marker_z,
:levels,
:ribbon,
:quiver,
:orientation,
:overwrite_figure,
:polar,
@ -396,10 +433,15 @@ end
const _plotly_attr = merge_with_base_supported([
:annotations,
:legend_background_color, :background_color_inside, :background_color_outside,
:legend_foreground_color, :foreground_color_guide,
:foreground_color_grid, :foreground_color_axis,
:foreground_color_text, :foreground_color_border,
:legend_background_color,
:background_color_inside,
:background_color_outside,
:legend_foreground_color,
:foreground_color_guide,
:foreground_color_grid,
:foreground_color_axis,
:foreground_color_text,
:foreground_color_border,
:foreground_color_title,
:label,
:seriescolor,
@ -427,9 +469,15 @@ const _plotly_attr = merge_with_base_supported([
:titlefonthalign,
:titlefontvalign,
:titlefontcolor,
:legend_font_family, :legend_font_pointsize, :legend_font_color,
:tickfontfamily, :tickfontsize, :tickfontcolor,
:guidefontfamily, :guidefontsize, :guidefontcolor,
:legend_font_family,
:legend_font_pointsize,
:legend_font_color,
:tickfontfamily,
:tickfontsize,
:tickfontcolor,
:guidefontfamily,
:guidefontsize,
:guidefontcolor,
:window_title,
:guide,
:lims,
@ -515,8 +563,10 @@ const _pgfplots_attr = merge_with_base_supported([
:background_color_inside,
# :background_color_outside,
# :legend_foreground_color,
:foreground_color_grid, :foreground_color_axis,
:foreground_color_text, :foreground_color_border,
:foreground_color_grid,
:foreground_color_axis,
:foreground_color_text,
:foreground_color_border,
:label,
:seriescolor,
:seriesalpha,
@ -632,9 +682,16 @@ end
const _pyplot_attr = merge_with_base_supported([
:annotations,
:legend_background_color, :background_color_inside, :background_color_outside,
:foreground_color_grid, :legend_foreground_color, :foreground_color_title,
:foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text,
:legend_background_color,
:background_color_inside,
:background_color_outside,
:foreground_color_grid,
:legend_foreground_color,
:foreground_color_title,
:foreground_color_axis,
:foreground_color_border,
:foreground_color_guide,
:foreground_color_text,
:label,
:linecolor,
:linestyle,
@ -658,16 +715,41 @@ const _pyplot_attr = merge_with_base_supported([
:titlelocation,
:titlefont,
:window_title,
:guide, :guide_position, :lims, :ticks, :scale, :flip, :rotation,
:titlefontfamily, :titlefontsize, :titlefontcolor,
:legend_font_family, :legend_font_pointsize, :legend_font_color,
:tickfontfamily, :tickfontsize, :tickfontcolor,
:guidefontfamily, :guidefontsize, :guidefontcolor,
:grid, :gridalpha, :gridstyle, :gridlinewidth,
:legend_position, :legend_title, :colorbar, :colorbar_title, :colorbar_entry,
:colorbar_ticks, :colorbar_tickfontfamily, :colorbar_tickfontsize,
:colorbar_tickfonthalign, :colorbar_tickfontvalign,
:colorbar_tickfontrotation, :colorbar_tickfontcolor,
:guide,
:guide_position,
:lims,
:ticks,
:scale,
:flip,
:rotation,
:titlefontfamily,
:titlefontsize,
:titlefontcolor,
:legend_font_family,
:legend_font_pointsize,
:legend_font_color,
:tickfontfamily,
:tickfontsize,
:tickfontcolor,
:guidefontfamily,
:guidefontsize,
:guidefontcolor,
:grid,
:gridalpha,
:gridstyle,
:gridlinewidth,
:legend_position,
:legend_title,
:colorbar,
:colorbar_title,
:colorbar_entry,
:colorbar_ticks,
:colorbar_tickfontfamily,
:colorbar_tickfontsize,
:colorbar_tickfonthalign,
:colorbar_tickfontvalign,
:colorbar_tickfontrotation,
:colorbar_tickfontcolor,
:colorbar_scale,
:marker_z,
:line_z,
@ -893,9 +975,16 @@ const _canvas_type = Ref(:auto)
const _hdf5_attr = merge_with_base_supported([
:annotations,
:legend_background_color, :background_color_inside, :background_color_outside,
:foreground_color_grid, :legend_foreground_color, :foreground_color_title,
:foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text,
:legend_background_color,
:background_color_inside,
:background_color_outside,
:foreground_color_grid,
:legend_foreground_color,
:foreground_color_title,
:foreground_color_axis,
:foreground_color_border,
:foreground_color_guide,
:foreground_color_text,
:label,
:linecolor,
:linestyle,
@ -988,10 +1077,16 @@ const HDF5PLOT_PLOTREF = HDF5Plot_PlotRef(nothing)
const _inspectdr_attr = merge_with_base_supported([
:annotations,
:legend_background_color, :background_color_inside, :background_color_outside,
:legend_background_color,
:background_color_inside,
:background_color_outside,
# :foreground_color_grid,
:legend_foreground_color, :foreground_color_title,
:foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text,
:legend_foreground_color,
:foreground_color_title,
:foreground_color_axis,
:foreground_color_border,
:foreground_color_guide,
:foreground_color_text,
:label,
:seriescolor,
:seriesalpha,
@ -1013,12 +1108,23 @@ const _inspectdr_attr = merge_with_base_supported([
:title,
:titlelocation,
:window_title,
:guide, :lims, :scale, #:ticks, :flip, :rotation,
:titlefontfamily, :titlefontsize, :titlefontcolor,
:legend_font_family, :legend_font_pointsize, :legend_font_color,
:tickfontfamily, :tickfontsize, :tickfontcolor,
:guidefontfamily, :guidefontsize, :guidefontcolor,
:grid, :legend_position, #:colorbar,
:guide,
:lims,
:scale, #:ticks, :flip, :rotation,
:titlefontfamily,
:titlefontsize,
:titlefontcolor,
:legend_font_family,
:legend_font_pointsize,
:legend_font_color,
:tickfontfamily,
:tickfontsize,
:tickfontcolor,
:guidefontfamily,
:guidefontsize,
:guidefontcolor,
:grid,
:legend_position, #:colorbar,
# :marker_z,
# :line_z,
# :levels,

View File

@ -783,4 +783,9 @@ end
font::Font = font(8)
title_font::Font = font(11)
column = 1
end :match = (:legend_font_family, :legend_font_color, :legend_title_font_family, :legend_title_font_color)
end :match = (
:legend_font_family,
:legend_font_color,
:legend_title_font_family,
:legend_title_font_color,
)

View File

@ -47,13 +47,8 @@ const _subplot_args = sort(union(collect(keys(_subplot_defaults))))
const _plot_args = sort(union(collect(keys(_plot_defaults))))
const _magic_axis_args = [:axis, :tickfont, :guidefont, :grid, :minorgrid]
const _magic_subplot_args = [
:title_font,
:legend_font,
:legend_title_font,
:plot_title_font,
:colorbar_titlefont,
]
const _magic_subplot_args =
[:title_font, :legend_font, :legend_title_font, :plot_title_font, :colorbar_titlefont]
const _magic_series_args = [:line, :marker, :fill]
const _all_axis_args = sort(union([_axis_args; _magic_axis_args]))