logo
down
shadow

R version doesn't support quartz graphic device - RStudio won't plot


R version doesn't support quartz graphic device - RStudio won't plot

By : user2955968
Date : November 22 2020, 10:48 AM
like below fixes the issue I run into the same issue.
According to the R brew formula history the last bottled version (i.e. precompiled version, which is what is installed by default) isn't run against aqua due to some bug so the installation of R has no aqua capabilities, which is what RStudio graphics device requires.
code :
brew install r --build-from-source


Share : facebook icon twitter icon
Quartz device: plot is cutoff by default

Quartz device: plot is cutoff by default


By : Apes Rao
Date : March 29 2020, 07:55 AM
around this issue Comment by @rawr spurred me in the right direction...
The size of the device is too large relative to the screen resolution. I used
code :
setHook(packageEvent("grDevices", "onLoad"), 
  function(...) grDevices::quartz.options(width = 6, height = 6))
Correctly set R default graphic device to quartz?

Correctly set R default graphic device to quartz?


By : Tessa Olowniuk
Date : March 29 2020, 07:55 AM
wish helps you The erro message says it all. There is no data-object named 'quartz' and the options function is not expecting (nor can it find) a function name as an argument value for the 'device'-node.
You are seeing the effect of the environment where .Rprofile is being evaluated because some of the usual packages (such as stats or graphics) are not yet loaded. Read more about this at ?Startup. You could avoid this by starting .Rprofile with require(grDevices)
How to make 2 axes cross at 0 in RStudio all the time (even when resizing the plot device)

How to make 2 axes cross at 0 in RStudio all the time (even when resizing the plot device)


By : Kelvin Chang
Date : March 29 2020, 07:55 AM
it helps some times The solution is a little bit tricky:
First, don't draw the axis with plot.cca (the first call of plot of object pca). You can plot the axes yourself afterwards like you do it in the second call of plot. Draw the ablines after the second plot. When testing you will see that there are two types of ablines now, one from plot.cca and one we plotted in 3. When looking into the function plot.cca (which is a S3 method for plot), e.g. with getAnywhere(plot.cca) we see that abline is called twice and there is no option to prevent that. So, a little bit tricky: we define our own plot function and remove the two lines with abline within plot.cca. We can call that function e.g. myccaplot. Now it should work like expected.
code :
for (i in 1:6) {

### pettern 1 / plot(pca); par(new=T); plot(~, new_lim())
s1= rnorm(50,mean = 12); s2= rnorm(50, mean = 17); s3= rnorm(50, mean = 20)
pca=rda(cbind(s1,s2,s3))
pca.scoop=scores(pca, scaling = 2)
myccaplot(    ### (4)
     pca, xlab = "x1", ylab = "y1",
     type = c("p"),main= "main",scaling = 2,choices = c(1,2),
     xlim =c(min(pca.scoop$sites[,1]),max(pca.scoop$sites[,1])),
     ylim = c(min(pca.scoop$sites[,2]),max(pca.scoop$sites[,2])),
     bty = "o",pch=4,
     axes = F) ### (1)
axis(1)  ### (2)
axis(2)  ### (2)
box()    ### (2)

par(new =TRUE)
plot(x2, y2, 
   xlim = new_lim(x2), 
   ylim = new_lim(y2, 2), axes = F, ann = F)
axis(3, col = "red", col.axis = "red")
axis(4, col = "red", col.axis = "red")
abline(v = 0, lty = 2)      ### (3)
abline(h = 0, lty = 2)      ### (3)
mtext("x2", side = 3, line = 2.5, col = "red")
mtext("y2", side = 4, line = 2.5, col = "red")
}

