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
2
votes
2 answers
Colored histogram with ggplot2
I have a data frame with values and their associated weights. I want to make a histogram, such that each bar's height corresponds to the number of values in that bin and the bar's color corresponds to their total weight. How do I do that?
Example:
D…

Don Reba
- 13,814
- 3
- 48
- 61
2
votes
1 answer
On aes_string(), factor() and Rstudio's Shiny Package
When I run the following code:
graph <- ggplot(data = graphData, aes_string(x = input$variable1, y = input$variable1))
graph <- graph + geom_point( aes_string(colour=input$groupVariable) )
I get the following graph:
Which is problematic…

Ragnar
- 169
- 7
2
votes
2 answers
Ability to specify ggplot aesthetics to function that should return a ggplot object
I'm trying to contstuct a function that behaves like a ggplot function, and also returns a ggplot object that other functions may work on further (add facets, apply a theme, etc.).
The hurdle I am facing now is that I cannot get argument passning…

Fredrik Karlsson
- 485
- 8
- 21
2
votes
1 answer
Multiple colour-scaling with lower level plots of ggplot2
I would like to achieve a different colour gradient every time I add another a geom_line() to my main plot, each time with 'colour' as the scale.
Here is a data frame just as an example:
df <-…

user1480445
- 21
- 1
1
vote
1 answer
Remove specific items from legend but keep aesthetic the same in ggplot
I would like to remove the no pipe items from the legend in this plot but keep the same plotting aesthetics. I have tried using scale_colour_discrete with breaks, which removed the intended items but it used the default colour palette. I then tried…

mrob27
- 61
- 6
1
vote
1 answer
ggplot legend with geom_tile and geom_line
I'm trying to produce a ggplot chart with two vertical axes where the user can decide which geom to use at each side. The options are lines, points and bars. I'm having troubles to have the correct shape in the legend when adding bars at the left…

djbetancourt
- 347
- 3
- 11
1
vote
1 answer
Merging shape and color in ggplot legend
I apologize that this might be a repost of another question. FWIW I've tried solutions from multiple threads but haven't been successful in my efforts.
How do I get my legend to include both shape and…

burphound
- 161
- 7
1
vote
2 answers
Define ggplot2 aesthetics from a list programatically without aes_string
I have a list of aesthetics constructed programmatically and passed from other functions. They may contain any combination of aesthetics like alpha, colour, fill, etc., which is not know beforehand.
my_aes_list <- list(
x = "cty",
y =…

Calimo
- 7,510
- 4
- 39
- 61
1
vote
1 answer
ggplot2 facet_grid, no legend, formatting
I´m running a study where I want wo display the results using facet_grid from ggplot2.
My testdata can be found here text
The Data has six columns, Ausfallrate (MissingRate), PFC_MCA, PFC_Hot, PFC_Mode, AnzahlI (Number of I), AnzahlJ (Number of J)
I…

Kevin
- 47
- 6
1
vote
2 answers
Fix the order of variables in geom_point plotted on top of geom_col
I have a data table with two categorical variables and one numeric variable.
Here's code to generate the sample data:
data <- data.frame(system = rep(c("X","Y","Z"), 10),
region = rep(letters[1:5], 6),
value =…

ESELIA
- 132
- 1
- 12
1
vote
0 answers
A problem with putting different texts in different panels of a facet_wrap ggplot2 graph
I have database of ratings with 16937 rows and 4 variables:
1.Subject
2.Distance_from_trap_F
3.type
4.rate
Here are the first 50 rows:
structure(list(Subject = c(110L, 110L, 110L, 110L, 110L, 110L,
110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L,…

Orit Heimer
- 21
- 2
1
vote
3 answers
Customise aesthetics in add_quantile violin plot in ggplot2. Adding thick median line, and dotted 25, 75% lines
Here is an example data and code for a violin plot in ggplot2 in r:
library(ggplot2)
#Make data frame
Label <- c("Blue", "Blue", "Blue", "Blue","Red", "Red","Red","Red","Blue", "Blue","Blue","Blue")
n <- c(10, 223, 890, 34, 78, 902, 34, 211,…

MM1
- 478
- 15
1
vote
1 answer
Mapping with geom_sf(): Assigning labels to data points when you don't have distinct x,y columns in dataframe
I am working to create a map in ggplot2 using the geom_sf() function. The data for the map is from a KML file (downloaded from GoogleEarth), so when I read that into R, the lat/longs for each datapoint are in a combined 'geometry' column rather than…

Makayla Kelso
- 31
- 2
1
vote
3 answers
ggplot2 and eurostat: row removed due to missing values (geom_text) using geom_sf_text
Using Eurostat I try to plot some values to the map of the EU, using the following code:
library(tidyverse)
library(eurostat)
library(leaflet)
library(sf)
library(scales)
library(cowplot)
library(ggthemes)
#----------- load dataset -----------
SHP…

Stefan Verweij
- 164
- 2
- 13
1
vote
1 answer
Ggplot uses reference of data
If i pass a value to ggplot, it is stored as a reference so if it gets modified, the plot is changed as well. However, this only happens if it is given to the aes function, not the geom_hline in my example.
library(ggplot2)
# The line is at…

wohlrajh
- 139
- 1
- 8