axes labels, legend entries, line color, marker shapes
This commit is contained in:
parent
eddf523d08
commit
9324123b4d
@ -1,4 +1,38 @@
|
||||
using PGFPlotsX: PGFPlotsX
|
||||
|
||||
const _pgfplotsx_linestyles = KW(
|
||||
:solid => "solid",
|
||||
:dash => "dashed",
|
||||
:dot => "dotted",
|
||||
:dashdot => "dashdotted",
|
||||
:dashdotdot => "dashdotdotted",
|
||||
)
|
||||
|
||||
const _pgfplotsx_markers = KW(
|
||||
:none => "none",
|
||||
:cross => "+",
|
||||
:xcross => "x",
|
||||
:+ => "+",
|
||||
:x => "x",
|
||||
:utriangle => "triangle*",
|
||||
:dtriangle => "triangle*",
|
||||
:circle => "*",
|
||||
:rect => "square*",
|
||||
:star5 => "star",
|
||||
:star6 => "asterisk",
|
||||
:diamond => "diamond*",
|
||||
:pentagon => "pentagon*",
|
||||
:hline => "-",
|
||||
:vline => "|"
|
||||
)
|
||||
|
||||
const _pgfplotsx_legend_pos = KW(
|
||||
:bottomleft => "south west",
|
||||
:bottomright => "south east",
|
||||
:topright => "north east",
|
||||
:topleft => "north west",
|
||||
:outertopright => "outer north east",
|
||||
)
|
||||
# --------------------------------------------------------------------------------------
|
||||
# display calls this and then _display, its called 3 times for plot(1:5)
|
||||
function _update_plot_object(plt::Plot{PGFPlotsXBackend})
|
||||
@ -6,10 +40,32 @@ function _update_plot_object(plt::Plot{PGFPlotsXBackend})
|
||||
|
||||
local axis
|
||||
for sp in plt.subplots
|
||||
axis = PGFPlotsX.Axis()
|
||||
bb = bbox(sp)
|
||||
axis = PGFPlotsX.@pgf PGFPlotsX.Axis(
|
||||
{
|
||||
xlabel = sp.attr[:xaxis][:guide],
|
||||
ylabel = sp.attr[:yaxis][:guide],
|
||||
height = string(height(bb)),
|
||||
width = string(width(bb)),
|
||||
title = sp[:title],
|
||||
},
|
||||
)
|
||||
for series in series_list(sp)
|
||||
series_plot = PGFPlotsX.Plot(PGFPlotsX.Coordinates(series[:x],series[:y]))
|
||||
opt = series.plotattributes
|
||||
series_plot = PGFPlotsX.@pgf PGFPlotsX.Plot(
|
||||
{
|
||||
color = opt[:linecolor],
|
||||
mark = _pgfplotsx_markers[opt[:markershape]],
|
||||
# TODO: how to do nested options?
|
||||
# "mark options" = "{color = $(opt[:markercolor])}",
|
||||
},
|
||||
PGFPlotsX.Coordinates(series[:x],series[:y])
|
||||
)
|
||||
push!( axis, series_plot )
|
||||
if opt[:label] != "" && sp[:legend] != :none && should_add_to_legend(series)
|
||||
push!( axis, PGFPlotsX.LegendEntry( opt[:label] )
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
push!( plt.o, axis )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user