USEPA/EPATADA

TADA_DepthProfilePlot title overlaps plot

Closed this issue · 4 comments

Describe the bug

The TADA_DepthProfilePlot title overlaps the plot.

To Reproduce

Code to reproduce the behavior:

# Download example data
df0 <- TADA::TADA_DataRetrieval(
  organization = c("REDLAKE_WQX", 
                   "SFNOES_WQX", 
                   "PUEBLO_POJOAQUE", 
                   "FONDULAC_WQX",   
                   "PUEBLOOFTESUQUE", "CNENVSER"),
  startDate = "2018-01-01",
  endDate = "2023-01-01")

# FIRST
# Categorize depth data as surface, middle and bottom
df1 <- TADA::TADA_FlagDepthCategory(df0, 
                                    bycategory = "no", # require no in shiny?
                                    bottomvalue = 2, # include option for user input in shiny
                                    surfacevalue = 2, # include option for user input in shiny
                                    dailyagg = "none", # include option for user input in shiny, be aware if user chooses to calculate "avg", "min", or "max" this will increase the number of rows in the dataset
                                    clean = FALSE) # require FALSE in shiny?

# SECOND
# ID location/date/characteristic combinations in the data set that can be used for depth profile plots or analysis
 # This output will be used to generate options for the plot below
df2 <- TADA::TADA_IDDepthProfiles(df1, 
                                  nresults = TRUE, 
                                  nvalue = 2, # include option for user input in shiny 
                                  aggregates = FALSE)

# THIRD
# Users can now explore depth profiles for selected characteristics (up to 3) at specific site on a single date
# TADA_DepthProfilePlot can plot up to three characteristics against depth
TADA::TADA_DepthProfilePlot(df1, groups = c('TEMPERATURE, WATER_NA_NA_DEG C', 
                                            'DEPTH, SECCHI DISK DEPTH_NA_NA_M',
                                            'DISSOLVED OXYGEN (DO)_NA_NA_MG/L'), # second in shiny, after users select a specific location and date, users should select up to three chars (use TADA::TADA_IDDepthProfiles output (df2) to generate list of options)
                            location = "REDLAKE_WQX-LRC", # first in shiny, users should select a specific location and date (use TADA::TADA_IDDepthProfiles output (df2) to generate list of options)
                            activity_date = "2018-07-09", # first in shiny, users should select a specific location and date (use TADA::TADA_IDDepthProfiles output (df2) to generate list of options)
                            depthcat = TRUE, # include check box in shiny to turn off or on on plot. This could also be a TADA_DepthProfilePlot function update to inlcude the check bix in the fig itself instead of just shiny?
                            surfacevalue = 2, # include option for user input on shiny
                            bottomvalue = 2, # include option for user input on shiny
                            unit = "m") # include option for user input on shiny ("ft", "m", "in")

Expected behavior

Title should not overlap plot.

Screenshots
newplot

Reminders for TADA contributors addressing this issue

New features should include all of the following work:

  • Create the function/code.

  • Document all code using comments to describe what is does.

  • Create tests in tests folder.

  • Create help file using roxygen2 above code.

  • Create working examples in help file (via roxygen2).

  • Add to appropriate vignette (or create new one).

image

What do you think of this update, @cristinamullin? Should title be centered only over the plot area?

Yes I think that would look cleaner - centered only over the plot area.

Ok - I'll get that figured out and then submit the pull request.

image

Here is what the update looks like. It will now center in the middle of the plot if the figure is large/wide enough. Is that what you are looking for as a solution? Or do we want the text to wrap differently if user resizes/zooms in or out on the figure?