kaitlyngaynor / gorongosa-mesocarnivores

2 stars 0 forks source link

color for occupancy figures #133

Closed klg-2016 closed 1 year ago

klg-2016 commented 1 year ago

https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/28f3e622bf27cb972a889a9e6cc460e08629cd24/scripts/species-interaction-model/02-multi-species-occupancy-analysis-GNP.Rmd#L248

this is where the code for the occupancy figures for each spp starts, so where the change for color of the CIs would be implemented If you're good to make that change, I'd appreciate it and will take a look after to see how you did it!

kaitlyngaynor commented 1 year ago

Git is being finnicky at the conference center so it's hard for me to pull & push but here's the fix, I think (I only changed the second line). Play around with the alpha value til it looks nice :)

Also, maybe pick a blue that is less pure BLUE. If you just google "Color palette generators" you can probably find a nice quartet of hex codes to use for the four species. Then just replace both instances of "blue" with "#187bcd" (a blue I just found quickly) and there you have it.

civet_lake <- ggplot(data = civet_urema_predict, aes(x = urema_unscaled, y = Predicted)) +
    geom_ribbon(aes(ymin = lower, ymax = upper), fill = "blue", alpha = 0.75) +
    geom_line(colour = "blue") +
    ylim(0,1) +
    theme_bw() +
    labs(x = "Distance to Lake (km)") +
    ggtitle("Civet")
klg-2016 commented 1 year ago

Got it, I'll implement those changes! Thank you

kaitlyngaynor commented 1 year ago

k hopefully it works! lmk if you have other questions

klg-2016 commented 1 year ago

This isn't a question, but I think your suggested edit for creating plots with detection probabilities instead of occupancy probabilities worked. I haven't implemented your code for the color yet. image

klg-2016 commented 1 year ago

and the color code works too! image I'm going to keep the four main colors I have for now, because I'm not 100% sure where the code is for the temporal overlap figure and if I run out of time to find it, I want to have the colors be the same as they were in my thesis.

kaitlyngaynor commented 1 year ago

Great! You might play around with the y-axis scale too—could bound between 0 and 0.5, for example, if detection probabilities are low

kaitlyngaynor commented 1 year ago

I think the temporal overlap figure is line 141 here? https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/master/scripts/temporal-analysis/01-temporal-overlap-calculation.R

klg-2016 commented 1 year ago

huh, what a concept looking in the script labeled 01-temporal-overlap-calculation (for whatever reason, my brain/eyes could not find/see that script). that looks like it, thank you!

klg-2016 commented 1 year ago

image

kaitlyngaynor commented 1 year ago

Looking good! You might actually change the y-axes so they vary by species, since overall detection probs are lower for honey badger & marsh mongoose... I could see using 0-0.20 for civet, 0-0.25 for genet, and 0-0.05 or 0.10 for honey badger and marsh mongoose? what do you think? I don't think it's necessarily misleading, particularly if you add a statement to the caption that says something like "We varied the y-axis scale by species for legibility, given differences in detection probabilities across species."

klg-2016 commented 1 year ago

yeah I was thinking leave it consistent to not be misleading, but you're right that it's harder to see the relationship for hb/mm with this axis. I'll edit and see what we think

klg-2016 commented 1 year ago

image image also edited colors on the temporal figure, thank you again for pointing me in the right direction

kaitlyngaynor commented 1 year ago

I like it! I think it's ok especially because the lines for HB & MM are still lower than the line for genet. If they were above that line, I think that's when it would start to look misleading.

If I may continue to be nit-picky, I'd increase the line width on the temporal figures - it's kind of hard to see honey badger. I think you'd have to change it in the original function you wrote here, though (lwd = 3 or something):

https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/9408910fb3bd3c3b14c10d513a643b1b1ae9dbbe/scripts/temporal-analysis/02-temporal-figure-functions.R#L354-L357

kaitlyngaynor commented 1 year ago

To clarify one more thing—didn't you go with # of termite mounds (in 1km) rather than termite mound density?

klg-2016 commented 1 year ago

Yes, it is number of termite mounds - in my thesis, we also used number of termite mounds and I still labeled it "Density", which writing out now doesn't actually make sense. I'll edit to "Number of termite mounds" (or "Number of termite mounds in a 1km radius"? or "Termite mounds in a 1km radius"?) Will also work on thickening lines (please be nitpicky, if I can get these figures so they're basically ready to go today/early this week, that's going to be super helpful when it comes time to submit)

klg-2016 commented 1 year ago

there's the thicker lines: image

klg-2016 commented 1 year ago

and edited labels: image

kaitlyngaynor commented 1 year ago

Well I think "density" still works as long as the "per unit area" piece is provided, e.g., "Termite mound density (# in 1km radius)" But maybe to save space, "Termite Mounds Within 1km" (I think you still need the area somewhere, so "No. Termite Mounds" won't cut it)

I like the thicker lines! Do you?

My next issue is that I find the dotted lines a little busy where they are overlapping, and I think I'd prefer them solid, but I realize that raises issues with greyscale/colorblindness... what if you pick 4 colors from a color-blind-friendly palette? https://www.color-hex.com/color-palette/49436 or look at the top answer here https://stackoverflow.com/questions/57153428/r-plot-color-combinations-that-are-colorblind-accessible

klg-2016 commented 1 year ago

image image

I think thicker is easier to see. The temporal figure now looks like a little kid scribbled with crayon (but not in a bad way, it just makes me smile)

kaitlyngaynor commented 1 year ago

ha. I actually love it!

kaitlyngaynor commented 1 year ago

ok last nit-picky comment (hopefully) -- can you make the line width in the detection prob plots thicker too, for consistency (and ease of seeing the line)?

kaitlyngaynor commented 1 year ago

I probably shouldn't promise that, there may be more... anyway you can do that with size = 2 or size = 3 in the aes() argument of geom_line()

klg-2016 commented 1 year ago

image

this is linewidth = 1 (size = was deprecated), actually, because 2 looked too thick. what do you think?

klg-2016 commented 1 year ago

I'm thinking it may also be too thick

kaitlyngaynor commented 1 year ago

I actually like it, plus it better matches the temporal graph. I find 1 pt lines too thin... it's a matter of personal preference of course

kaitlyngaynor commented 1 year ago

I should have given you all of my comments at once, but I think you want "Predicted" to read "Detection Probability"

klg-2016 commented 1 year ago

image

I think the only thing that's getting me with the line thickness is where it's almost as thick as the confidence interval, but I don't think that's ever actually true so I think it works.

klg-2016 commented 1 year ago

justed edited lion axis to read "Relative Lion Activity"