MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Text XY-size control in 2D graphics?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85093] Text XY-size control in 2D graphics?
  • From: Gordon Robertson <agrobertson at telus.net>
  • Date: Mon, 28 Jan 2008 03:27:16 -0500 (EST)

I would like to generate sequence logos (http://weblogo.berkeley.edu/ 
examples.html) using v6's 2D graphics 'Text'.

Below is an early and unsuccessful attempt to build a single column  
of stacked ACGT characters. Clearly I don't understand how to  
position letters correctly, using settings for text size, position  
and offset, and image size... but I imagine that it's possible to do  
this. What's currently a bigger concern is that I need to control the  
height of a character while keeping its width fixed, but for sizing  
letters I see only FontSize[param]. I've checked the online  
documentation, Options[Text], 'Mma Navigator', and Google, without  
finding how to do this.

Can anyone help by showing how to control Text character width and  
height independently?

ff = "Helvetica";
Show[
  Graphics[
   Text[Style["A", Green, Bold, FontSize -> Scaled[0.5], FontFamily - 
 > ff], {1,
      0}, {0, -1}]],
  Graphics[
   Text[Style["C", Blue, Bold, FontSize -> Scaled[0.3], FontFamily ->  
ff], {1,
     0}, {0, -3}]],
  Graphics[
   Text[Style["G", RGBColor[1, 0.7, 0], Bold, FontSize -> Scaled[0.15],
     FontFamily -> ff], {1, 0}, {0, -4.5}]],
  Graphics[
   Text[Style["T", Red, Bold, FontSize -> Scaled[0.05], FontFamily ->  
ff], {1,
     0}, {0, -7}]],
  Frame -> True, FrameLabel -> {None, "bits"}, FrameTicks -> {{{0.5,  
1, 1.5, 2}, None}, {{1}, None}},
  PlotRange -> {{0.5, 1.5}, {0, 2}}, AspectRatio -> 1, ImageSize -> 200
  ]

G
--
Gordon Robertson
Canada's Michael Smith Genome Sciences Centre
Vancouver BC Canada



  • Prev by Date: Re: Maximize command - trigonometric function
  • Next by Date: Re: file reading & processing
  • Previous by thread: Re: Shared color scaling
  • Next by thread: Re: Text XY-size control in 2D graphics?