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


19

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


17

How about this? Grid[{{1, 2, 3}, {4, Item[5, Frame -> {{True, True}, {True, False}}], 6}}]


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


12

Programmatically I would use: img = ExampleData[{"TestImage", "Lena"}]; Image[img, Magnification -> 1] Manually you can right-click on the image and select Actual Size. Edit: Although not as robust as what follows a simple solution to the resizing that takes place in Row, Grid, etc. is to wrap the Image or Graphics in Pane. Within an Image there ...


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


12

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


11

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


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


11

Using Graphics: As suggested by Mr.Wizard in comments Graphics, inconvenient as it is, is way to get the desired output: gF[txtopts_: {16, "Panel", Italic}, gopts_: {AspectRatio -> 1/GoldenRatio, ImageSize -> 500}] := With[{d2 = Transpose@Reverse[Prepend[Transpose[Prepend[Transpose[#], #2]], Prepend[#3, ""]]], dim = {1, 1} + ...


10

My standard(1) work-around for this problem is to add Pane: Grid[{{Pane@image}}] Row[{"abcd", Pane@image}] Grid[{{"abcd", Pane@image}}] A default characteristic of Pane is that it still allows resizing its contents to fit the window width of the Notebook. I find this a desirable default behavior. However if clipping is preferred you can specify an ...


9

You should investigate in the Scaled function: lots = GraphicsGrid[ Table[With[{a = RandomInteger[{1, 17}], b = RandomInteger[{1, 17}]}, ParametricPlot[Sin[t^2] {Cos[a t], Sin[b t]}, {t, 0, 2 \[Pi]}, PlotRange -> {{-1, 1}, {-1, 1}}, Frame -> True, ImageSize -> Scaled[1]]], {15}, {7}]]; Export["lots.pdf", lots]


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

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


8

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


8

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


8

You can do : p = ImplicitRegion[y <= 3/10 x + 18 && y > x^2/8, {x, y}] points = Reduce[Element[{x, y}, p], {x, y}, Integers] pp = Cases[points, x == xx_ && y == yy_ -> {xx, yy}] pp // Length (* 286 *) Show[RegionPlot[p], ListPlot[pp]]


8

As per my comment you will note that images can be pasted into notebooks and used as expressions. They are not rendered at full size but the size information is stored as an option. If all you want to do is have Row and Grid render something to the same specific size then try Show: Row[{"abcd", Show[image, ImageSize -> 300]}] Grid[{{"abcd", Show[image, ...


8

so you understand whats happening, the image is all there and being cut off by whatever software you use to render because it is wider than the page. It may actually be ok if you use some other software that properly handles eps. Acrobat cuts it off which is really annoying since they literally wrote the standard, but just for example, it imports correctly ...


7

Grid[tab, Frame -> {None, None, {{1, 1} -> True, {1, 2} -> True}}, ItemSize -> All]


7

Why this happens? The reason for this behaviour is that Mathematica works with two kinds of units: plot coordinates---the same thing you see on the axes offset coordinates---these are in printer's points Plot coordinates scale with the figure: if you print the figure (or export to PDF) at twice the size, objects specified on plot coordinates double in ...


7

I guess: i = ExampleData[{"TestImage", "Lena"}]; Image[#, ImageSize -> ImageDimensions[#]] &@i will do.


7

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


7

You could use TableForm, e.g. col = CharacterRange["A", "E"]; row = CharacterRange["a", "e"]; TableForm[m, TableHeadings -> {row, col}] A way using Grid: Grid[{PadLeft[col, 6, ""]}~Join~ MapThread[PadLeft[#1, 6, #2] &, {m, row}], Dividers -> {{False, True, {False}}, {False, True, {False}}}]


7

Perhaps what you want: m = Array[Subtract, {5, 5}, 0]; r = Range @ 5; Grid[ ArrayFlatten[{{"", {r}}, {{r}\[Transpose], m}}], Frame -> All ]


7

I can reproduce the problem described by OP in Mathematica 9.0.1 on Windows 8.1. By using FrontEnd`UndocumentedBoxInformationPacket to check the displayed Boxes' layout in the FrontEnd, I wildly guess that the cause of the problem might be hiding in the FrontEnd layout engine (of only the Windows version maybe?). If it's true, then there might be nothing we ...


7

eqn = y <= 3/10 x + 18 && y > x^2/8; sol = Reduce[eqn, {x, y}, Integers]; Length @ sol (* 286 *) points = {x, y} /. {ToRules[sol]}; (* thanks: BobHanlon *) RegionPlot[eqn, {x, -15, 18}, {y, -5, 25}, GridLines -> {Range[-15, 18], Range[-5, 25]}, PlotStyle -> Directive[{Opacity[0.5], Red}], Epilog -> ...



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