Re: ItemSize and ImageSize->Full , I do not understand what happens
- To: mathgroup at smc.vnet.net
- Subject: [mg105315] Re: ItemSize and ImageSize->Full , I do not understand what happens
- From: "Nasser M. Abbasi" <nma at 12000.org>
- Date: Fri, 27 Nov 2009 06:30:37 -0500 (EST)
Sorry everyone, I found the problem.
I had earlier written SetOptions[Plot,......] in another window.
I was trying things out in another window and I completely forgot about that
setting.
The Plot options that I set earlier were causing the problem below. Once I
realized this, and restarted the kernel, now I can see that ImageSize->Full
works as expected.
So, please ignore everything I said below. Just a user error. I have to be
carful from now on with the use of SetOptions.
Since we are on the subject, I could not find a way to reset options back to
default. One way I do it now is
default=Options[Plot]; <---- do this initially. (may be in init.m)
SetOptions[Plot,..new options...];
now to go back, I do
SetOptions[Plot,default]
But It would be really nice if there is a way to say SetOptions[Plot,
DefaultOptions ] or a new command called ResetOptions[Plot]; without having
to do the above or to restart the kernel.
or something like this.
--Nasser
"Nasser M. Abbasi" <nma at 12000.org> wrote in message news:...
> Just to add something. What I really like to obtain is the same effect as
> the following command
>
> Grid[{{
>
> Framed[ Plot[Sin[x], {x, -Pi, Pi},
> Frame -> False,
> ImageSize -> Scaled[1],
> ImageMargins -> 0,
> ImagePadding -> 0]
> ]
> }},
> ItemSize -> 20, Frame -> All
> ]
>
> You can see the image (plot here) completely fill all the space. This is
> what I want.
>
> But without the use of Scaled[], and without having to specify a numerical
> value for the plot ImageSize or width and hight. i.e. by only giving the
> one numerical value for the ItermSize, and the rest should be done
> Automatically just like the above, but again, without the use of Scaled.
> This way, I only need to change one value and not worry about different
> combinations affecting each others.
>
> I am still trying different options, but none seems to work as Scaled[1]
> does....
>
> "Nasser M. Abbasi" <nma at 12000.org> wrote in message news:...
>> Version 7
>>
>> One of the problems I always have with using Manipulate is getting the
>> plots and images to align and fit and have the sizes I want when they are
>> inside a Grid (or Column) and having the whole thing be of the right size
>> when everything is put togother.
>>
>> So, I am trying now to make a plot completely fill a given Grid or Column
>> cell (so that no empty space exist around the plot).
>>
>> I normally do this by playing around with the options ItemSize for the
>> Grid, and with ImageSize for the plot, and with AspectRatio for the plot
>> command, and with ImagePadding until I get the right size and layout
>> looks good.
>>
>> But I am finally decided to step back and see if I can find an easier way
>> than this trial and error method.
>>
>> One way to make an Image fit best inside a Grid or Column element is by
>> the use of Scaled[1], as in
>>
>> Column[{Plot[Sin[x], {x, -Pi, Pi}, ImageSize -> Scaled[1]]}, ItemSize ->
>> 20, Frame -> All]
>>
>> However, I do not want to use Scaled[] (for other reasons). So from the
>> help under ImageSize it says:
>>
>> "For an object that appears as an element in a Grid, ImageSize->Full
>> corresponds to the full width of the cell in the grid. "
>>
>> Sound good. So based on the above, if I use ImageSize->Full I should get,
>> what I thought, the same output or may be close to what I had with
>> Scaled[1], but something very weird happens instead:
>>
>> (be careful when using this command below, you'll notice strange output,
>> and the scroll bar will no longer work)
>>
>> Column[{Plot[Sin[x], {x, -Pi, Pi}, ImageSize -> Full]}, ItemSize -> 20,
>> Frame -> All]
>>
>> I do not understand why Mathematica did what it did. I am giving an
>> specific ItemSize and saying ImageSize->Full, so what is wrong with this?
>>
>> Thanks,
>> --Nasser
>>
>
>