MathGroup Archive 2006

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

Search the Archive

Re: Re: Re: Colored Tick Labels?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67050] Re: [mg66978] Re: [mg66928] Re: Colored Tick Labels?
  • From: Bruce Miller <brucem at wolfram.com>
  • Date: Thu, 8 Jun 2006 04:53:20 -0400 (EDT)
  • References: <e5reku$h2e$1@smc.vnet.net> <200606040510.BAA13037@smc.vnet.net> <200606061027.GAA20612@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

A workaround for this is to Rationalize the numbers you are borrowing.

In[2]:= plt = Plot[Sin[t], {t, 0, 2},PlotLabel -> 1,
     Ticks->{{1/2,1,3/2,2},Automatic}];

In[3]:= AbsoluteOptions[plt, PlotLabel]

Out[3]= {PlotLabel -> 1}

In[4]:= ao = AbsoluteOptions[plt,Ticks][[1,2,1]]

Out[4]= {{0.5, 0.5, {0.00625, 0.},
     {GrayLevel[0.], AbsoluteThickness[0.25]}},

   {1., 1., {0.00625, 0.},
     {GrayLevel[0.], AbsoluteThickness[0.25]}},

   {1.5, 1.5, {0.00625, 0.},
     {GrayLevel[0.], AbsoluteThickness[0.25]}},

  {2., 2., {0.00625, 0.},
     {GrayLevel[0.], AbsoluteThickness[0.25]}}}

In[5]:= Plot[Cos[x],{x,0,2}, Ticks->{Rationalize[ao],Automatic}];


Bruce Miller
Technical Support
Wolfram Research, Inc.
support at wolfram.com
http://support.wolfram.com/



On Jun 6, 2006, at 5:27 AM, Gianluca Gorni wrote:

> Unfortunately it seems that AbsoluteOptions[] applies N[]
> to all its output. Tick labels that were not floating-point
> numbers will get corrupted.
>
> For example try with
>
> AbsoluteOptions[Plot[Sin[x], {x, 0, Pi}, Ticks -> {{E}, {1/2}}], Ticks]
>
> Any exact numeral in PlotLabel will be affected too.
>
> I sent a report to wri about this in 2003.
>
> Gianluca Gorni
>
> On 4 giu 2006, at 07:10, bghiggins at ucdavis.edu wrote:
>
>>  Not sure I have a complete answer, but here are some possibilities to
>> examine:
>>
>> Suppose you have the following plot
>>
>> plt = Plot[Sin[x], {x, -1, 1}]
>>
>> You can extract the Ticks from this plot using AbsoluteOptions and
>> then
>> modify them. In the following example I make the x tick values Blue
>> and
>> the y tick values Red
>>
>> myTicks = {(Ticks /. AbsoluteOptions[plt,
>>             Ticks])[[1]] /. {x_Real, y_Real, z__} -> {x, StyleForm[y,
>>         FontColor ->  Blue], z}, (Ticks /. AbsoluteOptions[plt,
>> Ticks])[[
>>         2]] /. {x_Real, y_Real, z__} -> {x,
>>             StyleForm[y, FontColor -> Red], z}}
>


  • Prev by Date: Re: Any ideas on expanded results for SetPartitions in discrete-combinatoria
  • Next by Date: Re: Two questions (1) Sollve and (2) Precision
  • Previous by thread: Re: Re: Colored Tick Labels?
  • Next by thread: Re: Re: Re: Colored Tick Labels?