Tag Info

Hot answers tagged

45

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


41

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

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


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

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. Let us check how the new ...


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

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

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

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


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

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


19

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


19

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


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

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


18

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


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

My preferred method for this kind of thing is projecting each dimension onto a plane and then combining them together. I think MATLAB has similar functionality. Mind you, the answers and comments on my question about projecting are right in pointing out that this will become inefficient for high polygon counts (essentially more PlotPoints) so if you want to ...


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

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

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


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


17

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


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

First, there is no need to use Module in your sample code above. You could write simply: CCGray[pic_?ImageQ] := ColorConvert[pic,"GrayScale"] Now, if you want to manage the channel mixing manually you can use ImageApply and Dot: customGray[img_?ImageQ, ker_?VectorQ] := ImageApply[ker.# &, img] img = Import["http://i.stack.imgur.com/wtlqF.jpg"]; ...


15

The PlotMarkers option is designed to handle this problem. Here are two very simple ways to do it using that option. data = Table[Table[Sin[k x], {x, 0, 2 Pi, 0.1}], {k, {1, 2, 3}}]; ListPlot[data, Joined -> True, PlotMarkers -> {Automatic, 7}] The above solution has a drawback: there can be a slight misalignment of the markers, because ...


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]} *) ...



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