-
Notifications
You must be signed in to change notification settings - Fork 2
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
Long legend #504
base: main
Are you sure you want to change the base?
Long legend #504
Conversation
…zes are reduced to fit the text into the plot, if required
@Felixmil This PR introduces automatic adjustment of text sizes of a plot that is exported through Some test code:
Example of a plot with The same plot exported with Legend entries are still causing lot of trouble, as:
@Felixmil I twisted my brain trying to figure out how to change the size of legend symbols, but I could not figure it out. Maybe you will have better luck. Please try to find ways to change the above-mentioned properties. I could take care of the (initial) fine-tuning. |
@PavelBal If I understood correctly, only the exported version of the plots will have adjusted text/keys sizes, not the plot Object. Shouldn't we perform these modifications directly in the plot generation processes (plot and grids) so that objects and exports are identical ? If yes, I can move reuse what you implemented here in {tlf} (for plots) and {ospsuite} (for plotgrids). |
If this can be done at earlier steps than export - even better, go ahead. I wasn't sure because the size of the plot in cm is defined in the export configuration, I am not that familiar with gglop to judge if the scaling can be done earlier. |
Codecov Report
@@ Coverage Diff @@
## main #504 +/- ##
==========================================
- Coverage 82.06% 81.56% -0.51%
==========================================
Files 30 30
Lines 1812 1871 +59
==========================================
+ Hits 1487 1526 +39
- Misses 325 345 +20
|
… ARE NOT SCALED YET!) - Collapsing title strings (WHY?)
Here is what can be obtained with the new TLF branch: knitr::opts_chunk$set(fig.width = 7, fig.asp = 1, dpi = 300, warning = FALSE)
library(esqlabsR)
#> Loading required package: ospsuite
#> Loading required package: rClr
#> Loading the dynamic library for Microsoft .NET runtime...
#> Loaded Common Language Runtime version 4.0.30319.42000
###### Test for long captions
myDc <- DataCombined$new()
ds <- DataSet$new("LegendsCanHaveVeryLongStrings|BecauseTLFNowWrapsThemOn|SpacesorSpecialCharacters")
ds$setValues(1, 1)
myDc$addDataSets(ds)
myDc2 <- DataCombined$new()
ds2 <- DataSet$new("LegendsCanHaveVeryLongStringsBecause|TLFNowWrapsThemOnSpacesorSpecialCharacters")
ds2$setValues(1, 1)
myDc2$addDataSets(list(ds, ds2))
plotConfig <- createEsqlabsPlotConfiguration()
plotConfig$titleSize <- 9
plotConfig$title <- "ThisPlotTitleIsVeryLong ButTLFCanNowWrapLongStringsOnSpaces WhichShouldBeCommonOnPlotTitles!"
singlePlot <- plotIndividualTimeProfile(myDc, plotConfig)
plotConfig$title <- "ThisPlotTitleIsAlsoVeryLong ButTLFCanNowWrapLongStringsOnSpaces WhichShouldBeCommonOnPlotTitles!"
singlePlot2 <- plotIndividualTimeProfile(myDc2, plotConfig)
plotGridConfiguration <- createEsqlabsPlotGridConfiguration()
plotGridConfiguration$title <- "ThisPlotGridHasAVeryLongTitle ThatWillFitOnTopOfThePlots BecauseTLFCanNowWrapTextOnSpaces"
plotGridConfiguration$addPlots(list(singlePlot, singlePlot2))
plotGrid(plotGridConfiguration) Created on 2023-08-07 with reprex v2.0.2 |
- Plot title centered - Reduce point size
Reduced points and line size
Fixes #503