[Biopython-dev] [Bug 2964] placing x-axis of graph track at the bottom or top of the track

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Mon Dec 7 11:48:32 UTC 2009


http://bugzilla.open-bio.org/show_bug.cgi?id=2964





------- Comment #4 from Daniel.Nicorici at gmail.com  2009-12-07 06:48 EST -------
Here is the cut down example of what I mean:

=====================================================
import Bio.SeqFeature
import Bio.Graphics.GenomeDiagram
import random

gdd=Bio.Graphics.GenomeDiagram.Diagram('Test diagram')


gdt_features=gdd.new_track(1)
gds_features=gdt_features.new_set()


feature=Bio.SeqFeature.SeqFeature(Bio.SeqFeature.FeatureLocation(25,125),strand=+1)
gds_features.add_feature(feature,name="Forward",label=True)

feature=Bio.SeqFeature.SeqFeature(Bio.SeqFeature.FeatureLocation(150,250),strand=None)
gds_features.add_feature(feature,name="Forward",label=True)

feature=Bio.SeqFeature.SeqFeature(Bio.SeqFeature.FeatureLocation(275,375),strand=-1)
gds_features.add_feature(feature,name="Forward",label=True)

# Add graph
gdt_features=gdd.new_track(2)
gds_features=gdt_features.new_set('graph')
# generate some random values for plotting
coverage=[]
coverage.append((50,float(0)))
coverage.extend( [ (i, random.uniform(0,100)) for i in xrange(51,100)])
coverage.append((100,float(0)))
coverage.append((250,float(0)))
coverage.extend( [ (i, random.uniform(50,400)) for i in xrange(251,400)])
coverage.append((400,float(0)))
gds_features.new_graph(coverage, 'coverage', style='bar',center=0)

gdd.draw(format='linear',orientation='landscape',pagesize='A4',fragments=1,start=1,end=500)
gdd.write("Test_gaph.pdf","pdf")
===========================================

The values which are plotted here in this are in range 0 to 400 and the
GenomeDiagram's y-axis range is from -400 to 400 when center is set to 0. It is
really odd choice of a y-axis range of -n to n when all the values which are to
be plotted are in range 0 to n.

The feature proposed here allows the entire track to be used instead of using
half of the track and also having a better range for y-axis.



(In reply to comment #2)
> I'm guessing you are talking about GenomeDiagram? If so, yes, tracks default to
> having the x-axis line at the middle y-value (center or centre=None). Try
> setting 
> center to zero when you create the Graph object. If you could give a cut down
> example it would be easier to help.
> 
> Peter
> 


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list