You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's an issue related to the structure of the plots in Winston.
plot(x,y,"o-"), etc. actually creates two plot components, one for the line and another for the points; and each one has a different key in the legends.
There is no plot component type (that I am aware of) that may be used to put both components into a single one, and create a mixed legend. It might be created, but it does not exist in this moment.
A workaround is creating two overlapping legends manually:
using Winston
p =plot([1,2], "o-")
oplot([1,3], "o-r")
comp =getcomponents(p)
[setattr(comp[i], label="black") for i=1:2]
[setattr(comp[i], label="red") for i=3:4]
leg1 =Legend(0.1,0.9,{comp[1], comp[3]})
leg2 =Legend(0.1,0.9,{comp[2], comp[4]})
add(p, leg1, leg2)
using Winston
# Assign the plot to variable p to get the list of components
p =plot([1,2], "o-")
oplot([1,3], "o-r")
comp =getcomponents(p)
# use Winston.PlotGroup(components::Array{Any,1}) to group the plot components:# comp[1:2] contain the black line and points, comp[3:4] the red ones.# Add these two groups to a new plot p2, and make the legend for them.
p2 =FramedPlot()
add(p2, Winston.PlotGroup(comp[1:2]), Winston.PlotGroup(comp[3:4]))
legend(p2, ["black", "red"])
This adds both legends to the black-plot. One to the line, one to the "o". (this is on commit 705449e)
The text was updated successfully, but these errors were encountered: