fslaborg / RProvider

Access R packages from F#
http://fslab.org/RProvider/
Other
235 stars 69 forks source link

Misplaced labels on dataframe plot #180

Open stuarthillary opened 7 years ago

stuarthillary commented 7 years ago

I have taken code from a presentation by Mathias Brandewinder that demonstrates some basic use of the FSharpRProvider:

https://github.com/mathias-brandewinder/Presentations/blob/master/fsharp-for-csharp-devs/code/Type-Providers/Script.fsx

Part of the script creates a plot from a dataframe and then tries to label the points. However, the labels are incorrectly positioned on the chart:

rplotnameserror

I have stripped out the unnecessary code and created a repository to demonstrate the problem here:

https://github.com/stuarthillary/RProviderPlotError.git

I am working with R version 3.3.1 on Windows 10 Enterprise and I am running the code inside Visual Studio Enterprise 2015 Update 3 via F# interactive.

tpetricek commented 7 years ago

cc @mathias-brandewinder

This looks odd - but I suppose this might be more of an R question than R provider question.

stuarthillary commented 7 years ago

I have looked into this issue further. The last version of the the FSharpRProvider that could plot the labels correctly was 1.0.7-alpha. I tested this on various version of R, from 3.0.2 upwards to the latest 3.3.0 release. Between versions 1.0.9 and 1.0.15 I could not execute the script using FSI (an exception was being raised in the constructor of RProvider). Version 1.0.16 and later could execute the script without this exception being thrown, but the plot labels are incorrectly placed.

AndrewIOM commented 2 years ago

Not sure if this is an RProvider issue. I ran the example code on RProvider v2 and could reproduce this problem. Changing the code from:

R.text(gdp2000, gdp2010, names)

to

R.text(namedParams["x", box gdp2000; "y", box gdp2010; "labels", box names])

fixes the issue. Looks like it is to do with named parameter ordering.