Questions tagged [aesthetics]
Aes, short for "aesthetics", is part of the ggplot2 package in R; `aes` is used to "describe how variables in the data are mapped to visual properties (aesthetics) of geoms". The aesthetics tag should **not** be used to reference software's artistic merit.
aesthetics
226
questions
0
votes
1
answer
32
views
How do I pass aesthetics to stat_summary in ggplot2?
I'm trying to produce the following plot (working example from mtcars)
I can obviously do it by summarizing my data beforehand, but I would like to do it on the fly using something like this:
mtcars %...
0
votes
1
answer
42
views
Passing variables to ggplot aes() [duplicate]
I am using ggplot to map the relationship between two attributes of a vector data.
The attributes are named by year: v_2000, v_2001, v_2002,... and p_2000, p_2001, p_2002,...The code below works fine
...
1
vote
1
answer
24
views
ggplot2::geom_smooth() drops aesethetics "label" with {ggrepel}
I want to use ggplot2::geom_smooth() together with the {ggrepel} package, but I always get a warning. See the following Reprex with the Anscombe dataset:
library(ggplot2)
library(ggrepel)
anscombe |&...
0
votes
0
answers
36
views
Change point shape by group returns error "Shape aesthetic contains invalid values"
I am building a simple map with 3 points that I want to have different symbols but when I try to change the shape by group manually I get an error about shape aesthetics.
First a map:
library(ggplot2)
...
0
votes
0
answers
51
views
How to make desired adjustments to this graph
Very bad programmer here, hopefully someone can help!
I have this code:
plot_alldata <- function(data){
#make sure 'date' column is in Date type
data$date <- as.Date(data$date)
#...
0
votes
0
answers
28
views
ggplot legend in R not recognising aesthetic changes for label category with no data points
Consider the following image:
Although the underlying dataset does not contain values below 0.1 degrees Celsius, I want to and still can force the legend to display the label and box for 'Below 0.1', ...
2
votes
0
answers
24
views
using ggplot jitter vs point with grouped stroke / fill aesthetics
I made a scatterplot with error bars that I like, however I wanted to add a white outline around the points to help differentiate them. This created a whole slew of issues. All my attempts either ...
1
vote
1
answer
26
views
Bars do not get the color tried to give to them in a barplot
How to make all the bars blue except from the year 2005 that is red. My code doesn't do it. Is there a way to do this without specifying the color for every year in the data frame?
df <- data.frame(...
1
vote
2
answers
203
views
How to add multiple trendlines to a scatter plot by groups
I'm trying to add multiple trendlines to a scatter plot in ggplot by age groups. I have 4 Age_range's 20_under, 21_24, 25_29, and 30_up so I'm looking to have 4 trendlines for each of these age groups
...
2
votes
2
answers
56
views
Positioning SE bars with different aesthetics in geom_errorbar using ggplot2 in R
I have to give SE values manually in a grouped bar plot in R. However, SE lines don't take the same positions with bars. I understand the x variables that I defined (x = Species) in each geom_errorbar ...
0
votes
1
answer
209
views
How to change polygon colors to white when plotting a shapefile with ggplot2
I want to plot the polygons of this shapefile without the colors (just white with black borders); I also do not want the legend. I have tried scale_fill_manual and a few other things but to no avail. ...
0
votes
1
answer
104
views
ggplot2::scale_shape_manual removes geom_point fill
I am trying to make a plot of the concentration-discharge regimes for rivers as a function of its agricultural and urban land use. Here is my example data:
df.tri<-structure(list(site_no = c("...
2
votes
2
answers
110
views
combining predefined aesthetics (ggplot2)
I have a function that optionally accepts predefined aesthetics (for ggplot2). This can be in one of several forms, including
mapping <- aes(color = c(cyl, gear))
mapping
# Aesthetic mapping:
# * `...
0
votes
1
answer
59
views
Custom x-axis labels not applying correct custom x-axis colours
In my df, I need the two x-axis labels under "subset" = "Initial" to be coloured grey50 (like the two bars on the left) and the two x-axis labels under "subset" = "...
0
votes
1
answer
25
views
How can I preserve the order I decide in divergent plot
I want to follow this order = genes_order, which I guess is modified by the "stat = identity", overriding it. I don't know how to keep it this way, without the interference of quantitative (...