Question Details

No question body available.

Tags

python matplotlib plot curve

Answers (1)

Accepted Answer Available
Accepted Answer
March 24, 2026 Score: 4 Rep: 507 Quality: High Completeness: 80%

You can simple change plt.xscale('symlog') to plt.xscale('log'). 'symlog' is an extension of the 'log' scale for negative values, which you do not need here. Naturally, this extension is not seamless, and it needs to remove values under a small threshhold. That is what is causing you issues here.

Figure without artefacts

Be careful if you need to plot for values starting at 0.1, you need to change t at the begining.

Full code:

import numpy as np
import matplotlib.pyplot as plt

t = np.logspace(-1, 4, 100)

CP = 400 Pan = 1100 tau = 30

P = CP+P
an/(1+t/tau)

dPdPan = 1/(1+t/tau) dPdtau = (Pan*t)/(tau2*(1+t/tau)2)

S
CP = CP/P normpan = (dPdPan - dPdPan.min()) / (dPdPan.max() - dPdPan.min()) normtau = (dPdtau - dPdtau.min()) / (dPdtau.max() - dPdtau.min())

plt.figure(figsize=(6,4)) plt.plot(t, normpan, label=r'$\text{P}\text{an}$') plt.plot(t, normtau, label=r'$\tau$') plt.plot(t, SCP, label="CP")

plt.vlines(tau, 0, max(normtau), linestyles=':', colors="dimgray", alpha=.4, lw=1.5)

plt.xscale('log') plt.xlim(0.1, 10001) plt.ylim(0, 1.05)

ax = plt.gca() ax.spines["top"].set
visible(False) ax.spines["right"].setvisible(False)

ax.set
xticks([1, 10, tau, 100, 1000, 10000]) ax.setxticklabels([1, 10, r'$\tau$', 100, 1000, 10000])

plt.legend(fontsize=9, frameon=False, loc='center right')

plt.tight
layout() plt.show()