这样的数据用R语言怎么绘制成直方图,谢谢!
Sequence_sizeLength_distribution40024324500154126001123370092088007882900703910006674...
Sequence_size Length_distribution
400 24324
500 15412
600 11233
700 9208
800 7882
900 7039
1000 6674
1100 6352
1200 6166
1300 5816
1400 5880
1500 5781
1600 5787
1700 5457
1800 4994
1900 4873
2000 4429
2100 4035
2200 3581
2300 3294
2400 2916
2500 2782
2600 2564
2700 2439
2800 2262
2900 2029
3000 1785
>=3000 17842 展开
400 24324
500 15412
600 11233
700 9208
800 7882
900 7039
1000 6674
1100 6352
1200 6166
1300 5816
1400 5880
1500 5781
1600 5787
1700 5457
1800 4994
1900 4873
2000 4429
2100 4035
2200 3581
2300 3294
2400 2916
2500 2782
2600 2564
2700 2439
2800 2262
2900 2029
3000 1785
>=3000 17842 展开
2个回答
展开全部
储存原始数据后,将其在R中命名为test,运行以下数据就能得到你要的条形图了
tp <- barplot(test$Length_distribution, names.arg=test$Sequence_size, las =2, ylim=c(0,30000),col="black")
text(tp, test$Length_distribution, labels =test$Length_distribution,pos=4,srt=90,offset=0)
tp <- barplot(test$Length_distribution, names.arg=test$Sequence_size, las =2, ylim=c(0,30000),col="black")
text(tp, test$Length_distribution, labels =test$Length_distribution,pos=4,srt=90,offset=0)
展开全部
这样的数据用R语言怎么绘制成直方图代码如下:
turboc 直方图
#include <math.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <graphics.h>
int main()
{
int GraphDriver;
int GraphMode;
int i, x, y;
char buffer[5];
int data[]={7,3,12,6,9,5,8,11};
GraphDriver = DETECT;
initgraph(&GraphDriver, &GraphMode, "");
setcolor(15);
moveto(635, 461);
lineto(20, 461);
lineto(20, 20);
setcolor(15);
for (i = 1 ; i < 13; i++)
{
itoa(i, buffer, 10);
outtextxy(20 - textwidth(buffer), 456 - i * 36, buffer);
moveto(20, 460 - i * 36);
lineto(23, 460 - i * 36);
}
setfillstyle(SOLID_FILL, 1);
for (i = 0 ; i < 8; i++)
{
moveto(i * 50 + 49, 461);
lineto(i * 50 + 49, 465);
outtextxy(i * 50 + 51, 463, itoa(i + 1, buffer, 10));
bar(i * 50 + 35, 460 - data[i] * 36, i * 50 + 65, 460);
}
getch();
closegraph();
}
turboc 直方图
#include <math.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <graphics.h>
int main()
{
int GraphDriver;
int GraphMode;
int i, x, y;
char buffer[5];
int data[]={7,3,12,6,9,5,8,11};
GraphDriver = DETECT;
initgraph(&GraphDriver, &GraphMode, "");
setcolor(15);
moveto(635, 461);
lineto(20, 461);
lineto(20, 20);
setcolor(15);
for (i = 1 ; i < 13; i++)
{
itoa(i, buffer, 10);
outtextxy(20 - textwidth(buffer), 456 - i * 36, buffer);
moveto(20, 460 - i * 36);
lineto(23, 460 - i * 36);
}
setfillstyle(SOLID_FILL, 1);
for (i = 0 ; i < 8; i++)
{
moveto(i * 50 + 49, 461);
lineto(i * 50 + 49, 465);
outtextxy(i * 50 + 51, 463, itoa(i + 1, buffer, 10));
bar(i * 50 + 35, 460 - data[i] * 36, i * 50 + 65, 460);
}
getch();
closegraph();
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询