Tag Info

Hot answers tagged

13

image = Import["http://i.stack.imgur.com/6YRfK.jpg"]; If you want to use your f, uRange and vRange as the arguments to ParamatricPlot3D, you need to wrap each with Evaluate: f = {u, Sin[v]*(u^3 + 2 u^2 - 2 u + 2)/5, Cos[v]*(u^3 + 2 u^2 - 2 u + 2)/5}; uRange = {u, -2.3, 1.3}; vRange = {v, 0, 2 Pi}; ParametricPlot3D[Evaluate@f, Evaluate@uRange, ...


11

Just a combination of Graphics3D objects Graphics3D[{Scale[ Cylinder[{{0, 0.9, -0.5}, {2, 0.7, 0.5}}, 0.75], {1, 0.95, 1}], Scale[Cylinder[{{0, -0.9, 0}, {2, -0.7, 0}}, 0.75], {1.0, 0.95, 1}], Scale[Cylinder[{{-1.1, 0, 0}, {-0.3, 0, 0}}, 1.5], {1, 1, 0.5}], Scale[Sphere[{0., 0.75, -0.25}, 1.05], {1.1, 0.9, 1}], Scale[Sphere[{0., -0.75, 0.1}, 1.05], {1.1, ...


6

I suggest you try the following. Set your two plots in the Question to p1 and p2. Then, col = Map[ColorData["TemperatureMap"][#] &, Rescale[var[[2]], {0, maxvar}]]; ans = MapIndexed[(#1 /. (RGBColor[__] -> col[[Last[#2]]])) &, p1 // InputForm, {6}]; ans[[1]] reproduces p2 without calling GraphPlot3D, which should be faster. This process can, ...


6

Something like this is probably what you're after: dat = DeleteCases[({CityData[#, "Population"], CityData[#, "Coordinates"]} & /@ CityData[{All, "Mexico"}]), {___, _Missing, ___}]; func = PDF[SmoothKernelDistribution[ WeightedData[dat[[All, 2]], dat[[All, 1]]]], {x, y}]; ra = func[[2, 0, 1]]; Plot3D[Log10@func, {x, ra[[1, 1]], ra[[1, ...


4

I would be happy if I could get Mathematica to prefix each POV-Ray export (which Mathematica supports, by the way) with a preamble in which I specify camera, lighting, etc. But unfortunately I don't know to what extent it's possible to customize Mathematica's export facilities. Use ExportString for obtaining the output file as a String inside of ...


4

p = Plot3D[x^2 + y^2, {x, -1, 1}, {y, -1, 1}]; pv = VectorPlot3D[{{2 x, 2 y, 0}, {-2 y, 2 x, 0}}, {x, -1, 1}, {y, -1, 1}, {z, -0.01, 0.01}, PlotRange -> {Automatic, Automatic, {-1, 1}}]; Show[pv, p]


3

One way to make transparent regions is to use RegionFunctions. For example, here are your two cubes and then the "symmetric difference" between them. This essentially removes the smaller one from the larger, and leaves a transparent window. r1 = Cuboid[{0, 0, 0}, {0.8, 0.1, 2}]; r2 = Cuboid[{0.1, -0.001, 1.35}, {0.7, 0.101, 1.85}]; d = ...


3

You can also use RegionPlot3D: cuboid1 = {{0, 0, 0}, {0.8, 0.1, 2}}; cuboid2 = {{0.1`, -0.001`, 1.35`}, {0.7`, 0.101`, 1.85`}}; {cuboid1b, cuboid2b} = Insert[#, {x, y, z}, 2] & /@ {cuboid1, cuboid2}; {region, hole} = (And @@ Less @@@ Transpose@#) & /@ {cuboid1b, cuboid2b}; RegionPlot3D[region && Not[hole],{x, 0, 2}, {y, 0, 2}, {z, 0, 2}, ...


3

The region where $z$ is between $x$ and $y$ is bounded by the curves $z = x$ and $z = y$, or equivalently, $z-x=0$ and $z-y=0$. To draw these curves in the plot, the usual trick is to supply the left-hand sides of the equations to MeshFunctions and specify that Mesh lines be drawn only when they are zero. Plot3D[-4.53 + 2.67 x + 2.78 y - 1.09 x y, {x, 1.8, ...


2

Put the ViewPoint inside the room: Graphics3D[{Room3D}, ViewPoint -> {-3, -2, 1}/15, ImageSize -> {400, 400}, Lighting -> "Neutral"] See also Extract values for ViewMatrix from a Graphics3D.


2

EDIT: Corrected error by adding ColorFunctionScaling -> False f[x_, y_] = -4.53 + 2.67 x + 2.78 y - 1.09 x y // Rationalize // Simplify; Plot3D[f[x, y], {x, 1.8, 2.6}, {y, 1.8, 2.6}, PlotRange -> {1.7, 2.6}, PlotPoints -> 101, AxesLabel -> (Style[#, Bold, 14] & /@ {"x", "y", "z"}), Ticks -> {{1.8, 2., 2.2, 2.4, 2.6}, ...


2

This isn't clever at all, basically because it doesn't "detect" the edges on its own, but I don't know of anything better: f[u_, v_] := {Cos[u], Sin[u], v}; Show[ ParametricPlot3D[f[u, v], {u, 0, 2 Pi}, {v, 0, 1}, Mesh -> None, Boxed -> False, Axes -> False, PlotRangePadding -> .2], ParametricPlot3D[f[u, 1], {u, 0, 2 Pi}, ...


2

Here's your code with fixes I've suggested in comments: DynamicModule[ {Location = {{0, 0, 0}, {0, 0, 0}}, pos10 = {{}, {}}, pos11 = {{0, 0, 0}, {0, 0, 0}}, pos12 = {{0, 0, 0}, {0, 0, 0}}, pos20, pos21 = {{0, 0, 0}, {0, 0, 0}}, pos22 = {{0, 0, 0}, {0, 0, 0}}, posInt, x, y, z, Chosen = 1}, posInt[] := ...


2

I don't know how much you have worked with POVRay, but there is no need to generate thousands of individual pov files. For animations you can use the built-in clock function. Include in the graphics primitives exported by Mathematica a dependence on the clock, and let POVRay do the work for you. The following is a very simple example of POVRay code which ...


2

Yes, if you move your mouse to the right and double-click on the output, the input should be hidden.


2

A terser way to use Graphics[] arguments: pts = {{19.4, 12.4, 6.2}, {15.9, 4.6, 12}, {18.64, 10.52, 7.51}, {20.3, 3.1, 4.1}}; cols = {Green, Blue, Orange, Purple}; Manipulate[ Graphics3D[{Opacity[.1], Sphere[{18.64, 10.52, 7.51}, 2.93], Opacity[.5], AbsolutePointSize[6], Thread[{cols, Point /@ pts}]}, PlotRange -> If[fixedPltRng, {{-20, 20}, ...


2

Opacity should be in the range 0-1, and the elements must be in a list of elements: Manipulate[ Graphics3D[{ {Opacity[.1], Sphere[{18.64, 10.52, 7.51}, 2.93]}, {Opacity[.5], Green, AbsolutePointSize[6], Point[{19.4, 12.4, 6.2}]}, {Opacity[.5], Blue, AbsolutePointSize[6], Point[{15.9, 4.6, 12}]}, {Opacity[.5], Orange, AbsolutePointSize[6], ...


1

As @halirutan suggested, the error occurs, because data is undefined. I presume that xyz, which otherwise is unused, is meant to be the data. Inserting it in place of data produces a fine plot.



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