Relative Content

Tag Archive for rggplot2tidyverse

Is there a way to prevent facet labels from being equal width (after rotation)

When I apply a facet_grid, sometimes the labels are quite wide, sometimes so wide that they don’t fit, and I have to rotate them. This isn’t a problem unless I want to facet by multiple different groups. In this case, it auto-sizes every single group’s label to be the same as the longest label. A reproducible example should help clarify my meaning:

ggplot2: geom_line with color and linetype rendered

I want to plot a line graph with two categorical variables. The desired output is that
‘team’ variable is rendered as color, while each ‘strength’ is rendered with a different linetype. So the colored lines for each team has different linetypes based on strength on the same line.

Spaces at start of new lines ggplot label

When I try to add labels to a plot in ggplot, some new lines have an additional space, while others don’t. I think it’s to do with the paste part of my code, but I cannot figure it out. I’d like my labels to be all aligned on the left so it looks better.