RStudio contour function not displaying a plot - r

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.

Related

Par() function in R,plot not shown

Hey there stackoverflow geeks, I am working with a dataset in R language using R studio. I want to display my pareto charts side by side so better analysis can be done.
When I use par() function , i only get the first plot with an empty white space on right, can anyone please help me with what the issue is?
library(qcc)
stateRegion <- table(state.region)
stateDivision <- table(state.division)
par(mfrow=c(1,2))
pareto.chart(stateRegion) #only this one appears
pareto.chart(stateDivision) #this one is not plotting
EDIT
The code is working with all other plots except pareto chart/plot.
Please help.

R plot symbols on axis not shown correctly

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.

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

plot3D from rgl package doesn't appear

I'm trying to use the rgl package to produce 3D plots of my graphs in RStudio. I use a Mac and I have XQuartz installed, but when I follow step-by-step tutorials for 3D plotting even the simplest plots won't work.
No warning message appears and no plot appears after I launch the command. When I bring all windows forward I can see a small one with no close/expand button and no images on it (same goes for the plot area of the workspace, nothing happens at all).
Does anybody have an idea of why this could be the case? I updated R a couple of weeks ago and all of my packages have been uninstalled and re-installed.
Thanks!
Here's the basic code I used, just in case.
x=runif(1000)
y=runif(1000)
z=rnorm(1000)
install.packages("rgl")
library("rgl")
plot3d(x,y,z)

Resources