Open-Systems-Pharmacology / TLF-Library

TLF Library implementation in R
https://www.open-systems-pharmacology.org/TLF-Library/
Other
9 stars 6 forks source link

Ticks and axes are not always shown #510

Open PavelBal opened 3 months ago

PavelBal commented 3 months ago

E.g. this snapshot lost its axes:

https://github.com/Open-Systems-Pharmacology/OSPSuite-R/blob/develop/tests/testthat/_snaps/plot-observed-vs-simulated/lloq-vertical.svg

It was in this PR: https://github.com/Open-Systems-Pharmacology/OSPSuite-R/pull/1368

pchelle commented 3 months ago

I think the issue comes from the {ggplot2} update to version 3.5 The axis seems not displayed if there is no tick in the plot

[!CAUTION] the displayed ticks in the example come from ggplot2::annotation_logticks and not the ggplot2::scale_x_log10

library(tlf)

logConfigNoTick <- ObsVsPredPlotConfiguration$new(
  xScale = Scaling$log, 
  yScale = Scaling$log
  )
logPlotNoTick <- plotObsVsPred(
  data = data.frame(x=2:3, y=3:3),
  plotConfiguration = logConfigNoTick
)

logConfigTick <- ObsVsPredPlotConfiguration$new(
  xScale = Scaling$log, 
  yScale = Scaling$log
)
logConfigTick$xAxis$ticks <- 2:3
logConfigTick$yAxis$ticks <- 2:3
logPlotTick <- plotObsVsPred(
  data = data.frame(x=2:3, y=2:3),
  plotConfiguration = logConfigTick
)

patchwork::wrap_plots(logPlotTick, logPlotNoTick)

Created on 2024-03-12 with reprex v2.0.2