Tag Info

Hot answers tagged

37

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

data: latlong = {{32.6123, -117.041}, {40.6973, -111.9}, {34.0276, -118.046}, {40.8231, -111.986}, {34.0446, -117.94}, {33.7389, -118.024}, {34.122, -118.088}, {37.3881, -122.252}, {44.9325, -122.966}, {32.6029, -117.154}, {44.7165, -123.062}, {37.8475, -122.47}, {32.6833, -117.098}, {44.4881, -122.797}, {37.5687, -122.254}, {45.1645, -122.788}, ...


24

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


24

The following is a little involved, but it calculates the "minimum displacement" evolution by choosing the least total displacement alternatives from the permutations generated by the "AutomorphismGroup" of the graph: {n, edges, coords1, perms} = GraphData["PappusGraph", {"VertexCount", "EdgeList", ...


23

There is a Mathematica package exactly for this at the OEIS wiki. Somewhat related: there's also a package for formatting data into the OEIS format. WolframAlpha also has some of this information, though I'm not sure how to get the $n^{\mathrm{th}}$ term of the sequence. In[1] := WolframAlpha["A004001", {{"TermsPod:IntegerSequence", 1}, "ComputableData"}] ...


23

There is nice way to to put your data on rotatable 3D globe. Your data: centers = {{32.6123, -117.041}, {40.6973, -111.9}, {34.0276, \ -118.046}, {40.8231, -111.986}, {34.0446, -117.94}, {33.7389, \ -118.024}, {34.122, -118.088}, {37.3881, -122.252}, {44.9325, \ -122.966}, {32.6029, -117.154}, {44.7165, -123.062}, {37.8475, \ -122.47}, {32.6833, -117.098}, ...


23

In the example code, CountryData[#, "AntarcticNations"] is a built in predicate that returns True or False. You need something similar for your countries. Perhaps, myCountries={ "Germany","Hungary","Mexico","Austria", "Bosnia","Turkey","SouthKorea","China"}; Graphics[{If[MemberQ[myCountries,#],Orange,LightBrown], ...


22

You can "preload" all the data to your computer so that it doesn't have to look it up each time. An added advantage is that it'll also be available when you're offline. This is covered in this support article on wolfram.com. In your case, you would do: ChemicalData[All,"Preload"] RebuildPacletData[] and you should be all set. Note that it will take a ...


20

Introduction Your (paraphrased) question was "Why do some of the CountryData flags render so badly?". I take the liberty to answer a much wider question, namely "How can the rendering of all flags be improved?". The main problem is that all bitmaps are so measly small (and they are bitmaps). What I would like to have is that CountryData[country, "Flag"] ...


18

One key function you might need is the (undocumented) function Graphics`Mesh`InPolygonQ[], which tests if a point is inside a given polygon. With it, and a few other tweaks, here's my version of weatherMap[]: weatherMap[region_String, property_String, res_Integer: 25, opts___] := Module[{fmin, cmax, coords, pts, minLong, maxLong, minLat, maxLat, ...


18

There are system options available that should restore the old behavior for most of the currated data paclet: SetSystemOptions[SystemOptions["DataOptions"] /. True -> False] {"DataOptions" -> {"ReturnEntities" -> False, "ReturnQuantities" -> False, "UseDataWrappers" -> False}} Note that this prevents these paclets from returning ...


17

Here's a start. latLngs={{32.6123,-117.041},{40.6973,-111.9},{34.0276,-118.046}, {40.8231,-111.986},{34.0446,-117.94},{33.7389,-118.024}, {34.122,-118.088},{37.3881,-122.252},{44.9325,-122.966}, {32.6029,-117.154},{44.7165,-123.062},{37.8475,-122.47}, {32.6833,-117.098},{44.4881,-122.797},{37.5687,-122.254}, ...


17

This is a matter of rules ordering for CountryData definitions. You have to do something like this: Unprotect[CountryData]; CountryData[c_String, "MyProperty"] := 0; (*actually call to another function*) DownValues[CountryData] = RotateRight[DownValues[CountryData]]; Protect[CountryData]; This reorders the definitions so that yours is at the top (or close ...


16

It is a nice application for the Graph[] features in Mma. We can calculate quickly all possible decays for all known isotopes, and then let VertexComponent[] look for the chains ending in {"Iridium191", "Iridium193"}. g = Graph@Union@Flatten[Thread[DirectedEdge @@ ##] & /@ Select[{#, IsotopeData[#, "DaughterNuclides"]} & /@ IsotopeData[], ...


15

Here is a shameless plug for my HTML parser posted here. The code is a bit long to reproduce here, the only change to it I'd do is to replace the function processPosList with this code: processPosList::unmatched = "Unmatched lists `1` enountered!"; processPosList[{openlist_List, closelist_List}] := Module[{opengroup, closegroup, poslist}, {opengroup, ...


15

You can get some nice vector playing cards from this site, licensed under GNU LGPL (read more here). Download this folder to your computer and then try the following: (* replace with your download dir *) files = Flatten@With[{dir = ...


15

I separated this project into two parts. The first is to compute the coordinates of the Geohash location. (*Grab the user's geographical location. The location is based on IP address, so it may not be completely accurate. It's usually good enough to get your graticute. You can replace home with with known coordinates in the form {hx, hy} if you like.*) home ...


15

apple = Interpreter["Company"]["Apple"]["Image"] Interpreter["Company"]["GE"]["Image"] Also works for the continent and respects colours: Interpreter["Company"]["Siemens"]["Image"] Update Interpreter["Company"]["Wolfram"]["Image"] For Apple addicts: ImageFilter[Max[Flatten[#]] - Min[Flatten[#]] &, ...


14

Please note that parts of the explanations and initialization code is shown together with the main function code, as a single large code block. I will appreciate any help on this matter - I am quite confused, perhaps overlooking something obvious here. Preamble While the question has been answered already, the delays with loading built-in data are a ...


14

AstronomicalData was updated to remove Pluto, so you don't need to anymore. In[27]:= AstronomicalData["Planet"] Out[27]= {"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"}


14

Not super high quality, but this might do for some purposes: cards = Join[ Table[ToString[k], {k, 2, 10}], {"Jack", "Queen", "King", "Ace"}]; suits = {"hearts", "diamonds", "clubs", "spades"}; deck = Flatten[Outer[#2 <> " of " <> #1 &, suits, cards]]; images = Table[ WolframAlpha[card, {{"Image", 1}, "Content"}], {card, deck}]; ...


14

You can easily do it using CountryData and there's no need to import anything. For this, we'll need an undocumented function, Graphics`Mesh`PolygonCombine, which will be used to "combine" all the countries so that there are no internal borders. Evaluating Graphics`Mesh`MeshInit[] will load the undocumented functions into your context path. You can then ...


14

All the information is there, but to adjust the sphere radius I had to do a replacement as follows: spaceFilledPlot[latticeType_] := LatticeData[latticeType, "Image"] /. Sphere[pt_, r_] :> {Opacity[.5], Sphere[pt, LatticeData[latticeType, "PackingRadius"]]} spaceFilledPlot["FaceCenteredCubic"] I added the opacity for better visibility of ...


14

It took me quite a while, but finally, here's a visualization of the perigee of Flamsteed's comet: I should first note two things: first, some of the needed data for computing the orbit of comet C/1683 O1 was missing in AstronomicalData["CometC1683O1", "Properties"], and I had to pull information from external sources to supplement the information ...


14

After downloading and unpacking the stanford Part-Of-Speech tagger that @PlatoManiac mentioned it is easy to call it with JLink: $POSTaggerPath = "/some/where/stanford-postagger-2013-11-12/"; << JLink` AddToClassPath[$POSTaggerPath]; tagString[str_String] := JavaBlock[ Module[{tagger}, ...


14

I guess you're hoping to take data produced by Mathematica via commands like CountryData and CityData and display that data on a map of some type. From your question, it's honestly not totally clear if you'd prefer an in notebook solution or a completely separate Google Map but both are possible. A static map in notebook In order to display your points as ...


14

This is a long comment for Nick Lariviere's answer. You can use Trace to see how lengthy the entity and quantity logic is. Version 9: Tuples@{Range@112, {"Symbol", "Group"}} // First ElementData @@ % // Trace; % // ByteCount 78336 TreeForm[%%, VertexLabeling -> False, ImageSize -> 800, AspectRatio -> 2] Version 10: ... % // ByteCount ...


13

Initializing is not the same as downloading: I believe you are witnessing the data being unpacked for use.


13

A bit of a hack, could do with some polishing, but the basic idea will work: OEISData[str_] := StringSplit[#, ","] & /@ Select[StringSplit[Import["http://oeis.org/search?q=" <> str]], StringMatchQ[#, __ ~~ ","] &]; OEISData["A004001"][[9]] If you just want the numbers, it could be even easier to just import from ...


13

It's been demoted to a "dwarf planet", a splendid way of avoiding saying it's not a planet like Jupiter. From the documentation in Mathematica 8:



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