# Tag Info

44

I'm posting this as a second answer, as it's really a completely different approach. It's also been substantially expanded as of April 25, 2012. While this still doesn't specifically address the question of adding a region, it does plot the countries separately. Of course, each country could be viewed as a region in itself. Our objective is to make a ...

25

This is not a direct response to the question but rather a response to Istvan's comment to FJRA answer. As Istvan points out, the 3D globe has "artefacts like excess polygon-parts". An alternative approach is to use ParametricPlot3D together with a 2D map as a texture. Here's the result. SeedRandom[4]; countries = Table[{ColorData["DarkTerrain"][Random[]], ...

21

You could use a combination of Translate and Scale. Suppose the radii and centres of the circles are given by radii = RandomReal[{.1, .6}, 8]; centres = RandomReal[{-2, 2}, {8, 3}]; Then using the original sphere image = ExampleData[{"ColorTexture", "GiraffeFur"}]; sphere = SphericalPlot3D[1, {theta, 0, Pi}, {phi, 0, 2 Pi}, Mesh -> None, ...

21

Here's a method based on creating a MeshRegion from the text: text = Style[HoldForm @ Sum[x^2, {x, 0, 10}], 100, Bold]; graphics = First[text ~ExportString~ "PDF" ~ImportString~ "PDF"]; region = DiscretizeGraphics[graphics, MaxCellMeasure -> 5]; image = ExampleData[{"ColorTexture", "Kingwood"}]; RegionPlot[region, Frame -> False, ...

19

Go into the option inspector, and try the different settings for Graphics Options > RenderingOptions > "Graphics3DRenderingEngine and see if that has any effect. Edit This option can be set on a per-graphic basis, say by using Style: AbsoluteTiming[ Rasterize[ Style[Graphics3D[{Opacity[0.1], Sphere[{0, 0, 0}, #] & /@ Range[20]}, ...

13

You can use the raster image produced by MatrixPlot as Texture directive if you construct Cylinder using ParametricPlot3D or ContourPlot3D. mplt = MatrixPlot[Table[Sin[x y/100], {x, -10, 10}, {y, -10, 10}], ColorFunction -> "Rainbow", Frame -> False, ImagePadding -> 0, PlotRangePadding -> 0] ParametricPlot3D ParametricPlot3D[{Cos[...

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

12

The main problem here is that you need to include a VertexTextureCoordinates (VTC) in the Polygon for a texture to be applied. However, the rest of the problem is not as simple as it seems. Here's the output of my approach. Below it, I discuss texturing several polygons belonging to the same country, according to their timezone. You can also skip that and ...

12

I don't think you can control the interpolation used by Texture. One option might be to embed the image as a Raster primitive instead. Show[ParametricPlot[{20 + 1.4 x - 40 y, x}, {x, 0, 200}, {y, 0, 1}, BoundaryStyle -> Directive[Purple, Thick], PlotRange -> {{0, 201}, {0, 144}}, Prolog -> {Raster @ Reverse @ ImageData @ a}]] Zoomed in:...

11

Well, you’ve clearly established that they’re no set–subset relationship between SchematicPolygon and Polygon. One can only speculate as to why that is, but the fact remains that this behaviour of Polygon is documented: “Main boundaries [i.e. Polygon] exclude entities such as outlying islands and dependencies.” It is desirable at least for some purposes ...

11

This example is from the documentation for Texture in Mathematica version 8: With[{vc = Transpose[ Rescale /@ Transpose[First[CountryData[#, "Coordinates"]]]]}, Show[CountryData[#, "Shape"], ImageSize -> {{100}, {100}}] /. {RGBColor[__] :> Texture[ImageReflect[Image[CountryData[#, "Flag"]], Top -> Right]], Polygon[a_] :> ...

11

I made a program of this kind before and the most efficient solution I found was Cuboid. Or perhaps it was the best-looking solution. The rendering code is: render[stack_, iterations_, color_, thickness_, overlap_] := Module[ {center, interval, width = Length[stack[[1]]]}, interval = 2. \[Pi]/width; Last@Reap[Do[ Sow[Rotate[ Last@...

11

There is a PlotMarkers option in ListPlot: img = ExampleData[{"TestImage", "Lena"}]; ListPlot[Table[{Sin[n], Sin[2 n]}, {n, 50}], PlotMarkers -> Show[img, ImageSize -> 20]]

10

It sounds like you might like to use a stereographic projection. xy[ϕ_, λ_] := 2 Tan[(π - ϕ)/2] {Cos[λ], Sin[λ]}; Here is a cubic with a free parameter (for fun): cubic[{x_, y_}, b_] := y^3 - b x y + 4 x^3; For the sphere, use SphericalPlot3D of course. Although you could resort to ParametricPlot3D for the cubic curve, it's automatic and much simpler ...

10

Perhaps something like this? p = Plot[x^3/9, {x, -3, 3}, PlotStyle -> Thickness[0.01], Filling -> Axis, AspectRatio -> 1, ImageSize -> 500, BaseStyle -> {FontFamily -> "Calibri", 30}, AxesStyle -> Thick]; With[{k = 3}, SphericalPlot3D[1, {theta, 0, Pi}, {phi, 0, 2 Pi}, Mesh -> None, Boxed -> False, Axes -> False, ...

10

I think the "ugly thing" might be because texture is interpolated on triangles (demonstrated after), and a quadrangle is only divided into 2 triangles - up-left and down-right. So to solve the problem, we just need a triangulation network with much higher resolution. One way is to use ParametricPlot: ParametricPlot[ Evaluate[tr@{u, v}], {u, 0,...

10

For some reason those lines are created during the rasterization of the thing inside Texture: Rasterize[ Style[ Column[{"in=" <> ToString@1, "out=" <> ToString@2}, Right, Background -> Green], Black, Bold ] ] As you can see, the lines are part of the rasterized image's background. Manually rasterizing the thing inside ...

9

"Antarctica" is part of CountryData, but it is not returned by CountryData[All], and it's only returned by CountryData["Continents"]. If you want quick graphics (including country borders) you should use: Graphics[{EdgeForm[{Green, Thin}], CountryData[#, "SchematicPolygon"] & /@ Flatten@{CountryData[All], "Antarctica"}}, ImageSize -> 400] ...

9

In general, I don't think it's possible to use Texture directly with the built-in primitives such as Sphere and Cylinder. See also Texture mapping and resizing a sphere primitive in Mathematica. So you have to write your own replacement for those primitives. Since you specifically mentioned the Cylinder, I added the ability to handle Texture to my answer ...

9

ImageAdd is your friend: image = Import["http://creativity103.com/collections/Graphic/rainbowbars.jpg"]; text = HoldForm @ Sum[x^2, {x, 0, 10}]; img2 = Image @ Rasterize @ Style[text, 100, Bold]; rainbow = image ~ImageResize~ ImageDimensions[img2] ~ImageAdd~ img2 With Pickett's extension for outlining: img3 = ColorNegate[img2] ~Dilation~ 2 // ...

8

I noticed an example in the document of Texture which used the alpha channel. So I think a disk-shape primitive may be simulated to a limited degree by mapping the image img, which has been set to 100% transparent outside of the circle, onto a rectangle-shape Polygon. My code: img = Rasterize[ DensityPlot[Sin[x] Sin[y], ...

8

The existing answers show how to perfectly generate small textures on top of the cuboids. Unfortunately, the resulting 3D scene it is quite slow when you try to rotate it (about one frame per second). I propose to use one GraphicsComplex object with only one texture (aka atlas) histogram[data_, cf_] := Module[{nx, ny}, {nx, ny} = Dimensions@data; {...

7

kguler's answer is perfectly correct but I thought it worth mentioning that rescaling the Polygon itself is not necessary, only the vertices: gp := Graphics bill = ExampleData[{"TestImage", "Lena"}]; rawpoly = {{1, 0}, {.5, .86}, {-.5, .86}, {-1, 0}, {-.5, -.86}, {.5, -.86}}; poly1 = Rescale[rawpoly, {-1, 1}, {0, 1}]; g1 = {Texture[ExampleData[{"...

7

Whenever you have an object in a three-dimensional scene that needs to be displayed independently of the lighting conditions, it's a good idea to give that object a Glow. From the docs: Glow is a color component independent of simulated illumination. This is what I use in the definition of gr (last line before Show in the answer linked in the question):...

7

Using Simon Woods' shadow package this is easy: text = Style[HoldForm@Sum[x^2, {x, 0, 10}], 100, Bold]; image = ImageResize[Import["http://creativity103.com/collections/Graphic/rainbowbars.jpg"], ImageDimensions@Rasterize@text]; shadow[image, text] In the example above I stretched the background to fit the image of the equation. If you want to tile the ...

7

You can set Texture before each polygon t = ImageResize[ExampleData@#, {100, 100}] & /@ ExampleData["ColorTexture"][[;; 6]]; vtc = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; coords = {{{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}}, {{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 0, 1}}, {{1, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1}}, {{1, 1, 0}, {0, 1, 0}, {0,...

7

A quick and dirty way to do this is to pad the image with pixels of some inoffensive color, so that the actual meaningful part of the image gets mapped to a smaller portion of the sphere: image = Import["ExampleData/ocelot.jpg"]; {width, height} = ImageMeasurements[image, "Dimensions"]; image = ImagePad[image, {{2 width, 2 width}, {height, height}}, White]; ...

6

u = {x, x^3, 0}; v = {0, 0, z2}; l = (u - v) t + v; w = l /. Solve[xs xs + ys ys + (zs - 1)^2 == 1 /. Thread[{xs, ys, zs} -> l], t][[2]]; Manipulate[Show[ ParametricPlot3D[{Cos[u] Sin[v], Sin[u] Sin[v], 1 - Cos[v]}, {v, ArcCos[1 - z1], 0}, {u, 0, 2 Pi}, PlotStyle -> {Opacity[.3], FaceForm[Red, Yellow]}, Mesh -> False, ...

6

Does this work? lena=ExampleData[{"TestImage", "Lena"}]; poly1 = {{1, 0}, {.5, .86}, {-.5, .86}, {-1, 0}, {-.5, -.86}, {.5, -.86}}; scldpoly1=Rescale[poly1,{-1,1},{0,1}]; g1 = {Texture[lena],Polygon[scldpoly1,VertexTextureCoordinates -> scldpoly1]}; Graphics[g1] or something like: poly2 = {{-.5, -.5}, {.5, -.5}, {.5, .5}, {-.5, .5}}; Graphics[{...

5

Maybe begin with something like sphere /. GraphicsComplex[pts_, others__] :> GraphicsComplex[1.1 pts, others] // Show[#, PlotRange -> All] &

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