Tag Info

Hot answers tagged

46

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


37

Basic method There appears to be a mechanism for doing just that, though I have yet to map its capabilities. As a basic example for the time being: Themes`AddThemeRules["wizard", DefaultPlotStyle -> Thread@Directive[{Purple, Orange, Hue[0.6]}, Thick], LabelStyle -> 18, AxesStyle -> White, TicksStyle -> LightGray, Background -> ...


28

The triangle plot markers It is natural to expect that the triangle marker is placed in such a way that its center of mass (center of circumcircle) coincides with the point it marks. That's how it is implemented in all major scientific plotting software, for example Origin: Some time ago I published my own implementation of triangle-based plot markers. ...


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

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


23

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


22

i = Import@"http://i.stack.imgur.com/8I3B1.jpg"; f[{{tmin_, tmax_}, {rmin_, rmax_}}, ___] := Module[{l = Join[{{0, 0}}, Table[{Cos@t, Sin@t}, {t, tmin, tmax, (tmax-tmin)/100}]]}, {Texture[i], EdgeForm[], Polygon[l, VertexTextureCoordinates -> 1/2 Transpose[Transpose[l] + {1, 1}]]}] Framed@PieChart[{1, 2, 3, 4, 5, 6}, ChartElementFunction -> f] ...


22

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


21

Here is another approach. It could be improved (I am sure) to properly determined the principle axes and translation (if I get time I will aim to update): lin = {#1^2, #1, #2, 2 #1 #2, #2^2} & @@@ points; lm = LinearModelFit[lin, {1, a, b, c, d}, {a, b, c, d}] Exploring model: lm["ParameterTable"] Determining quadric formula: pa = ...


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


20

Taking the cube root on both sides fixes the problem, and then you don't need lots of PlotPoints any more. ContourPlot3D[(x^2 + 9/4 y^2 + z^2 - 1) == CubeRoot[x^2 z^3 + 9/80 y^2 z^3], {x, -6/5, 6/5}, {y, -6/5, 6/5}, {z, -6/5, 3/2}, Mesh -> None, Boxed -> False, AxesLabel -> {"x", "y", "z"}, Axes -> False, ContourStyle -> Directive[Red, ...


20

First define the Morse code (from rosettacode.org with corrections by @evanb) morsecode = (#1 -> Characters[#2]) & @@@ { {"a", ".-"}, {"b", "-..."}, {"c", "-.-."}, {"d", "-.."}, {"e", "."}, {"f", "..-."}, {"g", "--."}, {"h", "...."}, {"i", ".."}, {"j", ".---"}, {"k", "-.-"}, {"l", ".-.."}, {"m", "--"}, {"n", "-."}, {"o", "---"}, ...


18

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


18

In an presentation by Markus van Almsick, he gives an solution to visualize atomic orbitals using Image3D. Radius wave function (hydrogen): R[n_Integer?Positive, l_Integer?NonNegative, r_] := Block[{ρ = (2 r)/n}, Sqrt[(2/n)^3 (n - l - 1)!/(2 n (n + l)!)] E^(-ρ/2) ρ^l LaguerreL[n - l - 1, 2 l + 1, ρ]] /; l < n full wave function: ψ[n_, l_, m_, ...


18

Update ticks[x1_, x2_] := {#/10 + π/2, #} & /@ FindDivisions[{10 (x1 - π), 10 (x2 - π)}, 20] funcs = Table[3 + BesselJ[i, 10 (x -π/2)], {i, 0, 3}]; PolarPlot[funcs // Evaluate, {x, -π/2, 3π/2}, PolarAxes -> Automatic, PolarTicks -> {ticks[0, 2 π][[2 ;; -2]], Automatic} ] (*thanks @kguler 's and @rm-rf 's advice*) Manipulate ...


18

Your comment raises interesting question: I got everything simply faded and flat, while in the example - its all bright and sharp I think the problem is related to the fact that Mathematica's graphical functions always work in linear colorspace. Starting from Pickett's solution with better resampling method, in version 10.0.1 we obtain: ...


17

This is based on Rahul's ideas, but a different implementation: contourRegionPlot3D[region_, {x_, x0_, x1_}, {y_, y0_, y1_}, {z_, z0_, z1_}, opts : OptionsPattern[]] := Module[{reg, preds}, reg = LogicalExpand[region && x0 <= x <= x1 && y0 <= y <= y1 && z0 <= z <= z1]; preds = Union@Cases[reg, _Greater | ...


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

body[t_] = Integrate[#[u^2], {u, 0, t}] & /@ {Cos, Sin} ParametricPlot3D[body[t]~Join~{t}, {t, -2 Pi, 2 Pi}, BoxRatios -> 1, SphericalRegion -> True]


17

The colors alone are indexed color scheme #97: ColorData[97, "ColorList"] Update: further digging in reveals these PlotTheme indexed color relationships: {"Default" -> 97, "Earth" -> 98, "Garnet" -> 99, "Opal" -> 100, "Sapphire" -> 101, "Steel" -> 102, "Sunrise" -> 103, "Textbook" -> 104, ...


17

data = Table[{RandomReal[{-10, 10}], RandomReal[{-10, 10}]}, {i, 1, 300}]; L0 = ListPlot[data, Frame -> True, Axes -> False, AspectRatio -> 1, ImageSize -> 400, BaseStyle -> PointSize[.02]]; Using @rm-rf's function inPolyQ inPolyQ[poly_, pt_] := Graphics`Mesh`PointWindingNumber[poly, pt] =!= 0 from this Q/A: Deploy@ ...


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

I have found that my approach with textures has different applications: How to plot contours in the faces of a cube? How to plot ternary density plots? Now I want to use it for the enhancement of the DensityPlot: Options[fastDensityPlot] = Append[Options[DensityPlot], Subpoints -> 30]; SyntaxInformation[fastDensityPlot] = ...


15

The default colours for charts are defined by Charting`CommonDump`rogerStyles. For up to five different colours the values are hard-coded: Charting`CommonDump`rogerStyles[5] (* {RGBColor[0.798413, 0.82472, 0.968322], RGBColor[0.733333, 1., 0.833722], RGBColor[1, 0.986999, 0.742123], RGBColor[1, 0.860624, 0.662562], RGBColor[1, 0.696086, 0.721935]} *) ...


15

This is a solution based on interval operations. Usage and examples First, let's look at how to use the function. The code is at the end. Let's generate some sample data and plot it: data1 = RandomVariate[ExponentialDistribution[1], 200]; data2 = RandomVariate[NormalDistribution[2, 1], 200]; beeswarmPlot[data1] Now let's plot two together: ...


15

In analytic geometry, the ellipse is defined as the set of points (X,Y) of the Cartesian plane that, in non-degenerate cases, satisfy the implicit equation with and where Lets fit points with second-order curve (which include ellipse). elipse = a11*x^2 + a22*y^2 + 2*a12*x*y + 2*a13*x + 2*a23*y + a33; coeff = {a11, a22, a12, a13, a23, a33}; ...


15

To long for a comment, but here's one approach, using information readily available in the docs and on this site: First, make a map that wraps a globe changing the Geoprojection to something a bit more useful. img = With[{Δ = 30}, Row[Table[ GeoGraphics[GeoBackground -> GeoStyling["ReliefMap"], GeoRange -> {{-90, 90}, {λ, λ + Δ}}, ...


14

My pc is rather old so there was not much I could do. Maybe no as pretty as in the link but I'm happy because of the result: r = 35; p = Show[ Plot3D[-Sum[2 Exp[-((x - xo)^2 + (y - yo)^2)], {xo, -24, 8, 4}, {yo, -28, 8, 4}], {x, -r, r - 4}, {y, -r, r - 4}, Evaluated -> True, PlotRange -> All, PlotPoints -> 200, Mesh ...


14

Update: now it is real ternary plot. You can start with the 2D-adaptation of the surface plotting: texturize[f_, n_, colf_] := # /. Polygon[{v1_, v2_, v3_}] :> {EdgeForm[], Texture@ImageData@Colorize[Image@f[#1, #2, 1 - #1 - #2] &[#, Transpose[#]] &@ ConstantArray[Range[-1./n, 1 + 1/n, 1./n], n + 3], ColorFunction ...


14

Here is a standard direct way to get the principal exes and other transformation data. Find the mean of the points, subtract it to center them, and take the singular value decomposition. The third and second components thereof give the rotation and scaling data necessary to form a circle on which the first component, viewed as a point set, roughly lies. The ...



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