Questions tagged [r-base-graphics]

14 questions
76
votes
3 answers

How to reset par(mfrow) in R

I set par(mfrow =c(1,2)) and now everytime I plot it shows splits it into 2 plots. How can I reset this to only show one plot. Thanks so much.
akz
  • 1,865
  • 2
  • 16
  • 13
4
votes
1 answer

How to draw circles around polygon/spider chart, without plotting libraries

Without using ggplot2 or other plotting libraries, I would need to draw circles around a polygon/star chart vertices, i.e. each circle with a radius equal to the respective polygon radius. You can see an example here: d1 <- 1:4 names(d1) <-…
choabf
  • 57
  • 5
2
votes
2 answers

Save plot from mirt inside a function

I have a curious issue saving a plot generated inside a function when using the mirt package for R. Here's a reprex: #save image from base plot save_as_file = function(code, filename, width = 1000, height = 750) { png(filename, width = width,…
CoderGuy123
  • 6,219
  • 5
  • 59
  • 89
2
votes
2 answers

Plotting a Function With Noise

I always wondered how such pictures are made: I am working with the R programming language. I would like to plot a parabola with "random noise" added to the parabola. I tried something like this: x = 1:100 y = x^2 z = y + rnorm(1,…
stats_noob
  • 5,401
  • 4
  • 27
  • 83
2
votes
1 answer

plot.ts - change font size of labels & axis.labels

When I plot a time series (f.e. cardox from astsa-package) I am not able to change the fontsize of labels and axis.labels: library(astsa) class(cardox) plot(cardox) plot(cardox,cex.axis=0.5,cex.lab=0.5,cex=0.5) The plots look the same, the fontsize…
Martina
  • 139
  • 1
  • 10
2
votes
1 answer

R par set cannot be changed

I wonder how I can use the par set of no.readonly normally.For the following code, par1 <- par(no.readonly=TRUE) set.seed(2015) xx<-rnorm(100) par(pch=17,col="red") plot(xx) par2 <- par(no.readonly=TRUE) # par2…
chunjin
  • 240
  • 1
  • 8
1
vote
0 answers

Label personalization from a multiple stacked plot in R

I am trying to change an individual y-labels from a stacked plot with R. I am trying to capitalize each label, and reduce the font size to avoid overlapping. However, I have not found how to do it. Please view the attached image and my…
1
vote
0 answers

Polygon inscribed into circles without ggplot2 or fmsb package

I want to create some sort of radar chart but without using ggplot2 or fmsb. Sample chart: d1 <- 1:10 names(d1) <- LETTERS[1:10] rChart <- function(N = 7, R = 1, border = NA, density = NA, angle = 45, col = rgb(1, 0, 0,…
Steeve_R
  • 11
  • 2
0
votes
1 answer

R: default palette used for pie charts

I would like to add a legend to a pie chart in R The default color palette is fine for me, but how can I use it in the legend (to match the colors of the plot)? pie(table(iris$Species)) legend('right',c('A','B','C'), fill = colors(3)) (I know that…
NicolasBourbaki
  • 853
  • 1
  • 6
  • 19
0
votes
2 answers

Vertical adjustment of symbols relative to text in legend

Is there a way to vertical align the symbols in a legend relative to the first line of the corresponding text? plot(table(iris$species)) legend('right',c('A','B','long\ntext'), fill = colors(3)) The labels A and B are vertically aligned to the…
NicolasBourbaki
  • 853
  • 1
  • 6
  • 19
0
votes
1 answer

r plot xlab for side 3 and side 4

In R is there a way to have titles for side 3 (top) = x2 and side 4 (right) = y2 like highlighted below? Below is R code. x<-1:4; y=x*x plot(x, y, pch=18, col="red", type="b", frame=FALSE, xaxt="n") # Remove x axis axis(1, 1:4,…
forecaster
  • 1,084
  • 1
  • 14
  • 35
0
votes
1 answer

Plot multiple columns saved in data frame with no x

My problem is multifaceted. I would like to plot multiple columns saved in a data frame. Those columns do not have an x variable but would essentially be 1 to 101 consistent for all. I have seen that I can transfer them into long format but most…
0
votes
1 answer

Homogenizing scale for density plot

I am making a series of plots from a point pattern (PPP) with the density (kernel) function. I would like that the maximum plotted number is 200 in all cases and just the heatmap accordingly (two of the images only go up to 100). I have not been…
0
votes
3 answers

Plot empty groups in violin plot

I want to compare a number of violinplots. But I am running into a problem for cases where a group is empty: I would like an empty slot plotted so its easier to compare multiple plots. lets say I have a dataframe: df = data.frame("x"=rep(c(1:4), 3),…
KGee
  • 771
  • 7
  • 26