Message Boards Message Boards

GROUPS:

Retrieve data from a graph

Posted 17 days ago
245 Views
|
2 Replies
|
1 Total Likes
|

Friends: I have a question about a (I think) very simple operation which I have not managed to solve.

I request, say, the GDP per capita of a country using Shift =:

= per capita GDP Colombia

This returns a lot of information, including a nice beautiful graph with Colombia's GDP per capita from 1960 to 2018. Now, however, I want not only the graph but also all the data points, say in a list. If I select the Graph and right click there is a "get coordinates" option, but apparently it does not allow me to get all the data points.

So the question is: how can I get the data from the graph? Thanks in advance Francisco

2 Replies
Posted 17 days ago

Hi Francisco,

If you copy the cell as Input it is

gdp = Entity["Country", "Colombia"][
   EntityProperty["Country",  "GDP", {"Date" -> All, "CurrencyUnit" -> "CurrentUSDollar", 
     "PerCapita" -> "PerCapita"}]];

Which evaluates to a TimeSeries. To plot it

DateListPlot[gdp]

To get the data points

gdp["DatePath"]

Works like a charm. Thank you Rohit!!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract