Re: How to extract ImageSize?

*To*: mathgroup at smc.vnet.net*Subject*: [mg112842] Re: How to extract ImageSize?*From*: "István Zachar" <replicatorzed at gmail.com>*Date*: Sun, 3 Oct 2010 03:37:47 -0400 (EDT)*References*: <14523943.21633.1286013656382.JavaMail.root@m06> <001e01cb6246$7aaa3940$6ffeabc0$@net>

Dear David, thanks for the answer. Yes, ImageSize is the option I want to deal with. My problem is that I programmatically want to place self-made controls onto the axes of plots. I cannot include the full code here, as it involves multiple packages. A toy model is presented below: Consider, you have a more advanced slider you want to position (invisibly) over the full range of the x axis, to be able to easily change the plot range by directly draggin the x axis with your mouse. The red frame represents the dragger control below: p = Plot[Sin[x], {x, -2, 2}, ImageSize -> Medium]; Show[p, Epilog -> Inset[Framed[{}, FrameStyle -> Red, ImageSize -> {359, 10}], Scaled@{0, .5}, {Left, Center}]] Now how can I set the ImageSize of Framed, or the size of the inset directly to be the value of the full horizontal size of the image? Istvan On 2010.10.02. 17:28, David Park wrote: > p = Plot[Sin[x], {x, -2, 2}]; > > ImageSize is not an explicit option in p. > > Part[p, 2] > > {AspectRatio -> 1/GoldenRatio, Axes -> True, AxesOrigin -> {0, 0}, > PlotRange -> {{-2, 2}, {-1., 1.}}, PlotRangeClipping -> True, > PlotRangePadding -> {Scaled[0.02], Scaled[0.02]}} > > So it takes on its default value, which is Automatic and you can't extract > it from p. > > But if you wrap the actual plot output as: > > ImageSize /. AbsoluteOptions[plot output] > > and adjust the output size by dragging a handle, and then evaluate, you will > obtain a value for the option. > > {342.692, Automatic} > > (Are you sure you don't mean PlotRange?) > > > David Park > djmpark at comcast.net > http://home.comcast.net/~djmpark/ > > > From: István Zachar [mailto:zac at freemail.hu] > > Dear Group, > > is there any way to extract the exact numerical values of ImageSize > from a plot, if no explicit value was supplied by the user? > > In[53]:= ImageSize /. Options@Plot > > Out[53]= Automatic > > In[54]:= p = Plot[Sin[x], {x, -2, 2}]; > ImageSize /. AbsoluteOptions@p > > Out[55]= Automatic > > In[56]:= p = Plot[Sin[x], {x, -2, 2}, ImageSize -> Small]; > ImageSize /. AbsoluteOptions@p > > Out[57]= Small > > > > Istvan > > >