Help:Creating charts with AI

Category:Commons work in progress#Creating%20charts%20with%20AI

This page explains how to create charts easily using AI. If you know more about it, please add the information to this page.

Uses of videos from public broadcasting on Wikipedias via a glamorous scan of uses of files in Category:Videos from public broadcasting by country
  1. To create a chart from AI, first gather the data needed.
    For example, the glamorous Commons tool can output a table as well as XML. In this example this query is used.
  2. Copy the relevant data. In this case in the XML simply
    <usage project="de.wikipedia" usage_count="811"/>
    <usage project="en.wikipedia" usage_count="517"/>
    […]
  3. In an AI like GPT 5 mini, enter this with a prompt like make a bar chart of the following data with 7 vertical columns (combining the lowest wikipedias as "Other") and no text labels. Create the matplotlib code for this. and below that prompt after a new line enter the data copied earlier.
  4. Once you get the code from the AI, copy it.
  5. Save it into a new file like "newchart.py"
  6. Install python and matplotlib if you haven't done so already. Here a python virtual environment is used which you also need to set up first and then enter /path/virtual-environment/bin/pip3 install matplotlib where the path needs to be that of the virtual environment that you set up and pip3 in it.
  7. Run /path/virtual-environment/bin/python3 /path2/newchart.py where you need to enter the path to python3 and the path to the chart file you saved earlier
  8. Check the resulting file. If there are any changes needed such as in regards to the labels, ask the AI to change those things and rerun the new matplotlib python code.
  9. After you got the file to look like intended, check whether things are accurate. Note that if you let the AI generate an image directly like a PNG or SVG file that you can download, it's quite likely it will be inaccurate such as having skewed scales so instead always use code. The example chart is on the right.
  10. Make sure to add the code used into the source field of your uploaded Commons file (as in the example). For this insert {{Igen|Matplotlib|+|s=|code=code here}} below the file information template

See also

Category:Wikimedia projects and AI Category:Commons image resources Category:AI-generated charts
Category:AI-generated charts Category:Commons image resources Category:Commons work in progress Category:Wikimedia projects and AI