-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add function to show presence/absence by depth bin? #31
Comments
I think this type of addition would be great. I have a few other plots that I have been working on for survey visualization. One of them is a similar to your above (not nearly as pretty) which shows the percent positive tows by year. I think we could also do a similar plot to your but have it across latitudes. I will not be able to incorporate any of this new plotting functionality in the next couple of months but that could give us time to identify a needed suite of plots and how best to create the code (e.g. something similar to SS_plots that would do a full set of plots calling separate plotting functions internally). |
New function Example commands below from
|
Thank you @iantaylor-NOAA. I used the example code that you sent to create plots for Dover sole and it was super informative. Based on my playing around with Dover sole, I have some ideas of options and features that will create reasonable plots across species. This give us a create start for development. To help foster additional ideas here are the modified plots that I created for Dover sole (with Ian's help I can make great plots too!): |
Nice Dover plots, Chantel. |
Quick question. I inferred that the width of the bins in your example are related to the cpue by bin (e.g., higher cpue would result in wider bin). Is this correct? I standardized everything for Dover sole because the numbers of observations across depths and the size of positive tows was a bit messy since it is the extreme end for trawl species. I think both options would be useful. |
I believe widths are proportional to the number of tows within each bin, which I think is also useful information, but I could see how it could add confusion for a species like Dover that spans all depths everywhere. 100% of the plotting code in this function is done in the single line |
@iantaylor-NOAA and @chantelwetzel-noaa would you mind if I changed the x-axis bin labels to be on an angle because the values often overlap (e.g., see Ian's example above and the example below). |
That is great. Feel free to commit this change. I plan on working more on this plotting function today or next week to incorporate additional revisions that I explored when creating a figure for Dover sole to make it more versatile. |
Deprecates `dopng =` because dir = NULL can serve as FALSE. * Remove importsFrom for two functions with :: * Uses ifelse to create main_ to remove so many if statements with duplicated code. * Uses on.exit to call dev.off() in case the function fails, then the device is not left on. * fix(PlotPresenceAbsence.fn): * dim: `match.arg` allows you to list all of the possible options in the function call so users know what is available. Then, `match.arg` will use the first listed as the default. * Uses dontrun plot b/c the figures and download take too long and `check()` complains. So, I wrapped them in dontrun{} and I added an example with the package data where you do not have to download anything. * Checked spelling in documentation and wrapped at 80 characters. Part of #31 TODO: * Use `ggplot2::ggsave()` * Remove the call to windows() which only works on windows machines and will cause GitHub actions to fail if there was a test.
Deprecates `dopng =` because dir = NULL can serve as FALSE. * Remove importsFrom for two functions with :: * Uses ifelse to create main_ to remove so many if statements with duplicated code. * Uses on.exit to call dev.off() in case the function fails, then the device is not left on. * fix(PlotPresenceAbsence.fn): * dim: `match.arg` allows you to list all of the possible options in the function call so users know what is available. Then, `match.arg` will use the first listed as the default. * Uses dontrun plot b/c the figures and download take too long and `check()` complains. So, I wrapped them in dontrun{} and I added an example with the package data where you do not have to download anything. * Checked spelling in documentation and wrapped at 80 characters. Part of #31 TODO: * Use `ggplot2::ggsave()` * Remove the call to windows() which only works on windows machines and will cause GitHub actions to fail if there was a test.
Deprecates `dopng =` because dir = NULL can serve as FALSE. * Remove importsFrom for two functions with :: * Uses ifelse to create main_ to remove so many if statements with duplicated code. * Uses on.exit to call dev.off() in case the function fails, then the device is not left on. * fix(PlotPresenceAbsence.fn): * dim: `match.arg` allows you to list all of the possible options in the function call so users know what is available. Then, `match.arg` will use the first listed as the default. * Uses dontrun plot b/c the figures and download take too long and `check()` complains. So, I wrapped them in dontrun{} and I added an example with the package data where you do not have to download anything. * Checked spelling in documentation and wrapped at 80 characters. Part of #31 TODO: * Use `ggplot2::ggsave()` * Remove the call to windows() which only works on windows machines and will cause GitHub actions to fail if there was a test.
Deprecates `dopng =` because dir = NULL can serve as FALSE. * Remove importsFrom for two functions with :: * Uses ifelse to create main_ to remove so many if statements with duplicated code. * Uses on.exit to call dev.off() in case the function fails, then the device is not left on. * fix(PlotPresenceAbsence.fn): * dim: `match.arg` allows you to list all of the possible options in the function call so users know what is available. Then, `match.arg` will use the first listed as the default. * Uses dontrun plot b/c the figures and download take too long and `check()` complains. So, I wrapped them in dontrun{} and I added an example with the package data where you do not have to download anything. * Checked spelling in documentation and wrapped at 80 characters. Part of #31 TODO: * Use `ggplot2::ggsave()` * Remove the call to windows() which only works on windows machines and will cause GitHub actions to fail if there was a test.
I created a branch plot_presence that has a function that can {ggplot2} versions these figures. I pushed a wrapper as well that saves the CPUE by depth and latitude and we can easily add sex to the wrapper but I just haven't yet. Below are the CPUE figures. Let me know what you think. @chantelwetzel-noaa they don't have white backgrounds because then you cannot see the gridlines, which I think are helpful. I can change this though, no problem. |
These figures look good. In my limited experience creating barplots with ggplot2, I had issues where there was white space between the figure and the axes but you have solved that issue. Have you successfully create these similar figures with equally sized bars across the x-axis? I think having that option is fairly important for species with wide depth distributions (e.g., Dover sole, sablefish, thornyheads). |
This can be accomplished now with |
Can you give me and example call for this? I just tested this out by using:
This is a fine way to look at this but I would also like to be able to produce the sex ratio where the proportions by sex sum to 1. |
The figure below was created for the 2019 Big Skate assessment as a simple illustration of the depth distribution of the species, where the width of each bar is proportional to the number of tows within that depth bin. In this case of Big Skate it was useful to see that the modal depth was likely near or shallower than the 55m minimum of the survey.
Would it be useful to generalize this for application to any species which occurs in the WCGBT Survey?
If so, I would provide inputs to choose the latitude range, depth range, and depth bin size and any other refinements that anyone suggests.
Code is at https://github.com/iantaylor-NOAA//BigSkate_Doc/blob/master/R/Depth_explorations.R
The text was updated successfully, but these errors were encountered: