# Questions tagged [ggplot2]

bst365体育投注网址大全 ggplot2 is an actively maintained open-source chart-drawing package for R, written by Hadley Wickham, based upon the principles of "Grammar of Graphics". It partially replaces R's basic plot and the lattice package, while providing a clean, powerful, orthogonal and fun API.

35,502
questions

**1**

vote

**1**answer

14 views

### Save unicode characters to .pdf in R

I would like to save specific unicode characters to a pdf file with ggsave.
Example code
library(ggplot2)
ggplot() +
geom_point(data = data.frame(x=1, y=1), aes(x,y), shape = "\u2191") +
...

**-1**

votes

**2**answers

24 views

### Is there a way to make a line plot that connects emperical pairs of words with ggplot2?

Im not sure what the correct name for this type of plot would be, but lets say we have a list of names (or letters here): data <- data.frame(letters[1:10])
Lets also say that we want to illustrate ...

**0**

votes

**1**answer

25 views

### ggplot2 | Customize geom_point for only one variable

As per the attached plot, I was fairly able to achieve what I had ought to. However, I'm stuck at an elementary change that is necessary.
Objective:
allow geom_point to only value1 and the rest of ...

**1**

vote

**0**answers

11 views

### Transitioning between two different geom_smooth() objects in gganimate

I'm having difficulty with gganimate and I'd be grateful for some help.
I'm interested in how the relationship between two continuous variables differs across two values of a factor variable. Imagine, ...

**0**

votes

**0**answers

16 views

### Graphing the results of a linear mixed model using ggplot

Wondering if anyone can help me with using ggplot to graph the results of a linear mixed model? There's patients who underwent a brain lesioning procedure, and I want to show how a tract density ...

**0**

votes

**2**answers

29 views

### R ggplot . HOW TO plot only the variables >0?

I am plotting the number of covid19 PCR in the towns of my province. The problem its that many town haven´t any PCR positive. I need a way to plot only the towns with at least 1+ PCR.
This is my code:
...

**2**

votes

**1**answer

42 views

### How can I add a layer showing the distribution on a conditional variable in a probability plot in R studio?

I am fitting the following regression:
model <- glm(DV ~ conditions + predictor + conditions*predictor, family = binomial(link = "probit"), data = d).
I use 'sjPlot' (and 'ggplot2') to ...

**2**

votes

**2**answers

24 views

### How can I write a function for ggplot2's scale in a dplyr workflow?

I would like to set the labels in ggplot2::scale_x_discrete() (or similar) dynamically in one pipe workflow and since I am failing, it seems I have a misunderstanding of how pipes work. I illustrate ...

**0**

votes

**0**answers

17 views

### Adding a boxplot at specific x coordinates in a geom_line plot

I have a geom_plot and am needing to add a boxplot for a specific range on the x-axis.
I used the following code:
dput(frontalL)
frontalL_plot_HbO <- ggplot(frontalL, aes(x = Timepoint, y = HbO, ...

**0**

votes

**1**answer

18 views

### Input error using autoplot and ggplot2: Invalid input: date_trans works with objects of class Date only

library(quantmod)
GDP.growth <- ts(data = getSymbols('A191RL1Q225SBEA', src = 'FRED', auto.assign = F), frequency = 4, start = c(1947,2))
library(ggplot2)
library(forecast)
fit.1 <- arima(ts(...

**0**

votes

**1**answer

14 views

### How to reduce the size of a ggplot figure? The plot has too many lines and thus weights too much

I'm plotting the results of a simulations study, where I have repeated for 500 times a certain analysis. I would like to show how a quantity changes over time across simulations (spaghetti plot) to ...

**1**

vote

**1**answer

35 views

### Save multiple ggplots with different layout matrices

Currently I'm creating multiple plots with regional data and save them to a PDF file. This works without problems, thanks to an SO post I've found (use grid.arrange over multiple pages or marrangeGrob ...

**0**

votes

**1**answer

27 views

### Error message in ggplot, has to do with my call for ( family=“Lato”)

I am getting this warning message below for a ggplot. it only gives me an empty plot with the following warning messages below
Warning messages:
1: In grid.Call.graphics(C_text, as.graphicsAnnot(x$...

**1**

vote

**1**answer

34 views

### How do I preserve the order of a group in a ggplot2 bar plot?

How do I preserve the order of the "net" in ggplot2 as in dataset? Currently, it is plotting in alphabetical order. I need Non-LTE > LTE > Mixed > 5G from bottom to top order in the ...

**1**

vote

**1**answer

22 views

### ggplotly- Plot title overlapping with graph

I am plotting a facet_grid plot in Rstudio showing the day wise trend graph. When I use ggplotly the plot header overlaps with the main graph.
names(ss)[1] <- "State_OR_UT"
state_tr1 &...