aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2019-03-08 10:41:40 +0300
committerBonfaceKilz2020-08-08 03:26:09 +0300
commit6e1102e36737a3f48a74cf431819c269c54f2601 (patch)
treebb889457103dd67c8bc5005cf14c9297a61ea70e
parentdcd053e0249b14c938d94eb749a8b4095c80be29 (diff)
downloadgenenetwork2-6e1102e36737a3f48a74cf431819c269c54f2601.tar.gz
Use draw_rotated_text()
Use the new draw_rotated_text() function to draw the text rotated as was formerly done. * wqflask/utility/Plot.py (plotBar): Use draw_rotated_text(). * wqflask/wqflask/marker_regression/display_mapping_results.py: (DisplayMappingResults) Use draw_rotated_text().
-rw-r--r--wqflask/utility/Plot.py14
-rw-r--r--wqflask/wqflask/marker_regression/display_mapping_results.py24
2 files changed, 21 insertions, 17 deletions
diff --git a/wqflask/utility/Plot.py b/wqflask/utility/Plot.py
index e7115036..d4373412 100644
--- a/wqflask/utility/Plot.py
+++ b/wqflask/utility/Plot.py
@@ -38,7 +38,7 @@ from numarray import ones, array, dot, swapaxes
import webqtlUtil
import corestats
from base import webqtlConfig
-
+from utility.pillow_utils import draw_rotated_text
import utility.logger
logger = utility.logger.getLogger(__name__ )
@@ -219,12 +219,12 @@ def plotBar(canvas, data, barColor=BLUE, axesColor=BLACK, labelColor=BLACK, XLab
font=labelFont,fill=labelColor)
if YLabel:
- im_drawer.text(
- text=YLabel,
- xy=(19,
- yTopOffset+plotHeight-(plotHeight-im_drawer.textsize(
- YLabel,font=labelFont)[0])/2.0),
- font=labelFont,fill=labelColor,angle=90)
+ draw_rotated_text(canvas, text=YLabel,
+ xy=(19,
+ yTopOffset+plotHeight-(
+ plotHeight-im_drawer.textsize(
+ YLabel,font=labelFont)[0])/2.0),
+ font=labelFont, fill=labelColor, angle=90)
labelFont=ImageFont.truetype(font=VERDANA_FILE,size=16)
if title:
diff --git a/wqflask/wqflask/marker_regression/display_mapping_results.py b/wqflask/wqflask/marker_regression/display_mapping_results.py
index 39067fc5..b03902a5 100644
--- a/wqflask/wqflask/marker_regression/display_mapping_results.py
+++ b/wqflask/wqflask/marker_regression/display_mapping_results.py
@@ -45,6 +45,7 @@ from utility import Plot
from utility.benchmark import Bench
from wqflask.interval_analyst import GeneUtil
from base.webqtlConfig import TMPDIR, GENERATED_TEXT_DIR, GENERATED_IMAGE_DIR
+from utility.pillow_utils import draw_rotated_text
import utility.logger
logger = utility.logger.getLogger(__name__ )
@@ -1519,11 +1520,12 @@ class DisplayMappingResults(object):
if lastGene == 0:
- im_drawer.text(
- text="%s" % (_chr[j].name),
+ draw_rotated_text(
+ canvas, text="%s" % (_chr[j].name),
+ font=ImageFont.truetype(font=VERDANA_FILE,
+ size=12),
xy=(geneStartPix,
geneYLocation+17+2*maxind*self.EACH_GENE_HEIGHT*zoom),
- font=ImageFont.truetype(font=VERDANA_FILE, size=12),
fill=BLACK, angle=-90)
oldgeneEndPix = geneEndPix;
@@ -1804,9 +1806,10 @@ class DisplayMappingResults(object):
(startPosX+tickdists*plotXScale, yZero + 7)),
fill=BLACK, width=1*zoom)
if j % 2 == 0:
- im_drawer.text(
- xy=(startPosX+tickdists*plotXScale, yZero+10*zoom),
- text=str(tickdists), fill=BLACK, font=MBLabelFont, angle=270)
+ draw_rotated_text(
+ canvas, text=str(tickdists), font=MBLabelFont,
+ xy=(startPosX+tickdists*plotXScale,
+ yZero+10*zoom), fill=BLACK, angle=270)
startPosX += (self.ChrLengthDistList[i]+self.GraphInterval)*plotXScale
megabaseLabelFont = ImageFont.truetype(font=VERDANA_FILE, size=int(18*zoom*1.5))
@@ -2037,11 +2040,12 @@ class DisplayMappingResults(object):
LRSLODFont=ImageFont.truetype(font=VERDANA_FILE, size=int(18*zoom*1.5))
yZero = yTopOffset + plotHeight
- im_drawer.text(
- text=self.LRS_LOD,
- xy=(xLeftOffset - im_drawer.textsize("999.99", font=LRSScaleFont)[0] - 15*(zoom-1),
+ draw_rotated_text(
+ canvas, text=self.LRS_LOD, font=LRSLODFont,
+ xy=(xLeftOffset - im_drawer.textsize(
+ "999.99", font=LRSScaleFont)[0] - 15*(zoom-1),
yZero - 150 - 300*(zoom - 1)),
- font=LRSLODFont, fill=BLACK, angle=90)
+ fill=BLACK, angle=90)
for item in LRSAxisList:
if LRS_LOD_Max == 0.0: