<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>生信菜鸟团 &#187; 3D条形图</title>
	<atom:link href="http://www.bio-info-trainee.com/tag/3d%e6%9d%a1%e5%bd%a2%e5%9b%be/feed" rel="self" type="application/rss+xml" />
	<link>http://www.bio-info-trainee.com</link>
	<description>欢迎去论坛biotrainee.com留言参与讨论，或者关注同名微信公众号biotrainee</description>
	<lastBuildDate>Sat, 28 Jun 2025 14:30:13 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.33</generator>
	<item>
		<title>用R语言画3D条形图</title>
		<link>http://www.bio-info-trainee.com/140.html</link>
		<comments>http://www.bio-info-trainee.com/140.html#comments</comments>
		<pubDate>Fri, 13 Mar 2015 11:42:58 +0000</pubDate>
		<dc:creator><![CDATA[ulwvfje]]></dc:creator>
				<category><![CDATA[R]]></category>
		<category><![CDATA[计算机基础]]></category>
		<category><![CDATA[3D条形图]]></category>

		<guid isPermaLink="false">http://www.bio-info-trainee.com/?p=140</guid>
		<description><![CDATA[用R语言画3D条形图 我暂时找到的能画3D条形图的R语言包就有四个，接下来我们分 &#8230; <a href="http://www.bio-info-trainee.com/140.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p style="text-align: center;"><b>用R语言画3D条形图</b></p>
<p>我暂时找到的能画3D条形图的R语言包就有四个，接下来我们分别比较一下它们的优劣</p>
<p>library(rgl)</p>
<p>library(scatterplot3d)</p>
<p>library(epade)</p>
<p>library(latticeExtra)</p>
<p>数据塑形包（reshape2）也需要加载</p>
<p><span id="more-140"></span></p>
<p>library(reshape2)</p>
<p>第一步读入数据</p>
<p>a=read.table("vj-all",header=T)</p>
<p>数据形式如下</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/用R语言画3D条形图398.png"><img class="alignnone size-full wp-image-141" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/用R语言画3D条形图398.png" alt="用R语言画3D条形图398" width="588" height="122" /></a></p>
<p>我们需要以pos_V作为X轴，pos_J作为Y轴，然后后面的数据作为Z轴条形的高度。</p>
<p>dat=a[,1:3]</p>
<p>我们只挑取第一个H.1这个个体的数据来作图</p>
<p>一、scatterplot3d包里面的scatterplot3d函数画的3D条形图，它接受一个X,Y,Z变量组合的数据框来描述数据。</p>
<p>rbc &lt;- rainbow(nrow(dat))</p>
<p>scatterplot3d(dat,type='h',lwd=5,pch='',color=rbc,box=F, xlab = "V-gene", ylab = "J-gene", zlab = "Percent",y.ticklabs=unique(dat[,2]),x.ticklabs = unique(dat[,1]))</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/用R语言画3D条形图931.png"><img class=" size-full wp-image-142 aligncenter" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/用R语言画3D条形图931.png" alt="用R语言画3D条形图931" width="546" height="198" /></a></p>
<p>怎么评价这个图呢，它的确能很好的展示我们的数据，但是我研读了源码也找不到该如何把X轴的坐标标记弄好，所以就排除它了。</p>
<p>二、rgl包里面的plot3d包画3D条形图，它接受一个X,Y,Z变量组合的数据框来描述数据。</p>
<p>plot3d(dat,type='h',lwd=5,pch='',col=rbc,box=F, xlab = "V-gene", ylab = "J-gene", zlab = "Percent")</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/用R语言画3D条形图1336.png"><img class=" size-full wp-image-143 aligncenter" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/用R语言画3D条形图1336.png" alt="用R语言画3D条形图1336" width="448" height="485" /></a></p>
<p>X,Y,Z轴的坐标标记都很难调整，而且画的好丑，也排除掉。</p>
<p>三、epade包里面的bar3d.ade函数画3D条形图，它接受一个矩阵来描述数据。</p>
<p>par(las=2,cex=1.5)</p>
<p>tmp=dcast(dat,pos_V~pos_J)     #这里是把长形数据变成宽数据</p>
<p>data=as.matrix(tmp[,-1])</p>
<p>rownames(data)=tmp[,1]</p>
<p>bar3d.ade(t(data), wall=6,ylab = "Percent",zw=0.3)</p>
<p><a href="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/用R语言画3D条形图1771.png"><img class=" size-full wp-image-144 aligncenter" src="http://www.bio-info-trainee.com/wp-content/uploads/2015/03/用R语言画3D条形图1771.png" alt="用R语言画3D条形图1771" width="550" height="284" /></a></p>
<p>不知道为什么，大家居然觉得这个好看，那我就不解释最后一个包（latticeExtra）了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bio-info-trainee.com/140.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
