我有一个WordPress网站,我想使用一个名为DataTables的jQuery插件.我一直在努力找出将jQuery脚本和DataTables脚本加载到WordPress的正确方法.
我知道我应该使用以下内容:wp_enqueue_script("jquery")- 但我不知道在哪里放或者如何加载我需要的其他jQuery插件.
我尝试的最后一点是把它放在header.php我的WordPress网站的文件中:
<?php wp_enqueue_script("jquery"); ?>
<?php wp_head(); ?>
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激!
默认对齐方式是使ggplot标题与plot.background元素左对齐。其他人指出,您可以使用plot.title = element_text(hjust = 0.5)来居中标题。
但是,我想使标题在整个面板中居中,而不是只与情节相对。过去,我通过修改hjust来推动标题以使其居中显示,从而实现了这一点,但是的值hjust取决于标题的长度,这使得在批量生产图形时进行设置非常繁琐。
是否可以始终将ggplot的标题元素设置为在panel.background中居中?
library(reprex)
library(tidyverse)
data(mtcars)
mtcars %>%
rownames_to_column(var = "model") %>%
top_n(8,wt) %>%
ggplot(aes(x =model, y = wt))+
geom_col()+
coord_flip()+
labs(title="This title is left-aligned to the plot")
Run Code Online (Sandbox Code Playgroud)

mtcars %>%
rownames_to_column(var = "model") %>%
top_n(8,wt) %>%
ggplot(aes(x =model, y = wt))+
geom_col()+
coord_flip()+
labs(title="This title is center-aligned to the plot width.")+
theme(plot.title = element_text(hjust = 0.5))
Run Code Online (Sandbox Code Playgroud)

mtcars %>%
rownames_to_column(var = "model") %>%
top_n(8,wt) %>%
ggplot(aes(x =model, y = …Run Code Online (Sandbox Code Playgroud)