I am using plotly in a project being used/run from windows/linux/mac machines. Generally this has been working fine, but I have an issue when trying to generate plotly plots from command line in windows.
As a reproducible example, following the code here:
install.packages("plotly")
library(plotly)
p <- plot_ly(midwest, x = ~percollege, color = ~state, type = "box")
p
Results in the error:
Error in shell.exec(url) :
access to '...\Local\Temp\Rtmpq42cvu\viewhtmla386dc27ae4/index.html' denied
That last backslash being the wrong way is an obvious candidate for the problem. And if I point my browser to the same file but with the last backslash changed to match the others, I see the plot as expected.
Could someone please check if they have the same problem? Note that I only have this problem when running from the command line. If I run the same code from Rstudio it works no problem. I'm on R version 3.4.0 and packageVersion("plotly") returns ‘4.6.0’.
Following the comment from #MikeWise (many thanks) I tried switching my default browser from firefox to chrome, and this fixed the issue.
Also, I have confirmed that this issue is also resolved by using an up-to-date version of firefox.
Related
I am a new user of Julia. I want to start using Julia in Atom using Juno. Before I did some tutorials using jupyter-notebooks.
Now the when I tried to run the code below it returns the following error message.
When I run the same code, on the same machine in a jupyter-notebook I do not get an error.
There are a lot of people online that get the same error but none of the solutions could help me. It seems to me that the problem that plots is not precompiling correctly.
For example: Plot not defined with Julia
using Plots
x = 1:10;
y = rand(10); # These are the plotting data
plot(x,y)
UndefVarError: plot not defined
top-level scope at testatom.jl:3
This should work, try rebuilding plots?
using Pkg;pkg”build Plots”
Also do any updates suggested in atom.
Also, which version of julia? Please note that link is very old...
ggplot(data=NULL,aes(x=1,y=1))+
geom_text(size=10,label="ক্ত", family="Kohinoor Bangla")
On my machine, the Bengali conjunct cluster "ক্ত" is rendered as its constituents plus a virana:
I have tried several different fonts to no avail. Is there a trick to making conjuncts render correctly?
EDIT:
Explicitly using the unicode still doesn't not render correctly:
This renders correctly for me:
print(stringi::stri_enc_toutf8("\u0995\u09cd\u09a4"))
This still gives me the exact same result as before
ggplot(data=NULL,aes(x=1,y=1))+
geom_text(size=10,label="\u0995\u09cd\u09a4", family="Kohinoor Bangla")
Why is there a difference between the console output and ggplot output?
I'm not familiar with the Bengali language, but if you would look up the unicode characters for the text that you want to render, you could simply use those in geom_text()
# According to unicode code chart, these are some Bengali characters
# U+099x4
# U+09Ex3
ggplot(data=NULL,aes(x=1,y=1))+
# Substitute 'U+' by '\u', leave the 'x' out
geom_text(size = 10, label = "\u0994\u09E3")
Substitute the unicode characters as you see fit.
Hope that helped!
EDIT: I tried your last piece of code, which gave me a warning about the font not being installed. So I ran it without the family = "Kohinoor Bangla":
ggplot(data=NULL,aes(x=1,y=1))+
geom_text(size=10,label="\u0995\u09cd\u09a4")
Which gave me the following output:
From a visual comparison with the character that you posted, it looks quite similar. Next, I ran the same piece of code on my work computer, which gave me the following output:
The difference between work and home, is that work runs on a linux, while home runs on windows, work has R 3.4.4, home has R 3.5.3. Both are in RStudio, both are ggplot 3.2.0. I can't update R on work because of backwards compatibility issues, to check wether the version of R might be the problem. However, you could check wether your version of R is older than 3.5.3 and see if updating relieves the problem. Otherwise, I would guess it is a platform issue.
I ran into a very weird problem: my R code for generating a plot only works if I type it into the console but not when I ran it inside the script (with Ctrl+Enter command)... It's the same problem with all plots (regular plots or ggplots). Also I tried it on two different computers and the same thing happened. Anyone have any idea why this is happening?
One possible reason: I installed the newest version of Rstudio on both computers so it might be an issue with the version. The exact same code worked before on an older version of rstudio...Could this be it? If so, how can I fix it?
I think I figured out what the problem was: the setting in the new version of Rstudio has a default option of outputting the plots inside the Rmarkdown script (at the very end of the script). And that's why I wasn't seeing them. You could change the setting such that it outputs in the console.
Try dev.off() to reset the graphics device.
This helps with a lot of weird graphics behaviour.
Probably too late for the original poster... However, I just ran into the same problem after installing an R update. The way I fixed it was to go to preferences, R markdown, and turn off "show inline output". For me, it was just coming out at the bottom of the chunk instead of in the plot window like I wanted. Hope that helps someone!
I just ran into this problem. I mistakenly put my plot() command inside the r markdown setup chunk. I moved it to its own code chunk and it ran as expected.
Even while using the sample code given in ggplotly help function... I'm continuously getting the below error
Error in map_layout(panel, plot$facet, layer_data, plot$data) :
unused argument (plot$data)
I had the same issue and followed the solution suggested by #royr2. Specifically, I installed the development version of plotly using devtools::install_github("ropensci/plotly") and restarted my R session and reloaded the package. After that, ggplotly worked again in RStudio.
I know this isn't an answer per se, but this has been documented as known issue with ggplot 2.1.0 - see link:
https://github.com/ropensci/plotly/issues/481
I'm trying to use the package RIGHT, but my output is not the one shown on the package website (i.e. I can't access the interactive graphics).
library(RIGHT)
data(diamonds)
plot(price ~ carat, diamonds, type="p")
#THE ABOVE WORKS
RIGHT(plot(price ~ carat, diamonds, type="p"))
The above just returns a webpage without the graph with "© 2013 - The RIGHT team"
on the left and "E-mail : right-user#googlegroups.com" on the right. Basically the bottom of the last graph shown here.
I've tried to do this in the R console and in Rstudio and got the same output.
I'm running Windows 7 (64 bit), R version 3.0.2 (2013-09-25). I've also tried with previous R versions but got the same output. Has this happened to anyone else?
Thanks for using RIGHT. If you see a small box and the copyright statement from above statement, you may be experiencing browser compatibility issue. We have not been able to solve browser compatibility issue completely yet, so you probably have to do the following at the moment:
https://code.google.com/p/r-interactive-graphics-via-html/wiki/FAQs