fix fontrotation being interpreted as fontsize (#3533)

* fix convenience font functions

* correct size argument
This commit is contained in:
Simon Christ 2021-06-02 22:12:30 +02:00 committed by GitHub
parent 697e5a87cf
commit 5fafddb995
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,7 @@ struct SeriesSegment
# indexes of this segement in series data vectors # indexes of this segement in series data vectors
range::UnitRange range::UnitRange
# index into vector-valued attributes corresponding to this segment # index into vector-valued attributes corresponding to this segment
attr_index::Int attr_index::Int
end end
# ----------------------------------------------------- # -----------------------------------------------------
@ -88,11 +88,11 @@ function series_segments(series::Series, seriestype::Symbol = :path)
(SeriesSegment(i:i, i) for i in r) (SeriesSegment(i:i, i) for i in r)
else else
(SeriesSegment(i:i+1, i) for i in first(r):last(r)-1) (SeriesSegment(i:i+1, i) for i in first(r):last(r)-1)
end end
end) end)
else else
(SeriesSegment(r, 1) for r in nan_segments) (SeriesSegment(r, 1) for r in nan_segments)
end end
warn_on_attr_dim_mismatch(series, x, y, z, segments) warn_on_attr_dim_mismatch(series, x, y, z, segments)
return segments return segments
@ -109,7 +109,7 @@ function warn_on_attr_dim_mismatch(series, x, y, z, segments)
if any(v -> !isnothing(v) && any(isnan, v), (x,y,z)) if any(v -> !isnothing(v) && any(isnan, v), (x,y,z))
@info """Data contains NaNs or missing values, and indices of `$attr` vector do not match data indices. @info """Data contains NaNs or missing values, and indices of `$attr` vector do not match data indices.
If you intend elements of `$attr` to apply to individual NaN-separated segements in the data, If you intend elements of `$attr` to apply to individual NaN-separated segements in the data,
pass each segment in a separate vector instead, and use a row vector for `$attr`. Legend entries pass each segment in a separate vector instead, and use a row vector for `$attr`. Legend entries
may be suppressed by passing an empty label. may be suppressed by passing an empty label.
For example, For example,
plot([1:2,1:3], [[4,5],[3,4,5]], label=["y" ""], $attr=[1 2]) plot([1:2,1:3], [[4,5],[3,4,5]], label=["y" ""], $attr=[1 2])
@ -270,7 +270,7 @@ function heatmap_edges(x::AVec, xscale::Symbol, y::AVec, yscale::Symbol, z_size:
or `size(z) == (length(y)+1, length(x)+1))` (x & y define edges).""") or `size(z) == (length(y)+1, length(x)+1))` (x & y define edges).""")
end end
x, y = heatmap_edges(x, xscale, isedges), x, y = heatmap_edges(x, xscale, isedges),
heatmap_edges(y, yscale, isedges, ispolar) # special handle for `r` in polar plots heatmap_edges(y, yscale, isedges, ispolar) # special handle for `r` in polar plots
return x, y return x, y
end end
@ -939,67 +939,67 @@ ignorenan_extrema(plt::Plot) = (xmin(plt), xmax(plt))
# --------------------------------------------------------------- # ---------------------------------------------------------------
# get fonts from objects: # get fonts from objects:
plottitlefont(p::Plot) = font( plottitlefont(p::Plot) = font(;
p[:plot_titlefontfamily], family = p[:plot_titlefontfamily],
p[:plot_titlefontsize], pointsize = p[:plot_titlefontsize],
p[:plot_titlefontvalign], valign = p[:plot_titlefontvalign],
p[:plot_titlefonthalign], halign = p[:plot_titlefonthalign],
p[:plot_titlefontrotation], rotation = p[:plot_titlefontrotation],
p[:plot_titlefontcolor], color = p[:plot_titlefontcolor],
) )
colorbartitlefont(sp::Subplot) = font( colorbartitlefont(sp::Subplot) = font(;
sp[:colorbar_titlefontfamily], family = sp[:colorbar_titlefontfamily],
sp[:colorbar_titlefontsize], pointsize = sp[:colorbar_titlefontsize],
sp[:colorbar_titlefontvalign], valign = sp[:colorbar_titlefontvalign],
sp[:colorbar_titlefonthalign], halign = sp[:colorbar_titlefonthalign],
sp[:colorbar_titlefontrotation], rotation = sp[:colorbar_titlefontrotation],
sp[:colorbar_titlefontcolor], color = sp[:colorbar_titlefontcolor],
) )
titlefont(sp::Subplot) = font( titlefont(sp::Subplot) = font(;
sp[:titlefontfamily], family = sp[:titlefontfamily],
sp[:titlefontsize], pointsize = sp[:titlefontsize],
sp[:titlefontvalign], valign = sp[:titlefontvalign],
sp[:titlefonthalign], halign = sp[:titlefonthalign],
sp[:titlefontrotation], rotation = sp[:titlefontrotation],
sp[:titlefontcolor], color = sp[:titlefontcolor],
) )
legendfont(sp::Subplot) = font( legendfont(sp::Subplot) = font(;
sp[:legendfontfamily], family = sp[:legendfontfamily],
sp[:legendfontsize], pointsize = sp[:legendfontsize],
sp[:legendfontvalign], valign = sp[:legendfontvalign],
sp[:legendfonthalign], halign = sp[:legendfonthalign],
sp[:legendfontrotation], rotation = sp[:legendfontrotation],
sp[:legendfontcolor], color = sp[:legendfontcolor],
) )
legendtitlefont(sp::Subplot) = font( legendtitlefont(sp::Subplot) = font(;
sp[:legendtitlefontfamily], family = sp[:legendtitlefontfamily],
sp[:legendtitlefontsize], pointsize = sp[:legendtitlefontsize],
sp[:legendtitlefontvalign], valign = sp[:legendtitlefontvalign],
sp[:legendtitlefonthalign], halign = sp[:legendtitlefonthalign],
sp[:legendtitlefontrotation], rotation = sp[:legendtitlefontrotation],
sp[:legendtitlefontcolor], color = sp[:legendtitlefontcolor],
) )
tickfont(ax::Axis) = font( tickfont(ax::Axis) = font(;
ax[:tickfontfamily], family = ax[:tickfontfamily],
ax[:tickfontsize], pointsize = ax[:tickfontsize],
ax[:tickfontvalign], valign = ax[:tickfontvalign],
ax[:tickfonthalign], halign = ax[:tickfonthalign],
ax[:tickfontrotation], rotation = ax[:tickfontrotation],
ax[:tickfontcolor], color = ax[:tickfontcolor],
) )
guidefont(ax::Axis) = font( guidefont(ax::Axis) = font(;
ax[:guidefontfamily], family = ax[:guidefontfamily],
ax[:guidefontsize], pointsize = ax[:guidefontsize],
ax[:guidefontvalign], valign = ax[:guidefontvalign],
ax[:guidefonthalign], halign = ax[:guidefonthalign],
ax[:guidefontrotation], rotation = ax[:guidefontrotation],
ax[:guidefontcolor], color = ax[:guidefontcolor],
) )
# --------------------------------------------------------------- # ---------------------------------------------------------------