2
$\begingroup$

I can plot a graph for one company at a time. For example :

    DateListPlot[Entity["Company", "NVIDIACorporation::7ymsk"][EntityProperty["Company","GrossProfit", {"TimeSeriesType" -> #, "Date" -> All}]], ImageSize -> 200, PlotLabel -> #, PlotTheme -> "Business"] & /@ {"Annual", "Quarterly", "TTM"}

How could I compare two "TTM" values of this company and another company on a graph. I tried various things, but I still can't figure it out.

EDIT: I tried to somehow move the pure function, so that it could compare two companies. It turns out I only got to compare two properties of the same company. CODE:

DateListPlot[[EntityProperty["Company","GrossProfit",{"TimeSeriesType"->#,"Date"->All}]]&/@{"TTM", "Annual"},ImageSize->200,PlotLabel-> "Graph",PlotTheme->"Business"]
$\endgroup$
4
  • 2
    $\begingroup$ I tried various things - what did you try? Please put the code in your post. Did you try Show or DateListPlot[{company1, company2},...] ? $\endgroup$
    – flinty
    Apr 6, 2021 at 12:38
  • $\begingroup$ @flinty I tried DateListPlot, but I cannot choose the date or property to display. $\endgroup$
    – VLC
    Apr 6, 2021 at 13:14
  • $\begingroup$ I do not understand what you mean by: "How could I compare two "TTM" values of this company and another company on a graph". TTM is a time series. How can you compare TTM of the same company? To compare TTM of different companies, do you mean 2 series in the same plot or their ratio? $\endgroup$ Apr 6, 2021 at 13:39
  • $\begingroup$ @DanielHuber I mean two series of "TTM" of different companies on the same plot yes $\endgroup$
    – VLC
    Apr 6, 2021 at 13:40

1 Answer 1

3
$\begingroup$

If you include a list of time series as first argument of DateListPlot you will get a plot with multiple curves.

Here is an example where I plot "TTM" and "Quarterly" of the given company in the same plot. For clarity, I first create the time series separately and subsequently feed them to DateListPlot:

ds1 = Entity["Company", "NVIDIACorporation::7ymsk"][
   EntityProperty["Company", 
    "GrossProfit", {"TimeSeriesType" -> "TTM", "Date" -> All}]];
ds2 = Entity["Company", "NVIDIACorporation::7ymsk"][
   EntityProperty["Company", 
    "GrossProfit", {"TimeSeriesType" -> "Quarterly", "Date" -> All}]];
DateListPlot[{ds1, ds2}]

enter image description here

If we want to restrict the dates to plot, we can do so e.g. by:

DateListPlot[{ds1, ds2},PlotRange -> {{{2005, 1, 1}, {2020, 1, 1}}, Automatic}]

enter image description here

$\endgroup$
2
  • $\begingroup$ Do you maybe know how to set "Date" to be from a certain point onward ? $\endgroup$
    – VLC
    Apr 6, 2021 at 16:54
  • 1
    $\begingroup$ A added an example to my answer. $\endgroup$ Apr 6, 2021 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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