Issue
I feel like the way i did feels abit inefficient but im not sure how to better represent the data side by side, while comparing different product and different column categories
Solution
Since there is no expected output, we propose an approach to create multiple graphs grouped into one. I converted your data to vertical format and grouped them by category type; for the y-axis, the income value is too large in normal format to see the other values. So I have changed it to log format.Kindly refer to this.
data2 = data.melt(id_vars='Product', var_name='item', value_vars=['Education', 'Usage', 'Fitness', 'Income', 'Miles'])
import seaborn as sns
import matplotlib.pyplot as plt
g = sns.catplot(
data=data2, kind="bar",
x="Product", y="value", hue="item",
palette="dark", alpha=.6, height=6
)
g.despine(left=True)
g.ax.set_yscale('log')
g.set_axis_labels("x labels", "y labels")
g.legend.set_title("legend title")
Answered By - r-beginners
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.