Motivated by a comment by Barbara Beeton, I was wondering if there is a way to show the average activity on this site vs. time of the day? I am interested in a plot of the following type (I stress that there is no real data underlying this plot, this is the data I am interested in!)

enter image description here

Is it possible to get this data? If so, how? Where can one read more about how to access this data?

EDIT: Barbara Beeton pointed that one has, of course, to specify the time zone. I was thinking the natural choice will be the time zone in which the reputation gets binned.

  • you should specify the base time zone so that the results make sense. utc would be best, i think. – barbara beeton Aug 1 at 14:28
  • @barbarabeeton You are right, but isn't there a predefined time zone, namely the one a day on TeXLive is defined? (Users subject to reputation caps will know what I mean ;-) – marmot Aug 1 at 14:30
  • related pre-existing query at SEDE data.stackexchange.com/meta.tex/query/315251/… – David Carlisle Aug 1 at 14:34
  • i agree there must be a predefined time zone, but unless the person looking at the results of the query knows what that is w.r.t their local time, not helpful. what i see on my screen for the timestamp of a question/answer/comment/chat item is my local time. – barbara beeton Aug 1 at 14:35
  • @DavidCarlisle Sadly I cannot run it ... – marmot Aug 1 at 14:36
  • 6
    if you have not set up an account there there is a captcha to check you are human, which obviously marmots can not pass. – David Carlisle Aug 1 at 14:39
  • 1
    This answer could also be interesting meta.stackexchange.com/a/313296/237989 For TeX.se the graph looks like this: i.stack.imgur.com/lTyn3.png – samcarter Aug 1 at 16:24
up vote 24 down vote accepted

I created a SEDE query for the distribution of the creation dates of questions and answers by time of day (in UTC): At time of writing, the result looks like this

enter image description here

The data comes from the entire time TeX StackExchange existed until 2018-08-01, 19:20.

The following graph only analyzes posts from 2017 (SEDE query):

enter image description here

As far as I can tell this is not possible for votes: While votes are accessible using the Data Explorer, the time is considered private information.


Since this is a LaTeX forum, one can also plot the data with LaTeX means.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots,filecontents}
\begin{filecontents*}{allquestions.csv}
Hour,Name,Activity
0,Question,0.02742403306
1,Question,0.02445506715
2,Question,0.02222056242
3,Question,0.0215981377
4,Question,0.01952546339
5,Question,0.0200545244
6,Question,0.02334092691
7,Question,0.03000087139
8,Question,0.04025843074
9,Question,0.04803873971
10,Question,0.05047242036
11,Question,0.05041017788
12,Question,0.0528002888
13,Question,0.05857639018
14,Question,0.06190013817
15,Question,0.06244787192
16,Question,0.06130883469
17,Question,0.05616138228
18,Question,0.05274427058
19,Question,0.05022345047
20,Question,0.04956990452
21,Question,0.04505732531
22,Question,0.03954886656
23,Question,0.0318619213
\end{filecontents*}
\begin{filecontents*}{allanswers.csv}
Hour,Name,Activity
0,Answer,0.02900122291
1,Answer,0.02304429242
2,Answer,0.02030228914
3,Answer,0.01757939389
4,Answer,0.01709691596
5,Answer,0.01880708526
6,Answer,0.02365097259
7,Answer,0.03209194787
8,Answer,0.04143100087
9,Answer,0.04653284671
10,Answer,0.04889746627
11,Answer,0.04756945771
12,Answer,0.05039267015
13,Answer,0.05562827225
14,Answer,0.05880020636
15,Answer,0.05993235754
16,Answer,0.05978427026
17,Answer,0.05552795505
18,Answer,0.05219360262
19,Answer,0.05225570374
20,Answer,0.05434803378
21,Answer,0.05271429663
22,Answer,0.04531948637
23,Answer,0.03709825352
\end{filecontents*}
\pgfplotsset{compat=1.16}
\begin{document}
\pgfplotstableread[col sep=comma]{allquestions.csv}\qtable
\pgfplotstableread[col sep=comma]{allanswers.csv}\atable
\begin{tikzpicture}
    \begin{axis}[
        width  = 0.85*\textwidth,
        ymin=0,
        height = 8cm,xmax=24,xmin=0,
        ylabel = {activity},xlabel={time of day},
        legend cell align=left,
        legend style={
                at={(1,1.05)},
                anchor=south east,
                column sep=1ex
        }
    ]
    \addplot table[x=Hour ,y=Activity,col sep=comma]{\qtable};
    \addlegendentry{questions}
    \addplot table[x=Hour ,y=Activity,col sep=comma]{\atable};
    \addlegendentry{answers}
    \end{axis}
\end{tikzpicture}
\end{document}

enter image description here


Here is the plot for the 2017 data. To produce it,

  1. follow this link and download the file "QueryResults.csv"

  2. remove the obnoxious <cr>with dos2unix and remove all apostrophes in that file

Then you will be able to compile

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\pgfplotstableread[col sep=comma]{QueryResults.csv}\datatable
\begin{tikzpicture}
    \begin{axis}[
        width  = 0.85*\textwidth,
        ymin=0,
        height = 8cm,xmax=24,xmin=0,
        ylabel = {activity},xlabel={time of day},
        legend cell align=left,
        legend style={
                at={(1,1.05)},
                anchor=south east,
                column sep=1ex
        },
    ]
    \addplot table[x=Hour ,y=Activity,col sep=comma,
      skip coords between index={24}{49}]{\datatable};
    \addlegendentry{questions}
    \addplot table[x=Hour ,y=Activity,col sep=comma,
      skip coords between index={0}{24}]{\datatable};
    \addlegendentry{answers}
    \end{axis}
\end{tikzpicture}
\end{document}

to get

enter image description here

  • 1
    I added some pgfplots way of plotting your nice data, please feel free to remove it if you don't like it. – marmot Aug 1 at 18:16
  • @marmot This certainly looks much nicer than the original – Marcel Krüger Aug 1 at 18:22
  • there seems to be an increase in 2017 in the wee hours. maybe that indicates greater participation from australia, japan, and elsewhere in east asia. – barbara beeton Aug 1 at 18:41
  • @barbarabeeton I'm not sure I agree. The problem is that the vertical axis does not start at 0. But in the 2017 curve the lowest hand highest points of the answer curve differ by a factor 4, yet in the all time data this factor is a bit lower. This ratio is just half as large on the mathematics and physics sites, where the peak is also shifted to the right. – marmot Aug 1 at 18:55
  • thought i checked that, but obviously not. the lowest index on the all-years graph is .015 and .010 for 2017. i stand corrected. still, it appears to be strongly eurocentric. thanks for the exploration. – barbara beeton Aug 1 at 19:08
  • @barbarabeeton I just added a pgfplots version of the second plot, which starts from 0. And I added a simple snippet plus instructions that will allow you to produce the plots for any site or year (of course using Marcel's nice data!). – marmot Aug 1 at 19:31
  • 2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .