简体   繁体   English

如何在PowerBi中使用R中的直方图在X轴上标记每个条

[英]How to label each bar on X axis using histogram in R in PowerBi

I'm using R and PowerBI. 我正在使用R和PowerBI。 I use hist() function for histogram and it does the job. 我将hist()函数用于直方图,即可完成工作。 I'm not able to put labels for each bar on x axis. 我无法在x轴上为每个条形贴标签。 The closes parameter I found is called labels = TRUE 我发现的closes参数称为labels = TRUE

在此处输入图片说明

I want each bar to have a value that is increment of 10,000 in this case. 在这种情况下,我希望每个小节的值都是10,000。

assign the histogram to a variable and then obtain the values to plot and co-ordinates to plot at from that variable. 将直方图分配给变量,然后从该变量获取要绘制的值和要绘制的坐标。 Set xaxt = "n" to supress x-axis at first and then use axis to add the desired x-axis. 首先将xaxt = "n"设置为xaxt = "n" x轴,然后使用axis添加所需的x轴。 Read more at ?par 了解更多信息?par

set.seed(42)
x = rnorm(250)
h = hist(x, xaxt = "n")
text(x = h$mids, y = h$counts, labels = h$counts, pos = 3)
axis(side = 1, at = h$mids, seq_along(h$mids)*10000, las = 2)

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

相关问题 在R中的直方图中标记x轴正确 - Label the x axis correct in a histogram in R 是否有可能在 x 轴上添加变量的 label “主题 ID 号”R-geom_histogram(所有主题的每个条上的 ID)并在 y 轴上计数 - Is there a possibility to add label "subject ID number" R-geom_histogram (ID on each bar for all subjects) of variable on x-axis and count on y-axis 在 R 中使用 mfrow:如何给每个子图一个不同的 y 标签和一个 x 轴 label - using mfrow in R : how do you give each subplot a different y-label and the x-axis one label x轴上的2个变量用于R中的直方图 - 2 variables on the x axis for a histogram in R 如何在 geom_histogram 中的每个条形顶部旋转 label - How to rotate label in the top of each bar in geom_histogram 使用R处理日期时格式化直方图x轴 - Formatting histogram x-axis when working with dates using R 在 r 中使用 ggplot2 在 x 轴上的直方图中指定 bin - Specifying bins in histogram on the x- axis using ggplot2 in r R:如何标记箱线图的x轴 - R: how to label the x-axis of a boxplot 如何使用 R 中的 Shiny 中的滑块动态更新直方图的 x 轴范围 - How to dynamically update the range of x-axis of histogram using sliders in Shiny in R 如何在使用R中的Lattice软件包制作的直方图中更改x轴上的比例? - How to change the scales on the x axis in the Histogram made using Lattice package in R?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM