ggplot2 Questions

3

Solved

I have a data frame like this BP R2 LOG10 96162057 0.2118000 2.66514431 96162096 0.0124700 0.31749391 96162281 0.0008941 0.07012148 96163560 0.5011000 2.48505399 96163638 0.8702000 3.37778598 an...
Forbes asked 28/8, 2013 at 12:4

2

Some sample data: dfr <- data.frame( x = rep.int(1:10, 2), y = runif(20), g = factor(rep(letters[1:2], each = 10)) ) A simple scatterplot with two facets: p <- ggplot(dfr, aes(x, y)) +...
Maddock asked 25/11, 2010 at 10:53

2

Solved

For the data: def.percent period valence 1 6.4827843 1984-1985 neg 2 5.8232425 1985-1986 neg 3 -2.4003260 1986-1987 pos 4 -3.5994399 1987-1988 pos If I add a line to the points, how can I use g...
Lowry asked 25/2, 2015 at 21:35

2

I am trying to plot a facet grid of growth plots and my labels at the ends of each plot are overlapping with the each other. Here is sample code using the mpg data: print(ggplot(data = aggregate(h...
Cosenza asked 19/12, 2016 at 14:55

3

I have a plot made with ggplot2 and I'd like to get the legend positioned in the top left corner. legend.position = "top" gets me a legend positioned above the plot, but centered: legend.posit...
Alic asked 2/3, 2015 at 18:1

3

I am preparing a plot for publication. I created a stacked box plot to show frequency of patients in each group who were some complicated accumulation of seronegatives versus not. The legend is usi...
Newbold asked 6/9, 2011 at 16:31

4

Solved

I am trying to draw a box and whisker plot in R. My code is below. At the moment, because I only have data for two months in one of the two sites, the bars are wider for that site (because the thir...
Giuseppinagiustina asked 12/3, 2013 at 17:14

1

I previously asked a question about using stat_summary to add a vertical line for the median value in my density plot. I'm now trying to adapt this to also add vertical lines for the 95% confidence...
Psittacosis asked 22/3 at 18:7

1

Solved

I have a multi-panelled density plot with two density curves/panel. I'd like to add the mean value for each density curve as a vertical line in each panel (i.e., 2 lines/panel). How do I do this wi...
Finicking asked 21/3 at 21:12

6

Solved

I am trying to create a barplot using ggplot2 where I am stacking by one variable and dodging by another. Here is an example data set: df=data.frame( year=rep(c("2010","2011"),each=4), treatmen...
Supersensual asked 3/10, 2012 at 19:39

2

Solved

I have the following two questions: (1) I want to get the label to be between two ticks. My original thought was to add the secondary ticks and remove the primary ticks, but axis.minor.ticks.length...
Matthaeus asked 15/3 at 13:22

2

Solved

I love the JMP variability plot. (link) It is a powerful tool. The example the plot has 2 x-axis labels, one for part-number and one for operator. Here the JMP variability plot displays more tha...
Cupel asked 3/5, 2017 at 15:42

2

Solved

Here is my code and the attached plot result: g <-ggplot(NDVI2, aes(LAI2, NDVI, colour = Legend)) + theme_bw (base_family = "Times") + scale_colour_manual (values = c("purple&...
Sulfapyridine asked 27/10, 2014 at 12:48

3

My data is like below. Two column, serial number (SL) and the expression value (log) > df SL log 1 1.5 2 -2.5 3 1.0 4 2.5 5 -1. > ggplot(df, aes(x = SL, y = log)) + geom_point(size = 0.5, ...
Faction asked 6/3 at 23:32

3

Before maptools and rgdal were deprecated, I used this code to import a shapefile, centroids csv and commuting count data, to create a flow map using the code below (I removed the ggplot code for l...
Doby asked 5/3 at 12:23

4

Solved

aes_string had some convenient behaviours that I made use of when programming with ggplot2. But aes_string has been deprecated (noticeably since ggplot2 version 3.4.0 I believe). I am struggling wi...
Limburg asked 12/11, 2022 at 15:39

2

Solved

Suppose I have a bar plot with grouped bars. Bars have one large group and multiple very small groups. Group labels are on the groups. In order to increase readability, I want to introduce some amo...
Metabolic asked 19/6, 2018 at 10:7

5

Solved

I'd like to create a split violin density plot using ggplot, like the fourth example on this page of the seaborn documentation. Here is some data: set.seed(20160229) my_data = data.frame( y=c...
Mellisamellisent asked 1/3, 2016 at 7:49

3

I have created the plot below with these commands: ggplot(long.data, aes(owner,value)) + stat_summary(fun.y=mean,geom="bar", fill=c("deepskyblue","deepskyblue4")) + stat_summary(fun.data=mean_c...
Joinery asked 24/4, 2013 at 12:44

4

Solved

I am having trouble removing the white lines between tiles in my heat map. Below is my code and picture. Has anyone encountered this before? t <- ggplot(Drug_heatmap_df_final, aes(x=reorder(D...
Moffett asked 8/3, 2018 at 17:30

2

Solved

I have a plot (made in R with ggplot2) that's the result of some singular value decomposition of a bunch of text data, so I basically have a data set of ~100 words used in some reviews and ~10 cate...
Combinative asked 26/5, 2019 at 23:2

9

Is there a way to change the spacing between legend items in ggplot2? I currently have legend.position ="top" which automatically produces a horizontal legend. However, the spacing of the items...
Presbyter asked 6/7, 2012 at 17:26

2

Here is a example of what I currently have: x <- head(mtcars) x$rn <- rownames(x) x$rn[5] <- 'Hornet\nSportabout' library(ggplot2) ggplot(x, aes(x = rn, y = mpg)) + geom_point() + theme...
Byrne asked 22/8, 2017 at 3:0

9

Solved

How would I ignore outliers in ggplot2 boxplot? I don't simply want them to disappear (i.e. outlier.size=0), but I want them to be ignored such that the y axis scales to show 1st/3rd percentile. My...
Oteliaotero asked 15/4, 2011 at 14:0

4

I would like to put perpendicular lines at the ends of the whiskers like the boxplot function automatically gives.
Stanfield asked 20/10, 2012 at 23:18

© 2022 - 2024 — McMap. All rights reserved.