使用 导出绘图ggsave()时,与在 R studio 中查看和导出绘图时相比,我的 ggplot 的几乎所有元素(尤其是文本)都被放大了。我使用的原因ggsave()是我可以获得出版所需的 300 dpi 和 85mm 宽度。
如何确保ggsave()输出与 RStudio 导出的内容相匹配?
1. RStudio 导出(正确的比例):
2. ggsave() 导出(比例不正确):
3.我的代码
library(ggplot2)
library(cowplot)
library(grid)
# Make plot
fig4 <- ggplot()
# Add Landings lines
fig4 <-
fig4 + geom_line(
data = NorRus,
aes(year, tonnes, color = fishing_entity),
size = 0.75
)
# Change colors.
fig4 <-
fig4 + scale_color_manual(
values = bluesPalette,
name = NULL
)
# adjust y axis labels, remove scientific …Run Code Online (Sandbox Code Playgroud) 许多人都遇到过自定义字体出现在 ggplot 中但在使用 导出时消失的问题ggsave,但我只找到了用于导出 pdf 的解决方案(例如 pdf 中的ggplot 嵌入字体)。我正在尝试导出为 png。这以前对我来说效果很好,所以不确定发生了什么。
刚刚更新了所有内容,但没有解决问题 - R 版本为 3.5.0;RStudio 为 1.1.453;在 macOS Sierra 上。
这两项工作都可以将字体添加到绘图中:
1:
if (!require(showtext)) {
install.packages("showtext", repos = "http://cran.utstat.utoronto.ca/")
require(showtext)
}
font_add_google("Karla", "karla") # Add nice google font
showtext_auto() # Tell R to use showtext to render google font
Run Code Online (Sandbox Code Playgroud)
2:
if (!require(extrafont)) {
install.packages("extrafont", repos = "http://cran.utstat.utoronto.ca/")
require(extrafont)
}
font_import(pattern = "Karla")
Run Code Online (Sandbox Code Playgroud)
我如何绘制它:
theme_map <- function(...) {
theme_minimal() +
theme(
text = element_text(family = "Karla", color …Run Code Online (Sandbox Code Playgroud) 我想做的是每当更新t1时更新。t2但是,我需要使用表t3来连接它们,这意味着我需要一个子查询。t1当满足一个条件时我可以成功更新;但是,当涉及多个条件时,我无法理解更新的语法 - 本质上我在组合 postgresql UPDATE、IF/ELSEIF/ELSE和子查询时遇到了麻烦。我正在寻找类似的东西:
-- TABLES
create table t1
(
serial_number integer primary key,
current_location varchar
);
create table t2
(
some_id bigserial primary key,
status integer
);
create table t3
(
serial_number integer REFERENCES t1(serial_number),
some_id integer REFERENCES t2(some_id),
unique(serial_number, some_id)
);
-- TRIGGER
create or replace function trigger_update_currentlocation()
returns trigger as
$body$
begin
-- If SUBQUERY status is deployed (0), retrieved (1), or lost (2), then …Run Code Online (Sandbox Code Playgroud) 在body性能和*特性不同?
我总是以同样的方式使用body和html属性。我可以将*属性与body和一起使用html吗?什么应该在不同的*相对body性能?我不明白为什么需要同时使用这两个属性?
如果我使用其中之一会产生任何问题吗?
我用这个
*{
margin:0;
padding:0;
background:#FFF;
}
Run Code Online (Sandbox Code Playgroud)
并在体内
body, html{
margin:0;
padding:0;
background:#FFF;
font:normal 12px verdana;
color:#0086ca;
}
Run Code Online (Sandbox Code Playgroud)
当我使用body, html它时会改变背景。当我background从中取出*时并没有改变 bg 颜色。
我正在使用wow.js,以便在向下滚动时淡出内容.它的工作方式是将div类添加wow到你想要淡入的东西中,wow.js识别然后动画.(这里真的很简单的文档http://mynameismatthieu.com/WOW/docs.html)
但是,如果浏览器禁用了javascript,则无法在类的任何内容上识别任何css样式wow,这.wow在我的样式表中没有定义.我想知道是否有一个解决方法 - 我应该将.wow类添加到我自己的样式表中,类似于.wow {display: block}什么?或者有没有办法告诉浏览器没有启用JavaScript,只是忽略wow该类?
不幸的是,我不能简单地发一条<noscript>消息说javascript已被禁用,因为我知道许多工作人员正在查看网站,其中javascript被禁用,他们需要能够查看它.
css ×2
ggplot2 ×2
r ×2
class ×1
html ×1
if-statement ×1
javascript ×1
postgresql ×1
rstudio ×1
sql ×1
sql-update ×1