USGS-R / gsplot

plotting foundation for timeseries reporting
Other
6 stars 14 forks source link

legend not adding legend.name if created first #387

Closed lindsayplatt closed 8 years ago

lindsayplatt commented 8 years ago
gs <- gsplot() %>% 
    legend() %>% 
    points(1,2, legend.name="stuff")
names(gs$legend$legend.auto)
[1] "location"      "legend_offset" "draw"   

image

lindsayplatt commented 8 years ago

This line seems to be the issue: https://github.com/USGS-R/gsplot/blob/master/R/modify_legend.R#L152

orderedParams <- new.legend.args[match(names(legend.args), names(new.legend.args))]

When it tries to add the legend.name from points, the match argument returns a vector of NAs because the legend only has the defaults (location, legend_offset, draw) specified