I am working with pandas DataFrames and I would like to plot columns as colormaps.
The DataFrames that I am working with have the following dimensions:
powers = [21 rows x 7 columns]
Fit_ABs = [21 rows x 7 columns]
Taus_lin_inv = [1 row x 7 columns]
My code is:
import os
import time
import numpy as np
import pandas as pd
import pylab as plt
import scipy
import re
from scipy.optimize import curve_fit
from scipy import stats
from sklearn import preprocessing
from matplotlib import cm
colorsP= plt.cm.jet_r(np.linspace(0.1, 0.9, len(powers.columns)))
colorsF= plt.cm.Greys_r(np.linspace(0.0,0.8,len(powers.index)))
fig, axs = plt.subplots(1, 2)
for c in range(len(colorsP)):
for row in range(len(powers.index)):
axs[0].semilogy(powers.iloc[row,:], Taus_lin_inv.iloc[0,:], marker='*', markersize=10, linestyle='', color=colorsP[c])
axs[0].semilogy(powers.iloc[row,:], Fit_ABs.iloc[row,:], linestyle='solid', color=colorsF[row])
axs[0].set_xlabel(r'$\sqrt{Amplitude}$' + ' ' + r'[$\sqrt{V}$]')
axs[0].set_ylabel(r'$1/\tau}$')
axs[0].grid(True, which='both')
axs[0].legend(powers, loc='best', fontsize=15)
plt.show()
Obtaining the next plot:
In the plot the horizontal points are the values of every column. I would like that all these sets of points change the color as jet. Also I would like that the legend is in agreement with the previous statement.
Thanks in advance