Tag Info

Hot answers tagged

23

Answers to your 4 questions step by step to see how each of these changes the composite plot: 1. The image padding around the two images differs so you need to set a fixed value for each. With ImagePadding -> {{50, 50}, {50, 10}} as an option for both plots I get this: 2. ChartLabels -> Placed[Style[#, "Text"] & /@ labels, Below],ImagePadding ...


19

Often I find it easier to construct such graphics directly from Graphics primitives. First your data: purple = RGBColor[97/255, 16/255, 106/255]; orange = RGBColor[245/255, 132/255, 31/255]; labels = {"FY15 Q1/2", "FY15 Q3/4", "FY16 Q1/2", "FY16 Q3/4", "FY17 Q1/Q2", "FY17 Q3/Q4", "FY18 Q1/2", "FY18 Q3/4"}; starvedTime = {7.55, 11.23, 8.58333, ...


11

Following solution is almost fully automatic, You only have to pay attention to ticks. Main idea is to use ImagePadding with Overlay. Reversed Ticks are created automatically. T = {{"100", 12.23, 2.675, 1}, {"140", 35.2, 3.5, 1.4}, {"180", 81.3,4.275, 1.9}, {"220", 162, 5.05, 2.4}, {"260", 288, 5.8,2.9}, {"300", 451, 6.4, 3.3}, {"340", 674, 7, 3.8}, ...


8

k = Import["traffic.avi", "ImageList"]; a = RandomReal[{0, 1}, 10]; s[n_] := ListLinePlot[a[[1 ;; n]], PlotStyle ->{Thick, White}, PlotRange ->{{1, 10}, {0, 1}}] Table[ImageCompose[k[[n]], s[n]], {n, 10}]


7

In your case, the biggest advantage of GraphicsGrid over Grid is the Epilog option which allows you to put the additional elements over your grid of numbers: f[x_] := 2 x + 3 GraphicsGrid[ Join[{{Style[x, 36], Style[y, 36]}}, Table[{Style[i, 36], Style[f[i], 36]}, {i, 0, 4}]], Dividers -> {{2 -> Directive[Red, Thin]}, {2 -> ...


6

Use the DataRange option of ArrayPlot. If possible, it might help to force the size of the array to have the correct aspect ratio. plot1 = ArrayPlot[RandomReal[{0, 1}, {200, 100}], FrameTicks -> Automatic, DataRange -> {{0, Pi}, {0, 2 Pi}}]; plot2 = Plot[x^2, {x, 0, Pi}, PlotRange -> {0, 2 Pi}, PlotStyle -> {Thick, Red}]; Show[{plot1, ...


6

Is this what you are looking for? pic = Image@RandomReal[1, {5, 10}] x = {1.5, 1.5}; y = {2.5, 3.5}; max = Dimensions@ImageData@pic - .5; Column[{ LocatorPane[Dynamic@{x, y}, Colorize@Image[pic, ImageSize -> 1000], {{0.5, 0.5}, max, {1, 1}}], Dynamic@x, Dynamic@y, ...


5

I present a solution qualitatively similar to belisarius's, but done somewhat differently: (* import an AVI frame-by-frame *) imgs = ExampleData /@ ExampleData[{"TestAnimation", "ToyVehicles"}, "Frames"]; (* some plots *) plots = Table[Plot[Sin[x], {x, -$MachineEpsilon, u}, Axes -> None, Frame -> True, Epilog -> ...


5

You can use Export[] when you cannot select outputs in the Front End. Overlay[{p1, Item[Show[p2], Alignment -> {-.7, .6}]}] Export["graphics.pdf",%] saves the graphics as PDF in your current working directory. No rasterization happens. This technique can also be used for output of GraphicsRow, GraphicsColumn, and GraphicsGrid where you cannot select ...


5

Although Overlay preserves unrasterized copies of its constituent Graphics it is rasterized by the Front End for the purpose of display. Therefore I do not believe that you can use Overlay for this purpose. However, I believe you can use Epilog and Inset: p1 = Plot[Sinc[x], {x, 0, 10}]; p2 = BarChart[{{1, 2, 3}, {1, 3, 2}}]; Show[p1, ImageSize -> ...


5

Since an example using GraphicsGrid is posted, here is an example using direct Graphics. It is good to try to separate the data from presentation. Also, since we use Mathematica, then lets try to automate things a little more. So, this function takes list of data as it, and draw it. It uses only 2 parameters, which you can either fix or supply. There are ...


4

It is all about rescaling, - visual with Overlay or @A.G. idea in the comment. So: L = Abs[Rescale[Accumulate[RandomInteger[{-1, 1}, 1000]]]]; S = 2 10^27 Abs[Rescale[Accumulate[RandomInteger[{-1, 1}, 1000]]]]; U = 50 Abs[Rescale[Accumulate[RandomInteger[{-1, 1}, 1000]]]]; ListPlot[Rescale /@ {L, S, U}, Joined -> True]


4

To get a rolling plot you can change the PlotRange with time, something like this: (* fake movie frames *) image[t_] := RandomImage[{0, 1}, {150, 150}]~Blur~3 (* make up some data to plot *) data = Accumulate[RandomReal[{-1, 1}, {100}]]; range = {Min[data], Max[data]}; (* define the rolling plot *) rollingplot[t_, n_] := ListLinePlot[data[[;; t]], ...


4

If you import the avi using the option GraphicsList then you immediately have a variable which is a list with all the frames. For instance: imagelist = Import["...file.avi","GraphicsList"] You can then create an animation with this imagelist and superpose the frame numbers (or whatever other numbers you want using Show inside the Animate function): ...


4

There is a three-argument form of Overlay that allows you to specify one of the layers as the target for interactions. So if you only want to modify the contents of the last layer in the list of overlays, you can specify that layer as follows: Overlay[{Plot[1, {x, -1, 1}], Graphics[{Blue, Circle[]}]}, Automatic, 2] This draws a blue circle as an ...


4

data = 1000 RandomVariate[GammaDistribution[3, .5], 10^4]; distrib = HistogramDistribution[data]; Overlay[{DiscretePlot[CDF[distrib, x], {x, 0, Max[data]}, ImageSize -> {600, 400}, Frame -> {{False, True}, {False, False}}, FrameTicks -> {{None, Range[0.1, 1, .1]}, {None, None}}, ImagePadding -> {{50, 100}, {15, 25}}], Histogram[data, ...


4

Another way to do that is to use Show: LocatorPane[Dynamic[{pt1, pt2, pt3, pt4}], Show[Image[img], Graphics[{Orange, Opacity[.4], Dynamic@MultiContourPolygon[{{pt1, pt2, pt3, pt4}, {{0, 0}, {d[[1]], 0}, d, {0, d[[2]]}}}]}, ImagePadding -> 0]]] With this solution you do not have to specify any PlotRange or ImageSize.


4

I don't think the third argument of Overlay can be used to do what you want. An alternative is to change the active layer dynamically using EventHandler as in DynamicModule[{layer = 1}, EventHandler[ Overlay[{Slider2D[], Graphics[{Opacity[.2], Disk[]}]}, All, Dynamic[layer]], {{"MouseClicked", 2} :> ((layer = layer /. {1 -> 2, 2 -> 1}))}, ...


4

You need to specify the Plot Range: LocatorPane[Dynamic[{pt1, pt2, pt3, pt4}], Overlay[{Image[img, ImageSize -> 400], Graphics[{Orange, Opacity[.4], Dynamic@MultiContourPolygon[{{pt1, pt2, pt3, pt4}, {{0, 0}, {d[[1]], 0}, d, {0, d[[2]]}}}]}, ImagePadding -> 0, ImageSize -> 400, PlotRange -> Transpose[{{0, 0}, ...


3

Overlay's second parameter specifies which layers are visible and in what order. The third parameter specifies which layer can be interacted with. For your usage you can use the Overlay[layers, All, 1] form. Here's a small demonstration for Overlay. I got a little carried away <_< but it should make clear what the second parameter can be used for. ...


2

For the record. The data you've provided do not match your plot. But here is the way: dat1 = Import["Spectrum1.dat"]//Flatten; dat2 = Import["Spectrum2.dat"]//Flatten; With[{opt = Sequence[PlotRange -> All, ImagePadding -> 35, ImageSize -> 500, BaseStyle -> {18, Bold}]}, Overlay[{ ListLinePlot[dat1, PlotStyle ...


2

You can also do the following with any plot: A2 = RandomReal[1, 16]; C2 = RandomReal[1, 17]; PlotA = ListLinePlot[A2, PlotStyle -> Red, ImagePadding -> 25, Frame -> {True, False, True, True}, FrameTicksStyle -> Directive[15], FrameTicks -> {{{2, 1995}, {7, 2000}, {12, 2005}, {17, 2010}}, None, {{2, 1995}, {7, 2000}, {12, ...


1

I feel it is a duplicate but I can't find it. This is the way to go, just use Column and Control on Manipulate arguments that are referring to particular variables: Manipulate[ Column[ {Plot[Tan[a x], {x, 0, 1}], Plot[Cot[a x], {x, 0, 1}]} ] , Column[{ Control[{a, 0, 1}], Dynamic@Plot[Cos[ x/(a + 1)], {x, 0, 1}] }, Center, Spacings ...


1

Using A2 = RandomReal[1, 16]; C2 = RandomReal[1, 17]; and increasing ImagePadding -> 55: Notice that you have to use None not False if you don't want particular label.


1

This is a very rudimentary approach for an editing application. I'll reuse the Plot from Jens here... Basically it shows you how to select a specific layer in your Overlay graphical object through a specific event (Right-Mouseclick for instance). You can handle this specific event to flip through the Overlay layers. From there you could do your specific ...


1

This is related to this recent question: relative scale of elements in ImageCompose My answer is similar: LocatorPane[Dynamic[{pt1, pt2, pt3, pt4}], Show[ Rasterize @ img, Epilog -> {Orange, Opacity[.4], Dynamic@MultiContourPolygon[{{pt1, pt2, pt3, pt4}, {{0, 0}, {d[[1]], 0}, d, {0, d[[2]]}}}]} ] ] This way there is no need ...



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