score:1

Accepted answer

It seems chartJSRadar does not call a plot but shows an interactive plot in the viewer. Hence a plot is not called and you cannot use legend(). From the documentation for chartJSRadar, it does seem like there is a legend option for the radar plot, see http://www.chartjs.org/docs/#radar-chart-chart-options:

//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"

This is JavaScript, which I have no expertise in, so unfortunately this is as far as I can help you.

score:0

Try using fmsb package which has radarchart() function. You can plot the same for your data.

http://127.0.0.1:25882/library/fmsb/html/radarchart.html

I tried it in R and it works in R plot window. As I do not understand the radar chart data. You would definitely be able to do it with legend using radarchart() and legend()using package fmsb

score:4

If using R Studio make sure to run the entire chunk (not ctr + enter). I had a similar issue using igraph. I tried to attach the legend to the graph but had the same error message. Running the entire chunk worked.


Related Query

More Query from same tag