Open phoenixor opened 2 days ago
@phoenixor 你好! 我是Dosu,一个可以帮助您解决错误、回答问题并成为贡献者的机器人。我会帮助您解决问题,感谢您的耐心等待人类维护者的回复。
A similar issue was discussed in a closed thread where the solution involved setting the font for matplotlib to display Chinese characters correctly. You can use the following code snippet to set the font to 'SimHei', which should be placed before generating the charts:
import matplotlib.pyplot as plt
# Set the font for matplotlib
plt.rcParams['font.sans-serif'] = ['SimHei'] # Use 'SimHei' font to display Chinese characters
plt.rcParams['axes.unicode_minus'] = False # Ensure the minus sign is displayed correctly
Make sure to include this code in your script before any chart generation code. This should help in displaying Chinese characters correctly in your charts [1].
To continue talking to Dosu, mention @dosu.
@phoenixor 你好! 我是Dosu,一个可以帮助您解决错误、回答问题并成为贡献者的机器人。我会帮助您解决问题,感谢您的耐心等待人类维护者的回复。
A similar issue was discussed in a closed thread where the solution involved setting the font for matplotlib to display Chinese characters correctly. You can use the following code snippet to set the font to 'SimHei', which should be placed before generating the charts:
import matplotlib.pyplot as plt # Set the font for matplotlib plt.rcParams['font.sans-serif'] = ['SimHei'] # Use 'SimHei' font to display Chinese characters plt.rcParams['axes.unicode_minus'] = False # Ensure the minus sign is displayed correctly
Make sure to include this code in your script before any chart generation code. This should help in displaying Chinese characters correctly in your charts [1].
To continue talking to Dosu, mention @dosu.
where can i find the code generating the charts. agent.chat(prompt) already output the charts png image, i can`t modify the image title
To modify the image title for the charts generated by agent.chat(prompt)
, you should look into the generate_matplotlib_code
method within the CodeGenerator
class. This method is responsible for generating the code that creates the charts using Matplotlib. Specifically, the line that sets the title of the plot is:
if title:
code += f"plt.title('''{title}''')\n"
You can modify this line to change how the title is set or to use a different title [1].
To continue talking to Dosu, mention @dosu.
System Info
OS : ubuntu or win10 python 3.10.11 pandasai 2.3.0
🐛 Describe the bug
i am using PandasAI with streamlit,but output charts can
t display chinese correctly, i
v search issues, someone said its the font problem, but i don
t know where to put the font settings codeplt.rcParams["font.sans-serif"] = ["SimHei"] plt.rcParams["axes.unicode_minus"] = False
i am using Agent to generate output and st.write to show the charts. my prompt is Plot histograms by department