Wednesday, January 19, 2022

Comparing R vs. Python graphing capabilities for time series data

 I used a simple time series data set on the number of touch downs for seven different quarterbacks achieved over the years.  The x-axes of the graphs are the quarterbacks' respective age.  The y-axes are their respective cumulative number of touch downs.  

You can see the complete presentation at the link below: 

R vs. Python comparison

And, I compare the two software using different types of graphs, including:

1) Time series graph of a single variable (the number of touch downs for one single quarterback);
2) Time series graph of multiple variables (including all 7 quarterbacks); and 
3) Facet graphs when you generate a separate graph for each of the quarterbacks. 

For the first two types of graphs, the two software were pretty competitive.  R was a bit more efficient in generating legends almost automatically.  Meanwhile, constructing a legend using Python was a lot longer and manual.  But, otherwise the respective Python graphs were pretty competitive with the R ones in terms of look and feel.  And, the coding difficulty (besides the legend bit) was fairly similar. 

When it came to Facet graphs, there was no comparison.  R was far easier and better.  Python facet graph capabilities appear more structured for scatter plots and not so much for time series plots.  Doing the latter in Python was truly a miserable experience.  And, the result was so poor relative to the R facet graphs, that I don't even dare to show them here.  I show them within the presentation link above.  With superior Python coding skills, maybe facet-time series graphs are doable.  But, be warned.  There is high hurdle rate there in terms of coding skills.  

Here is a multi variables regular Python graph that came out very well.


 

Here is the comparable R graph that came out equally well. 


 

Here is an R facet graph that came out very well. 



No comments:

Post a Comment

Compact Letter Display (CLD) to improve transparency of multiple hypothesis testing

Multiple hypothesis testing is most commonly undertaken using ANOVA.  But, ANOVA is an incomplete test because it only tells you ...