R plot symbols on axis not shown correctly - r

Hi guys,
I have set up a new conda R-environment (on my ubuntu 20.04) and oddly, the output of the base plot function does not show symbols on the axes or axis labels but little squares with numbers instead (see attached picture).
When I use the plot function in an R-Markdown code chunk and export it as PDF, the plot is displayed correctly. However, in RStudio or when exporting the Rmd to html, the symbols appear like in the picture.
I realize this could have to do with the encoding, but don't know how to solve it. Has anyone encountered this problem before or can give me advice how to troubleshoot it?
Many thanks in advance!

Simply adding the package r-cairodevice to my R environment solved the problem.

Related

Labels cannot be placed in second boxplots in R?

If you run the following simple code, you will notice that although in the first boxplot there are labels, this is not the case with the second boxplot where there are no labels. How to fix this? Is it an internal R bug?
I have tried to store boxplots in a working directory just in case this is an R studio graphics problem, but still... the same issue arised even then so this is not an Rstudio problem.
df=data.frame("A"=rnorm(10),"B"=rnorm(10),"C"=rnorm(10),"D"=rnorm(10))
for (i in 1:2){
boxplot(df[,1:2],xaxt='n')
axis(1,at=c(1,2))
boxplot(df[,3:4],xaxt='n')
axis(1,at=c(3,4))}

Show plot on R-Studio terminal

do you guys know how to display an R plot in a terminal/console instead of showing it on plot viewers?
I've recently working to integrate R with external tools, and somehow the only function works is to returns all the value shown up in the console result. Thus, I need some sort of workaround to be able to post a plot in the external tools.
Thanks in advance!
No. That is not possible. The reason is that the plot needs a graphic device.
The terminal (and R console) is a text-based device.
What you can do, is use the image-format files as graphic device. Here, you have a multitude of choices, such as PNG, BMP, JPEG. In R, look up ?png.

No visuals under the plots view

Hi i am still a beginner in R. I need a minor assistance
R does not display plots. The plot view remain just blank after running the commands to draw plot.
Everything under the Plots options is not working. I have restarted the session, closed and started R. but no change.
I was working with the packages ggplot2, tidyverse and dplyr.
I don't recall uninstalling something
What could the problem be?

How to change the scale of the plot in R

I have been trying to perform some of the raster related operations using R and whenever I am loading raster files in R in the plot window it is being displayed at a different scale which is hard to notice. I'm a little confused about how to bring it back to a standard size. As I'm new to the R language I'm not able to figure it out. Little help would be appreciated. Thanks in advance.
It was due to the default values set in par() function. By changing the "mar" parameter in the function I was able to resize it to my own convenience.enter image description here

RStudio contour function not displaying a plot

I'm using RStudio and for some reason I am not getting any output plot using contour function.
This is what I'm trying
x<-seq(1,10)
y<-x
f<-outer(x,y,function(x,y)cos(y)/(1+x^2))
contour(x,y,f)
I don't know if it is because of some missing package or the version of R i'm using.
Any help would be much appreciated.
Try using dev.off() and wait for null devices. This worked for me.

Resources