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...
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)) +...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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&...
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, ...
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...
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...
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...
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...
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...
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...
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...
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...
4
I would like to put perpendicular lines at the ends of the whiskers like the boxplot function automatically gives.
© 2022 - 2024 — McMap. All rights reserved.