You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create a polar plot with a log scale on the radial axis but I keep getting an error or I get a missed up plot.
This is the code that I use:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
I am trying to create a polar plot with a log scale on the radial axis but I keep getting an error or I get a missed up plot.
This is the code that I use:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
metabolites = data[["metabolite"]]
intercepts = data[["intercept"]]
amplitudes= data[["amplitude"]]
acrophases = data[["acrophase"]]
ind = data[["Unnamed: 0"]]
N = metabolites.count()
N = N.values
N = N[0]
metabolites = metabolites.values
acrophases = acrophases.values
amplitudes = amplitudes.values
ind = ind.values
colors = plt.cm.gist_rainbow(ind[:,0]/len(acrophases))
width = np.zeros((N,1)) + 0.3
for i in range(len(acrophases)):
if acrophases[i] <0:
acrophases[i] = acrophases[i]+ np.pi
acrophases = acrophases[:,0]
amplitudes = amplitudes[:,0]
width1 = width[:,0]
metabolites = metabolites[:,0]
fig = plt.figure()
ax = plt.subplot(111, projection='polar')
for j in range(len(acrophases)):
ax.bar(acrophases[j], amplitudes[j], width=0.3, bottom=0.0, align='center', color=colors[j], label=metabolites[j])
handles, labels = ax.get_legend_handles_labels()
ax.set_xticklabels(['0', '3', '6', '9', '12', '15', '18', '21'])
ax.set_rlim((1.0, 10000.0))
ax.set_rscale('log')
fig.savefig('plot.tiff', dpi=600)
plt.show()
The text was updated successfully, but these errors were encountered: