MathGroup Archive 2011

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

Search the Archive

Re: Nasti jitter in plotsize

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118011] Re: Nasti jitter in plotsize
  • From: Helen Read <readhpr at gmail.com>
  • Date: Fri, 8 Apr 2011 04:15:28 -0400 (EDT)
  • References: <ink9d8$gc2$1@smc.vnet.net>

On 4/7/2011 8:07 AM, roby wrote:
> Dear all,
>
> Manipulate[Plot[Sin[1/k x], {x, -k \[Pi], k \[Pi]}], {k, 1, 10}]
>
> I want to scale my x-axis simultaneously with my function (no I dont
> want to zoom the function)
> What happens is a small jitter of the plot size.
> This jitter exactly happens when the most left (most right) tick mark
> value coincidences with the plot border.
> I tried to remove the first and last tick of the final plot to avoid
> the problem.
>
> I was able to extract the ticks and remove the very first and last
> ones of the plot like this:
> With[{k=3},
> (Plot[Sin[1/k], {x, - k \[Pi], k \[Pi]}] // First@AbsoluteOptions[#,
> Ticks]&) /.
>   (Ticks ->  {x_, y_}) :>  (Ticks ->  {Rest@Most[x], Rest@Most@y})
> ]
>
> but I failed by automaticaly (not by hand) replacing the original
> ticks with with the modifyed ticks in the plot.

Add some ImagePadding. Also, I think it is almost always a good idea to 
set an explicit PlotRange when using Manipulate.

Manipulate[
  Plot[Sin[1/k x], {x, -k \[Pi], k \[Pi]}, PlotRange -> {-1.2, 1.2},
   ImagePadding -> 20], {k, 1, 10}]



--
Helen Read
University of Vermont


  • Prev by Date: Re: Nasti jitter in plotsize
  • Next by Date: Re: Nasti jitter in plotsize
  • Previous by thread: Re: Nasti jitter in plotsize
  • Next by thread: Re: Nasti jitter in plotsize