aboutsummaryrefslogtreecommitdiff
path: root/R/plot.mkinfit.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2016-06-25 21:07:11 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2016-06-25 21:16:37 +0200
commit43c0ae8431440bab723b35909d43f51434288c33 (patch)
treeef9b4d8df9fc64c9170242dfb355ef041ace9a60 /R/plot.mkinfit.R
parent693beea972cad4633c1d8baf422913ff3e8d709d (diff)
Fix the plot margins for combined plots
Diffstat (limited to 'R/plot.mkinfit.R')
-rw-r--r--R/plot.mkinfit.R21
1 files changed, 21 insertions, 0 deletions
diff --git a/R/plot.mkinfit.R b/R/plot.mkinfit.R
index 317c74a3..58ff88bc 100644
--- a/R/plot.mkinfit.R
+++ b/R/plot.mkinfit.R
@@ -103,6 +103,27 @@ plot.mkinfit <- function(x, fit = x,
ylim_row = ylim
}
+ if (sep_obs) {
+ # Margins for top row of plots when we have more than one row
+ # Reduce bottom margin by 2.1 - hides x axis legend
+ if (plot_row == 1 & n_plot_rows > 1) {
+ par(mar = c(3.0, 4.1, 4.1, 2.1))
+ }
+
+ # Margins for middle rows of plots, if any
+ if (plot_row > 1 & plot_row < n_plot_rows) {
+ # Reduce top margin by 2 after the first plot as we have no main title,
+ # reduced plot height, therefore we need rel.height.middle in the layout
+ par(mar = c(3.0, 4.1, 2.1, 2.1))
+ }
+
+ # Margins for bottom row of plots when we have more than one row
+ if (plot_row == n_plot_rows & n_plot_rows > 1) {
+ # Restore bottom margin for last plot to show x axis legend
+ par(mar = c(5.1, 4.1, 2.1, 2.1))
+ }
+ }
+
# Set up the main plot if not to be added to an existing plot
if (add == FALSE) {
plot(0, type="n",

Contact - Imprint