Hot answers tagged grid
11
While drag'n'drop isn't officially supported in Mathematica currently (Depending on your definition of support), I believe Wolfram is working on it for a future version, or at least more direct support. I can't remember which screencast, but something was mentioned about this in one of Steven Wolframs talks posted on the official Mathematica blog.
Now to ...
8
Depending on what you are doing, this might be better solved by using Graphics commands and building the display as a graphics object rather than a textural output. This however does the trick with just inserting elements into the grid shape:
gridDots[a_] := Module[{
rowspacing = Riffle[#, " ", {1, 1 + Last@Dimensions[a] 2, 2}] &,
colspacing = ...
7
Slightly less dirty:
d = 10;
t = Table[x, {d}, {d}];
Grid[MapAt[Item[#, Frame -> White] &, t, Tuples[{Range@d, {-2, -1}}]],
Dividers -> {#, #} &@Thread[(# -> Black &)[Range[3, d, 2]]]]
6
DynamicModule[{n = 3,
prefTable = ConstantArray[0, {3, 20, 7}],
lastName = ConstantArray["", {3}],
firstName = ConstantArray["", {3}],
ws = ConstantArray[0, {3}],
wsAmount = ConstantArray[Null, {3}],
wkndPref = ConstantArray[Null, {3}],
tabLabel = Array["Worker " <> ToString[#] &, {3}],
hours = DateString[DatePlus[{2012, 1, 1, 7, ...
6
Maybe
evenrows = Prepend[#, " "] & /@ (Join @@ Thread[{#, " "}] & /@ a);
oddrows = (Join @@ ConstantArray[{"\[CenterDot]", " "}, 8]);
Grid@Riffle[evenrows, {oddrows}, {1, -1, 2}]
?
6
Say you have two Grid:
First place the cursor at the end of the last row:
Then use menu command Add Row (please note the short-cut) to add as many rows as g2 has:
Then copy g2 by dragging from the items (not by select the whole grid or cell!):
Then select all empty rows you just created in g1 and paste:
6
You are asking:
Is there a simple option to add additional grid lines to the automatic ones? Thank you!
Well, I couldn't think of one, but out of curiosity I tried another approach (different to the Epilog I'd also rather choose). It seems to work pretty ok, so I figured I might share. As the other answer is much more versatile, I didn't spend too ...
5
Not sure why J.M.'s comment doesn't meet your requirements:
DateListPlot[
RandomReal[1, 20], {2000},
Joined -> True,
PlotRange -> All,
GridLines -> {Automatic, None},
Epilog -> {Directive[Thick, Magenta],
Line[
{Scaled[{0, -1}, {{2010, 1, 15}, 0}],
Scaled[{0, 1}, {{2010, 1, 15}, 0}]
}]}]
This incorporates Scaled, ...
5
I've started from the beginning, but with Grid with number of rows equal to 2*Length[range] and SpanFromAbove inside:
diffT[f_, range_, columns_] :=
Module[{n = Length@range, RF, dif, grid, form},
RF = Append[Evaluate@Riffle[#, SpanFromAbove], SpanFromAbove] &;
form = NumberForm[N@#, {5, 4}] &;
dif = ...
5
Update 3: Dealing with subgrids with different number of columns:
The main difficulty with differing number of columns is that both Spacings and ItemSizes in the subgrids have to be taken into account to get the same total width for all the subgrids. With $m$ subgrids indexed $i=1, ..., m$, where subgrid $g_i$ has $n_i$ columns with column widths
$w_{i ...
5
If you select your output cell (by the bracket on the right), it can be converted to bitmap via the Cell $\rightarrow$ Convert To $\rightarrow$ Bitmap menu option. For programmatic conversion:
If you prefer bitmaps, you can rasterize your table:
table = TableForm[{{5, 7}, {4, 2}, {10, 3}},
TableHeadings -> {{"A", "B", "C"}, {"1", "2"}}];
...
5
You can explicitly frame only those elements and not frame the rest. For example:
Grid[tab, Frame -> {None, None, {{1, 1} -> True, {1, 2} -> True}}]
To extend this to grids with $n$ columns in the header, you could replace the last element of the RHS of the Frame option with
Table[{1, i} -> True, {i, n}]
where n is an integer.
5
You can play with ItemSizes to make sure that the itemsizes in the two sub-grids are in alignment. For example:
Grid[{{"12", Grid[{{"1", "2"},
{Item["foo", ItemSize -> {5, 3}],
Item["bar", ItemSize -> {10, 3}]}}, Dividers -> All,
Alignment -> {Center, Center}]}, {"xxxx",
Grid[{{"1", "2"},
{Item["foo", ItemSize -> {10, ...
4
You can do :
alist = ConstantArray["", {20, 20}];
Dynamic@Panel[ Grid[alist, Background -> LightBlue, Spacings -> {1, 1},
ItemSize -> {0, 0}, Alignment -> {Center, Center}],
ImageSize -> {780, 480}, Background -> LightBlue]
alist[[1, 2]] = 10;
alist[[3]] = ConstantArray[3.14, {20}];
alist[[4, 2]] = 2.71;
alist[[4, 3]] = ...
4
another way
Grid[{
{Item["life alerts",Frame->True, Background -> Green,Alignment -> Left], SpanFromLeft},
{Item["Alert", Frame -> True], Item["% Life",Frame->True],Item["On day",Frame-> True]},
{"L1", 98, .52},
{"L2", 97, .77},
{"L3", 95, 1.27}
}, Alignment -> {Center}, Frame -> True]
This reference here ...
4
Here's one way to get random integers
Partition[RandomSample[Range[16]], 4]
This gets the first 16 integers in random order and formats them in a 4 by 4 block.
You can change the "16" to 400 and the "4" to 20 and get a larger matrix of such values.
3
In an HTML file, the appearance (and size) of elements is largely controlled by CSS properties and files, and by the users' browsers, which can choose to override the appearance (and the content, too).
Mathematica exports the contents of a grid as an HTML table:
<table class='Output'>
<tr style='vertical-align: baseline;'>
<td ...
3
This is something of a hack because I had to adjust the Dashing parameters by eye, but maybe it will give you an idea you can chew on.
t = Table[x, {10}, {10}];
Grid[t,
Dividers ->
{{{{True, False}}, {-1 -> False, -3 -> False, 1 -> False}},
{{{Dashing[{170., 100.}], False}}, {-1 -> False, 1 -> False}}}]
3
If you want to style a grid it is better IMO to do this with Grid options and keep content and styling separate: Grid[content, options(styling)]. Wrapping data elements in Item is (manually) inefficient and soon becomes impractical as the size of the data grows. It is also inefficient/impractical to do this if you are generating data dynamically in some way. ...
3
This is only a partial answer -- maybe only a fraction of a partial answer.
You define only one grid,week, which appears on all three panels. This means each of your workers is entering his/her choices into the same checkboxes, effectively undoing each other's choices. You really need a function that will return a new copy of your grid each time it is ...
3
Unfortunately, I have only a Linux and a Mac combination here to try but maybe I can give some hints. First, you should setup your systems in your local network so you can use ssh without password.
Then you should carefully study Preferences->Parallel->Remove Kernels->Custom launch command. This things is likely to need some adjustment. On my Linux machine ...
2
I think the problem is not the Mouseover itself, but with the redrawing of the Framed elements.
This, for example, is much faster:
Grid[Table[
Mouseover[Style[" ", Background -> Blue],
Style[" ", Background -> White]], {i, 50}, {j, 50}], Spacings -> 2,
Frame -> All]
2
Add a Frame -> All option to both plots and you'll see why excluding SpanFromLeft has such an effect. The SpanFromLeft is causing the cell height to adapt to the plot on its right.
With code: {4, "xxx", SpanFromLeft, plot, SpanFromLeft}
and with code: {4, "xxx", "", plot, SpanFromLeft}
2
There is a known-difficult problem in this:
How to convert between various ItemSize/ImageSize units?
Nevertheless:
ItemSize:
In Grid, w is measured in ems, and h in line heights. In GraphicsGrid, w and h are both measured in absolute printer's points.
Pane:
Pane[expr,{w,h}]
makes the pane be w points wide, and h points high, shrinking the ...
2
If you are not specifically set on creating an input grid using the Insert menu you can manually create the Box form that you want, including whatever alignment parameters you require. For example:
grid[dims__] :=
Cell[BoxData[GridBox[
ConstantArray["\[Placeholder]", {dims}],
GridBoxAlignment -> {"Columns" -> {{Left}}}
]], "Input"] // ...
2
I think the first issue is related to the fact that (docs >> Item >> Possible Issues)
"If Item is not the top-most item in the child of a function that supports Item, it will not work.
So a partial answer for the row selection problem can be obtained by moving Item outside EventHandler and using Framed with FrameStyle->None inside the EventHandler ...
2
I'm still not clear what you're looking for, but, with a slightly modified version of the code (from your web page):
list = DictionaryLookup[x__ /; x == StringReverse[x]];
SeedRandom[1];
col = Column@Riffle[
Framed[#,
Background -> RGBColor[RandomReal[{0,1}, 3]],
FrameMargins->2] & /@ list,
Framed[
TableForm[#, ...
2
It is not clear to me from your question what you need. You say:
I want to be able to accurately place the control objects without messing the sizes and have perfect predictable appearance on the front end.
Perhaps what you want can be done with Inset in Graphics, along with Deploy:
mygrid = ConstantArray["\[FilledSmallCircle]", {10, 10}];
mybutton1 ...
2
Here is another approach: define a function which can combine two grids preserving the union of their options.
rows = Partition[Range[5 3], 3];
g1 = Grid[rows[[;; 3]], Frame -> All]
g2 = Grid[rows[[4 ;;]], Frame -> All]
JoinGrids[Grid[data1 : {__}, opts1 : ___],
Grid[data2 : {__}, opts2 : ___]] :=
Grid[Join[data1, data2], ...
1
Using the data you provided :
data = {{20959.8`, 24054.4`, 2022.6`}, {20959.1`, 24054.6`, 2044.44`}, {20959.8`, 24053.`, 2026.29`},
{20957.7`, 24054.6`, 2014.58`}, {20958.6`, 24054.`, 2034.33`}, {16958.4`,31988.8`, 2110.8` },
{16803.8`, 31820.2`, 2107.43`}, {16650.3`, 31654.6`, 2102.42`}, {16496.8`, 31486.9`, 2101.77`},
{16341.7, ...
Only top voted, non community-wiki answers of a minimum length are eligible



