In a few recent applications I have plotted some time series where the more recent values are of more interest, but the historical values are good for context. Here's an example, a
Ideally I would like the more recent dates to be shown more spread out on the x-axis, but still labelled correctly as dates. This would look a bit like a logarithmic scale in reverse. I think this idea might be quite useful for timelines in contexts where progress accelerates over time, e.g. computation power.
CodePudding user response:
You may try something along these lines, i.e. converting your dates to number of days and then applying np.log10()
on them:
prog.loc[:,'days'] = -np.log10(abs((prog.when - prog.iloc[-1].when).dt.days - 100))
g = sns.lineplot(x="days",y="words",data=prog,markers=True,marker="o")
_ = g.set_xticks(prog.days.to_list(), prog.when.dt.date.to_list(), rotation=90)
This yields this plot:
You can then handle overlapping labels by manually adjusting the xticklabels.