Tag Info

Hot answers tagged

43

Yes we can. The following DashedGraphics3D[ ] function is designed to convert ordinary Graphics3D object to the "line-drawing" style raster image. Clear[DashedGraphics3D] DashedGraphics3D::optx = "Invalid options for Graphics3D are omitted: `1`."; Off[OptionValue::nodef]; Options[DashedGraphics3D] = {ViewAngle -> 0.4, ViewPoint ...


38

The cure is undocumented, unfortunately. Try adding Method -> {"AxesInFront" -> False}, like so: Plot[2 x - 2, {x, -10, 10}, PlotRange -> {{-10, 10}, {-10, 10}}, PlotStyle -> Directive[Black, AbsoluteThickness[2]], ImageSize -> 300, AxesStyle -> Directive[RGBColor[.8, .8, .8], AbsoluteThickness[2]], AspectRatio -> 1, ...


37

Consider this: ParametricPlot3D[ RotationTransform[a, {0, 1, 0}][{0, 0, Sin[3 a] + 5/4}], {a, 0, 2 Pi}, Evaluated -> True] Now rotate this around a circle, while rotating it at the same time around its' origin: ParametricPlot3D[ RotationTransform[b, {0, 0, 1}][{6, 0, 0} + RotationTransform[a + 3 b, {0, 1, 0}][{0, 0, Sin[3 a] + 5/4}]], ...


31

Here's a start. I'll leave the labeling and fine tuning the details to you: With[{thin = {Thin, Opacity[0.4]}}, RegionPlot[x^2 + y^2 <= 1, {x, -1, 1}, {y, -1, 1}, ColorFunction -> (Hue[ArcTan[#, #2]/(2 π)] &), ColorFunctionScaling -> False, PlotPoints -> 100, Frame -> False, Mesh -> {21, 21, 10, 7, 47}, ...


31

Edit note: I want to thank to all upvoters, this is really shocking and motivating :). Just to make this answer covering both graphs I've added right graph made with SectorChart like I suggested in comments and to not clone David's solution. data = RandomReal[{1, 5}, 16]; Left graph: For equally spaced (in angle) measurements it is easier to use Mesh for ...


26

I see at least two problematic points here. The first and most obvious is, that Plot creates many Line directives. If you set the thickness of adjacent lines differently, you may get thickness-jumps where the lines meet. In the worst case something like this Graphics[{Thickness[0.01], Line[{{0, 0}, {1, 1}}], Thickness[0.05], Line[{{1, 1}, {2, 0}}]}] ...


25

Yet another method: Let us calculate values of function on appropriate rectangular grids, which we will convert to textures (1 pixel = 1 value). Interpolation between pixels is built-in. f = 2 #1^2 + 2 #2^2 + #3^2 + #1 #2 &; PolyhedronData["Cube"] // N // Normal // toTriangles // texturize[f, 50, Hue, Lighting -> "Neutral", Axes -> True] ...


24

the newest edit thicknessFunction is not compatibile with ColorFunction. It is because Mathematica is creating GraphicsComplex for plots with ColotFunction. I have created procedure which is dealing with it. It is more useful than thicknessFunction[f_, f2_] from the bottom of this post because MMA is taking care for scalling etc. thick$color[f_] := ...


22

Here's a bruteforce way to do it for the simple case when the attractor is a fixed point. Find a fixed point Pick initial values for ODE Solve ODE, see if it gets close to fixed point Go back to 2 until satisfied By looking at Reduce[y == 0 && -9 Sin[x] - 2/10 y == 0, {x, y}, Reals] we see that for instance {x=0,y=0} is a fixed point, let's use ...


22

One can also use MeshFunctions: Clear[f]; f = {x, y, z} \[Function] x + Sin[5 z] + y^2; cube = PolyhedronData["Cube", "RegionFunction"]; mesh = 15; RegionPlot3D[cube[x/2, y/2, z/2], {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, MeshFunctions -> {f}, Mesh -> mesh, MeshShading -> ColorData["Rainbow"] /@ Range[0, 1, 1/(mesh + 1)], PlotPoints -> 50, ...


21

A basic approach You can start with a regular density plot, restricted to the domain of x and y using RegionFunction. Then you can transform the plot to an equilateral triangle. f[p_, q_, r_] := r Sin[10 p]^2 + (1 - r) r Cos[20 q]^2; dp = DensityPlot[f[x, y, 1 - x - y], {x, 0, 1}, {y, 0, 1}, RegionFunction -> (#1 <= 1 - #2 &), ColorFunction ...


20

Something like this perhaps. Thanks to halmir for pointing out that multiple highlighted elements might be useful. pieHighlight[chart_, n_] := chart /. DynamicModule[init_, body__] :> (ReplacePart[Hold[init], Thread @ {1, n, 2} -> True] /. Hold[x_] :> DynamicModule[x, body]) e.g. PieChart[{1, 2, 3}] ~pieHighlight~ 2 PieChart[{1, 2, ...


19

None of the solutions so far makes use of the fact that the data are percentages and hence add op to (nearly) 100. (* Add the rows of the data list *) Total[Rest /@ data, {2}] (* out *) {99.96, 99.98, 99.98, 99.99, 99.99, 99.99, 99.99, 99.97, 100., 99.99,100., 100.} Borrowing from Pinguin Dirk: BarChart[Rest /@ data ,ChartLayout -> "Stacked" ...


18

Well I do not have your data, so I'll just show things I have. I'll go with India, it has nice cities layout. You can upgrade for your data yourself. If you know only locations of cities, but not their population, then data = DeleteCases[ Reverse[CityData[#, "Coordinates"]] & /@ CityData[{All, "India"}], Missing["NotAvailable"]]; ...


18

This is how I would do this. Define frequencies and sampling rate precisely. Then use Periodogram because it takes SampleRate as an option and rescales frequency axis automatically. Read up Docs on Periodogram - see examples there. data = Table[{t, Sin[2 Pi 697 t] + Sin[2 Pi 1209 t]}, {t, 0., 0.1, 1/8000.}]; ListLinePlot[data, AspectRatio -> 1/4, ...


17

Another way to approach the xkcd-ification of plots is from an image processing perspective. The idea is to warp the space in which the image lies rather than to try and warp the lines themselves. When the image-space warps, the lines appear to vary in thickness. First define the following function, which is nearly just a line with slope one. The important ...


17

You can also try this: Generate yor data: data = RandomVariate[\[ScriptD] = MultinormalDistribution[{0, 0}, {{1, 0.9}, {0.9, 2}}], 10^4]; To improve a little bit the final image, you might want to introduce lighting vectors: lightSources = { {"Directional", White,Scaled[{1, 0, 1}]}, {"Directional", White,Scaled[{1, .5, 1}]}, {"Directional", ...


17

You can do this pretty cleanly with TemporalData. Setting the Method to None ensures no interpolation will be performed. The "Part" property resamples the paths when necessary using the Method setting. Since it was set to None it gives missing at days not present in the data. td = TemporalData[{data1, data2}, Method -> None]; resample = td["Part", All, ...


17

I was sure Histogram can be modified to have the hatching style. Little late but what about this! g[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := Module[{yval, line}, yval = Range[ymin, ymax, 15]; line = Line /@ Transpose@{Most@({xmin, #} & /@ yval),Rest@({xmax, #} & /@ yval)}; {FaceForm[White],Polygon[{{xmin, ymin}, {xmax, ymin}, {xmax, ymax}, ...


17

Edit: PolarTicks uses the built-in option for "Direction". An earlier version of this answer shows how to manually add PolarTicks. The following displays the wind rose on the right (with different data points). As rcollyer notes, the data points and joining lines can be both achieved in a single use of ListPolarPlot through PlotMarkers->Automatic. ...


17

Due to the limitations on the accuracy of SmoothKernelDistribution (mentioned by Murta) upon which SmoothDensityHistogram is based, I prefer to work with the more exact KernelMixtureDistribution. I will use the same data as Vitaliy here. data = DeleteCases[ Reverse[CityData[#, "Coordinates"]] & /@ CityData[{All, "India"}], ...


17

Regarding your 1. question A density plot is clearly not recommended for your problem. Firstly, a density is AFAIK per definition not complex, but let's ignore this for a moment. The real neck-breaker here is, that ListDensisityPlot interpolates the values if you don't turn it explicitly off. And even if you turn it off, a ListDensityPlot will create a ...


17

Something to get you started? f[{x_, y_}] := -Cos[x] x^2 - y^2 xy = First[ ContourPlot[f[{x, y}], {x, -1, 1}, {y, -1, 1}]] /. {x_?AtomQ, y_?AtomQ} :> {x, y, 1}; xz = First[ ContourPlot[f[{x, y}], {x, -1, 1}, {y, -1, 1}]] /. {x_?AtomQ, y_?AtomQ} :> {x, -1, y}; yz = First[ ContourPlot[f[{x, y}], {x, -1, 1}, {y, -1, 1}]] /. ...


17

Update: PlotPiecewise now automatically tries to convert a non-Piecewise function into one using PiecewiseExpand. PiecewiseExpand will also do some simplification, such as factoring and reducing a rational function; to avoid that, pass a Piecewise function directly. PlotPiecewise will not alter the formulas in a Piecewise. Note, however, that Mathematica ...


16

With the set-up you already have, you can do nearbin = Nearest[Table[verttri[[i]] -> i, {i, Length@verttri}]]; counts = BinCounts[nearbin /@ data, {1, Length@verttri + 1, 1}]; which counts the number of data points nearest to each vertex. Then just draw the glyphs directly: With[{maxCount = Max@counts}, Graphics[ Table[Disk[verttri[[i]], 0.5 ...


16

Another way is to use ParametricPlot (which will accomplish an equivalent thing via polygons). Here, thickness adds a multiple th of the unit normal to the curve. Just pass a thickness function as the parameter th. thickness[f_, th_] := Block[{x}, {x, f} + Normalize[{-D[f, x], 1}] th]; ParametricPlot[ Evaluate@thickness[2 Sin[x], 0.075 (1 + Sin[x]^2) t], ...


16

I recreated the animation on Wikipedia for those who like such things (I do). Here is the Manipulate version: R = 3; r = 1; fx[θ_, a_: 1] := (R + r) Cos[θ] - a r Cos[(R + r) θ/r]; fy[θ_, a_: 1] := (R + r) Sin[θ] - a r Sin[(R + r) θ/r]; gridlines = Table[{x, GrayLevel[0.9]}, {x, -6, 6, 0.5}]; plot[max_] := ParametricPlot[ {fx[θ], fy[θ]}, {θ, 0, ...


16

One More way! The means of each data is the blue dot. bars are color coded according to the standard deviation within each sub list. ListLinePlot[Mean /@ data, Prolog -> MapThread[{Thickness[.04], ColorData["SandyTerrain"][#3], Line[{{#2, First@#1}, {#2, Last@#1}}], Opacity[0.7], White, Dashed, Thickness[0.003], Arrowheads[0.025], ...


16

If you want to roll your own solution to evenly distrubute circles along the path you could use the so called arc length parametrization of the path $p(t)=(t,\cos(t))$. For this particular curve, it will need to be computed numerically. p[t_] := {t, Cos[t]}; $Assumptions = {t > 0}; speed[t_] = Simplify[Norm[p'[t]]]; arcLength[t_?NumericQ] := ...


15

If you want to combine the thickness with the color information, you could do this: Plot[{1.1 Sin[x], .9 Sin[x]}, {x, 0, 3 Pi}, PlotStyle -> {Thickness[0.01]}, ColorFunction -> "BlueGreenYellow", Filling -> {1 -> {2}}] Thanks Kuba for pointing out Artes' answer that shows how Filling can work here. Edit In response to the comment, let ...



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