在科研工作中,数据可视化不仅是展示结果的工具,更是传递科研故事的重要桥梁。
尤其是在投稿时,清晰、美观、信息量充足的Figure,往往能让审稿人和读者更直观地理解你的研究核心。
数据作图一般有两种做法:
- 基于软件,例如GraphPad,Origin等;
- 基于代码,例如Python、MATLAB、R等。
基于代码的优势是非常灵活、可重复性高,但学习门槛比较高。
GPT-5作为目前最先进的多模态AI大模型,在代码能力上有显著的提升。
而且GPT-5进一步增强了Canvas的支持,可以在云端直接运行代码并显示运行结果:
这篇文章主要是展示利用 GPT-5 进行数据作图,并且根据Canvas中的结果进行作图美化。
对于数据的导入,有两种方法。如果数据量较少且结构相对简单,可以直接以文本的形式包含在Prompt当中。
如果数据需要以Excel形式,可以直接上传Excel文件。
这里给一个Prompt的示例,在自己使用的时候需要修改其中的细节:
"You are an expert in scientific data visualization for high-impact journals such as *Nature*, *Science*, and *Cell*. I will provide a dataset and its description: '''Each observation records four numerical measurements: sepal length, sepal width, petal length, and petal width (in centimeters), along with a categorical variable Species indicating the flower type. The dataset is structured as a table with 150 rows and 5 columns.''' Goal: Create a figure to compare the measurements of different flower types. Your task is to: 1. Select the most suitable visualization method (e.g., boxplot, bar plot, scatter plot, violin plot) to clearly and accurately represent the data. 2. Write clean, reproducible Python code to create a high-quality figure, following these standards: - High resolution (≥ 300 dpi) for publication. - Figure size optimized for compact yet clear presentation. - Consistent, accessible, and colorblind-friendly color themes. - Clear, appropriately sized axis labels and tick marks. - Removal of unnecessary chart elements (e.g., top/right spines). 3. Provide a short explanation for each step, including the reasoning behind design choices. 4. Output: - The complete Python script. - The generated figure in the canvas."
重点是告诉GPT-5,你的数据是什么,数据结构是什么样。以及你最终想要展示什么数据。
这里在Prompt中会让GPT-5选一个最合适的可视化方法,如果有确定的方法,可以直接在Prompt里说明。
第一次Prompt得到的结果:
第一轮Prompt可以看到结果已经有模有样了,我们可以进一步优化细节。
例如除去背景的虚线,让Ticks朝外,等等。
优化Prompt:
Optimize the figure: 1. Set axis ticks to face outward. 2. Remove the dashed lines in the background.
优化结果:
如果Figure样式修改好了,可以通过提供的链接下载,或者点击查看分析获取代码:
gpt 教程
同样的,如果这种数据作图方式不满意,你可以让GPT-5推荐一种更好地数据展示方法。
例如用PCA对三种不同的物种的特征进行降维,同时了解哪些特征对于物种之间的分离比较重要。
后续我会探索更多用GPT-5进行科研绘图、图像处理的教程。
欢迎关注我的专栏。
GPT科研图像处理
发布者:Ai探索者,转载请注明出处:https://javaforall.net/239591.html原文链接:https://javaforall.net
