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

406 data mapping factors #407

Merged

Conversation

pchelle
Copy link
Collaborator

@pchelle pchelle commented Feb 20, 2023

This PR is necessary for the fixing reporting engine issue 985

Briefly explained, the function getDefaultCaptions() is responsible for creating internally the legend captions in most of the plots.
Since the factor levels were lost before, the legend was always re-ordered by alphabetical order, usually messing up initial legend.

With this fix, you can set up the legend correct order from the data itself (which is convenient if you want to associate a specific color or shape to your legend).

Here is a simple illustration:

data <- data.frame(
    x = rnorm(100),
    y = rlnorm(100),
    legend = rep(c("b", "a"), 50)
)

plotPKRatio(
    data = data, 
    dataMapping = PKRatioDataMapping$new(x = "x", y = "y", group = "legend")
    )

image

data$legend <- factor(data$legend, levels = c("b", "a"))

plotPKRatio(
    data = data, 
    dataMapping = PKRatioDataMapping$new(x = "x", y = "y", group = "legend")
    )

image

For instance, observed on the left and simulated on the right
@codecov-commenter
Copy link

Codecov Report

Base: 62.54% // Head: 62.66% // Increases project coverage by +0.11% 🎉

Coverage data is based on head (b431da8) compared to base (176c0da).
Patch coverage: 95.45% of modified lines in pull request are covered.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #407      +/-   ##
===========================================
+ Coverage    62.54%   62.66%   +0.11%     
===========================================
  Files           60       60              
  Lines         3786     3787       +1     
===========================================
+ Hits          2368     2373       +5     
+ Misses        1418     1414       -4     
Impacted Files Coverage Δ
R/observed-data-mapping.R 0.00% <ø> (ø)
R/timeprofile-datamapping.R 50.00% <ø> (+2.38%) ⬆️
R/utilities-mapping.R 46.51% <95.45%> (+2.15%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

pchelle added a commit to pchelle/OSPSuite.ReportingEngine that referenced this pull request Feb 20, 2023
…al axis in time profiles

Also Fixes Open-Systems-Pharmacology#985

The fix requires PR [407](Open-Systems-Pharmacology/TLF-Library#407) from tlf package and might have side effects on the legend order of other plots performed by the reporting engine
@Yuri05 Yuri05 merged commit 734b897 into Open-Systems-Pharmacology:develop Feb 20, 2023
Yuri05 pushed a commit to Open-Systems-Pharmacology/OSPSuite.ReportingEngine that referenced this pull request Feb 24, 2023
…993)

* Fixes #934 qualification workflows handle dual axis in time profiles

Also Fixes #985

The fix requires PR [407](Open-Systems-Pharmacology/TLF-Library#407) from tlf package and might have side effects on the legend order of other plots performed by the reporting engine

* Fix vignette fail due to update in tlf

* Use fix default values for qualification time profile properties

* Update documentation

* Comment and remove duplicated code chunk
@pchelle pchelle deleted the 406_dataMapping_factors branch February 15, 2024 16:18
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

Successfully merging this pull request may close these issues.

3 participants