Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 17477

How to use a colourmap to plot multiple plots on one graph and iterate over multiple different colourmaps

$
0
0

I need to use a different colourmap for a range of different sensors. I'm planning to have these different colourmaps in a list that will be called upon in the loop. The individual colourmap for a sensor shows the range of temperatures the sensor was measured over.

So far I am struggling to implement this, I can specify a common colourmap in the loop, here 'Blues' but don't know how to loop over the different colourmaps

cmap = ['Blues', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds']for j, n in enumerate(sensor_number):    fig = plt.figure(str(n), figsize=[10,6])    for k, T in enumerate(Temp):        xs = np.linspace(t[0], t[-1], 1000)        ys = model_funct(xs, *param[k][j])        plt.plot(xs, ys, label="Standard Linear Model", color='k', linestyle='dashed        cm = plt.cm.Blues(np.linspace(0.5, 0.8, len(Temp)))        for i in range(len(Temp)):            plt.scatter(t, R, s=0.5, label="Experimental Data", color=cm[i])    #plt.savefig(dir +'\\Graphs\\'+ str(n) +'hj.png')    plt.show()

where, t and R is my data

I have simplified and cut a lot of parts out of my code to show the problem, so the code might look a little unnecessary in places.

Also would a contour plot be better for this? Where a different contour is a different temperature


Viewing all articles
Browse latest Browse all 17477

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>