'How do I display a 1D slice of a contour plot?

I have a filled contour plot and I want to display the 1d slices of its two parameters. My contour plot was constructed by the following code:

import numpy as np
import matplotlib.pyplot as plt
import math

a=([8.0,9.0,10.0]) #a,b are the two axes in contour plot
b=([1.0,2.0,3.0])

c=[]
for i in range(0,len(a)):
    for j in range(0,len(b)):
        c.append(math.exp(a[i]/b[j]))  #c is the colour

c=np.array(c,dtype=float)
c=c.reshape(len(a),len(b))

y,x=np.meshgrid(b,a)
plt.contourf(x,y,c)

And my image looks like:

My contour plot

But the kind of plot I want is:

the kind of plot I want

Is there a way to do it with matplotlib?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source