小编tws*_*ewx的帖子

如何更改条形图y轴以表示其值?

我希望只绘制落在频段内的测量百分比.我将它们分为低中和高中.但是当我绘制它们时,它将代表性地显示不显示值(参见图像,例如输出)

代码如下

percents <- data.frame(TI = c("Low","Med","High"),
                   percent = c(format((totallowcount/totalvaluescount)*100,digits=3),
                             format((totalmedcount/totalvaluescount)*100,digits=3),
                             format((totalhighcount/totalvaluescount)*100,digits=3)))

TIbarplot <- ggplot(data = percents, aes(x = TI, y = percent)) + 
  geom_bar(stat = 'identity') + 
  scale_x_discrete(limits = c("Low","Med","High"))
Run Code Online (Sandbox Code Playgroud)

产量条状图.

我查看了做scale_y_discrete,scale_y_discrete(limits=c(0,25,50,100))但一直在为它获取错误.

Error in matrix(value, n, p) : 'data' must be of a vector type, was 'NULL' In addition: Warning message: Removed 3 rows containing missing values (position_stack).

r ggplot2

2
推荐指数
1
解决办法
48
查看次数

您是否可以提示用户输入,以便他们可以根据需要保存文件?

我希望我的用户能够按照自己的意愿保存文件.我正在编写的这个程序将被许多不同的人用于数百个文件.我希望这是可能的

filename = input("Enter Desired File Name:")
F = open(filename,'wb')
Run Code Online (Sandbox Code Playgroud)

作为试运行,我运行它并输入名称Hello_Buddy.csv并收到此错误.

Traceback (most recent call last):
    File "C:\Users\Bud\Desktop\School\Project Data\OWLeS\Radiosonde
Data\Python\Simple\Moving Average.py", line 44, in <module>
    filename = input("Enter Desired File Name:")
  File "<string>", line 2, in <module>
NameError: name 'Hello_Buddy' is not defined
Run Code Online (Sandbox Code Playgroud)

python input

1
推荐指数
1
解决办法
42
查看次数

标签 统计

ggplot2 ×1

input ×1

python ×1

r ×1