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
1
vote
2 answers

geom_density blind in terms of the aesthetics supplied?

I have to admit that it has been a while since I used ggplot, but this seems a bit silly. Either I am missing something fundamental when trying to make a density plot, or there is a bug in ggplot2 (v3.3.2) test <-…
Fredrik Karlsson
  • 485
  • 8
  • 21
1
vote
1 answer

The problem with producing the colour in one of the column of the table produced by the formattable package

I applied this code earlier and the results were not totally upto the expectations as the matching_probability section did not show the colour tiles. I couldn't add the image otherwise I would have shown. formattable(df, align =…
1
vote
0 answers

Could not find an answer in any websites

I have a time series from 2010Q1 to 2019Q4 built using ts(). I am unable to do a graph in ggplot2 to show year and relevant quarters in the x-axis (like 2010Q1,…, etc) for one of the variables, say A. The problem is the “aes” function: which throws…
Yasa7491
  • 11
  • 2
1
vote
0 answers

Issue adding colour aesthetic with ggplotly (when added all points appear on all frames)

I can generate the desired ggplotly plot with the x and y aesthetics and animate using f variable for the frame. However, when I add the colour aesthetic (z) all points for all frames appear (please see plots and code below). test dataframe:…
Betty
  • 173
  • 1
  • 2
  • 10
1
vote
1 answer

How to assign colors specified within dataframe contents to ggplot geoms?

I am trying to plot a graph of some points with some coloured background regions behind them. I would like the fill colour to be dependent on the "quadrant" name and specified within the dataframe itselt (e.g. "Indifferent" would be pink in the…
Mel
  • 700
  • 6
  • 31
1
vote
1 answer

Can't use a y variable in aes_string

I am currently working with COVID-19 data from Peru and I want to use a Rmisc::multiplot to show the development of positive cases in each region of the country. So I am trying to code a loop to generate 25 plots. Only as a matter of example I am…
1
vote
2 answers

ggplot add geom_path with different color aesthetic // Error: Error: Insufficient values in manual scale

I am trying to connect the geom_points in my ggplot with geom_path. The lines should be in the same color as the geom_point fill color. However, geom_path does not know fill and color is used for a different grouping. I am also highlighting certain…
1
vote
1 answer

Custom colors for discrete values in geom_bar in ggplot R

I am converting a histogram with counts to a proportion chart. I want to make the seven columns on the left green (x values 0-6), the next two are orange (7,8), and the right columns (9 and 10) red. I tried to follow the method in this thread but…
carmadillo
  • 13
  • 1
  • 3
1
vote
2 answers

Most efficient/aesthetic 3 way boolean check in C#

I have a C# function that is updating a database and need to check to make sure two values in a datarow are not null. I know that ValueA has a value more often than ValueB, so I have a check as follows to make sure I have the most efficient…
Kemilio
  • 88
  • 8
1
vote
0 answers

ggplotly ignores "linetype" aesthetic of geom_bar

How to make plotly::ggplotly correctly render/print linetypes when using ggplot2 geom_bar? Here is a reproductible exemple: library(tidyverse) library(plotly) # this shows the problem static_plot = ggplot(data = mtcars, aes(x = rownames(mtcars), y…
Paul
  • 2,850
  • 1
  • 12
  • 37
1
vote
1 answer

Error: stat_summary requires the following missing aesthetics: y

I'm trying to create a barplot with confidence interval error bars using ggplot. Essentially, I have a variable, Q1, with 7 answer options, and I want to plot the percent of respondents for each option, as a factor of two groups (One and Two) - the…
IG114
  • 85
  • 2
  • 10
1
vote
2 answers

Boxplot Not Showing Correctly

Attempting to run this command: data %>% + ggplot( aes(x=Seconds, y=Rate)) + + geom_boxplot( fill="skyblue", notch=FALSE) + + geom_jitter( size=1, color="orange", width=0.2) On this data.frame (each column has been transformed to a…
Dr Ken Reid
  • 577
  • 4
  • 22
1
vote
1 answer

Why is my R bar chart (geom_bar) not appropriately filling color based on the provided variable?

This is a bit of a newbie question. I am using the package "nycflights13" in R, and "tidyverse". library(nycflights13) library(tidyverse) I am trying to get a bar chart that shows the total number of flights by airline/carrier, and have it color…
ksulli10
  • 13
  • 5
1
vote
1 answer

How to make a bar plot using ggplot that uses multiple columns for the x-axis?

I am trying to use multiple column names as the x-axis in a barplot. So each column name will be the "factor" and the data it contains is the count for that. I have tried iterations of this: ggplot(aes( x = names, y = count)) + geom_bar() I tried…
Josh
  • 321
  • 1
  • 7
1
vote
1 answer

String constant inside aes in R - ggplot2

My query is with reference to this reprex: d1 <- data.frame(index= 1:100,x=1:100,x_hat= 1:100+ rnorm(100)) ggplot(data = d1 ) + geom_line(aes(x=index,y=x,color="True X")) + geom_line(aes(x=index,y=x_hat,color="Estimated X")) + …
user2338823
  • 501
  • 1
  • 3
  • 16