0

I am trying to condensate a plot with two peaks and a large zero region in between them so the peaks can be shown in a broader range.

My data looks like the function depicted below. Instead of plotting the whole x-range I only want to plot the two regions 10<x<30 and 70<x<90 within the same plot. How is that possible? I didn't find any example in the matplotlib documentation.

import numpy as np
import matplotlib.pyplot as plt
fig,ax1 = plt.subplots()

xtab = np.arange(0,100)
ftab = np.exp(-(xtab-20*np.ones(100))**2 /10) + np.exp(-(xtab-80*np.ones(100))**2 /10)

xtab2 = np.concatenate((xtab[10:30],xtab[70:90]))
ftab2 = np.concatenate((ftab[10:30],ftab[70:90]))

ax1.plot(xtab, ftab)
#ax1.plot(xtab2, ftab2)

plt.show()

Plot example

0 Answers0