Drawing with ChatGPT and Tikz

Sometime ago through HackerNews I found this experiment on drawing a unicorn with ChatGPT on the blog of Adam K Dean. The results left something to be desired. I prefer using Tikz instead of SVG so I decided to an experiment myself with reasonable results. First I wanted a simple sine wave. In 2014, during an interview, I was asked to sketch a sine wave on a whiteboard as a preliminary step for a problem the interviewers wanted me to tackle. Regrettably, I ended up poorly drawing a cosine wave instead. For ChatGPT however, it’s not a problem:

A rather detailed plot of a sine wave generated with the prompt: “Can you give me a sine wave plot with tikz”

This is pretty good, I know I would need to some searching to get to this. Next I wanted a house:

A very simple house created with Tikz and the prompt: “Draw a house in Tikz”

This is going better than expected, let’s try to draw a unicorn:

A simple unicorn generated with prompt: “Draw a unicorn in Tikz”

Please add some details:

After prompt: “Please add some details”

It does try hard to give me an Markowitz efficent frontier together with the Capital Allocation Line and the tangency portfolio but didn’t quite succeed. This is the final result of the prompts: “Now draw an Markowitz efficent frontier with some details”, “Can you add the CAL and the tangency portfolio?” and “Please don’t use path”. The latest command is necessary as my installation of Tikz doesn’t know about it but it appears to work in another version. The result isn’t great, by default the legend is over the points and I need to comment out the location of the tangency portfolio. That said, if one really wants to get this graph ChatGPT gives a great start and it writes around 40 lines of Tikz code in 2 minutes which I’m definitely not able to do.

A part of the efficient frontier with individual assets. The tangency portfolio has been commented out and the legend has been moved manually from ‘north west’ to south east.

One thought to “Drawing with ChatGPT and Tikz”

Leave a Reply

Your email address will not be published. Required fields are marked *