0
$\begingroup$

I have a bunch of plots as the one reported below. The data is from measurements performed on different times and different days. In the plot (which is a cumulative distribution function, if that matters), the colors differentiate data relevant to different days; the markers are used to further differentiate the data within each day. The problem is that the plot is very crowded and a bit ugly. Some markers can be barely seen.

Question: Any idea how I can better plot this data?

As you can see I tried to scatter the markers so that they would not appear in the same position. The code I used to create the markers (with python/matplotlib):

marker_list = ['$A$', '$B$', '$C$', '$D$', '$E$', '$F$', '$G$', '$H$', '$I$', '$J$',
               '$K$', '$L$', '$M$', '$N$', '$O$', '$P$', '$Q$', '$R$', '$S$', '$T$',
               '$U$', '$V$', '$W$', '$X$', '$Y$', '$Z$', r'$\Gamma$', r'$\Lambda$', 
               r'$\Omega$', r'$\Psi$',]
   
'set marker position'
rnd_lst = [np.random.randint(-10, 10) for i, _ in enumerate(marker_list)]
marker_pos = [[25+x, 45+x, 65+x, 87+x] for x in rnd_lst]    # fixed points + random number to scatter the markers

cc = plt.cycler(marker=marker_list, markevery=marker_pos)
plt.rc('axes', prop_cycle=cc)
plt.rc('lines', markersize=18)

However, it would be nice to "distribute the markers in the y direction". For example, it'd be nice to show the markers only where the CDF is above 0.25.

Question: how to limit the markers to a specific section of the y axis?

EDIT I guess my best option is to use linestyles instead markers. However, using more than 4 or 5 linestyles is also bad because they will be barely distinguishable from one another. To solve I can use a combination of linestyles and markers when I have more than say 4-5 lines with same color. The problem with this solution is that I find it not immediate to automate, at least not by using the cycler as shown above. Any help on this would be also appreciated :)

Cumulative distribution function

$\endgroup$
2
  • $\begingroup$ What do you want to show with the visualization? The differences between colours? The overall trend? The differences between letters? $\endgroup$
    – WBM
    Commented Mar 25, 2021 at 18:06
  • $\begingroup$ everything you said :-). Overall trend and difference between the days (colors) being the most important things to note and also the easiest to visualize (for the trend you just observe the distribution of the lines. For the days you observe the colors). The differences within each day (the letters) is however also important, because I need to understand for example why some orange lines are higher than others... A lot of info in a single plot. $\endgroup$
    – Robyc
    Commented Mar 25, 2021 at 18:23

1 Answer 1

0
$\begingroup$

You might want to look at these kinds of error band line plots in seaborn:

enter image description here

https://seaborn.pydata.org/examples/errorband_lineplots.html

You could compute this for each colour/ day of the week. The central line would be a mean value of each colour/day, the shadow being the distribution.

Then it's probably best to look at days individually to compare the distributions of functions. A box-whisker plot might be good to compare distributions, although this is typically only for 1-D data.

EDIT

You can limit the y axis with plt.ylim(0.25,1) but the previous might look more appealing

$\endgroup$
3
  • $\begingroup$ this is nice and I am also using time series plots for other types of analyses (with matplotlib plt.error + plt.fill_between, stackoverflow.com/a/58011267/7074426). However, here I really want to plot the CDF of individual data, not average values. Regarding the ylim hint: I want the markers to appear only above a threshold, e.g. for y > 0.25, not the yaxis to be limited to (0.25, 1). $\endgroup$
    – Robyc
    Commented Mar 26, 2021 at 16:09
  • $\begingroup$ Please accept the answer if it resolved your issue or let me know if something is unclear $\endgroup$
    – WBM
    Commented Apr 29, 2021 at 11:24
  • $\begingroup$ Thanks WBM. I wrote my comment above already. In brief no, this do not solve my issue. 1. I need to plot a CDF, not a time series. 2. I don't want to limit the y axis, I want the markers to appear above a certain threshold $\endgroup$
    – Robyc
    Commented Apr 30, 2021 at 15:51

Your Answer

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

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