Relative Content

Tag Archive for rggplot2legend

Trying to remove the background of color icon in ggplot legend

I’m trying to remove the gray box behind the color icon in the legend of this graph. Wondering if the issue is that I’m using geom_col() so the color aesthetic is just the outline of the column. Does anyone know if I can keep my use of geom_col() and just remove this background?

Modifying ggplot figure legend

I am trying to modify my figure legend to change the title of the legend and the item names within the legend. The code noted below will not change the names, the figure remains the same. We have tried using fill = SamplerNum instead of color = or group = and then it removes the legend and makes the lines on the graph grey. Have also tried scale_color_manual and guides() (see guides() code below)

Add legend after using gg.gap

I have a data set with a big negative value, so I used gg.gap package to make a discontinuous y-axis. The code worked well but after adding the function gg.gap the legend was deleted.
I tried adding a legend using the add.legend argument but it didn’t work.
Am I doing something wrong?
Here is a sample code

Order of ggplot ignoring order of legends

With the following data, I am trying to create a plot as shown, but the order of legends as: mgCST Group, CST Group, Treatment Status. However, ggplot is ignoring all attempts to order the legends