Merge 38d403570b117dd0b90c9ac2a5b6d541566ea211 into 89a5e5d57a534c7ffcc3da5c0a6b29fe0caf7963

This commit is contained in:
Sam Foo 2017-06-08 21:44:56 +00:00 committed by GitHub
commit 4c40f768dd
6 changed files with 12 additions and 5 deletions

View File

@ -51,6 +51,8 @@ export
yflip!, yflip!,
xaxis!, xaxis!,
yaxis!, yaxis!,
xgrid!,
ygrid!,
xlims, xlims,
ylims, ylims,
@ -220,6 +222,8 @@ xflip!(flip::Bool = true; kw...) = plot!(; xflip = flip
yflip!(flip::Bool = true; kw...) = plot!(; yflip = flip, kw...) yflip!(flip::Bool = true; kw...) = plot!(; yflip = flip, kw...)
xaxis!(args...; kw...) = plot!(; xaxis = args, kw...) xaxis!(args...; kw...) = plot!(; xaxis = args, kw...)
yaxis!(args...; kw...) = plot!(; yaxis = args, kw...) yaxis!(args...; kw...) = plot!(; yaxis = args, kw...)
xgrid!(grid::Bool = true; kw...) = plot!(; xgrid = grid, kw...)
ygrid!(grid::Bool = true; kw...) = plot!(; ygrid = grid, kw...)
let PlotOrSubplot = Union{Plot, Subplot} let PlotOrSubplot = Union{Plot, Subplot}
title!(plt::PlotOrSubplot, s::AbstractString; kw...) = plot!(plt; title = s, kw...) title!(plt::PlotOrSubplot, s::AbstractString; kw...) = plot!(plt; title = s, kw...)
@ -243,6 +247,8 @@ let PlotOrSubplot = Union{Plot, Subplot}
yflip!(plt::PlotOrSubplot, flip::Bool = true; kw...) = plot!(plt; yflip = flip, kw...) yflip!(plt::PlotOrSubplot, flip::Bool = true; kw...) = plot!(plt; yflip = flip, kw...)
xaxis!(plt::PlotOrSubplot, args...; kw...) = plot!(plt; xaxis = args, kw...) xaxis!(plt::PlotOrSubplot, args...; kw...) = plot!(plt; xaxis = args, kw...)
yaxis!(plt::PlotOrSubplot, args...; kw...) = plot!(plt; yaxis = args, kw...) yaxis!(plt::PlotOrSubplot, args...; kw...) = plot!(plt; yaxis = args, kw...)
xgrid!(plt::PlotOrSubplot, grid::Bool = true; kw...) = plot!(plt; xgrid = grid, kw...)
ygrid!(plt::PlotOrSubplot, grid::Bool = true; kw...) = plot!(plt; ygrid = grid, kw...)
end end

View File

@ -84,7 +84,6 @@ const _arg_desc = KW(
:colorbar => "Bool (show the colorbar?) or Symbol (colorbar position). Symbol values: `:none`, `:best`, `:right`, `:left`, `:top`, `:bottom`, `:legend` (matches legend value) (note: only some may be supported in each backend)", :colorbar => "Bool (show the colorbar?) or Symbol (colorbar position). Symbol values: `:none`, `:best`, `:right`, `:left`, `:top`, `:bottom`, `:legend` (matches legend value) (note: only some may be supported in each backend)",
:clims => "`:auto` or NTuple{2,Number}. Fixes the limits of the colorbar.", :clims => "`:auto` or NTuple{2,Number}. Fixes the limits of the colorbar.",
:legendfont => "Font. Font of legend items.", :legendfont => "Font. Font of legend items.",
:grid => "Bool. Show the grid lines?",
:annotations => "(x,y,text) tuple(s). Can be a single tuple or a list of them. Text can be String or PlotText (created with `text(args...)`) Add one-off text annotations at the x,y coordinates.", :annotations => "(x,y,text) tuple(s). Can be a single tuple or a list of them. Text can be String or PlotText (created with `text(args...)`) Add one-off text annotations at the x,y coordinates.",
:projection => "Symbol or String. '3d' or 'polar'", :projection => "Symbol or String. '3d' or 'polar'",
:aspect_ratio => "Symbol (:equal) or Number. Plot area is resized so that 1 y-unit is the same size as `apect_ratio` x-units.", :aspect_ratio => "Symbol (:equal) or Number. Plot area is resized so that 1 y-unit is the same size as `apect_ratio` x-units.",
@ -111,5 +110,6 @@ const _arg_desc = KW(
:foreground_color_text => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of tick labels.", :foreground_color_text => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of tick labels.",
:foreground_color_guide => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of axis guides (axis labels).", :foreground_color_guide => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of axis guides (axis labels).",
:mirror => "Bool. Switch the side of the tick labels (right or top).", :mirror => "Bool. Switch the side of the tick labels (right or top).",
:grid => "Bool. Show grid lines?"
) )

View File

@ -255,7 +255,6 @@ const _subplot_defaults = KW(
:colorbar => :legend, :colorbar => :legend,
:clims => :auto, :clims => :auto,
:legendfont => font(8), :legendfont => font(8),
:grid => true,
:annotations => [], # annotation tuples... list of (x,y,annotation) :annotations => [], # annotation tuples... list of (x,y,annotation)
:projection => :none, # can also be :polar or :3d :projection => :none, # can also be :polar or :3d
:aspect_ratio => :none, # choose from :none or :equal :aspect_ratio => :none, # choose from :none or :equal
@ -285,6 +284,7 @@ const _axis_defaults = KW(
:discrete_values => [], :discrete_values => [],
:formatter => :auto, :formatter => :auto,
:mirror => false, :mirror => false,
:grid => true,
) )
const _suppress_warnings = Set{Symbol}([ const _suppress_warnings = Set{Symbol}([
@ -321,6 +321,7 @@ for letter in (:x,:y,:z)
# :foreground_color_guide, # :foreground_color_guide,
# :discrete_values, # :discrete_values,
# :formatter, # :formatter,
# :grid,
# ) # )
_axis_defaults_byletter[Symbol(letter,k)] = :match _axis_defaults_byletter[Symbol(letter,k)] = :match

View File

@ -679,7 +679,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
# @show xticks yticks #spine_segs grid_segs # @show xticks yticks #spine_segs grid_segs
# draw the grid lines # draw the grid lines
if sp[:grid] if axis[:grid]
# gr_set_linecolor(sp[:foreground_color_grid]) # gr_set_linecolor(sp[:foreground_color_grid])
# GR.grid(xtick, ytick, 0, 0, majorx, majory) # GR.grid(xtick, ytick, 0, 0, majorx, majory)
gr_set_line(1, :dot, sp[:foreground_color_grid]) gr_set_line(1, :dot, sp[:foreground_color_grid])

View File

@ -213,7 +213,7 @@ function plotly_axis(axis::Axis, sp::Subplot)
letter = axis[:letter] letter = axis[:letter]
ax = KW( ax = KW(
:title => axis[:guide], :title => axis[:guide],
:showgrid => sp[:grid], :showgrid => axis[:grid],
:zeroline => false, :zeroline => false,
:ticks => "inside", :ticks => "inside",
) )

View File

@ -1056,7 +1056,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
lab[:set_family](axis[:tickfont].family) lab[:set_family](axis[:tickfont].family)
lab[:set_rotation](axis[:rotation]) lab[:set_rotation](axis[:rotation])
end end
if sp[:grid] if axis[:grid]
fgcolor = py_color(sp[:foreground_color_grid]) fgcolor = py_color(sp[:foreground_color_grid])
pyaxis[:grid](true, color = fgcolor, linestyle = ":") pyaxis[:grid](true, color = fgcolor, linestyle = ":")
ax[:set_axisbelow](true) ax[:set_axisbelow](true)