Erin-Rooney/XCT-freezethaw

Lost outline on points

Closed this issue · 20 comments

@kaizadp

I added shapes into the figure and it caused the entire points to become black, so I removed the color = black argument and now I can't figure out how to get outlines on my points.

tool_long %>%
filter(sample == "Aggregate-6") %>%
ggplot(aes(x = trmt, y = volume, color = Type)) +
#geom_boxplot(aes(group = trmt), fill = "gray50", alpha = 0.2, width = 0.2) +
geom_path(aes(group = Type, color = Type), size = 0.7, linetype = "dashed")+
geom_point(aes(fill = Type), size = 6, shape = 21, stroke = 1, color = "black") +
#geom_text(data = gglabel, aes(x = trmt, y = volume, label = label), color = "black")+
#facet_wrap(. ~ sample)+
labs (#title = "Pore Volumes",
# caption = "Permafrost Soil Aggregate from Toolik, Alaska",
# tag = "A",
x = expression (bold (" ")),
y = expression (bold ("Volume, %"))) +
scale_y_continuous(labels = scales::label_percent(accuracy = 0.1),
name = "Pore Volume, %"
) +
expand_limits(y = 0)+
theme_er() +
scale_color_manual(values = c("#c67b6f", "#5d74a5", "#efbc82", "#b0cbe7"))+
scale_fill_manual(values = c("#c67b6f", "#5d74a5", "#efbc82", "#b0cbe7"))

image

your code isn't up to date. commit and push the new changes, so I can see them.

But it looks like you used aes(shape = ...) but didn't set the correct shapes. It's currently showing the solid shapes, which use color, not fill. Set the correct shapes with scale_* (21, 22?) and bring back color = "black" in the geom_point.

also, in the color portion of the legend, arrange by color, so it's easier to understand. airs together and waters together.

Got it!
image

I'll work on fixing the legend for future info, but I cut the legends out of these figures anyway.

great!
In case we haven't already discussed it, you can fix the legend color/fill with this:
guides(fill=guide_legend(override.aes=list(shape=21)))

Oh, I'll try that. Also, I fixed it to be fill type rather than connectivity.

image

@kaizadp

Is there a way to combine the legends? Or can I change the labels "air" and "water"?

image

I would do aes(shape = Type), and then scale_shape_manual(values = c(21, 21, 22, 22). (adjust the shapes as needed). That should give you a single legend.

So that got rid of the second legend but didn't combine it into the legend.

image

Can you commit and push your code? I'll take a look at it.

Here it is!

conntotals_long %>%
filter(sample == "Aggregate-6") %>%
ggplot(aes(x = trmt, y = volume, color = Type)) +
#geom_boxplot(aes(group = trmt), fill = "gray50", alpha = 0.2, width = 0.2) +
geom_path(aes(group = Type, color = Type), size = 0.7, linetype = "dashed")+
geom_point(aes(fill = Type, shape = Type), size = 6, stroke = 1, color = "black") +
scale_shape_manual(values = c(21,21, 22, 22))+
theme_er() +
#geom_text(data = gglabel, aes(x = trmt, y = volume, label = label), color = "black")+
#facet_wrap(. ~ sample)+
labs (#title = "Pore Volumes",
# caption = "Permafrost Soil Aggregate from Toolik, Alaska",
# tag = "A",
x = expression (bold (" ")),
y = expression (bold ("Volume, %"))) +
scale_y_continuous(labels = scales::label_percent(accuracy = 0.1),
name = "Pore Volume, %",
limits = c(0,1)
) +
guides(fill=guide_legend(override.aes=list(shape=21)))+
#theme(legend.position="none")+
#expand_limits(y = 1)+
scale_color_manual(values = c("#5d74a5", "#c67b6f", "#b0cbe7", "#efbc82"))+
scale_fill_manual(values = c("#5d74a5", "#c67b6f", "#b0cbe7", "#efbc82"))

oh, line 198!
you are overriding the shapes to use shape = 21. remove that, and you'll have your shapes in the legend.

Ohh!! Thank you!!!!

image

Wait.

Okay, I get what's happening. I can fix it.

Got it!

image

great!
also,

  1. in the geom_path arguments, I would add show.legend = FALSE. that will remove it from the legend. right now, you have small nubs for the path.
  2. since you have dark/light blue for water, can you also do red/pink for air? the red/yellow aren't a pair.

How about this?

image

Yep, that's good!

Thanks!!!