Jul-15-2023, 08:45 PM
Hi,
I just have read and checked that idea here:
https://stackoverflow.com/questions/7097...ale-python
then copying/pasting first example:
I just have read and checked that idea here:
https://stackoverflow.com/questions/7097...ale-python
then copying/pasting first example:
import plot_likert
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
rng = np.random.default_rng(seed=42)
data = pd.DataFrame(rng.choice(plot_likert.scales.agree, (200, 2)), columns=['Q1', 'Q2'])
ax = plot_likert.plot_likert(data, plot_likert.scales.agree, plot_percentage=True, figsize=(14, 4))
for bars, color in zip(ax.containers[1:], ['white'] + ['black'] * 2 + ['white'] * 2):
ax.bar_label(bars, label_type='center', fmt='%.1f %%', color=color, fontsize=15)
plt.tight_layout()
plt.show()and get this:Error:TypeError: DataFrame.set_axis() got an unexpected keyword argument 'inplace'So went to the second example from this link, adapting a bit a data:import plot_likert
import pandas as pd
rng = np.random.default_rng(seed=42)
data = pd.DataFrame(rng.choice(plot_likert.scales.agree, (200, 2)), columns=['Q1', 'Q2'])
# define my selections
myscale1 = \
['Strongly disagree',
'Disagree',
'Neither agree nor disagree',
'Agree',
'Strongly agree']
# create a likert plot
ax1 = plot_likert.plot_likert(data, myscale1, plot_percentage=True, figsize=(20,20), colors=plot_likert.colors.likert5)
ax1.set_title(('Casually watch big matches (21-34 year old)'), fontsize=30)
ax1.set_ylabel('Football/Soccer Moments',fontdict={'fontsize':28})
ax1.set_xlabel('% Breakdown',fontdict={'fontsize':28})
ax1.tick_params(axis='y', labelsize= 15)
ax1.tick_params(axis='x', labelsize= 10)
for bars, color in zip(ax1.containers[1:], ['white'] + ['black'] * 2 + ['white'] * 2):
ax1.bar_label(bars, label_type='center', fmt='%.1f %%', color=color, fontsize=15)and received yet still the same error:Error:TypeError: DataFrame.set_axis() got an unexpected keyword argument 'inplace'How to rectify this, please ?

![[Image: prv97I.png]](https://imagizer.imageshack.com/v2/xq70/922/prv97I.png)