Questions tagged [ggtitle]

SEE ALSO:
docs

19 questions
383
votes
5 answers

Center Plot title in ggplot2

This simple code (and all my scripts from this morning) has started giving me an off center title in ggplot2: Ubuntu version: 16.04 R studio version: Version 0.99.896 R version: 3.3.2 GGPLOT2 version: 2.2.0 I have freshly installed the above…
Christopher John
  • 4,220
  • 2
  • 13
  • 14
9
votes
3 answers

accessing data of the plot within ggtitle

I am wondering if it is somehow possible to access the columns of the provided data within a ggplot2 graph for the title. So something like that: ggplot(mpg %>% filter(manufacturer == 'audi'), aes(x = hwy, y = displ, label = model)) + …
drmariod
  • 11,106
  • 16
  • 64
  • 110
5
votes
1 answer

Automatic line break in ggtitle

Is there a way to force an automatic line break in the ggtitle command? As part of a shiny application I use different plots with an input variable for the title. Unfortunately, some of these variable values are too long to be displayed. I came…
Francesca
  • 73
  • 1
  • 6
2
votes
1 answer

How to change the chart title dynamically in R?

Here is an example using mtcars to split by a variable into separate plots. What I created is a scatter plot of vs and mpg by splitting the data set by cyl. First an empty list is created. Then I used lapply to loop through the values of cyl (4,6,8)…
Sri Sreshtan
  • 535
  • 3
  • 12
2
votes
1 answer

paste function in ggtitle: remove extra spaces and add a new line in ggplot title

Within the shiny context, how can I remove extra space after and before parentheses in the title of a plot? As shown in the below image, there are redundant spaces between "(" and "6" as well as between "+" and ")". Also, I was wondering how can I…
Nader Mehri
  • 514
  • 1
  • 5
  • 21
1
vote
2 answers

Specifying different ggplot titles when using for loop to make multiple plots

I am using a loop to easily plot my data for different groups. I need a different plot for each cruise # (each year + season). I am having issues specifying a title that includes the Season and Year for each plot. Example df (original data has more…
FishyFishies
  • 301
  • 3
  • 14
1
vote
1 answer

Adding a calculation to the title of a ggplot

I'm new to R and wondering if the following is possible to calculation in the title of a ggplot scatter. The code below is how I thought it might be possible. AlexPlot + ggtitle("Alex's BG, The average is " + mean(Alex$bg, na.rm = TRUE))
1
vote
1 answer

Plot title not working in Circular Barplot

I'm trying to add title to my circular barplot using ggtitle() but cannot find the title anywhere in the plot. I even tried adjusting the position but of no use. Could someone tell me the issue please? The sample input and code is as below: grp =…
hk2
  • 487
  • 3
  • 15
1
vote
1 answer

How to make colors change in a function for monthly plots?

I have spatial-temporal data of migrating species and I want to make a GIF showing their movement throughout the year on a monthly basis. I'm using this code to produce a picture for each month: eb <- #put the dput() data provided below here cols_m…
Gotemn
  • 29
  • 9
1
vote
0 answers

Creating multiple plots in ggplot from a dataf rame with titles corresponding to the row names

I am trying to create multiple scatter plot graphs in ggplot that have the same structure but I want to have the respective name of the rows in the column. I need them to be separate (and therefore not use facet_wrap) because in a later step I use…
sk2020
  • 11
  • 2
1
vote
0 answers

R: Usage of greek letters within captions in ggtitle

I have a problem that I am not able to solve at the moment. I want to use greek letters in my plot titles. I can make: ggtitle("My title") And I know how to print an alpha. ggtitle(bquote(alpha)) But how it is possible to combine these two in the…
Mischu
  • 65
  • 6
0
votes
1 answer

Pull ggtitle name from different dataframe in a for loop

Hopefully you could help me out with the following. I have a large dataset from which I will build 56 plots using the following function markers <- unique(patient_flow$marker_id) marker_data <- ap_fcm_raw$markerdata library(ggplot2) for (i in…
0
votes
2 answers

How to plot filtered data with loop in R and combine them with facet_grid?

I am new in R, so my question could seem very trivial for someone, but I need a solution. I have a data frame: `structure(list(Time = c(0, 0, 0), Node = 1:3, Depth = c(0, -10, -20), Head = c(-1000, -1000, -1000), Moisture = c(0.166, 0.166, 0.166),…
Muru
  • 1
  • 1
0
votes
1 answer

Display unicode symbol (not equal to) in ggtitle

I am trying to get "the not equal to" symbol in the title of my ggplot. The unicode symbol is U+2260. When I run the main_title line in the example below, the symbol is displayed in the console. Example code below: #Example data testy <-…
OCarroll
  • 38
  • 5
0
votes
1 answer

Greek letter in ggtitle will not become italic bold in r

plot19 <- ggplot(FoBlandAlt.apex, aes(x = avg, y = perc)) + geom_point(size=2, alpha = 0.5) + geom_hline(yintercept = percent_mean_diff) + geom_hline(yintercept = lower.perc, color = "black", linetype="dashed") + geom_hline(yintercept =…
Sprint123
  • 25
  • 5
1
2