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
191
votes
7 answers

Remove 'a' from legend when using aesthetics and geom_text

How can I can remove the letter 'a' from the legend generated by this code? If I remove the geom_text, then the 'a' letter will not show in the legend. I want to keep geom_text, though. ggplot(data = iris, aes(x = Sepal.Length, y=Sepal.Width, …
user2700207
  • 1,953
  • 2
  • 12
  • 4
38
votes
5 answers

Aesthetics must either be length one, or the same length as the dataProblems

I would like to make a plot with X values as a subset of the measurement and Y-values as another subset of the measured data. In the example as below, I have 4 products p1, p2, p3 and p4. Each are priced according to their skew, color and version. I…
Riad
  • 953
  • 3
  • 13
  • 23
33
votes
4 answers

Plot point markers and lines in different hues but the same style with seaborn

Given the data frame below: import pandas as pd df = pd.DataFrame({ "n_index": list(range(5)) * 2, "logic": [True] * 5 + [False] * 5, "value": list(range(5)) + list(range(5, 10)) }) I'd like to use color and only color to distinguish…
ytu
  • 1,822
  • 3
  • 19
  • 42
26
votes
1 answer

What is the difference between aes and aes_string (ggplot2) in R

With missing background in informatics I have difficulties to understand the differences between aes and aes_string in ggplot2 and its implications for daily usage. From the description (?aes_string) I was able to understand that both describe how…
joaoal
  • 1,892
  • 4
  • 19
  • 29
21
votes
1 answer

Filling in the area under a line graph in ggplot2: geom_area()

For the data: def.percent period valence 1 6.4827843 1984-1985 neg 2 5.8232425 1985-1986 neg 3 -2.4003260 1986-1987 pos 4 -3.5994399 1987-1988 pos If I add a line to the points, how can I use ggplot2 to color the area…
TWest
  • 765
  • 2
  • 6
  • 27
20
votes
3 answers

How to add black border to matplotlib 2.0 `ax` object In Python 3?

I've been using style sheets in matplotlib lately. I really like how clean the seaborn-white looks and I want to be able to add the border to other styles like ggplot or seaborn-whitegrid. How can I add a black border around my ax object from fig,…
O.rka
  • 29,847
  • 68
  • 194
  • 309
18
votes
2 answers

How to increase the space between grouped bars in ggplot2?

[Data and code to produce plot at the end of the post] Using ggplot, I plotted a bargraph with error bars, bars are grouped by two factors (one on X axis, one with fill). I would like to increase the green distance between the groups on the xaxis to…
Kastany
  • 427
  • 1
  • 5
  • 16
13
votes
2 answers

ggpairs plot with heatmap of correlation values

My question is twofold; I have a ggpairs plot with the default upper = list(continuous = cor) and I would like to colour the tiles by correlation values (exactly like what ggcorr does). I have this: I would like the correlation values of the plot…
MadiN
  • 195
  • 4
  • 10
11
votes
1 answer

Why can't I use override.aes to change the color in a legend?

I want to remove the color line from a fill legend for a ggplot. I usually use guide_legend(override.aes = ...) to modify legend aesthetics - works great for points, lines, alpha, etc., but it's not working for my color aesthetic. What am I doing…
Gregor Thomas
  • 136,190
  • 20
  • 167
  • 294
8
votes
1 answer

How can I maintain a color scheme across ggplots, while dropping unused levels in each plot?

I want to compare some sub-groups of my data in one plot and some other sub-groups in another plot. If I make one plot with all sub-groups plotted, the figure is overwhelming and each individual comparison becomes difficult. I think it will make…
rcorty
  • 1,140
  • 1
  • 10
  • 28
8
votes
2 answers

How to change default aesthetics in ggplot?

Let's say that I would prefer geom_point to use circles (pch=1) instead of solid dots (pch=16) by default. You can change the shape of the markers by passing a shape argument to geom_point, e.g. ggplot(diamonds, aes(depth, carat, colour=cut)) +…
Ernest A
  • 7,526
  • 8
  • 34
  • 40
7
votes
2 answers

Why and when "Using size for a discrete variable is not advised"?

I made a scatterplot with ggplot2 and I mapped a binary variable to point size. The result was satisfactory but I got the warning "Using size for a discrete variable is not advised". I understand that using size to map a non ordinal categorical…
Pere
  • 706
  • 1
  • 7
  • 21
6
votes
1 answer

Control colour of geom_text_repel

I would like to change the colour of one of my ggrepel labels to black. I have tried to override the inheritance by specifying ...geom_text_repel(...colour='black') but that doesn't seem to work. My attempt at a fix to the problem is in the second…
Dom
  • 1,043
  • 2
  • 10
  • 20
6
votes
1 answer

extra variables in legend when wrapping ggplot2 in plotly R

I am having trouble making the legend of the following ggplot wrapped in ggplotly() show only one aesthetic. It currently shows three variables (shape, color, linetype) for each legend entry, but I only want to show one. Only one of the aes()…
Devri A
  • 63
  • 6
6
votes
1 answer

Change the title of factor plot in seaborn

Does anyone know how to change the legend and the title in seaborn? See the below. I kind of want to change the name "Gaussia" to "Guassian Naive Bayes" etc... or the legend in the second image
MYjx
  • 4,157
  • 9
  • 38
  • 53
1
2 3
13 14