Tag Info

Hot answers tagged

24

If you can put your schedule into a list like this: schedule = { {"Lundi", "09:30", 1, "Inorg 1", "N-515", Lighter[Orange, 0.5]}, {"Lundi", "10:30", 1, "Physique 4", "N-515", Lighter[Cyan, 0.5]}, {"Mardi", "9:30", 2, "Macromol 2", "G-815", Lighter[Green, 0.3]}, {"Mardi", "14:30", 1, "Inorg 1", "répet N-515", Lighter[Orange, 0.5]}, ...


21

You can also use the HorizontalGauge function introduced in version 9. For example: bar = HorizontalGauge[#, {0, 100}, GaugeMarkers -> "ScaleRange", GaugeStyle -> {Darker@Green, GrayLevel[0.95]}, TicksStyle -> None, GaugeFrameSize -> None, ScalePadding -> 0, ImageSize -> 200, AspectRatio -> 1/5, LabelStyle -> None, ...


21

I liked rm-rf's gauged solution so much that I made an interactive version: bar[n_] := DynamicModule[{x = n}, HorizontalGauge[Dynamic[x], {0, 100}, GaugeMarkers -> "ScaleRange", GaugeStyle -> {Darker@Green, GrayLevel[0.95]}, TicksStyle -> None, GaugeFrameSize -> None, ScalePadding -> 0, ImageSize -> 200, AspectRatio -> 1/5, ...


16

Something like this? Grid[Map[Graphics[{GrayLevel[0.8], Rectangle[Scaled[{0, 0}], Scaled[{#, 1}]], Black, Style[Text[#], Large]}, AspectRatio -> 0.2] &, RandomReal[{0, 1}, {4, 3}], {2}], Frame -> All] Of course you can place the Text and style to taste. Here is a slightly more complex version: Grid[Map[Graphics[{GrayLevel[0.8], ...


15

Here's my go at it. This tells you if two line segments intersect (unless they lie on the same line, in which case it fails horribly): ClearAll[segmentsIntersect]; segmentsIntersect[{a_, b_}, {p_, q_}] := Module[{s, t, soln}, soln = NSolve[a + t (b - a) == p + s (q - p), {s, t}]; If[Length@soln == 0, False, (0 <= s <= 1 && 0 <= t ...


15

Mathematica has lots of Graphics primitives for you to work with, as well as directives such as Thick, Dashed, Red, etc. I'll use Arrow below. You can specify the value of the GridLines option as a function. Using GridLines -> Range will give lines on a 1:1 grid starting from the extreme lower left of the graphic, as set with PlotRange or determined ...


15

GraphicsRow takes a PlotLabel option: p1 = Plot[Sin[x], {x, 0, Pi}, PlotLabel -> Sin]; p2 = Plot[Cos[x], {x, 0, Pi}, PlotLabel -> Cos]; GraphicsRow[{p1, p2}, PlotLabel -> "Two plots"]


12

This is my implementation using Graphics primitives and rules. Here's the final result; the implementation details and edge cases follow. 1. General approach First, we start with a single square and build up a test grid: square = Polygon[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}]; grid = Graphics[{EdgeForm[Black], FaceForm[None], Table[Transpose@First@square ...


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 ...


9

The Pane construct is quite flexible. I cannot imagine not using it with table for fluid sizes control and features. Here are your data: data={{"000000000\n111111111\n222222222","000000000"},{"000000000","000000000"}} This will fix the cell size and cut off the content if it won't fit: Grid[Map[Pane[#, ImageSize -> {80, 30}] &, data, {2}], Frame ...


9

Here is an ILP approach. It can be modified to alter requirements e.g. if a course has a lab, must take neither or both, maybe insist on at most one instructor with the lowest rating, at most two classes before 9 AM, have courses that meet on multiple days, etc. I entered it all by hand although clearly one could use Import and further processing. courses ...


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 = ...


8

GridLines works in Graphics Graphics[{ {Thick, Darker[Red], Arrow[{{0, 0}, {1, 1}}]}, {Dashed, Arrow[{{0, 0}, {1, 0}}]}, {Dashed, Arrow[{{1, 0}, {1, 1}}]}, Text[Style["R", Italic, Large], {.5, .5}, {0, -1}], Text[Style["\[Theta]", Large], {.2, .1}, {-1, 0}] }, GridLines -> Automatic, GridLinesStyle -> LightGray, PlotRange -> {{-1, 2}, ...


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]]]]


7

Possibly more versatile, but you have to mess with text overlapping your plots, but GraphicsRow also accepts Epilog GraphicsRow[{Plot[Sin[x], {x, 0, 4 Pi}], Plot[Cos[x], {x, 0, 4 Pi}]}, Spacings -> Scaled[0.4], Epilog -> Inset["Plot Title", Scaled[{0.5, 0.95}]]]


7

When I need more interface control, I usually do something like this: p1=Plot[Sin[x],{x,0,Pi},PlotLabel->Sin,ImageSize->150]; p2=Plot[Cos[x],{x,0,Pi},PlotLabel->Cos,ImageSize->150]; title=Panel[Style["Test Label",White,20],ImageSize->300,Background->Orange,Alignment->Center]; ...


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

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"}}]; ...


6

Maybe evenrows = Prepend[#, " "] & /@ (Join @@ Thread[{#, " "}] & /@ a); oddrows = (Join @@ ConstantArray[{"\[CenterDot]", " "}, 8]); Grid@Riffle[evenrows, {oddrows}, {1, -1, 2}] ?


6

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 ...


6

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, ...


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 ...


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

As Pinguin Dirk comments there is an example of exactly this in the documentation: Grid[Table[x, {4}, {7}], Background -> {None, None, {{1, 1} -> Pink, {3, 3} -> Red}}] Those who value brevity may wish to note that implicit Null may be used in place of None: Background -> {, , {{1, 1} -> Pink, {3, 3} -> Red}} You can also use Item ...


6

Here's one way that straigthforwardly makes a table of plots: Table[Plot[{Sum[c[[n]]*LegendreP[n, x], {n, 1, M}], f[x]}, {x, -1, 1}, PlotStyle -> {{Red}, {Thick, Blue}}, GridLines -> Automatic], {M, {10, 20, 50}}]


6

It seems that maximization of ratings leads to maximization of credits using. My code (but not answer) below. It's sequential search but it works. data = Import["university program chart.xlsx"]; dtt[d_] := d /. {"Monday" -> 0, "Tuesday" -> 1 24 60 60, "Wednesday" -> 2 24 60 60, "Thursday" -> 3 24 60 60, "Friday" -> 4 24 60 60, ...


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, ...


5

Maybe using sub-grids in the second column will more be like what you want. I tried it out and got something that was close to the TableForm layout. color = RGBColor[0., .5, 1.]; dots = Graphics[{color, Disk[]}, ImageSize -> #] & /@ {40, 60, 50, 60, 40}; data = {{"Angel Falls", "17.7 m", "0.82", "9.2"}, {"Bridalveil Fall", "6.9 m", "0.94", ...


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

A couple of references that might help you explore this topic: From the demonstration project: http://demonstrations.wolfram.com/ACycleIndexSpreadsheet/ you can download the source code. Also: http://www.wolfram.com/products/mathematica/analysis/content/Spreadsheets.html Pronto analytics did some work in this area: ...



Only top voted, non community-wiki answers of a minimum length are eligible