Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi all,
I am trying to have a python visual displayed on Power BI Desktop. I implemented my plot on Jupyter Notebooks and it appears as expected. However, when the plot gets displayed on Power BI Desktop, parts of the x-axis labels gets cut off. My plot has long x-axis labels and they need to be displayed on the x-axis (not in a legend). These labels display best when at a 90 degrees rotation.
Things I have tried so far:
- Using a smaller figure size for plot in python code
- Trying other x-axis label angle rotation (30, 45, 60 degrees)
- Publishing Power BI desktop report to Power BI My Workspace
I have created a sample stripplot to show the issue I am experiencing:
Plot on Jupyter Notebook
Plot on Power BI Desktop
Any advice on how to fix this issue will be greatly appreciated.
Solved! Go to Solution.
this one seems to work "better"
fig, ax = plt.subplots(1,1,figsize=(16,16))
sns.stripplot(data=dataset, x="x label", y="Concentration", ax=ax)
fig.autofmt_xdate(rotation=90)
plt.show()
please show the code and provide the sample data for the dataframe/dataset.
# code as applied in Power BI
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
plot_table = dataset
ax = sns.stripplot(data=plot_table, x="x label", y="Concentration")
ax.tick_params(axis='x', rotation=90)
plt.show()
I do not see a place to attach the excel table, so please see it included as a google sheet
https://docs.google.com/spreadsheets/d/1eRbP0wyM42_EDEw5I1VyKkqRDMnhd358/edit?usp=sharing&ouid=10187...
Thank you for taking the time to look into this
this one seems to work "better"
fig, ax = plt.subplots(1,1,figsize=(16,16))
sns.stripplot(data=dataset, x="x label", y="Concentration", ax=ax)
fig.autofmt_xdate(rotation=90)
plt.show()
That solves the issue.
THANK YOU!!!
User | Count |
---|---|
128 | |
109 | |
100 | |
65 | |
62 |
User | Count |
---|---|
137 | |
115 | |
102 | |
71 | |
61 |