# Logarithmic scale on a plot with negative values

I would like to plot two time-series on a same graph. One series takes much larger values than the other, so I thought a semilog scale might be appropriate (i.e. linear X (dates) and log Y). However, both series take on negative and positive values. Does it still make sense to use a log scale? If so, should I transform both series as follows?

    if observation > 0
log_observation = log(observation)
elseif observation < 0
log_observation = -log(-observation)
else
log_observation = 0

• Because whether and how to transform data depends on their characteristics (more than their signs!) and on the purpose of the transformation, please give us more information about both so that this can be an objectively answerable question.
– whuber
Nov 24, 2012 at 17:03
• The time-series are the returns in dollar vs. percent terms of a trading strategy over time. Nov 25, 2012 at 10:58
• Why don't you show them as-is, using two different vertical axes to put the two series on the same graph?
– whuber
Nov 25, 2012 at 16:31
• So linear with two different y-axes? That is a good suggestion, I'll try it out. The only downside is that you don't have a single axis to compare both time-series on, but at least the graph will show correlation quite well. Nov 25, 2012 at 21:46

• Beware that cube roots in naïve python (**(1/3)) don't handle negative numbers, either (although numpy.cbrt does). Jun 19, 2018 at 17:18