简体   繁体   English

如何在 R 图中更改 Xlab、Ylab 和 XY 轴颜色和字体大小的值

[英]How to change Xlab,Ylab and values of XY-axis color and font size in R plot

I'd like to change the color and font size of:我想更改以下内容的颜色和字体大小:

  1. Xlab,实验室,
  2. Ylab,实验室,
  3. values of X and Y-axis X 和 Y 轴的值
  4. Panel border (color)面板边框(颜色)

in R plot Is there a way to do it?在 R 图中有没有办法做到这一点?

Here's code demonstrating some of the lower level plotting functions that provide the sort of fine-grained control that you're wanting.下面的代码演示了一些较低级别的绘图函数,这些函数提供了您想要的那种细粒度控制。 See the help pages of the several functions for even more options.有关更多选项,请参阅多个功能的帮助页面。

plot(rnorm(99), bty="n", axes=FALSE, xlab="", ylab="")
box(col="dodgerblue")
axis(1, col="dodgerblue", col.ticks="green", col.axis="orange", cex.axis=2)
axis(2, col="dodgerblue", col.ticks="green", col.axis="orange", cex.axis=0.8)
mtext("Index", side=1, line=3, col="red", cex=2)
mtext("Value", side=2, line=3, col="purple", cex=0.8)

(The resulting plot is ugly enough that I'll let you run the code yourself, rather than reproduce it here!) (结果图很丑,我会让你自己运行代码,而不是在这里重现它!)

查看 ?par 帮助页面以及相关的Quick-R 教程,了解您可以更改以修饰或注释基本 R 图的参数概述。

Ok, first timer here so please be generous with positive votings :)好的,第一次来这里,所以请慷慨地投赞成票:)

Other than ggplot2 I dont think you need anything fancy.除了 ggplot2 我认为你不需要任何花哨的东西。 Here is a Time-Series-Plot for your panel-background, axis-text and axis-title aaaand some way to add nice vertical lines to mark important days.这是您的面板背景、轴文本和轴标题 aaa 的时间序列图,以及一些添加漂亮垂直线以标记重要日子的方法。

your_data%>%
  ggplot(aes(x=Date, y=Transactions))+geom_line(colour='gold', size=1)+
  theme(panel.background = element_rect(fill='#363636'), plot.background = element_rect(fill='#363636'), 
        axis.text = element_text(colour='white', size = 10), axis.title = element_text(colour='white', size=12), 
        plot.title = element_text(colour='white'))+
  geom_vline(xintercept = as.Date(c('2020-11-08', '2020-11-29')), col='red', size=1)+
  labs(title='Abokäufe insgesammt')

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

相关问题 R xts 中的 xlab 和 ylab plot - R xlab and ylab in xts plot 如何在 R 中使用相同的 xlab 和 ylab 在一张图中绘制多个信号? - How to plot multiple signals in one graph with same xlab and ylab in R? 如何在R BAS软件包的诊断功能中更改xlab和ylab - How to change xlab and ylab in diagnostics function in R BAS package 如何使用R中的绘图功能更改散点图中x轴和y轴标签的字体大小和颜色? - How to change the font size and color of x-axis and y-axis label in a scatterplot with plot function in R? R:为图中的图例和 xlab 和 ylab 参数设置粗体文本? - R: make the text bold for the legend and the xlab & ylab parameters in a plot? R:plot()中的ylim和xlab / ylab对于grofit包不起作用 - R: ylim and xlab/ylab in plot() for grofit package not working 为什么在 x 和 y 轴列选择之间使用 ~ 而不是在 R 文档中看到的 plot(x,y, xlab, ylab) 中的常规 plot(x,y ) ? - Why use ~ between x and y axis column selections rather than the conventional plot(x,y ) in plot(x,y, xlab, ylab) seen in R documentation? (R) 在包 beanplot 的 beanplot 函数中更改 xlab、ylab 和标题的大小 - (R) Changing size of xlab, ylab, and title in beanplot function from package beanplot 如何更改 R 中欧拉图中的字体大小? - How to change font size in Euler plot in R? 无法更改R图的标题和xlab - Can't change the title and xlab of an R plot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM