Questions tagged [aesthetics]

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.

210 questions
6
votes
2 answers

Combine/Merge two ggplot aesthetics

Let's say I have two ggplot aesthetics: a.1 <- aes(v.1=1, v.2=2) a.2 <- aes(v.3=3) Is there a way to combine the already built aesthetics? In my example it would be something like: a.merged <- aes(v.1=2, v.2=2,v.3=3) I know that aes_string can be…
papirrin
  • 2,004
  • 22
  • 30
5
votes
2 answers

Customizing aesthetics of faceted barplot

I am trying to do some analysis of the recent MLB draft with some ggplots in R selection <- draft[c("Team","Division","Position")] head(selection) Team Division Position 1 pit NL Central P 2 sea AL West P 3 ari NL West …
pssguy
  • 3,455
  • 7
  • 38
  • 68
5
votes
1 answer

ggplot legend key color and transparency

I'm plotting multiple lines together and they are transparent. However, I do not want the legend color to have any transparency. I attempted the override.aes but without success. This is similar to this question, but essentially the…
Tom Logan
  • 341
  • 3
  • 15
5
votes
1 answer

Temporarily disable aesthetics already defined in ggplot()

We may want to define some global aes() for a ggplot() graphics, but exclude them in some layers. For instance suppose the following example: foo <- data.frame(x=runif(10),y=runif(10)) bar <- data.frame(x=c(0,1),ymin=c(-.1,.9),ymax=c(.1,1.1)) p <-…
Ali
  • 9,440
  • 12
  • 62
  • 92
4
votes
0 answers

Can't set both scale_size_continuous() and scale_size(), ggplot

I am trying to both edit the legend for the size aesthetic and set the scale size for that aesthetic, but can't seem to do both. Here are the steps: #create the map library(ggplot2) world <- broders("world") #generate a dataframe of geolocated…
MorrisseyJ
  • 1,191
  • 12
  • 19
4
votes
1 answer

R ggplot modifying mapping aes

I'm trying to dynamically update the mapping of a ggplot object, but can't figure out how to go about it. There was another post of stackoverflow that seems to address most of the issue, but I don't know how to name the aes mapping dyanmically... …
Mark
  • 596
  • 1
  • 4
  • 14
4
votes
1 answer

Dash in column name yields "object not found" Error

I have a function to generate scatter plots from data, where an argument is provided to select which column to use for coloring the points. Here is a simplified version: library(ggplot2) plot_gene <- function (df, gene) { ggplot(df, aes(x, y))…
merv
  • 67,214
  • 13
  • 180
  • 245
4
votes
2 answers

MAPS & Animation in R

Trying to do similar to this: How the Ghana Floods animation was created My code below library(ggmap) library(ggplot2) library(gganimate) #devtools::install_github("dgrtwo/gganimate") library(readxl) s_data <-…
twistfire
  • 425
  • 1
  • 5
  • 15
4
votes
1 answer

ggplot thinks aesthetic wasn't made via `aes()`, but it was

I use ggplot2 pretty regularly, and I have to say this one has me befuddled. Script is: library(tidyverse) data_frame(value = rbinom(n = 100, size = 100, prob = 0.3)) %>% ggplot(mapping = aes(x = value)) %>% …
rcorty
  • 1,140
  • 1
  • 10
  • 28
4
votes
1 answer

Shapes and Linetypes in ggplot

In the following df: > seperate Tenors Ratio Pairs Subgroup 1 1W 93.9426 audusd USD Pairs 2 1M 97.6231 audusd USD Pairs 3 3M 100.0376 audusd USD Pairs 4 6M 108.7951 audusd USD Pairs 5 12M 127.6704 audusd USD Pairs 6…
4
votes
6 answers

Closing the lines in a ggplot2 radar / spider chart

I need a flexible way to make radar / spider charts in ggplot2. From solutions I've found on github and the ggplot2 group, I've come this far: library(ggplot2) # Define a new coordinate system coord_radar <- function(...) { …
Fredrik Karlsson
  • 485
  • 8
  • 21
3
votes
1 answer

How do I set y axis limits and breaks, and choose symbols in multiple variable in ggplot2?

df<-age_limbset df$limbset<-as.factor(df$limbset) limb_splot<-ggplot(df, aes(x=age,y=score)) limb_splot + geom_point(aes(color = limbset, shape = limbset))+ geom_smooth(aes(color = limbset), method = loess, se = FALSE, fullrange =…
Lucie
  • 31
  • 1
  • 2
3
votes
0 answers

Selecting just a small set of values for a plot

I have table from which I get 5 box plots, it has only two columns with 15 values each. The plots are grouped by a variable "X" (from 1-5, each one repeated 3 times), how do I plot only one of those box plots?
Hugo Ald
  • 31
  • 1
3
votes
1 answer

Dynamically color a portion of axis tick labels with ggplot

I am trying to color a portion of the y-axis tick labels in a ridges plot. My data are similar to the following: library(tidyverse) set.seed(10) dt <- data.frame("T1.C1" = rnorm(10, mean = -10), "T2.C2" = rnorm(10, mean = -5), …
cgibbs_10
  • 176
  • 1
  • 12
3
votes
2 answers

Means barplot with confidence intervals?

I have a large dataset, where I have a variable Q1with 7 response/value options, and two groups (One and Two). Q1<- c(6,4,2,4,7,1,4,7,4,5,4,4,2,6,1) Group<- c(One, Two, One, Two,Two, Two, One, One, One, One, Two, One, One, Two, Two) I'm…
IG114
  • 85
  • 2
  • 10
1
2
3
13 14