4
$\begingroup$

Let's say that I have a company, and I already extracted it's net profit with time series.

Nvidia = Entity["Company", "NVIDIACorporation::7ymsk"][
EntityProperty["Company", 
 "NetIncome", {"TimeSeriesType" -> #, 
  "Date" -> All}]] & /@ {"TTM"}

Now I have stored the data in the variable "data". How could I show dynamically by time this net profit geographically based on their headquarters in comparison to the other companies, that also have headquarters nearby.

What I want it, is to show a map with a circle around the dot where the headquarters of the company are located, the radius would show the net income. And then compare that circle with other companies that are in close proximity. With this I could see geographical comparison of net profits of different companies all located for example in Silicon Valley.

Is this possible to do with Mathematica?

$\endgroup$
1
  • 2
    $\begingroup$ It is certainly possible but you need to decide on the details. Read the help files about using geographical information. $\endgroup$
    – Nicholas G
    Apr 15 '21 at 2:18
4
$\begingroup$

Mathematica has the tools to display a geographical comparison of the net profits of different companies. The Company entity (version 12 and later) has NetIncome and Position properties that GeoBubbleChart can display. Here's a demonstration of one possible way to show a comparison. We need position and income data for each company for the GeoBubbleChart map.

Let's simplify by using the net income value instead of the time-series data, and use NVIDIA's location as the center of a map. Use EntityPrefetch to get the position data.

EntityPrefetch[EntityProperty["Company", "Position"]]
pos = Entity["Company", "NVIDIACorporation::7ymsk"]["Position"];

Now get the list of companies that are within 10 miles of NVIDIA's location. Some companies don't have locations, so ignore them. There are 944 companies, far too many for a meaningful map, but some have no net income and others have negative values. Simplify by mapping only the companies with positive net income.

nearbyCompanies = EntityList[
    FilteredEntityClass["Company", 
      EntityFunction[c,
      ! MissingQ[c["Position"]] &&
      GeoDistance[c["Position"], pos] < Quantity[10, "Miles"]]]];
Length[nearbyCompanies]
(* 944 *)

netIncomeList = 
  Select[DeleteMissing[
    EntityValue[nearbyCompanies, {"Position", "NetIncome"}, "EntityAssociation"], 
    1, \[Infinity]], QuantityMagnitude[Last[#]] > 0 &];
Length[netIncomeList]
(* 80 *)

Here are ten companies with the largest net income.

TableForm[
 Normal[TakeLargestBy[netIncomeList, Last, 10]] /. Rule -> List]

company net income

Use GeoBubbleChart to display circles scaled to each company's net income, and a circle that shows the 10-mile limit. The largest bubbles represent the companies with the highest net income (Apple is easily identified as the largest bubble).

geoNetList = Rule @@@ Values[netIncomeList];
Show[
 GeoGraphics[{EdgeForm[Black], Red, 
   GeoDisk[pos, Quantity[10, "Miles"]]}],
 GeoBubbleChart[geoNetList, GeoRangePadding -> Quantity[2, "Miles"]]
]

bubble chart

$\endgroup$
2
  • $\begingroup$ Do you maybe know how I could add a legend to the map. So that Let's say Nvidia company would be different color, or that a text would be beside the bubble? $\endgroup$
    – VLC
    May 25 '21 at 13:18
  • $\begingroup$ @VLC There are several ways to add legends of various types including Annotation, Labeled, Style, Tooltip, etc. See wrappers under the Options and Details section of the GeoBubbleChart documentation, and the Applications section for a nice example. $\endgroup$
    – creidhne
    May 25 '21 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.