I noticed that Code interpreter doesn’t support Korean output in graphs with marplot library , it doesn’t use any Korean supported font so I get boxes as output , any way around it ? maybe custom function call if possible ? I want the bot to output graphs
The problem is lack of unicode fonts with language coverage.
I give GPT-4 some example code, and the instructions meant for both you, and to be rewritten so an AI code interpreter can understand what to do:
Firstly, for the font that covers Korean and ideally all CJK characters, you might consider the “Noto Sans CJK” font. This is a sans-serif typeface designed as an intermediate style between the modern and traditional. It’s part of the Noto fonts family from Google. Noto’s goal is to provide a beautiful reading experience for all languages. It’s free and open source.
You can download it from here: Noto Sans CJK
Once you have downloaded the font, you can upload it to the sandbox.
Here’s how you can use it in your code:
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
if __name__ == "__main__":
prop = FontProperties()
prop.set_file('NotoSansCJK-Regular.ttc') # replace with the path to your font file
plt.xlabel("안녕하세요", fontproperties=prop) # replace with your text
Explanation of the code:
- We import the necessary modules.
matplotlib.pyplotis a collection of functions that make matplotlib work like MATLAB, and
FontPropertiesis a class in matplotlib that allows for manipulation of the font properties.
- We create a new figure with
- We create a
FontPropertiesobject and set the font file to the path of our downloaded “Noto Sans CJK” font.
- We set the x-label of our plot to a string of Korean text, using the font properties we just defined.
- Finally, we display the figure with
Without me going looking for documents, the assistants interface may have restrictions on uploading ttf font files, so you’d need to check if you can upload your own font files and put them where they can be found by AI-written software. You might have to zip them to upload and unzip, etc.
Yeah I uploaded the font as a zip and it worked , the thing is it’s not doing it automatic even after giving it an instruction to use it , im still testing tho , thanks!