我的R条图并未显示出年度销售的差异
成功运行条形图后,我有一个问题,其中y轴上的数字在代码中而不是完整,而不是显示正常的数字,而是显示了诸如0E+00之类的代码。
我希望Y轴显示102,000至106,000。
条形图也有不同的数字。但这并没有清楚地显示出年度销售额的差异。
# Table of average total sales by year
yearly_sales <- DataSet %>% group_by(Year) %>% summarise(sales = mean(Weekly_Sales))
summarise(yearly_sales)
mycols <- c("#FF7F50", "#DE3163", "#6495ED")
# Bar chart for Average Yearly Sales 2010 to 2012
barplot(height = yearly_sales$sales, names = yearly_sales$Year, col = mycols)
我如何获取图表以清楚地显示销售的差异,以及如何获得实际值而不是0E+00
After successfully running my bar plot, I have a PROBLEM where the numbers on the y axis are in codes and not in full, and instead of showing normal figures, it shows codes like 0e+00.
I would like the Y axis to show between 102,000 and 106,000.
The bar plot also has different figures. But it is not showing clearly the difference in yearly sales.
# Table of average total sales by year
yearly_sales <- DataSet %>% group_by(Year) %>% summarise(sales = mean(Weekly_Sales))
summarise(yearly_sales)
mycols <- c("#FF7F50", "#DE3163", "#6495ED")
# Bar chart for Average Yearly Sales 2010 to 2012
barplot(height = yearly_sales$sales, names = yearly_sales$Year, col = mycols)
How can I get the chart to show clearly the difference in sales and how can I get the actual values too instead of 0e+00
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可以使用
YLIM
和XPD
来完成,尽管我以这种方式警告表示您的数据,因为它夸大了年份之间的真正差异,并且通常违反了数据可视化。您在问题中代表的数字更准确。无论如何,如果您想执行此操作:
ylim
设置了限制,XPD
在下轴处夹住悬垂。This can be done using
ylim
andxpd
, though I caution representing your data this way as it exaggerates the true difference between years and is a general violation of data visualization. The figure you represented in your question is more accurate.At any rate, if you wanted to do this:
ylim
sets the limits andxpd
clips the overhang at the lower axis.暂时禁用科学符号
或
form> form> formatc
in。就像人们如何在实际上很小的同时给他们统计数据,并给人留下巨大差异的印象,从而欺骗他们的读者。 请不要这样做。
与2010年的首次测量相比,显示差异的百分比可能更专业
。 “ https://i.sstatic.net/d2c2a.png” alt =“在此处输入图像说明”>
data:
Either temporally disabling scientific notation ,
or
formatC
ing.Just like @jpsmith I'm neither a fan of narrowing the x-axis, because that's exactly how folks pimp their statistics and give the impression of huge differences while they are actually tiny, thus deceiving their readers. Please don't do this.
It might be more professional to show the percentage differences, e.g. compared to the first measurement in 2010.
Data: