Aes, short for "aesthetics" is an R Library, used to "Generate aesthetic mappings that 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.
Questions tagged [aesthetics]
210 questions
3
votes
2 answers
Wrong position of dodged error bars when aes(group = ...) but not aes(fill/shape = ...)
Plotting error bars with position = "dodge" has caused me many headaches lately... Curiously, dodging them with the aesthetics shape or fill (which should not apply for error bars) seem to work well. However, dodging with aesthetics group places the…

EEV
- 93
- 7
3
votes
1 answer
Add legend to ggplot histogram with different types of aesthetics
I want to add a legend to one of my plots, but I have different aesthetics and I never created a legend so I find it very difficult to determine how to build it.
One of my aesthetics is a fill code, which I added manually as a vector. The other…

SHW
- 461
- 7
- 26
3
votes
1 answer
How to write a function that passes NULL to ggplot without getting aesthetics error
I am trying to write a function that creates plots and ran into an error that I don't understand. Here is a simplified example.
Reproducible example:
library (ggplot2)
# Sample data
xdata = 0:20
ydata = 20:40
dat <- data.frame(xdata, ydata)
# This…

DaveM
- 664
- 6
- 19
3
votes
1 answer
geom_rect and ggplot2 Error: Aesthetics must be either length 1 or the same as the data (2)
I am trying to do something like https://stackoverflow.com/a/29649406/15485 but I get the error
Error: Aesthetics must be either length 1 or the same as the data (2):
xmin, xmax, ymin, ymax, x, y
What does '(2)' means?
What 'Aesthetics' are…

Alessandro Jacopson
- 18,047
- 15
- 98
- 153
3
votes
2 answers
Passing data and column names to ggplot via another function
I'll skip right to an example and comment afterwords:
cont <- data.frame(value = c(1:20),variable = c(1:20,(1:20)^1.5,(1:20)^2),group=rep(c(1,2,3),each=20))
value variable group
1 1 1.000000 1
2 2 2.000000 1
3 3 …

SatelliteEyes
- 75
- 1
- 8
3
votes
1 answer
convert string to aesthetics for aes_string
I have the following problem.
I want to turn a string e.g
> a<-paste('x=col1,y=col2,fill=col3')
into a form that aes_string accepts like this: x='col1',y='col2',fill='col3'
this is part of a…

LkRR
- 43
- 4
3
votes
3 answers
Modify aes list outside ggplot function
This is my first question about R in a forum, so sorry in advance if I made any mistake formulating the question or specifying the title.
The point is that for a particular task with ggplot I define the aesthetics outside the ggplot function and…

Osdorp
- 190
- 7
2
votes
2 answers
How can I shorten a function which outputs the chain numbers of the Collatz conjecture?
This Python function outputs a list based on the collatz conjecture. This is an unsolved maths problem where the function will perform different operations on 'n' depending on if it is odd or even, outputting 'n' to a list called 'seq' each time the…

Alastair909
- 29
- 4
2
votes
2 answers
Distribute elements of an array to different variables in Matlab
I see equivalent operations being done several times in my Matlab code, and I think, there must be a way to condense these and do it all once.
In this case it was checking whether some variables were less than a certain epsilon:
if abs(beta) < tol
…

Post169
- 668
- 8
- 26
2
votes
0 answers
Error in ggqqplot "The following aesthetics were dropped during statistical transformation: sample"
I am trying to use a QQ plot to determine if my data are normally distributed. I am using the mtcars dataset for practice. When making a QQ plot, I keep getting the error below:
Warning messages:
1: The following aesthetics were dropped during…

Alison Williams
- 31
- 1
- 3
2
votes
1 answer
Altering size of points on map in R (geom_sf) to reflect categorical data
I am creating a map to depict density of datapoints at different locations. At some locations, there is a high density of data available, and at others, there is a low density of data available. I would like to present the map with each data point…

Makayla Kelso
- 31
- 2
2
votes
3 answers
Speeding up button formatting in VBA
I have the below code that colors all the buttons (there are 10) grey to clear any previously colored button, and then colors the button selected blue. Basically acting as an indicator of what button is currently selected. I noticed that the code…

RBRN1231
- 67
- 5
2
votes
1 answer
How to plot filled points with multicolored borders in ggplot (white black contrast)
I was recently attempting to plot some filled points with an additional white border around the standard black border. I was unable to find a posted solution that did not rely on custom point shapes but still plotted all components of each point…

ikeebrown
- 56
- 2
2
votes
1 answer
how to add lines over a column bar graph where the lines pass by the middle-top of the bars considering bars with position='dodge'?
Here I provide an example of what I have tried:
df <- data.frame(a = rep(c(1:12), each = 2),
b = c("yes", "no"),
c = sample(x = 1:200, size = 24))
ggplot(df, aes(x = a, y = c)) +
geom_col(aes(fill = b), position…

Miguel_s
- 79
- 3
2
votes
0 answers
st_contour - mapping should be created with aes
I know the "mapping should be created with aes" bit has been done to death, so I hope this is a sufficiently unusual case, since I've tried to work out why it's happening and come up short.
Per this thread, I can plot my stars object in ggplot &…

dez93_2000
- 1,730
- 2
- 23
- 34