mirror of
https://github.com/dchakro/ggplot_themes.git
synced 2026-05-17 11:22:16 -07:00
set hjust and vjust when x.axis.angle is 45
This commit is contained in:
parent
b16e24fa01
commit
8be3d88736
1 changed files with 10 additions and 2 deletions
|
|
@ -2,8 +2,8 @@ DC_theme_generator <- function(type,
|
|||
legend = T,
|
||||
ticks = "out",
|
||||
x.axis.angle = 0,
|
||||
hjust = 0.5,
|
||||
vjust = 0.5,
|
||||
hjust = NULL,
|
||||
vjust = NULL,
|
||||
fontsize.cex = 1.5,
|
||||
fontfamily = "serif",
|
||||
ax.fontstyle = "italic",
|
||||
|
|
@ -32,6 +32,14 @@ DC_theme_generator <- function(type,
|
|||
# x.axis.angle = 45 (i.e. angle for the x axis text)
|
||||
# hjust and vjust = to adjust the x axis text
|
||||
|
||||
|
||||
if(is.null(hjust)){
|
||||
hjust <- ifelse(test = x.axis.angle==45,yes = 1.0,no = 0.5)
|
||||
}
|
||||
if(is.null(vjust)){
|
||||
vjust <- ifelse(test = x.axis.angle==45,yes = 1.0,no = 0.5)
|
||||
}
|
||||
|
||||
ticks <- tolower(ticks)
|
||||
fontfamily <- ifelse(test = tolower(fontfamily) %in% c("sans","serif","mono"),yes = tolower(fontfamily),no = fontfamily)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue