Tag Info

Hot answers tagged

8

Also PlotRange[plot] PlotRange /. AbsoluteOptions[plot] Last @@ AbsoluteOptions[plot, PlotRange] PlotRange /. plot[[2]] all give (* {{0.,10.},{-0.999999,1.}} *) Note: Regarding usage of PlotRange as a function, it is undocumented, and the earliest reference I could find on this site is this answer dated Oct 11, 2012: The same range on each plot in a ...


8

Using the same initialization code as Taiki: origin = {0, 0, 0}; points = {{-0.9207, -0.3896, 0.0091}, {-0.8272, 0.5077, -0.2399}, {0.2544, -0.3511, 0.901}, {0.351, 0.6527, 0.6712}, {0.5436, -0.6326, -0.5513}, {0.6016, 0.2317, -0.7643}}; fs = {{1, 3, 5}, {1, 2, 4, 3}, {1, 2, 6, 5}, {3, 4, 6, 5}, {2, 4, 6}}; faces = points[[#]] & /@ fs; Then ...


5

Plot[{11 + x, 27 - x, 1/5 (90 - 2 x), Min[11 + x, 27 - x], Min[11 + x, 27 - x, 1/5 (90 - 2 x)]}, {x, 0, 20}, Filling -> {5 -> {Axis, {White, LightBlue}}, 4 -> {{3}, {None, Yellow}}}]


5

r = ImplicitRegion[ y <= 11 + x && y <= 27 - x && y <= 1/5 (90 - 2 x) && x >= 0 && y >= 0, {x, y}]; Show[Plot[{11 + x, 27 - x, 1/5 (90 - 2 x)}, {x, 0, 20}, AxesOrigin -> {0, 0}], RegionPlot[r]]


5

One way is through a bilogarithmic plot. Define bilog[val_, cut_: 1., ff_: .25] := Module[ {out}, out = If[Abs[val] <= cut, ff val, Sign[val] Log10[Abs[val]] ] ]; for the data and blvs[{rl_, rh_}, cut_: 1] := Module[ {out, lin, lgn, lgp, lgt, lgm, lgo, tik, tkn, tkp}, lin = Range[-.9 cut, .9 cut, cut/10]; lgp = ...


5

While @Szabolcs has provided the correct work-around, the actual issue has to do with automatic use of Compile for function evaluation. The affected range is such that the value of Gamma[1+n] is still a machine real, but their product is out-of-bound. The issue comes, because the default setting of Compile's RuntimeOptions is to tolerate machine arithmetic ...


5

Gamma is an extremely quickly increasing function, so you're dealing with the ratio of huge numbers here. Something similar to catastrophic cancellation can happen. Fortunately, Mathematica is very good at dealing with this situation if you let it use arbitrary precision instead of machine precision. Change 0.5 to 1/2 and add something like ...


4

No need folding 1D graph to get a 2D Random walk in Mathematica. and the CCW easy in Mathematica. Here we go: Generate data set for the random sequence with 2000 steps. Alternatively, you may use your "own generated" data set. rdata = Accumulate[RandomChoice[{-1, 1}, {2000, 2}]] Now plot it with similar layout as your example ListLinePlot[rdata, ...


4

rw = Accumulate@RandomChoice[{-1, 1}, 400]; ListLinePlot[rw, AspectRatio -> 1] rw2 = Transpose[{rw[[ ;; 200]], rw[[201 ;; ]]}]; llp2 = ListLinePlot[rw2, AspectRatio -> 1] To rotate llp2: Show[MapAt[GeometricTransformation[#, RotationTransform[-45 Degree]] &, llp2, {1}], PlotRange -> All] Aside: Using InterpolationOrder->0 ...


4

ListLinePlot[Accumulate @ Prepend[RandomChoice[{{-1, 0}, {1, 0}, {0, -1}, {0, 1}}, 1000], {1, 1}], AspectRatio -> Automatic] Starting with some random data rd = RandomChoice[{1, -1}, 2000]; ListLinePlot[Accumulate@rd] Creating a random walk similar to the one shown in your question rw = Accumulate@Transpose[{rd[[;; 1000]], rd[[1001 ...


4

More or less a duplicate of this answer, but just to demonstrate how it is used: Some data: d1 = RandomVariate[NormalDistribution[0, 1], 200]; d2 = RandomVariate[NormalDistribution[0, 1], 1000]; Create the individual plots and then combine them using Overlay optsall = {Axes -> False, Frame -> True, ImageSize -> 600, BaseStyle -> {Thick, ...


4

I created this function to convert from cylindrical to cartesian: thing[r_, theta_, z_] := {r Cos[theta], r Sin[theta], z} Then use ParametricPlot3D ParametricPlot3D[thing[Exp[t], t + 1, Exp[2 t]], {t, 0, 1}]


3

A crude attempt This is for Mathematica 10+ only. To construct each face, I use an intersection between a unit 3-ball* centred at the origin and a pyramid whose base is at infinity and apex is at the origin. Each edge of the pyramid passes through each vertex of the spherical face. The pyramid is given by ConicHullRegion[{origin}, {vertices}]. The ...


3

According to the comment below your question I believe this does what you want: scale = Sign[#] Log[1 + Abs@#] &; invscale = Sign[#] (Exp[Abs@#] - 1) &; ListLinePlot[ llvaluefull, ScalingFunctions -> {{scale, invscale}, Identity} ] ScalingFunctions works in ListLinePlot in Mathematica 10.0.2, but it is not officially supported. It may ...


3

A trivial way (many ways to do this...) data = Range@100; myF[x_] := x^1/2 + Sin[x]; ListLinePlot[{data, myF /@ data}]


3

g[x_]=Gamma[x+1]/2-Gamma[x-1]/2 // FunctionExpand (-(1/2) + 1/2 (-1 + x) x) Gamma[-1 + x] f[y_] := NIntegrate[g[x], {x, 2, y}] Plot[f[x], {x, 2, 10}]


3

If you want a curve whose shape is determined by y = 1/2 (ArcCos[1 - Cos[2 x]]) and whose color is determined by Sin[x] Sin[y], you may use Plot[1/2 (ArcCos[1 - Cos[2 x]]), {x, -\[Pi]/4, \[Pi]/4}, ColorFunction -> Function[{x, y}, ColorData["SunsetColors"][Sin[x] Sin[y]]]]


3

Starting from this Plot3D: Plot3D[ Exp[-x^2 - y^2], {x, -3, 3}, {y, -3, 3}, PlotPoints -> 100, PlotRange -> {0, 1}, PlotRangePadding -> None, Mesh -> None, PlotPoints -> 50, BoxRatios -> {1, 1, 1}, Boxed -> False, AxesLabel -> Automatic, ViewPoint -> 100 {-2, -2, 3} ] let me address the question of how to ...


3

FilterRules[AbsoluteOptions[plot], PlotRange] does the trick (*{PlotRange -> {{0., 10.}, {-0.999999, 1.}}} *) Not sure if this is an exhaustive answer.


3

You can use ConditionalExpression using all the conditions that define the region you want to plot as the second argument: ClearAll[x, m, m3, s1min, s1max] x[s1_, s2_] := Sin[s1 + s2]; m = Sqrt[Pi/32]; m3 = Sqrt[Pi/64]; s1min[s_] := Sqrt@s; s1max[s_] := 2 + Sqrt@s; Plot3D[ConditionalExpression[x[s1, s2], (m3^2 + m^2)^2 <= s2 <= (Sqrt[s1] - m^2)^2 ...


3

First question answered, here we go with LegendMarkerSize: legend = LineLegend[styles, {"f", "g"}, LegendMarkerSize -> 5]; Second question answered: Customize a Grid for the legend using the Spacing option and use it in LegendLayout. Play around with Spacing values for horizontal and vertical adjustments. Here we go table[pairs_] := Grid[pairs, ...


3

You can add Specularity to the ColorFunction. Here is a Manipulate you can play with to figure out what settings you prefer: Manipulate[ Plot3D[Exp[-x^2 - y^2], {x, -3, 3}, {y, -3, 3}, PlotPoints -> 50, PlotRange -> All, PlotRangePadding -> None, Mesh -> None, ColorFunction -> (Directive[Specularity[s, 20], Glow @ ...


2

Anyway, while I wait for my flight, here's some code that'll give you everything there is to know about a plot. GetGeometry[g_Graphics] := Module[{ q, dim, plotrange=PlotRange/.AbsoluteOptions[g,PlotRange], }, q=Rasterize[Show[g, ...


2

Playing with many options, I find that to remove the jagged edges from the tube, the best solution is to Rasterize with high ImageResolution (which is probably not what you want). Using Antialiasing alone did not do as well a job, but it was still better than the image shown. Here is what I get in windows 7, V 10.02 turns = r = 10; Rasterize[Style[ ...


2

When you are using Floor you are bound to make a discrete jump at some point, as it only returns you the nearest integer. Depending on your other function this jump may be visible or not. What you are calling a tail is can be a manifestation of a jump. Most Probably it is coming because you are using Floor with a trigonometric function (as you know $ \sin ...


1

It looks like TradingChart rescales the chart from 1 to 100, so in order to add Epilog features, you must first know the range of your dates and then rescale the values. Here is a clunky way to do so. Clear[tchartx] tchartx[val_, limits_: data[[{1, -1}, 1]]] := Rescale[AbsoluteTime[val], AbsoluteTime /@ limits, {1, 100}] data = FinancialData["SP500", ...


1

im = Import["ExampleData/lena.tif"]; Show[ NumberLinePlot[{1, 10, 20, 30, 40, 50}], Graphics[ {Inset[im, {1, 1}], Inset[im, {20, 1}], Inset[im, {40, 1}] } ] ] You'd have to adjust the sizes and scale things to make it look ok


1

This can easily be fixed by adding the missing BaseStyle -> Graphics`DateListPlotDump`basestyle to Graphics`DateListPlotDump`options So if you either execute the code below before calling DateListPlot or put this into your init.m file, then SetOptions just works. I am sure this will be fixed in the next release (since the fix is so easy). What I ...


1

DensityPlot[Sin[x^2 + y], {x, 0, Pi}, {y, 0, Pi}, ColorFunction -> (ColorData["TemperatureMap", Rescale[#, {0, 2}, {0, 1}]] &), PlotLegends -> BarLegend[{"TemperatureMap", {0, 2}}, 10]]


1

xB = {0.00, 0.076, 0.164, 0.300, 0.479, 0.638, 0.854, 0.941, 1.00}; pP = {44.0, 42.2, 39.5, 36.4, 30.4, 27.6, 22.4, 12.9, 0.00}; pT = {44.0, 66.4, 84.0, 99.8, 105.8, 108.4, 109.0, 104.5, 94.4}; iP = Interpolation[{xB, pP}\[Transpose]]; iT = Interpolation[{xB, pT}\[Transpose]]; Show[ Plot[{iP[x], iT[x]}, {x, Min[xB], Max[xB]}], ListPlot[{{xB, ...



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