### (4) ## copy modified content of getAnywhere(plot.cca) here
    myccaplot <- function (x, choices = c(1, 2), display = c("sp", "wa", "cn"), 
          scaling = "species", type, xlim, ylim, const, correlation = FALSE, 
          hill = FALSE, ...) 
{
  TYPES <- c("text", "points", "none")
  g <- scores(x, choices, display, scaling, const, correlation = correlation, 
              hill = hill)
  if (length(g) == 0 || all(is.na(g))) 
    stop("nothing to plot: requested scores do not exist")
  if (!is.list(g)) 
    g <- list(default = g)
  for (i in seq_along(g)) {
    if (length(dim(g[[i]])) > 1) 
      rownames(g[[i]]) <- rownames(g[[i]], do.NULL = FALSE, 
                                   prefix = substr(names(g)[i], 1, 3))
  }
  if (!is.null(g$centroids)) {
    if (is.null(g$biplot)) 
      g$biplot <- scores(x, choices, "bp", scaling)
    if (!is.na(g$centroids)[1]) {
      bipnam <- rownames(g$biplot)
      cntnam <- rownames(g$centroids)
      g$biplot <- g$biplot[!(bipnam %in% cntnam), , drop = FALSE]
      if (nrow(g$biplot) == 0) 
        g$biplot <- NULL
    }
  }
  if (missing(type)) {
    nitlimit <- 80
    nit <- max(nrow(g$spe), nrow(g$sit), nrow(g$con), nrow(g$def))
    if (nit > nitlimit) 
      type <- "points"
    else type <- "text"
  }
  else type <- match.arg(type, TYPES)
  if (length(choices) == 1) {
    if (length(g) == 1) 
      pl <- linestack(g[[1]], ...)
    else {
      hasSpec <- names(g)[1] == "species"
      ylim <- range(c(g[[1]], g[[2]]), na.rm = TRUE)
      pl <- linestack(g[[1]], ylim = ylim, side = ifelse(hasSpec, 
                                                         "left", "right"), ...)
      linestack(g[[2]], ylim = ylim, side = ifelse(hasSpec, 
                                                   "right", "left"), add = TRUE, ...)
    }
    return(invisible(pl))
  }
  if (missing(xlim)) {
    xlim <- range(g$species[, 1], g$sites[, 1], g$constraints[, 
                                                              1], g$biplot[, 1], if (length(g$centroids) > 0 && 
                                                                                     is.na(g$centroids)) NA else g$centroids[, 1], g$default[, 
                                                                                                                                             1], na.rm = TRUE)
  }
  if (!any(is.finite(xlim))) 
    stop("no finite scores to plot")
  if (missing(ylim)) {
    ylim <- range(g$species[, 2], g$sites[, 2], g$constraints[, 
                                                              2], g$biplot[, 2], if (length(g$centroids) > 0 && 
                                                                                     is.na(g$centroids)) NA else g$centroids[, 2], g$default[, 
                                                                                                                                             2], na.rm = TRUE)
  }
  plot(g[[1]], xlim = xlim, ylim = ylim, type = "n", asp = 1, 
       ...)
  # abline(h = 0, lty = 3) # removed
  # abline(v = 0, lty = 3) # removed
  if (!is.null(g$species)) {
    if (type == "text") 
      text(g$species, rownames(g$species), col = "red", 
           cex = 0.7)
    else if (type == "points") 
      points(g$species, pch = "+", col = "red", cex = 0.7)
  }
  if (!is.null(g$sites)) {
    if (type == "text") 
      text(g$sites, rownames(g$sites), cex = 0.7)
    else if (type == "points") 
      points(g$sites, pch = 1, cex = 0.7)
  }
  if (!is.null(g$constraints)) {
    if (type == "text") 
      text(g$constraints, rownames(g$constraints), cex = 0.7, 
           col = "darkgreen")
    else if (type == "points") 
      points(g$constraints, pch = 2, cex = 0.7, col = "darkgreen")
  }
  if (!is.null(g$biplot) && nrow(g$biplot) > 0 && type != "none") {
    if (length(display) > 1) {
      mul <- ordiArrowMul(g$biplot)
    }
    else mul <- 1
    attr(g$biplot, "arrow.mul") <- mul
    arrows(0, 0, mul * g$biplot[, 1], mul * g$biplot[, 2], 
           length = 0.05, col = "blue")
    biplabs <- ordiArrowTextXY(mul * g$biplot, rownames(g$biplot))
    text(biplabs, rownames(g$biplot), col = "blue")
    axis(3, at = c(-mul, 0, mul), labels = rep("", 3), col = "blue")
    axis(4, at = c(-mul, 0, mul), labels = c(-1, 0, 1), col = "blue")
  }
  if (!is.null(g$centroids) && !is.na(g$centroids) && type != 
      "none") {
    if (type == "text") 
      text(g$centroids, rownames(g$centroids), col = "blue")
    else if (type == "points") 
      points(g$centroids, pch = "x", col = "blue")
  }
  if (!is.null(g$default) && type != "none") {
    if (type == "text") 
      text(g$default, rownames(g$default), cex = 0.7)
    else if (type == "points") 
      points(g$default, pch = 1, cex = 0.7)
  }
  class(g) <- "ordiplot"
  invisible(g)
}
How to plot in RStudio and not have a new window pop up (R Graphics: Device (ACTIVE)?

How to plot in RStudio and not have a new window pop up (R Graphics: Device (ACTIVE)?


By : Tom Hamer
Date : March 29 2020, 07:55 AM
This might help you For others who like me may still encounter this issue:
This is probably caused by an R update to 3.3.2 and is fixed by installing a newer version of RStudio. In my case 1.0.136 did the trick.
How to draw a plot on the next device after a layout in Rstudio?

How to draw a plot on the next device after a layout in Rstudio?


By : alma
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I have a code with several plots, some of them are in layouts and others stand alone. The problem is when I draw a layout, the next plots, that must be alone, appears in the previous layout arrangement. How can I stop the layout arrangement for the plots after a layout? , We can run the following line to reset the plot device setting.
code :
par(mfrow=c(1, 1))
plot(1, main = "Example 1")
plot(2, main = "Example 2")
Related Posts Related Posts :
  • Conditionally removing rows from a matrix in R
  • Using a loop to find P(-1.5<Y<1.5) for a range of sample sizes
  • R-Count and list the maximum count row by row
  • Include Iverson Bracket in R documentation
  • update a data frame and environment in R
  • How to write dynamic cumulative multiple in R
  • format time using as.POSIX in R
  • Change the class of multiple columns
  • Remove period and spaces within column headings nested in a list of data frames
  • R: error message --- package error: "functionName" not resolved from current namespace
  • labels with geom_text ggplot2
  • Passing mongodb ISODate in R
  • Importing "csv" file with multiple-character separator to R?
  • Change row names of a table obtained from a lm regression using xtable function
  • R language iterate over R object
  • How do you delete the header in a dataframe?
  • Re coding in R using complicated statement
  • accumulating functions and closures in R
  • How do you combine two columns into a new column in a dataframe made of two or more different csv files?
  • Twitter authentication fails
  • Summing Values of One Vector Conditional on Values of Another Vector
  • draw cube into 3D scatterplot in RGL
  • lme4 translate formula to code in 3-level model
  • How to draw single axis plot in R
  • Combine geom_tile() and facet_grid/facet_wrap and remove space between tiles (ggplot2)
  • Use snpStats with R version 3.0.1
  • Makefile gives strange error while compiling markdown file into .docx file
  • How to determine whether a points lies in an ellipse
  • Summarize data already grouped in r
  • Is the bigvis package for R not available for R version 3.0.1?
  • Operator overloading in R reference classes
  • How to enable user to switch between ggplot2 and gVis graphs in R Shiny?
  • Is there an easy way to separate categorical vs continuous variables into two dataset in R
  • Correct previous year by id within R
  • Installation of rdyncall package for R
  • ggplot2 plot that evaluates the percentage and mean of a third variable at intersecting points
  • Error Handling with Lapply
  • data.table - split multiple columns
  • How to compute the overall mean for several files in R?
  • R: Graph Plotting: Subscripts in the legend like LaTeX
  • Restructuring data in R
  • Distance of pointsfrom cluster centers after K means clustering
  • R incorrect value of date function
  • Package "Imports" not loading in R development package
  • r - run a user defined function several times by taking column elements as parameters
  • Create input$selection to subset data AND radiobuttons to choose plot type in Shiny
  • Generate crosstabulations from dataframe of categorical variables in survey
  • Restructure output of R summary function
  • New behavior in data.table? .N / something with `by` (calculate proportion)
  • search certain number vector in R
  • Referencing a function parameter in R
  • How to synchronize signals using a cross-correlation and FFT in R?
  • Plotting coefficients and corresponding confidence intervals
  • passing expressions to curve() within a function
  • More effective merging of matched column with duplicates in data.table
  • Easy way to export multiple data.frame to multiple Excel worksheets
  • R Foreach Iterator - Walkforward
  • Table format and output in R
  • Restructuring data and duplicating rows in R
  • use ggplot2 to plot two lines with ribbons
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org