Skip to content
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

Allow plotting pdf and cdf on the same base graphics layer #409

Closed
jamesmbaazam opened this issue Nov 12, 2024 · 1 comment
Closed

Allow plotting pdf and cdf on the same base graphics layer #409

jamesmbaazam opened this issue Nov 12, 2024 · 1 comment

Comments

@jamesmbaazam
Copy link
Member

I was trying to plot the pdf and cdf of an <epiparameter> on the same base graphics layer with par(mfrow) but it wasn't working. I realised this is caused by the following line in the plotting method: https://github.com/epiverse-trace/epiparameter/blob/d3ab32849ea65258771a0dbf77519ca8c7d5daca/R/plot.R#L56C3-L56C10. Is there a reason why you're not allowing the griding of these plots? Below is a reprex of the described behaviour

library(epiparameter)
# Extract influenza serial interval from the database
influenza_serial <- epiparameter_db(
  disease = "influenza",
  epi_name = "serial_interval"
)
#> Returning 1 results that match the criteria (1 are parameterised). 
#> Use subset to filter by entry variables or single_epiparameter to return a single entry. 
#> To retrieve the citation for each use the 'get_citation' function

# Plot the distribution of the serial interval
par(mfrow = c(1, 2))
plot(influenza_serial)

plot(influenza_serial, cumulative = TRUE)

Created on 2024-11-12 with reprex v2.1.1

This is fixed when you remove the code I linked as seen below

devtools::load_all()
#> ℹ Loading epiparameter
# Extract influenza serial interval from the database
influenza_serial <- epiparameter_db(
  disease = "influenza",
  epi_name = "serial_interval"
)
#> Returning 1 results that match the criteria (1 are parameterised). 
#> Use subset to filter by entry variables or single_epiparameter to return a single entry. 
#> To retrieve the citation for each use the 'get_citation' function

# Plot the distribution of the serial interval
par(mfrow = c(1, 2))
plot(influenza_serial)
plot(influenza_serial, cumulative = TRUE)

Created on 2024-11-12 with reprex v2.1.1

@joshwlambert
Copy link
Member

Thanks for posting this @jamesmbaazam, I didn't know this was happening. I've resolved the issue in PR #420.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants