diff --git a/examples/plot_tasks_MPI.py b/examples/plot_tasks_MPI.py
index 612b79fc05d2cf7029fc891e17d0c04c4146fe5b..5e2f24a0bf08d6ab60dfd760e077c9bb1ee6edbc 100644
--- a/examples/plot_tasks_MPI.py
+++ b/examples/plot_tasks_MPI.py
@@ -122,7 +122,7 @@ for line in range(num_lines):
     if tic > 0 and toc > 0:
         rank = int(data[line,0])
         thread = int(data[line,1])
-        index = thread*nranks + rank
+        index = rank*nranks + thread
         tasks[index].append({})
         tasks[index][-1]["type"] = types[ str(int(data[line,2])) ]
         tasks[index][-1]["subtype"] = subtypes[str(int(data[line,3]))]