MathGroup Archive 2001

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

Search the Archive

Re: Q: How change font in legend?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26699] Re: Q: How change font in legend?
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 18 Jan 2001 00:57:08 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <943f1k$cra@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,


you may transform the text in the legend with

leg1 = 
    Graphics[Legend[{{Graphics[Text["\[EmptyCircle]", {0, 0}]], 
              "Search"}, {Graphics[Text["\[FilledSquare]", {0, 0}]], 
              "Reduce"}, {Graphics[Text["\[FilledUpTriangle]", {0, 0}]], 
              "Relax"}}, LegendBackground -> RGBColor[0.75, 0.75, 1]] /. 
        Text[txt_, pos___] :> 
          Text[txt, pos, TextStyle -> {FontFamily -> "Helvetica"}], 
      AspectRatio -> 0.9]

and combine the graphics and the legend with

Show[Graphics[{Rectangle[{0, 0}, {1, 1}, yourGraphics], 
      Rectangle[{0.15, 0.5}, {0.4, 1}, leg1]}, AspectRatio ->
Automatic]]


The legend box in the Legen package is placed in the same way as above.
Since this
produce a "scaling" of the PostScript code in the graphics, fonts, line
thickness
.. are scaled with the bounding box. Since the inner image knows nothing
about the
real dimensions  of the outer graphics you can't scale the inner figure
in a easy way.

The inner Graphics[] has it's own PostScript prolog and epilog and I
would expect
that 

yourFigureWithLegend /. Graphics[gr_,opts_] :>
Graphics[gr,AppendTo[opts,ColorOutput->GrayLevel]]

will  solve the color output problem

No, iut is not a bug, it's one of the more special features :-)

Regards
  Jens


Klaus Duellmann wrote:
> 
> To add a  legend to a plot I use the standard package Graphics`Legend
> together with the Plot or Listplot command. I can change the font used
> for axes labels or plot label by defining DefaultFont -> Whatever.
> 
> Question 1: DefaultFont does not change the font of the legend text! How
> can this be achieved?
> 
> Question 2) In the legend box the linestyles are printed together with
> the respective legend. However if the lines differ by thickness/dashing
> and not by color it's sometimes hard to recognize these differences in
> the legend. How can I make these lines better visible, e.g. in general
> thicker, without changing the size of the legend box itself?
> 
> For the plot I can change from colour output to graylevel using
> ColorOutput -> GrayLevel. But changing to graylevel does not change the
> linestyle in the legend, the lines there still remain in color.
> 
> Question 3) Is this a bug? Is there a workaround or something I am
> missing?
> 
> Any assistance in this is much appreciated.
> 
> Mathematica Version used: 4.0 (Windows NT)
> --
> 
> Klaus Duellmann
> 
> E-mail: k.duellmann at uni-mannheim.de


  • Prev by Date: idiom for recurrence relations
  • Next by Date: task
  • Previous by thread: Q: How change font in legend?
  • Next by thread: MathSource Package Corrected