
We also talk about personalised nutrition and the revolutionary PREDICT studies, carried out for Tim’s ZOE nutritional science company, which found people can have dramatically different biological responses to the same foods. We discuss a move towards counting quality instead of calories, and why the new mandatory calorie labels are unhelpful for most people. Tim believes the obesity crisis is more of a food crisis, fuelled by ultra-processed foods. And because diversity is key, Tim shares some of his own food hacks for getting to 30 different plant foods a week.

He reveals the gut-friendly properties of plant fibre, polyphenols and fermented foods. Tim explains that, unlike our genes, it’s something we can influence, thereby improving not just digestion but almost all aspects of our wellbeing. We start by discussing why gut health is such a hot topic. But don’t worry if you’re new to the subject of gut health, as we also provide a need-to-know guide to get you up to speed. This conversation will bring you up to date with all Tim’s most recent findings and practical advice. Tim is author of two excellent books, The Diet Myth and Spoonfed: Why Everything You Know About Food Is Wrong. He’s a world-leader when it comes to the gut microbiome – and Director of the British Gut Project – whose research has transformed what we know about food and health. Tim is a professor of genetic epidemiology and Head of the Department of Twin Research at King’s College London. Professor Tim Spector was my first-ever guest, and he returns for the third time today, with the very latest on gut health and personalised nutrition.
#FIXIN X UNCLUTTER MAP SERIES#
If this stepsize based solution doesn't fit, then one can also populate the values of sparse_xticks or sparse_yticks at irregular intervals, if that is what is desired.For the last in the current series of Feel Better Live More, I’m welcoming back someone I know you’ll love.
#FIXIN X UNCLUTTER MAP CODE#
Sparse_yticks = yĪx.set_xticklabels(sparse_xticks, fontsize=6) # set sparse xtick valuesĪx.set_yticklabels(sparse_yticks, fontsize=6) # set sparse ytick valuesĭepending on the usecase, one can adapt the above code simply by changing show_every and using that for sampling tick values for X or Y or both the axes. # here, we show every third value from `x` and `y` Now, we clean up the clutter with a new plot that shows only a sparse set of values on both x and y axes as ticks. # Note the super cluttered ticks on both X and Y axis. Here is a sample piece of code that produces cluttered ticks on both X and Y axes. Since None of the above solutions worked for my usecase, here I provide a solution using None (pun!) which can be adapted to a wide variety of scenarios. Notice the x-axis has integer values all evenly spaced by 5, whereas the y-axis has a different interval (the matplotlib default behavior, because the ticks weren't specified). Sample Usage import matplotlib.pyplot as plt Print(list(computeTicks(series, step = 100))) XMax, xMin = math.ceil(max(x)), math.floor(min(x))ĭMax, dMin = xMax + abs((xMax % step) - step) + (step if (xMax % step != 0) else 0), xMin - abs((xMin % step)) X - Required - A list-like object of integers or floats Here's a runnable example: import numpy as npĪx.t_ticks(np.arange(start, end, 0.712123))Īx.t_major_formatter(ticker.FormatStrFormatter('%0.1f'))īelow's a pure python implementation of the desired functionality that handles any numeric series (int or float) with positive, negative, or mixed values and allows for the user to specify the desired step size: import mathĬomputes domain with given step encompassing series params For example, ax.t_major_formatter(ticker.FormatStrFormatter('%0.1f')) However, if you wish to have more control over the format, you can define your own formatter.

The default tick formatter should do a decent job rounding the tick values to a sensible number of significant digits. start, end = ax.get_xlim()Īx.t_ticks(np.arange(start, end, stepsize)) If you wish to keep those limits, and just change the stepsize of the tick marks, then you could use ax.get_xlim() to discover what limits Matplotlib has already set. The plt.plot (or ax.plot) function will automatically set default x and y limits. ( np.arange was used rather than Python's range function just in case min(x) and max(x) are floats instead of ints.) You could explicitly set where you want to tick marks with plt.xticks: plt.xticks(np.arange(min(x), max(x)+1, 1.0))
