简体   繁体   English

R ggplpot():较粗的X和Y轴

[英]R ggplpot(): Thicker X and Y Axes

在此处输入图片说明

I have data that crosses the x-axis and I am trying to darken the axes to make them more apparent in the chart. 我有横穿x轴的数据,并且我正在尝试使这些轴变暗,以使其在图表中更明显。 The code I am using just keeps darkening the lines on the bottom and left of the box around the chart and not the axes themselves. 我使用的代码只是使图表周围方框底部和左侧的线条变暗,而不是轴本身变暗。 What am I missing? 我想念什么? Code and image are below. 代码和图像如下。

ggplot() +
  geom_line(data=eff, aes(EaR, Forward.Cost), color=rgb(187,8,38, max=255)) +
  geom_line(data=arbitrary, aes(EaR, Forward.Cost), color=rgb(196,165,96, max=255)) +
  ggtitle("Efficient Frontier \n") +
  labs(x="EaR", y="Forward Cost") +
  theme_bw() +
  theme(axis.line = element_line(size = 1, color = rgb(0,0,0,max=255))) +
  geom_point(data=eff, aes(EaR, Forward.Cost),size=2, color=rgb(187,8,38,max=255)) +
  geom_point(data=arbitrary, aes(EaR, Forward.Cost),size=2, color=rgb(196,165,96,max=255))

For backgrounds and borders. 用于背景和边框。

gg+theme(panel.border = element_rect(linetype = "solid", colour = "black", size=5))+

rest of your code 您的其余代码

There is an issue with the argument "panel.border" in ggplot2 . ggplot2中的参数“ panel.border”存在问题 The users etiennebr and nfdisco have detected that, even when printing in PDF, lines showed discrepancies in thickness between different axes. 用户etiennebr和nfdisco已检测到,即使以PDF打印时,线条也显示出不同轴之间的厚度差异。

Therefore, there seems to be very little workarounds to this persistent issue. 因此,似乎很少有解决此持续性问题的方法。 You may want to try different values for the line thickness, for png(res=xxx) , or ggsave(dpi=xxx) , to see if there are any significant changes, as suggested by the collaborator wch. 您可能想要尝试不同的线宽值,例如png(res=xxx)ggsave(dpi=xxx) ,以查看是否存在任何重大变化,如合作者wch所建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM