more params
This commit is contained in:
parent
fba9791769
commit
fad07e82ef
@ -581,22 +581,77 @@ function _initialize_backend(::GastonBackend)
|
|||||||
end
|
end
|
||||||
|
|
||||||
const _gaston_attr = merge_with_base_supported([
|
const _gaston_attr = merge_with_base_supported([
|
||||||
|
# :annotations,
|
||||||
|
# :background_color_legend,
|
||||||
|
# :background_color_inside,
|
||||||
|
# :background_color_outside,
|
||||||
|
# :foreground_color_legend,
|
||||||
|
# :foreground_color_grid, :foreground_color_axis,
|
||||||
|
# :foreground_color_text, :foreground_color_border,
|
||||||
:label,
|
:label,
|
||||||
:legend,
|
# :seriescolor, :seriesalpha,
|
||||||
:seriescolor,
|
:linecolor, :linestyle, :linewidth, :linealpha,
|
||||||
:seriesalpha,
|
:markershape, :markercolor, :markersize, :markeralpha,
|
||||||
:linestyle,
|
# :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle,
|
||||||
:markershape,
|
# :fillrange, :fillcolor, :fillalpha,
|
||||||
:bins,
|
# :bins,
|
||||||
:title,
|
# :bar_width, :bar_edges,
|
||||||
:guide, :lims,
|
# :title,
|
||||||
|
# :window_title,
|
||||||
|
# :guide, :guide_position, :lims, :ticks, :scale, :flip, :rotation,
|
||||||
|
# :tickfont, :guidefont, :legendfont,
|
||||||
|
# :grid, :legend,
|
||||||
|
# :colorbar, :colorbar_title,
|
||||||
|
# :fill_z, :line_z, :marker_z, :levels,
|
||||||
|
# :ribbon, :quiver, :arrow,
|
||||||
|
# :orientation,
|
||||||
|
# :overwrite_figure,
|
||||||
|
# :polar,
|
||||||
|
# :normalize, :weights, :contours,
|
||||||
|
# :aspect_ratio,
|
||||||
|
:tick_direction,
|
||||||
|
# :framestyle,
|
||||||
|
# :camera,
|
||||||
|
# :contour_labels,
|
||||||
])
|
])
|
||||||
const _gaston_seriestype = [
|
const _gaston_seriestype = [:path,
|
||||||
:path, :scatter, :shape, :straightline,
|
# :path3d,
|
||||||
|
:scatter,
|
||||||
|
:steppre,
|
||||||
|
# :stepmid,
|
||||||
|
:steppost,
|
||||||
|
# :histogram2d,
|
||||||
|
# :ysticks, :xsticks,
|
||||||
|
# :contour,
|
||||||
|
# :shape,
|
||||||
|
# :straightline,
|
||||||
|
]
|
||||||
|
|
||||||
|
const _gaston_style = [:auto,
|
||||||
|
:solid,
|
||||||
|
:dash,
|
||||||
|
:dot,
|
||||||
|
:dashdot,
|
||||||
|
:dashdotdot
|
||||||
|
]
|
||||||
|
|
||||||
|
const _gaston_marker = [:none,
|
||||||
|
# :auto,
|
||||||
|
:circle,
|
||||||
|
:rect,
|
||||||
|
:diamond,
|
||||||
|
:utriangle,
|
||||||
|
:dtriangle,
|
||||||
|
:pentagon,
|
||||||
|
:x,
|
||||||
|
:+
|
||||||
|
] #vcat(_allMarkers, Shape)
|
||||||
|
|
||||||
|
const _gaston_scale = [:identity,
|
||||||
|
# :ln,
|
||||||
|
# :log2,
|
||||||
|
# :log10,
|
||||||
]
|
]
|
||||||
const _gaston_style = [:auto, :solid]
|
|
||||||
const _gaston_marker = [:none, :auto, :circle]
|
|
||||||
const _gaston_scale = [:identity]
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# unicodeplots
|
# unicodeplots
|
||||||
|
|||||||
@ -1,11 +1,16 @@
|
|||||||
# https://github.com/mbaz/Gaston.
|
# https://github.com/mbaz/Gaston.
|
||||||
const G = Gaston
|
const G = Gaston
|
||||||
const GastonSubplot = G.Plot
|
const GastonSubplot = G.Plot
|
||||||
|
const GASTON_MARKER_SCALING = 1.3 / 5.0
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# These functions are called by Plots
|
# These functions are called by Plots
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# Create the window/figure for this backend.
|
# Create the window/figure for this backend.
|
||||||
function _create_backend_figure(plt::Plot{GastonBackend})
|
function _create_backend_figure(plt::Plot{GastonBackend})
|
||||||
|
xsize = plt.attr[:size][1]
|
||||||
|
ysize = plt.attr[:size][2]
|
||||||
|
G.set(termopts="""size $xsize,$ysize""")
|
||||||
|
|
||||||
state_handle = G.nexthandle() # for now all the figures will be kept
|
state_handle = G.nexthandle() # for now all the figures will be kept
|
||||||
plt.o = G.newfigure(state_handle)
|
plt.o = G.newfigure(state_handle)
|
||||||
end
|
end
|
||||||
@ -14,10 +19,10 @@ end
|
|||||||
function _before_layout_calcs(plt::Plot{GastonBackend})
|
function _before_layout_calcs(plt::Plot{GastonBackend})
|
||||||
# Initialize all the subplots first
|
# Initialize all the subplots first
|
||||||
plt.o.subplots = G.SubPlot[]
|
plt.o.subplots = G.SubPlot[]
|
||||||
|
|
||||||
grid = size(plt.layout)
|
grid = size(plt.layout)
|
||||||
plt.o.layout = grid
|
plt.o.layout = grid
|
||||||
|
|
||||||
|
|
||||||
for sp in plt.subplots
|
for sp in plt.subplots
|
||||||
gaston_init_subplot(plt, sp)
|
gaston_init_subplot(plt, sp)
|
||||||
end
|
end
|
||||||
@ -43,7 +48,7 @@ function _display(plt::Plot{GastonBackend})
|
|||||||
end
|
end
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# These functions are called gaston specific
|
# These functions are gaston specific
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
|
|
||||||
function gaston_init_subplot(plt::Plot{GastonBackend}, sp::Subplot{GastonBackend})
|
function gaston_init_subplot(plt::Plot{GastonBackend}, sp::Subplot{GastonBackend})
|
||||||
@ -72,8 +77,19 @@ function gaston_parse_series_args(series::Series)
|
|||||||
curveconf = String[]
|
curveconf = String[]
|
||||||
st = series[:seriestype]
|
st = series[:seriestype]
|
||||||
|
|
||||||
if st == :path
|
if st == :scatter
|
||||||
push!(curveconf, """with lines """)
|
pt = gaston_marker(series[:markershape])
|
||||||
|
ps = series[:markersize] * GASTON_MARKER_SCALING
|
||||||
|
lc = gaston_color(series[:markercolor])
|
||||||
|
alpha = series[:markeralpha] # TODO merge alpha with rgb color
|
||||||
|
push!(curveconf, """with points pt $pt ps $ps lc $lc""")
|
||||||
|
elseif st == :path
|
||||||
|
lc = gaston_color(series[:linecolor])
|
||||||
|
dt = gaston_linestyle(series[:linestyle])
|
||||||
|
lw = series[:linewidth]
|
||||||
|
alpha = series[:linealpha] # TODO merge alpha with rgb color
|
||||||
|
push!(curveconf, """with lines lc $lc dt $dt lw $lw""")
|
||||||
|
|
||||||
elseif st == :steppre
|
elseif st == :steppre
|
||||||
push!(curveconf, """with steps""")
|
push!(curveconf, """with steps""")
|
||||||
elseif st == :steppost
|
elseif st == :steppost
|
||||||
@ -81,7 +97,7 @@ function gaston_parse_series_args(series::Series)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# line color
|
# line color
|
||||||
push!(curveconf, """lc rgb "#$(hex(series[:linecolor], :rrggbb))" """)
|
# push!(curveconf, """lc rgb "#$(hex(series[:linecolor], :rrggbb))" """)
|
||||||
|
|
||||||
# label
|
# label
|
||||||
push!(curveconf, """title "$(series[:label])" """)
|
push!(curveconf, """title "$(series[:label])" """)
|
||||||
@ -105,12 +121,10 @@ function gaston_parse_axes_args(plt::Plot{GastonBackend}, sp::Subplot{GastonBack
|
|||||||
|
|
||||||
# tickfont
|
# tickfont
|
||||||
push!(axesconf, """set $(letter)tics font "$(axis_attr[:tickfontfamily]), $(axis_attr[:tickfontsize])" """)
|
push!(axesconf, """set $(letter)tics font "$(axis_attr[:tickfontfamily]), $(axis_attr[:tickfontsize])" """)
|
||||||
|
|
||||||
push!(axesconf, """set $(letter)tics textcolor rgb "#$(hex(axis_attr[:tickfontcolor], :rrggbb))" """)
|
push!(axesconf, """set $(letter)tics textcolor rgb "#$(hex(axis_attr[:tickfontcolor], :rrggbb))" """)
|
||||||
|
|
||||||
push!(axesconf, """set $(letter)tics $(axis_attr[:tick_direction])""")
|
push!(axesconf, """set $(letter)tics $(axis_attr[:tick_direction])""")
|
||||||
|
|
||||||
mirror = axis_attr[:mirror] ? "nomirror" : "mirror"
|
mirror = axis_attr[:mirror] ? "mirror" : "nomirror"
|
||||||
push!(axesconf, """set $(letter)tics $(mirror) """)
|
push!(axesconf, """set $(letter)tics $(mirror) """)
|
||||||
|
|
||||||
# set xtics (1,2,5,10,20,50)
|
# set xtics (1,2,5,10,20,50)
|
||||||
@ -118,3 +132,31 @@ function gaston_parse_axes_args(plt::Plot{GastonBackend}, sp::Subplot{GastonBack
|
|||||||
end
|
end
|
||||||
return join(axesconf, "\n")
|
return join(axesconf, "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function gaston_marker(marker)
|
||||||
|
marker == :none && return -1
|
||||||
|
marker == :circle && return 7
|
||||||
|
marker == :rect && return 5
|
||||||
|
marker == :diamond && return 28
|
||||||
|
marker == :utriangle && return 9
|
||||||
|
marker == :dtriangle && return 11
|
||||||
|
marker == :+ && return 1
|
||||||
|
marker == :x && return 2
|
||||||
|
marker == :star5 && return 3
|
||||||
|
marker == :pentagon && return 15
|
||||||
|
marker == :pixel && return 0
|
||||||
|
|
||||||
|
@warn("Unsupported marker $marker")
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
gaston_color(color) = """rgb "#$(hex(color, :rrggbb))" """
|
||||||
|
|
||||||
|
function gaston_linestyle(style)
|
||||||
|
style == :solid && return "1"
|
||||||
|
style == :dash && return "2"
|
||||||
|
style == :dot && return "3"
|
||||||
|
style == :dashdot && return "4"
|
||||||
|
style == :dashdotdot && return "5"
|
||||||
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user