Paper deep dive
Aligned Multi-View Scripts for Universal Chart-to-Code Generation
Zhihan Zhang, Lizi Liao
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 97%
Last extracted: 6/21/2026, 8:37:13 AM
Summary
The paper introduces Chart2NCode, a dataset of 176K charts paired with aligned Python, R, and LaTeX scripts, and CharLuMA, a parameter-efficient multimodal adaptation module. CharLuMA uses a language-conditioned mixture of low-rank subspaces to allow a shared visual understanding while specializing in specific plotting languages. The approach demonstrates significant improvements in chart-to-code generation across multiple languages compared to existing Python-centric methods and general MLLMs.
Entities (9)
Relation Signals (4)
Chart2NCode â containsalignedscriptsin â Python
confidence 100% · Chart2NCode, a dataset of 176K charts paired with aligned scripts in Python, R, and LaTeX
CharLuMA â isbasedon â LLaVA
confidence 100% · Building on a LLaVA-style architecture, we further propose CharLuMA
CharLuMA â usesvisionencoder â SigLIP
confidence 100% · We adopt SigLIP (Zhai et al., 2023a) as the vision encoder
Chart2NCode â providessupervisionfor â CharLuMA
confidence 90% · finetune the model on Chart2NCode
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Chart-to-code generation converts a chart image into an executable plotting script, enabling faithful reproduction and editable visualizations. Existing methods are largely Python-centric, limiting practical use and overlooking a critical source of supervision: the same chart can be expressed by semantically equivalent scripts in different plotting languages. To fill this gap, we introduce Chart2NCode, a dataset of 176K charts paired with aligned scripts in Python, R, and LaTeX that render visually equivalent outputs, constructed via a metadata-to-template pipeline with rendering verification and human quality checks. Building on a LLaVA-style architecture, we further propose CharLuMA, a parameter-efficient adaptation module that augments the multimodal projector with a language-conditioned mixture of low-rank subspaces, allowing the model to share core chart understanding while specializing code generation to the target language through lightweight routing. Extensive experiments show consistent gains in executability and visual fidelity across all languages, outperforming strong open-source baselines and remaining competitive with proprietary systems. Further analyses reveal that balanced multi-language supervision benefits all languages and that the adapter allocates a compact shared core plus language-specific capacity. Codes and data are available at this https URL.
Tags
Links
- Source: https://arxiv.org/abs/2604.24559v1
- Canonical: https://arxiv.org/abs/2604.24559v1
Trouble viewing inline? Open PDF directly â
Full Text
101,774 characters extracted from source content.
Expand or collapse full text
Aligned Multi-View Scripts for Universal Chart-to-Code Generation Zhihan Zhang, Lizi Liao School of Computing and Information Systems, Singapore Management University zhihanzhang.2024@phdcs.smu.edu.sg, lzliao@smu.edu.sg Abstract Chart-to-code generation converts a chart im- age into an executable plotting script, enabling faithful reproduction and editable visualiza- tions. Existing methods are largely Python- centric, limiting practical use and overlooking a critical source of supervision: the same chart can be expressed by semantically equivalent scripts in different plotting languages. To fill this gap, we introduce Chart2NCode, a dataset of 176K charts paired with aligned scripts in Python, R, and LaTeX that render visually equivalent outputs, constructed via a metadata- to-template pipeline with rendering verifica- tion and human quality checks. Building on a LLaVA-style architecture, we further pro- pose CharLuMA, a parameter-efficient adap- tation module that augments the multimodal projector with a language-conditioned mixture of low-rank subspaces, allowing the model to share core chart understanding while special- izing code generation to the target language through lightweight routing. Extensive exper- iments show consistent gains in executability and visual fidelity across all languages, outper- forming strong open-source baselines and re- maining competitive with proprietary systems. Further analyses reveal that balanced multi- language supervision benefits all languages and that the adapter allocates a compact shared core plus language-specific capacity 1 . 1 Introduction Charts serve as a compact and prevalent medium for communicating quantitative evidence in sci- entific literature, but they are frequently dissemi- nated as static images, which impedes reproduc- tion, editing, and reuse. Chart-to-code genera- tion (Shi et al., 2025) bridges this gap by trans- lating a chart image into an executable plotting script that faithfully reconstructs both the underly- ing data encodings and the visual design attributes. 1 Codes and data are available athttps://github.com/ Zhihan72/CharLuMA. Title := Ecological Metrics Plot_Color := â#DCE3EFâ Category := âCarbon Sequestration","Biodiversity" ,"Water Quality","Soil Health","Climate Adaptation" Values := 50, 80, 60, 40, 75 Colors :=â#8A2BE2','#F0F8F', '#00BFFF','#D2691E','#1E90F' fig, ax = plt.subplots() ax.bar(Category, Values, color=Colors) ax.set_title(Title) ax.set_facecolor(Plot_Color) plt.show() Python Script R Script df <- data.frame(x = Category, y = Values, fill = Colors) ggplot(df, aes(x = x, y = y, fill = fill)) + geom_bar(stat = "identity") + scale_fill_identity() + labs(title = Title) + theme(panel.background = element_rect(fill = Plot_Color)) tikzpicture 4 axis[ title = Title, axis background/.style =fill=Plot_Color, xticklabels = Category, ybar, xtick=0,..., , ymin=0] in 0,..., +[fill=Colors[ ]] coordinates ( , Values[ ]); axis tikzpicture LaTex Script Aligned Visual Semantic Multiple Syntactic Views ...... This plot looks great. Could you help me reproduce it in Python/R/LaTex/... script? Figure 1: Illustration of aligned multi-view scripts for chart-to-code generation task. While recent multimodal large language models (MLLMs) have demonstrated strong capabilities in general visionâlanguage tasks (Yue et al., 2024; Lu et al., 2023; Zhang et al., 2025b), chart-to-code generation requires a substantially higher degree of precision: minor discrepancies in extracted data, axis specifications, or stylistic parameters can re- sult in compilation failures or visually mislead- ing outputs. Furthermore, the field remains con- strained by a restrictive Python/matplotlib-centric bias (Wu et al., 2025; Zhao et al., 2025; Zhang et al., 2025a), neglecting the diverse ecosystem of plotting toolsâsuch as R (ggplot2) and LaTeX (TikZ)âthat serve as publication standards in many scientific disciplines (Mooney, 2022). Beyond real-world applicability, the Python- centric paradigm overlooks a critical learning sig- nal: the alignment of visual semantics across dif- ferent plotting languages, as shown in Figure 1. While surface syntax diverges, scripts in multiple languages share a common latent visual semantic, encoding identical data tables, stylistic designs, and layout constraints. We frame these distinct scripts as complementary âviewsâ of the same underly- ing chart semantics. We use the alignment across 1 arXiv:2604.24559v1 [cs.CL] 27 Apr 2026 languages to provide multi-target supervision for chart-to-code learning, where the same chart can be realized in multiple plotting syntaxes. Realizing this multi-view idea necessitates a re- source currently absent from the literature: aligned chartâcode pairs across multiple languages that are visually isomorphic. The predominantly monolin- gual nature of existing datasets restricts models to a single target syntax, precluding the study of cross-language supervision (Shi et al., 2025; Zhao et al., 2025; Wu et al., 2025; Niu et al., 2025). To bridge this gap, we introduce Chart2NCode, a pioneering dataset of 176K chart images paired with aligned scripts in Python, R, and LaTeX. The dataset is constructed via an automated pipeline that synthesizes language-agnostic metadata into language-specific templates, ensuring high fidelity through rendering verification and human quality checking. This dataset supports both training and evaluation of multi-language chart-to-code models under consistent supervision. A second challenge lies in the modeling: de- veloping separate experts for each language is in- efficient and discards the shared structure, while straightforward multi-language training can suffer from interference and uneven specialization. We propose CharLuMA, a parameter-efficient adap- tation approach that preserves shared chart under- standing while enabling language-specific code re- alization. Building on the LLaVA architecture (Liu et al., 2023), CharLuMA augments the multimodal projector with a language-conditioned mixture of low-rank subspaces (Figure 3). This module oper- ates via a lightweight routing mechanism, which dynamically selects and combines a small subset of subspaces conditioned on the target language and visual features. This design enables the model to reuse a compact shared core while adapting its latent representations to specific syntactic conven- tions, offering an efficient alternative to the redun- dancy of independent experts or the interference of joint training. Experimental results demonstrate that balanced multi-language alignment yields con- sistent improvements across all languages and that the adapter allocates a compact shared core plus language-specific capacity. To sum up, our contributions are three-fold: âą We formulate chart-to-code generation in a multi- language setting and propose CharLuMA that re- alizes multi-view script alignment via language- guided routing over low-rank subspaces. âąWe present Chart2NCode, a dataset of 176K visu- ally aligned chartâPythonâRâLaTeX quadruples that enables the first systematic study of universal chart-to-code generation beyond Python. âąExtensive experiments validate our approach against open-source baselines and confirm that di- verse, balanced multi-language supervision syn- ergistically benefits all languages. 2 Related Work Multimodal large language models employ mul- timodal projectors to bridge vision encoders with large language models, enabling reasoning across modalities. Existing works explores diverse strate- gies to optimize visual perception, ranging from compressing visual tokens (Li et al., 2022; Bai et al., 2023; Hu et al., 2024) to fusing multiple vi- sion encoders (Tong et al., 2024; Lin et al., 2023). LLaVA (Liu et al., 2023, 2024) demonstrates that a simple MLP projector can effectively align modali- ties without discarding visual information. Some recent works employ sparsely gated MoE projec- tors (Li et al., 2025; Xu et al., 2025), which par- allelize MLPs as experts at the cost of substantial parameter growth. Chart-to-code generation task requires models to translate chart images into executable plotting scripts, challenging MLLMs with demands in vi- sual understanding, code generation, and cross- modal reasoning. Prior efforts have primarily focused on chart-to-Python generation, spanning dataset construction (Shi et al., 2025; Zhao et al., 2025; Niu et al., 2025), multi-agent framework (Yang et al., 2024; Goswami et al., 2025) , and preference learning method (Zhang et al., 2025a). Other studies untilize chart-to-code generation for aligning multimodal projectors (Xu et al., 2025) or constructing question answering datasets (Zhang et al., 2024; He et al., 2025). These efforts remain restricted to single-language settings, which limits practical applicability and overlooks the learning signals in cross-language alignment. Multi-view representation learning aims to con- struct comprehensive representations by integrating complementary information from multiple distinct views. It often enforces consistency constraints, ex- tracting robust features that remain invariant across these views (Tian et al., 2020; Bachman et al., 2019). This principle has proven effective in both natural language processing (Conneau and Lample, 2019; Conneau et al., 2020) and code generation 2 Python Script Figure-level Axis-level Object-level Find Templates R Script LaTex Script Fill with Metadata 2 21 Excute Failure in Source DataMetadataTemplate InstantisationPost debugging Chart Image Global Title Plot Size Legend Location Axis Label Coordinate Color&Style Chart Type? R Template LaTex Template Reproduced Image Template Orientation? 1 or LLM assistance Figure 2: Overview of the automatic annotation pipeline of Chart2NCode. (Roziere et al., 2020; Guo et al., 2022), where mod- els align diverse surface syntaxes into a shared semantic space. We extend this paradigm to scien- tific visualization, treating Python, R, and LaTeX scripts as complementary views of a single chart. 3 The Chart2NCode Dataset We present Chart2NCode, the first large-scale dataset that aligns chart-code pairs across multiple programming languages. With 176K Chart-Python- R-LaTeX quadruples, Chart2NCode establishes a comprehensive resource for developing and evalu- ating multi-language chart-to-code models. 3.1 Automatic Annotation We construct multi-language plotting scripts via an automatic annotation pipeline as shown in Fig- ure 2. We first collect single-language source data from publicly available and open-source reposito- ries. Specifically, we utilize Python scripts from ChartCoder (Zhao et al., 2025), a chart-specific sub- set of LaTeX scripts from DaTikZ (Belouadi et al., 2024a), and 40K newly curated R scripts from on- line communities, ensuring compliance with their respective open licenses and terms of use. Metadata Extraction.We extract language- agnostic metadata from single-language plotting scripts at the figure, axis, and object levels. The figure level captures global attributes that de- termine the overall layout and presentation of the chart. The axis level records structural el- ements that define the coordinate system and its descriptive properties. The object level en- codes graphical primitives together with their vi- sual styles, ensuring precise representation of chart content. Metadata is obtained from plot- ting objects for Python (matplotlib.axes) and R (ggplot_build()), while LaTeX scripts are pro- cessed via regular-expression parsing. Collectively, these layers yield a comprehensive description of each chart, enabling faithful reconstruction using different languages in the following steps. Template Instantiation. We synthesize multi- language scripts by identifying object-level meta- data patterns to retrieve and instantiate language- specific templates. For instance, a horizontal bar chart is characterized at the object level by rectan- gles of equal height and varying width, which are organized into a data table and matched to the cor- responding templates in different languages. Our library comprises 202 human-curated templates spanning over 30 chart subtypes in Python, R, and LaTeX, derived from systematic observations of the source data. Once the appropriate template is identified, it is instantiated with structured meta- data such as titles, axis ticks, and data values. We also add an attribute-mapping process during in- stantiation to maintain cross-language consistency, such as mapping theboldfont style in Python to the bfseries directive in LaTeX. Post Debugging. In situations where template identifying is unsuccessful or script execution er- rors occur, we incorporate an LLM-assisted debug- ging module powered by GPT-4o (OpenAI, 2024b). If no suitable template exists, the module trans- lates the available single-language script into the target languages; if an instantiated template fails, it applies error correction to restore executability. Scripts that remain invalid or produce deprecated figures are discarded to maintain dataset quality. We detail the source data acquisition, annotation pipeline, and illustrative examples in Appendix A.1, Appendix A.2, and Appendix A.5, respectively. 3.2 Human Quality Checking We conduct human evaluation to assess the cross- language fidelity of Chart2NCode using a random sample of 1,000 quadruples. We recruited three in- dependent annotators from the university campus, requiring demonstrated proficiency in data visu- alization across all target languages. Annotators evaluated the samples across four dimensions on a 1â5 scale. The proportion of examples achieving an average scoreâ„4 demonstrates high quality across 3 all dimensions: structural fidelity (98.2%), data in- tegrity (95.2%), semantic consistency (97.4%), and stylistic coherence (95.8%). The inter-annotator agreement yields a Krippendorffâsα(Krippendorff, 2011) of 0.81, indicating robust evaluation reliabil- ity. Further details and results are in Appendix A.3. 3.3 Data Statistics Chart2NCode comprises 176k quadruples con- sisting of a chart image and aligned scripts in Python, R, and LaTeX, with 14.7% refined via LLM-assisted debugging. In terms of diversity, the dataset covers a wide spectrum of 20 distinct chart types, ranging from 18 regular types to 2 ad- vanced categories featuring composite layouts and multiple coordinate systems. For benchmarking purpose, we construct a test set of 1,000 randomly sampled examples that achieve average scores of at least 4 across all quality aspects in Section 3.2. Using the Llama 3 tokenizer (Meta, 2024), we ob- serve average token counts of 384.1 for Python, 591.8 for R, and 637.1 for LaTeX, with standard deviations of 189.7, 242.0, and 247.1, respectively. Detailed statistics are provided in Appendix A.4. 4 The CharLuMA Model We propose CharLuMA, a chart-to-code MLLM that extends a LLaVA-style architecture with a novel low-rank subspace adapter for efficient multi- language adaptation. The model is optimized via a progressive training strategy that combines align- ment pretraining with instruction tuning. 4.1 Architecture CharLuMA is composed of a vision encoder and a LLM backbone, connected through a two-layer MLP projector augmented with a novel low-rank subspace adapter (see Figure 3). The adapter is governed by a language-guided routing policy that dynamically selects subspace experts based on both the chartâs image features and the target language token, enabling language-specific specialization while maintaining shared visual understanding. Vision Encoder. We adopt SigLIP (Zhai et al., 2023a) as the vision encoder, configured with an input resolution of384Ă 384. Pretrained on mil- lions of imageâtext pairs, it provides strong priors for extracting semantically meaningful visual fea- tures. Formally, given a chart input X v , the vision encoderg v (·)generates its corresponding represen- tation Z v , i.e. Z v = g v (X v ). Alignment Pretraining Instruction Tuning Freezing Training Status Router - R Linear MLP Vision Encoder Language Model ... Text Instruction Router -Python Router - Latex ... Language-guided Routing Low-rank Projector Subspace Pool Target Language: LaTex 0 1 2 N-2 N-1 Top-r Activation rank=r Chart Image Figure 3: Overview of CharLuMA. The adapter em- ploys language-conditioned routing to dynamically com- pose low-rank subspaces, exemplified here for a LaTeX target. The training strategy comprises alignment pre- training followed by instruction tuning. Multimodal Projector. The standard multimodal projector in LLaVA-style architectures (Liu et al., 2023) is a two-layer MLP blockWthat performs a one-to-one transformation, mapping visual features Z v into the embedding space of the LLM backbone. The resulting output,H base = WZ v , serves as a shared base representation across languages. To enable efficient language adaptation while preserving visual understanding, we augment this linear MLP block with a low-rank subspace adapter (Ding et al., 2025; Wu et al., 2024). The adapter consists of three components: a low-rank projector A, a subspace poolb i N i=1 , and language-specific routersW l (lâPython, R, LaTeX) (Chen et al., 2023). Given the visual featuresZ v , the projec- torAmaps them into a compact rank-rrepre- sentation (r < N). The router then determines which subspaces to activate for the target language l, as specified in the text instruction. Concretely, the routerW l applies a language-specific trans- formation to the mean-pooled visual featureZ v , yielding a probability distribution over the sub- space pool. The top-rsubspaces are then se- lected,y l = top r (softmax(W l Z v ))wherey l de- notes their indices, and concatenated to form the matrixB = concat iây l b i . The reconstruction ma- trixBis combined with the low-rank projectorA to map the visual features into the LLM embedding space, yielding an language-adaptable representa- tion. The final visual tokens injected into the LLM consists of visual tokens that merge the base and 4 language-adaptable representations: H v = H base + H adapt = WZ v + ABZ v . Large Language Model. We use DeepSeek-Coder (Guo et al., 2024) as the LLM backbone, with 1.3B and 6.7B variants named CharLuMA-1.3B and CharLuMA-6.7B. The visual tokensH v pro- duced by the multimodal projector are concate- nated with the text tokensH t to construct the input sequence for the LLMg L (·). The final output is then obtained as g L (H v ; H t ). 4.2 Training Strategy Alignment Pretraining. We initialize the mul- timodal projector by pretraining the linear MLP blockWon ChartMoE-Align (Xu et al., 2025), a dataset comprising 900k ChartâJSON pairs that en- code structural representations. The vision encoder and LLM backbone remain frozen during this stage, ensuring thatWlearns to align visual features of charts with textual schema representations without altering pretrained components (Yan et al., 2024). Instruction Tuning. We augment the multimodal projector with the proposed low-rank subspace adapter and finetune the model on Chart2NCode. We first warm up the language-specific routersW l and the subspace poolb i N i=1 over fixed steps, while keeping the MLP block, vision encoder, and LLM backbone frozen. The low-rank projectorA is randomly initialized and kept frozen through- out training, ensuring that adaptation capacity is directed toward language-specific diversities rather than redundantly modeling visual commonalities (Ding et al., 2025; Tian et al., 2025). We then un- freeze the LLM backbone and continue training jointly with the routers and subspace pool, while keeping the MLP block, vision encoder, andA frozen. This progressive protocol stabilizes rout- ing and subspace specialization in the early phase, and subsequently enables the LLM to effectively leverage language-adaptive visual tokens. 5 Experiment We validate the efficacy of CharLuMA through extensive experiments across diverse benchmarks, establishing consistent gains over strong baselines in multi-language chart-to-code generation. 5.1 Implementation Details During alignment pretraining, we train the MLP block for 1 epoch on 900k ChartâJSON pairs from ChartMoE-Align (Xu et al., 2025), with a learn- ing rate of 2e-4. During instruction tuning, we warm up the subspace pool and language-specific routers for 274 steps, and then continue with full fine-tuning of the LLM backbone for 1 epoch on the Chart2NCode training set, which contains 175k ChartâPythonâRâLaTeX quadruples. The learning rates are set to 2e-4 for the warm-up phase and 2e-5 for fine-tuning. We set the subspace sizeN = 32 and the rankr = 16. Detailed experimental set- tings are provided in Appendix B.1. 5.2 Evaluation Settings Datasets. We evaluate CharLuMA and baselines on three chart-to-code datasets. The Chart2NCode test set provides 1,000 charts paired with scripts in Python, R, and LaTeX, enabling multi-language evaluation. ChartMimic (Shi et al., 2025) testmini set comprises 600 charts with human-curated mat- plotlib scripts in Python, spanning 22 chart types. Plot2Code (Wu et al., 2025) contains 132 high- quality matplotlib plots across 6 types. Evaluation Metrics. We evaluate chart-to-code performance across two primary dimensions: exe- cutability and fidelity. Execution Rate (ER) mea- sures the proportion of generated scripts that run successfully. To assess fidelity, we adopt Dream- Sim (DS) (Fu et al., 2023), a metric capturing per- ceptual similarity between generated and ground- truth images. Following the successful use of large foundation models for evaluation in computer vi- sion (Shi et al., 2025; Zhao et al., 2025), we further employ an MLLM-as-Judge approach (MJ) to as- sess visual alignment of reproduced charts. We employ GPT-4o as the judge following criteria in Figure 11, with reproducibility validated against open-source alternatives with high correlation re- sults (see Appendix B.2). For Python scripts specif- ically, we report an averaged F1 score covering text, layout, type, and color attributes (Shi et al., 2025). To ensure rigorous evaluation, unexecutable scripts are assigned a score of zero for DS, MJ and F1. 5.3 Baselines General MLLMs.We evaluate both closed- source and open-source MLLMs as the general- purpose baselines. The closed-source group in- cludes GPT-4o (OpenAI, 2024b), GPT-4o-mini (OpenAI, 2024a), GPT-5-mini (OpenAI, 2025), Claude-3.5-Sonnet (Anthropic, 2024), and Claude- Sonnet-4 (Anthropic, 2025). The open-source group covers 9 representative visionâlanguage 5 Models ChartMimicPlot2CodeChart2NCode Chart2PythonChart2PythonChart2PythonChart2RChart2LaTeX ERDSMJF1ERDSMJF1ERDSMJF1ERDSMJERDSMJ Propriety Multimodal Large Language Models GPT-5-mini86.8 86.9 78.271.593.2 85.9 72.772.885.2 89.0 80.067.590.3 82.581.249.7 75.2 41.1 GPT-4o-mini89.0 77.5 74.870.290.2 77.8 63.867.094.8 81.2 79.874.589.5 75.470.394.7 61.2 70.4 GPT-4o93.2 83.5 83.579.092.4 83.6 76.775.498.5 85.0 87.480.994.5 78.878.388.4 72.4 69.8 Claude-Haiku-3.588.0 76.2 73.565.787.1 72.8 60.656.891.3 81.6 76.768.893.0 76.273.978.2 57.3 55.3 Claude-Sonnet-496.2 83.3 86.481.595.5 81.2 81.076.898.3 86.8 88.081.493.9 82.083.192.7 76.0 72.2 Open-source Multimodal Large Language Models Qwen3-VL-2B56.3 68.4 39.739.268.9 64.2 41.250.174.0 78.0 59.661.056.5 52.442.056.0 60.8 37.4 Qwen3-VL-4B72.5 71.9 58.455.277.3 66.4 54.455.487.6 83.2 77.276.175.4 66.460.962.4 68.6 45.2 Qwen3-VL-8B78.772.565.261.978.868.157.356.991.1 83.7 80.880.673.6 72.757.277.3 66.8 57.1 InternVL3.5-2B48.5 65.6 32.531.361.4 55.7 34.244.269.8 76.1 53.253.161.8 53.444.99.652.64.7 InternVL3.5-4B62.8 69.5 44.743.062.1 58.8 38.042.777.9 78.4 63.463.066.8 56.451.525.7 55.5 14.7 InternVL3.5-8B71.2 71.0 52.148.974.2 61.0 47.249.182.5 79.6 67.567.067.0 67.648.281.1 57.1 53.3 DeepSeek-VL2-3B50.2 69.4 35.035.072.5 59.8 45.444.272.0 80.2 58.758.023.0 56.916.43.942.71.9 Phi-3.5-vision-4B66.7 44.1 41.038.672.7 63.8 43.142.668.8 53.3 56.134.247.0 52.533.57.942.95.1 LLaVA-v1.6-7B62.0 55.9 25.725.969.7 49.8 26.532.571.0 65.7 38.039.558.5 50.937.977.3 42.4 42.2 ChartLlama-13B57.5 44.9 28.124.881.8 50.1 18.922.465.3 46.0 14.816.213.0 44.86.221.7 32.5 10.2 ChartMoE-8B52.7 56.9 22.925.370.5 58.9 37.626.969.5 64.2 40.235.439.3 52.925.517.1 27.9 11.1 ChartCoder-7B91.469.274.072.587.965.758.256.696.248.186.456.1---17.9 39.1 10.6 CharLuMA-1.3B83.0 71.8 64.862.583.3 64.3 50.647.294.486.578.476.994.578.973.384.571.365.1 CharLuMA-6.7B92.3 77.4 75.173.396.2 68.3 62.260.598.0 88.7 88.183.596.5 81.880.989.0 72.5 74.2 Table 1: Performance on ChartMimic, Plot2Code, and Chart2NCode test set.ERâdenotes execution rate,DSâ denotes the image-similarity score DreamSim,MJ âdenotes the MLLM-as-Judge score, andF1 âdenotes the heuristic F1 score for Python scripts. A â-â indicates that no executable script is generated. models including Qwen3-VL-2B, Qwen3-VL-4B, Qwen3-VL-8B (Team, 2025), InternVL-3.5-2B, InternVL-3.5-4B, InternVL-3.5-8B (Wang et al., 2025), DeepSeek-VL2-Tiny (Lu et al., 2024), Phi- 3.5-Vision-4B (Abdin et al., 2024), and LLaVA- v1.6-7B (Liu et al., 2023). Chart MLLMs. We also compare against chart- specialized MLLMs. ChartLlama-13B (Han et al., 2023) adapts LLaVA to chart reasoning via in- struction tuning. ChartMoE-8B (Xu et al., 2025) advances chart understanding through a mixture- of-experts multimodal projector. ChartCoder-7B (Zhao et al., 2025) directly targets chart-to-code generation by employing a code LLM as its lan- guage backbone. 5.4 Main Results Existing MLLMs often exhibit pronounced dispar- ities in chart-to-code generation across different programming languages, as illustrated in Table 1. ChartCoder-7B achieves 96.2 ER and 86.4 MJ on the Python subset of Chart2NCode, while its per- formance deteriorates significantly on other lan- guages, yielding 17.9 ER on LaTeX and zero valid generations for R. We observe similar performance gaps in general-purpose open-source models on the Chart2NCode test set. DeepSeek-VL2-3B and Phi- 3.5-Vision-4B display acute imbalances, achieving around 70 ER on Python while falling below 10 ER on LaTeX. Qwen3-VL-8B suffers from severe fidelity degradation, showing markedly reduced vi- sual alignment for R (57.2 MJ) and LaTeX (57.1 MJ) compared to Python (80.8 MJ). Proprietary models display this same tendency in a more mod- erate form; GPT-4o-mini and Claude-Haiku-3.5 maintain the DS score above 80 on Python, but drop to around 60 DS on LaTeX. CharLuMA effectively addresses cross-language disparities, establishing itself as the open-source MLLM for universal chart-to-code generation. On established Python benchmarks, CharLuMA-6.7B delivers top-tier results with 92.3 ER and 77.4 DS on ChartMimic, along with 96.2 ER and 68.3 DS on Plot2Code. CharLuMA-1.3B shows high effi- ciency, securing 83.0 ER and 71.8 DS on Chart- Mimic. On the Chart2NCode test set, CharLuMA- 6.7B sustains balanced performance across lan- guages, achieving 88.7 DS and 83.5 F1 on Python, 81.8 DS and 80.9 MJ on R, and 72.5 DS and 74.2 MJ on LaTeX. Notably, it rivals Claude-Haiku-3.5 6 Model Size Projector Architecture Chart2NCode ERDSMJ 1.3B Linear MLP88.176.969.5 Mixture-of-MLP87.975.168.2 Subspace Adapter91.178.972.3 6.7B Linear MLP91.078.276.3 Mixture-of-MLP91.977.476.8 Subspace Adapter94.581.081.1 Table 2: Performance of alternative multimodal projec- tor architectures during the instruction tuning stage of CharLuMA-1.3B and -6.7B on the Chart2NCode test set. Results are averaged over all three languages. Language Model Vision Encoder Chart2NCode ERDSMJ DeepSeek-LLM-7BSigLIP88.677.174.3 DeepSeek-Coder-6.7BCLIP88.879.275.0 DeepSeek-Coder-6.7BSigLIP94.581.081.1 Table 3: Ablation study of backbone choices in Char- LuMA on the Chart2NCode test set, with results aver- aged over all three languages. and GPT-4o-mini on all benchmarks, significantly narrowing the gap with proprietary systems. 6 Further Study We conduct ablation studies and analyses to dis- entangle component contributions, demonstrating CharLuMAâs robustness and interpretability. 6.1 Model Architecture Ablation We conduct ablation studies on CharLuMA-1.3B with the Chart2NCode test set to examine alter- native architectures, backbone choices, and sub- spaceârouter configurations. Alternative Architecture. We compare our low- rank subspace adapter with two alternative projec- tor designs in Table 2. The linear MLP baseline (Belouadi et al., 2024b,a; Zhao et al., 2025) yields modest improvements, resulting in 88.1 ER and 69.5 MJ for the 1.3B model. The Mixture-of-MLP design (Li et al., 2025; Xu et al., 2025) replaces the MLP block with a sparsely gated mixture-of- experts, each initialized from a pretrained MLP block, and we adapt it with a hard-routing policy that activates the language-specific and shared ex- perts (see Appendix B.3). This achieves 91.9 ER and 76.8 MJ for the 6.7B model. In contrast, our low-rank subspace adapter achieves the strongest results across both model sizes with a far more compact design compared to Mixture-of-MLP. Total Subspace Activated Subspace Total Router Chart2NCode ERDSMJ 168388.977.670.5 328389.477.871.3 6432387.875.668.5 3216186.175.167.0 3232085.873.266.3 3216391.178.972.3 w/o warming up before finetuning87.175.667.9 w/o freezing A matrix of adapter90.278.070.1 Table 4: Ablation study of subspace-router configura- tions in CharLuMA-1.3B on the Chart2NCode test set, with results averaged over all three languages. Backbone Choices. We examine the effect of lan- guage and vision backbones in Table 3. Our de- fault configuration with DeepSeek-Coder-6.7B and SigLIP yields the strongest results. Deviating from this setup leads to consistent performance drops: re- placing the language model with DeepSeek-LLM- 7B lowers scores to 88.6 ER and 74.3 MJ, while substituting the vision encoder with CLIP-Large reduces performance to 88.8 ER and 75.0 MJ. SubspaceâRouter Configurations.We com- pare different subspace settings, routing strategies and training choices in CharLuMA-1.3B on the Chart2NCode test set in Table 4. Regarding sub- space settings, we identify our default 32â16 con- figuration (Row 6) as the optimal balance; it out- performs both smaller and larger total subspaces (Rows 1 and 3) and surpasses the insufficient active capacity of the 32â8 setting (Row 2). We further confirm the necessity of language-guided routing in Rows 4â6, where replacing language-specific routers with a single shared router reduces DS from 78.9 to 75.1, and removing them entirely lowers it to 73.2. Finally, Rows 7â8 validate our training choices: removing the warming-up stage destabi- lizes specialization and lowers DS to 75.6, while unfreezing theAmatrix compromises the low-rank representation, reducing DS to 78.0. 6.2 Language Structure Ablation We examine the impact of language structure dur- ing training on Chart2NCode. To guarantee fair- ness, we enforce a fixed budget of training sam- ples across all settings. Under the single-language setting, we give script supervision for each image from one single language. For the two-language set- ting, we randomly sample half of the charts and pro- vide script supervision in two different languages (e.g., pairing each image with both LaTeX and 7 Python+R Python+LaTeX Python+R R+LaTeX Python+LaTeX R+LaTeX Python Python+R+ LaTeX Python+R+LaTeX Python+R+LaTeX R LaTex Unaligned UnalignedUnaligned Figure 4: Ablation study of language structure using CharLuMA-1.3B on the Chart2NCode test set. Python scripts). Similarly, in three-language set- ting, we randomly sample one-third of the charts and apply script supervision using all three lan- guages. Additionally, we include an unaligned baseline using only the original source script per chart, which biases towards predominant languages and lacks multi-view alignment. Finally, the num- ber of routers is configured to match the target language count (see Appendix B.3). Figure 4 shows that greater language diver- sity leads to substantial improvements on the Chart2NCode test set, effectively outweighing the reduction in unique visual exposure. The three-language model achieves the highest exe- cution rates and visual fidelity scores across all languages, significantly outperforming single- and two-language models. Notably, training on un- aligned source data induces systematic biases that impede universality, skewing the model toward the dominant language, i.e., Python. This positions Chart2NCode as the first dataset to provide the diverse, aligned supervision necessary for robust chart-to-code generation. 6.3 Subspace Activation Analysis We visualize the normalized activation frequency of 32 subspaces across CharLuMAâs language- specific routers in Figure 5. These heatmaps re- veal a hybrid allocation strategy, featuring com- pact shared clusters alongside broader language- specific zones. In CharLuMA-1.3B, subspaces 21, 23, and 30 are frequently activated across all languages, while subspace 1 is used primarily for Python, 18 for R, and 17 for LaTeX. CharLuMA- 6.7B shows a more balanced distribution, with most subspacesâsuch as 8, 20, and 29âexhibiting in- termediate activation frequencies across the three languages. These findings confirm that the architec- ture facilitates smooth multi-language integration (a) CharLuMA-1.3B(b) CharLuMA-6.7B Figure 5: Heatmap of subspace activation frequency for (a) CharLuMA-1.3B and (b) CharLuMA-6.7B. CharLuMA-6.7BCharLuMA-1.3Bw/o warm-up adapter (1.3B) w/o freeze A matrix (1.3B) w/o language alignment (1.3B) 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 Shared-subspace ratio Mean Median 95% Confidence Interval Figure 6: Distribution of shared-subspace ratios across CharLuMA and ablated models. across various model scales. We introduce the shared-subspace ratio to quan- tify the cross-language allocation of subspaces, de- fined as the proportion of experts activated by all routers relative to the total activated set (Appendix B.3). Figure 6 reports the distribution of this ratio over a random sample of 1,000 Chart2NCode in- stances. CharLuMA-1.3B achieves a median ratio of 0.19, corresponding to roughly 5 shared experts out of 27. CharLuMA-6.7B shows a similar pattern with a median of 0.18, where about 4.9 experts are shared out of 27.5 on average. This indicates that scaling preserves a compact shared core, while allo- cating the increased capacity to expanded language- specific subspaces. In contrast, the ablated 1.3B variants exhibit inflated ratios (0.23â0.24), result- ing from a contraction of the activation pool that compromises language-specific specialization. 6.4 Quantitative Analysis We conduct a detailed error analysis of CharLuMA- 6.7B on the Chart2NCode test set to reveal dis- tinct language-specific failure dynamics. Execu- tion errors in Python and R stem primarily from logic and data discrepancies, led by dimension mis- matches (72.3% in Python, 56.1% in R) and un- 8 defined variables (11.9% in Python, 22.0% in R). LaTeX is uniquely prone to collapsing into unex- ecutable states due to rigid syntactic constraints (55.5%) such as missing braces. Beyond execution, successful generations often exhibit reproduction limitations relating to missing annotations, inac- curate subtypes, or stylistic inconsistencies (Ap- pendix B.5). Case studies in Appendix B.7 further confirm CharLuMAâs superior cross-language sta- bility against GPT-4o and ChartCoder. 7 Conclusion We leverage the visual semantic equivalence of scripts in different plotting languages to drive uni- versal chart-to-code generation. We introduce Chart2NCode, a pioneering dataset of 176K visu- ally aligned ChartâPythonâRâLaTeX quadruples, and CharLuMA that realizes the multi-view super- vision via language-conditioned routing over low- rank subspaces. Extensive experiments show that balanced multi-language supervision from aligned scripts provides complementary training signals that improve executability and visual fidelity over strong baselines. These contributions pave the way toward universal chart-to-code systems that reflect the diverse software ecosystems in practice. Limitations While this study offers a comprehensive analysis, we acknowledge specific limitations that merit fu- ture investigation. First, constrained by computa- tional resources, we limited the CharLuMA archi- tecture to 1.3B and 6.7B parameters. Although these scales demonstrate robust performance, scal- ing to larger backbones may yield further improve- ments in reasoning and generation quality. Second, the model remains constrained by the fixed input resolution of the visual encoder. While our choice of SigLIP represents a significant improvement over baselines like CLIP-Large, resolution bottle- necks may still limit performance on information- dense charts. Future work will focus on integrat- ing high-resolution visual adapters to better handle these visually complex scenarios. Acknowledgments This research was supported by the National Re- search Foundation, Singapore under its National Large Language Models Funding Initiative (AISG Award No. AISG-NMLP-2024-002), and by the Ministry of Education, Singapore, under its AcRF Tier 2 Funding (Proposal ID: T2EP20123-0052). Any opinions, findings, conclusions, or recommen- dations expressed in this material are those of the author(s) and do not reflect the views of the Na- tional Research Foundation or the Ministry of Edu- cation, Singapore. References Marah Abdin, Jyoti Aneja, Hany Awadalla, Ahmed Awadallah, Ammar Ahmad Awan, Nguyen Bach, Amit Bahree, Arash Bakhtiari, Jianmin Bao, Harkirat Behl, Alon Benhaim, Misha Bilenko, Johan Bjorck, SĂ©bastien Bubeck, Martin Cai, Qin Cai, Vishrav Chaudhary, Dong Chen, Dongdong Chen, and 110 others. 2024. Phi-3 technical report: A highly capa- ble language model locally on your phone. Preprint, arXiv:2404.14219. Anthropic. 2024. Claude 3.5 sonnet. Anthropic. 2025. Introducing claude 4. Philip Bachman, R Devon Hjelm, and William Buchwal- ter. 2019. Learning representations by maximizing mutual information across views. In Proceedings of the 33rd International Conference on Neural Infor- mation Processing Systems, Red Hook, NY, USA. Curran Associates Inc. Jinze Bai, Shuai Bai, Shusheng Yang, Shijie Wang, Sinan Tan, Peng Wang, Junyang Lin, Chang Zhou, and Jingren Zhou. 2023. Qwen-vl: A frontier large vision-language model with versatile abilities. ArXiv, abs/2308.12966. Jonas Belouadi, Anne Lauscher, and Steffen Eger. 2024a. AutomaTikZ: Text-guided synthesis of sci- entific vector graphics with TikZ. In The Twelfth International Conference on Learning Representa- tions. Jonas Belouadi, Simone Paolo Ponzetto, and Steffen Eger. 2024b. Detikzify: Synthesizing graphics pro- grams for scientific figures and sketches with tikz. In The Thirty-eighth Annual Conference on Neural Information Processing Systems. Tianlong Chen, Xuxi Chen, Xianzhi Du, Abdullah Rashwan, Fan Yang, Huizhong Chen, Zhangyang Wang, and Yeqing Li. 2023. Adamv-moe: Adap- tive multi-task vision mixture-of-experts. In 2023 IEEE/CVF International Conference on Computer Vision (ICCV), pages 17300â17311. Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco GuzmĂĄn, Edouard Grave, Myle Ott, Luke Zettle- moyer, and Veselin Stoyanov. 2020. Unsupervised cross-lingual representation learning at scale. In Pro- ceedings of the 58th Annual Meeting of the Asso- ciation for Computational Linguistics, pages 8440â 8451, Online. Association for Computational Lin- guistics. 9 Alexis Conneau and Guillaume Lample. 2019. Cross- lingual language model pretraining. In Proceedings of the 33rd International Conference on Neural In- formation Processing Systems, Red Hook, NY, USA. Curran Associates Inc. Chenhao Ding, Jiangyang Li, SongLin Dong, Xinyuan Gao, Yuhang He, and Yihong Gong. 2025. SuLoRA: Subspace low-rank adaptation for parameter-efficient fine-tuning. In Findings of the Association for Com- putational Linguistics: ACL 2025, pages 5334â5349, Vienna, Austria. Association for Computational Lin- guistics. Stephanie Fu, Netanel Tamir, Shobhita Sundaram, Lucy Chai, Richard Zhang, Tali Dekel, and Phillip Isola. 2023. Dreamsim: Learning new dimensions of hu- man visual similarity using synthetic data. In Ad- vances in Neural Information Processing Systems, volume 36, pages 50742â50768. Kanika Goswami, Puneet Mathur, Ryan Rossi, and Franck Dernoncourt. 2025. Plotgen: Multi-agent llm-based scientific data visualization via multimodal retrieval feedback. In Companion Proceedings of the ACM on Web Conference 2025, W â25, page 1672â1676, New York, NY, USA. Association for Computing Machinery. Daya Guo, Shuai Lu, Nan Duan, Yanlin Wang, Ming Zhou, and Jian Yin. 2022. UniXcoder: Unified cross- modal pre-training for code representation. In Pro- ceedings of the 60th Annual Meeting of the Associa- tion for Computational Linguistics (Volume 1: Long Papers), pages 7212â7225, Dublin, Ireland. Associa- tion for Computational Linguistics. Daya Guo, Qihao Zhu, Dejian Yang, Zhenda Xie, Kai Dong, Wentao Zhang, Guanting Chen, Xiao Bi, Y. Wu, Y. K. Li, Fuli Luo, Yingfei Xiong, and Wen- feng Liang. 2024. Deepseek-coder: When the large language model meets programming â the rise of code intelligence. Preprint, arXiv:2401.14196. Yucheng Han, Chi Zhang, Xin Chen, Xu Yang, Zhibin Wang, Gang Yu, Bin Fu, and Hanwang Zhang. 2023. Chartllama: A multimodal llm for chart understand- ing and generation. Preprint, arXiv:2311.16483. Wei He, Zhiheng Xi, Wanxu Zhao, Xiaoran Fan, Yiwen Ding, Zifei Shan, Tao Gui, Qi Zhang, and Xuanjing Huang. 2025. Distill visual chart reasoning ability from llms to mllms. Preprint, arXiv:2410.18798. Wenbo Hu, Yifan Xu, Yi Li, Weiyue Li, Zeyuan Chen, and Zhuowen Tu. 2024. Bliva: A simple multimodal llm for better handling of text-rich visual questions. Proceedings of the AAAI Conference on Artificial Intelligence, 38(3):2256â2264. Klaus Krippendorff. 2011. Computing krippendorffâs alpha-reliability.Departmental Papers (ASC), page 43. Jiachen Li, Xinyao Wang, Sijie Zhu, Chia-Wen Kuo, Lu Xu, Fan Chen, Jitesh Jain, Humphrey Shi, and Longyin Wen. 2025. Cumo: scaling multimodal llm with co-upcycled mixture-of-experts. In Proceedings of the 38th International Conference on Neural In- formation Processing Systems, NIPS â24, Red Hook, NY, USA. Curran Associates Inc. Junnan Li, Dongxu Li, Caiming Xiong, and Steven C. H. Hoi. 2022. Blip: Bootstrapping language-image pre- training for unified vision-language understanding and generation. In International Conference on Ma- chine Learning. Ziyi Lin, Chris Liu, Renrui Zhang, Peng Gao, Longtian Qiu, Han Xiao, Han Qiu, Chen Lin, Wenqi Shao, Keqin Chen, Jiaming Han, Siyuan Huang, Yichi Zhang, Xuming He, Hongsheng Li, and Yu Qiao. 2023. Sphinx: The joint mixing of weights, tasks, and visual embeddings for multi-modal large lan- guage models. Preprint, arXiv:2311.07575. Haotian Liu, Chunyuan Li, Yuheng Li, and Yong Jae Lee. 2024. Improved baselines with visual instruc- tion tuning. In 2024 IEEE/CVF Conference on Com- puter Vision and Pattern Recognition (CVPR), pages 26286â26296. Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. 2023. Visual instruction tuning. In Thirty- seventh Conference on Neural Information Process- ing Systems. Haoyu Lu, Wen Liu, Bo Zhang, Bingxuan Wang, Kai Dong, Bo Liu, Jingxiang Sun, Tongzheng Ren, Zhu- oshu Li, Yaofeng Sun, Chengqi Deng, Hanwei Xu, Zhenda Xie, and Chong Ruan. 2024. Deepseek-vl: Towards real-world vision-language understanding. Preprint, arXiv:2403.05525. Pan Lu, Hritik Bansal, Tony Xia, Jiacheng Liu, Chun yue Li, Hannaneh Hajishirzi, Hao Cheng, Kai-Wei Chang, Michel Galley, and Jianfeng Gao. 2023. Mathvista: Evaluating mathematical reasoning of foundation models in visual contexts. In Interna- tional Conference on Learning Representations. Meta. 2024. Introducing meta llama 3: The most capa- ble openly available llm to date. Paul Mooney. 2022. 2022 kaggle machine learning and data science survey. Tianhao Niu, Yiming Cui, Baoxin Wang, Xiao Xu, Xin Yao, Qingfu Zhu, Dayong Wu, Shijin Wang, and Wanxiang Che. 2025. Chart2Code53: A large-scale diverse and complex dataset for enhancing chart-to- code generation. In Proceedings of the 2025 Con- ference on Empirical Methods in Natural Language Processing, pages 15839â15855, Suzhou, China. As- sociation for Computational Linguistics. OpenAI. 2024a. Gpt-4o mini: advancing cost-efficient intelligence. OpenAI. 2024b. Hello gpt-4o. OpenAI. 2025. Gpt-5 is here. 10 Baptiste Roziere, Marie-Anne Lachaux, Lowik Chanus- sot, and Guillaume Lample. 2020. Unsupervised translation of programming languages. In Proceed- ings of the 34th International Conference on Neu- ral Information Processing Systems, NIPS â20, Red Hook, NY, USA. Curran Associates Inc. Chufan Shi, Cheng Yang, Yaxin Liu, Bo Shui, Junjie Wang, Mohan Jing, Linran Xu, Xinyu Zhu, Siheng Li, Yuxiang Zhang, Gongye Liu, Xiaomei Nie, Deng Cai, and Yujiu Yang. 2025. Chartmimic: Evaluating LMMâs cross-modal reasoning capability via chart- to-code generation. In The Thirteenth International Conference on Learning Representations. Qwen Team. 2025. Qwen3 technical report. Preprint, arXiv:2505.09388. Chunlin Tian, Zhan Shi, Zhijiang Guo, Li Li, and Chengzhong Xu. 2025. Hydralora: an asymmetric lora architecture for efficient fine-tuning. In Pro- ceedings of the 38th International Conference on Neural Information Processing Systems, NIPS â24, Red Hook, NY, USA. Curran Associates Inc. Yonglong Tian, Dilip Krishnan, and Phillip Isola. 2020. Contrastive multiview coding. In Computer Vision â ECCV 2020, pages 776â794, Cham. Springer Inter- national Publishing. Shengbang Tong, Ellis Brown, Penghao Wu, Sanghyun Woo, Manoj Middepogu, Sai Charitha Akula, Jihan Yang, Shusheng Yang, Adithya Iyer, Xichen Pan, Austin Wang, Rob Fergus, Yann LeCun, and Saining Xie. 2024. Cambrian-1: A fully open, vision-centric exploration of multimodal llms. In Advances in Neural Information Processing Systems, volume 37, pages 87310â87356. Curran Associates, Inc. Weiyun Wang, Zhangwei Gao, Lixin Gu, Hengjun Pu, Long Cui, Xingguang Wei, Zhaoyang Liu, Linglin Jing, Shenglong Ye, Jie Shao, Zhaokai Wang, Zhe Chen, Hongjie Zhang, Ganlin Yang, Haomin Wang, Qi Wei, Jinhui Yin, Wenhao Li, Erfei Cui, and 56 others. 2025. Internvl3.5: Advancing open-source multimodal models in versatility, reasoning, and effi- ciency. Preprint, arXiv:2508.18265. Chengyue Wu, Zhixuan Liang, Yixiao Ge, Qiushan Guo, Zeyu Lu, Jiahao Wang, Ying Shan, and Ping Luo. 2025. Plot2Code: A comprehensive benchmark for evaluating multi-modal large language models in code generation from scientific plots. In Find- ings of the Association for Computational Linguistics: NAACL 2025, pages 3006â3028, Albuquerque, New Mexico. Association for Computational Linguistics. Taiqiang Wu, Jiahao Wang, Zhe Zhao, and Ngai Wong. 2024. Mixture-of-subspaces in low-rank adaptation. In Proceedings of the 2024 Conference on Empiri- cal Methods in Natural Language Processing, pages 7880â7899, Miami, Florida, USA. Association for Computational Linguistics. Zhengzhuo Xu, Bowen Qu, Yiyan Qi, SiNan Du, Chengjin Xu, Chun Yuan, and Jian Guo. 2025. Chart- moe: Mixture of diversely aligned expert connector for chart understanding. In The Thirteenth Interna- tional Conference on Learning Representations. Pengyu Yan, Mahesh Bhosale, Jay Lal, Bikhyat Ad- hikari, and David Doermann. 2024. Chartreformer: Natural language-driven chart image editing. In Doc- ument Analysis and Recognition - ICDAR 2024: 18th International Conference, Athens, Greece, August 30âSeptember 4, 2024, Proceedings, Part I, page 453â469, Berlin, Heidelberg. Springer-Verlag. Zhiyu Yang, Zihan Zhou, Shuo Wang, Xin Cong, Xu Han, Yukun Yan, Zhenghao Liu, Zhixing Tan, Pengyuan Liu, Dong Yu, Zhiyuan Liu, Xiaodong Shi, and Maosong Sun. 2024. MatPlotAgent: Method and evaluation for LLM-based agentic scientific data visu- alization. In Findings of the Association for Compu- tational Linguistics: ACL 2024, pages 11789â11804, Bangkok, Thailand. Association for Computational Linguistics. Xiang Yue, Yuansheng Ni, Tianyu Zheng, Kai Zhang, Ruoqi Liu, Ge Zhang, Samuel Stevens, Dongfu Jiang, Weiming Ren, Yuxuan Sun, Cong Wei, Botao Yu, Ruibin Yuan, Renliang Sun, Ming Yin, Boyuan Zheng, Zhenzhu Yang, Yibo Liu, Wenhao Huang, and 3 others. 2024. Mmmu: A massive multi-discipline multimodal understanding and reasoning benchmark for expert agi. In 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 9556â9567. Xiaohua Zhai, Basil Mustafa, Alexander Kolesnikov, and Lucas Beyer. 2023a. Sigmoid loss for language image pre-training. In 2023 IEEE/CVF Interna- tional Conference on Computer Vision (ICCV), pages 11941â11952. Xiaohua Zhai, Basil Mustafa, Alexander Kolesnikov, and Lucas Beyer. 2023b. Sigmoid loss for language image pre-training. Preprint, arXiv:2303.15343. Wenqi Zhang, Zhenglin Cheng, Yuanyu He, Mengna Wang, Yongliang Shen, Zeqi Tan, Guiyang Hou, Mingqian He, Yanna Ma, Weiming Lu, and Yueting Zhuang. 2024. Multimodal self-instruct: Synthetic abstract image and visual reasoning instruction using language model. In Proceedings of the 2024 Confer- ence on Empirical Methods in Natural Language Pro- cessing, pages 19228â19252, Miami, Florida, USA. Association for Computational Linguistics. Zhihan Zhang, Yixin Cao, and Lizi Liao. 2025a. Boosting chart-to-code generation in mllm via dual preference-guided refinement. In Proceedings of the 33rd ACM International Conference on Multimedia, M â25, page 11032â11041, New York, NY, USA. Association for Computing Machinery. Zhihan Zhang, Yixin Cao, and Lizi Liao. 2025b. XFin- Bench: Benchmarking LLMs in complex financial problem solving and reasoning. In Findings of the As- sociation for Computational Linguistics: ACL 2025, 11 pages 8715â8758, Vienna, Austria. Association for Computational Linguistics. Xuanle Zhao, Xianzhen Luo, Qi Shi, Chi Chen, Shuo Wang, Zhiyuan Liu, and Maosong Sun. 2025. Chart- Coder: Advancing multimodal large language model for chart-to-code generation. In Proceedings of the 63rd Annual Meeting of the Association for Compu- tational Linguistics (Volume 1: Long Papers), pages 7333â7348, Vienna, Austria. Association for Compu- tational Linguistics. A Dataset A.1 Data Acquisition We collect single-language plotting scripts from established datasets and publicly available reposito- ries governed by permissive licenses as our source data. ChartCoder (Zhao et al., 2025) contributes approximately 160k chart-to-Python scripts, while DaTikZ (Belouadi et al., 2024a) provides 49k vector-graphics-to-LaTex scripts, of which 8.8k correspond to charts with explicit axis structures. In addition, we curated 40k R plotting scripts from Stack Overflow 2 , strictly adhering to the plat- formâs attribution requirements and C BY-SA data usage policy. To handle deprecated or non- executable scripts, we employed GPT-4o as an au- tomated debugging assistant, guided by the prompt instructions in Figure 9, with a total API cost of 132.2 USD. A.2 Annotation Pipeline Metadata Structure and Extraction. We adopt a hierarchical metadata schema to capture chart infor- mation at three levels: figure, axis, and object. This structure provides a standardized representation of chart elements across languages while preserving both global properties and fine-grained graphical details. At the figure level, metadata records global properties such as the overall title, background color and legend, plot size (width, height, and units), twin-axis relationships, and subplot layout. For each axis, metadata focuses on type-agnostic attributes including axis titles, x- and y-axis labels, tick values and labels, legends, grids, panel boxes, background color, and annotations. At the object level, metadata captures fine-grained properties of graphical elements grouped into patches, lines, col- lections, and images. For each object, visual proper- ties such as color, transparency, line width, marker 2 Retrieved using StackAPI with keywords representa- tive of R plotting functions and libraries, includingggplot, plot_ly, geom, plot(, hist, boxplot and so on. style, and hatch patterns are recorded, together with precise geometric information such as rectangle bounds, circle centers and radii, polygon vertices, line coordinates, scatter offsets, and heatmap arrays. Cleaned labels are associated with color or stylish values where available, ensuring consistency with legends and categorical encodings. Metadata is extracted by executing or pars- ing plotting scripts in their native environments. For Python plotting scripts, each script is ex- ecuted in an isolated runtime, and the figure is inspected usingfig.get_axes(). Axis-level attributes are gathered through standard APIs such asax.get_title(),ax.get_xlabel(), and ax.get_yticks(). Object-level elements are ob- tained by iterating overax.patches,ax.lines, ax.collectionsand so on.For R scripts based onggplot, code is evaluated to collect the plotting objectpbuilt viaggplot_build(). We extract axis-level metadata from structures such asp$labels$title,p$mapping$y, and p$theme$panel.border, while object-level meta- data is obtained by iterating overp$layers. For base R graphics, we wrap high-level functions like barplot,hist, andboxplot, as well as low-level commands such astext,legend, andgrid, to cap- ture metadata during execution. For LaTeX, we use the regular-expression parsing to detectaxisen- vironments while drawing commands are parsed to recover object geometries such as rectangles, circles, and paths. Template Design. The templates are parameter- ized chart skeletons that translate extracted meta- data into executable plotting code. Each template specifies placeholders for chart elements such as titles, axis labels, ticks, grids, legends, annotations, and objects, which are directly filled from meta- data. The overall structure is consistent across lan- guages, but implementation details differ. Taking the bar type for example, Python uses functions likeax.barorax.barhin matplotlib, R employs geom_barin ggplot, and LaTeX relies on declar- ative PGFPlots options such asxbar,ybarand addplot using TikZ. To maintain cross-language consistency during template instantiation, we employ an attribute- mapping process that normalizes visual properties across Python, R, and LaTeX. Legend locations are aligned so that values such as âupper rightâ in Python correspond to ârightâ in R and ânorth eastâ in LaTeX. Font styles are unified by map- ping bold and italic settings into Pythonâs weight 12 and style fields, Râs font face descriptors, or La- TeX commands likebfseriesanditshape. Font sizes are standardized by converting numeric val- ues in Python and R into LaTeX size categories such assmallorLarge. Annotation alignment is harmonized by translating Pythonâs top, bottom, and center into equivalent justification values in R and LaTeX. Marker and line styles are also consol- idated through shared dictionaries, ensuring that a logical style such as circle, dashed, or cross is rendered consistently across all languages. This mapping guarantees that semantic attributes are preserved even when the syntax differs, allowing metadata extracted in one language to be instanti- ated in another without loss of fidelity. Metadata-Template Matching. A critical step in our automatic pipeline is to identify the correct template once the metadata of a chart has been ex- tracted. We address this by assigning each chart a type and subtype based on patterns in the object- level metadata. Taking bar charts for example, we examine the geometry of rectangular patches: over- lapping intervals reveal stacked bars, repeated clus- ters of equal size indicate grouped bars, with other cases default to base bars. For pie charts, subtype inference is based on patch geometry and offsets: the presence of an inner radius or nonzero x posi- tion signals a donut chart, displaced segment cen- ters indicate exploded pies, and their combination yields donutâexploded pies. These inference rules allow the system to automatically select the most appropriate template across diverse chart variants. LLM-assisted Debugging. We incorporate an LLM-assisted debugging module based on GPT- 4o to handle cases where no suitable template is identified or when an instantiated template fails to execute. Instruction prompts for these two scenar- ios are provided in Figure 8 and Figure 9. The total expenditure on the OpenAI API is 316.6 USD. A.3 Quality Assurance We conduct a human evaluation to system- atically assess the cross-language fidelity of Chart2NCode.We randomly sample 1,000 chartâPythonâRâLaTeX quadruples from the Chart2Ncode dataset, which are independently an- notated by three annotators. All annotators were recruited on campus, with eligibility requiring prior experience in data visualization and programming in Python, R, and LaTeX. They were compensated in accordance with the institutionâs standard remu- neration policies for academic work. DimensionAnn. 1Ann. 2Ann. 3Avg. Structural fidelity98.797.898.198.2 Data integrity94.595.895.395.2 Semantic consistency97.996.697.797.4 Stylistic coherence96.295.795.595.8 Table 5: Proportion (%) of examples with average rat- ingâ„ 4on 1,000 sampled quadruples, reported per annotator and averaged across annotators. Overall row averages the four dimensions. We conduct evaluations for each quadruple, com- paring the reproduced charts in Python, R, and LaTeX against the original image, and annotators assess their fidelity across four dimensions. Struc- tural fidelity measures whether the geometric ar- rangement of the chart is preserved, including the number and configuration of subplots and axis ori- entation. Data integrity evaluates whether the un- derlying quantitative values are reproduced exactly, meaning that the reconstructed chart reflects the same data table as the original. Semantic consis- tency assesses whether textual and categorical in- formation is maintained, ensuring that titles, axis labels, legends, and annotations convey the same meaning without omissions, substitutions, or hallu- cinations. Stylistic coherence concerns the visual presentation, requiring that non-semantic design el- ementsâsuch as color palettes, font attributes, line styles, and grid line visibilityâremain consistent with the original chart. All dimensions are rated on a 1â5 scale, where 1 denotes severe mismatch and 5 denotes perfect alignment. A screenshot of the evaluation interface is available in Figure 14. We compute the average per-dimension score across annotators for each example, and report the proportion of examples achieving an average score of at least 4. As shown in Table 5, the evalua- tion results confirm high fidelity across dimensions: 98.2% of examples exceed the threshold for struc- tural fidelity, 95.2% for data integrity, 97.4% for semantic consistency, and 95.8% for stylistic co- herence. To rigorously assess reliability on the full ordinal scale, we compute Krippendorffâsα(Krip- pendorff, 2011). The resulting averageαof 0.81 indicates substantial agreement beyond chance, rep- resenting a strong and practical level of consistency for human judgment in chart reproduction tasks. A.4 Detailed Data Staistics We report detailed statistics for the Chart2NCode dataset, spanning chart type distributions and code complexity. To ensure a robust training and evalua- 13 tion source, the Chart2NCode dataset covers 20 dis- tinct chart categories. Table 6 details the frequency and percentage of each type. The dataset explic- itly challenges models with advanced composite visualizations, including Multidiff, which requires generating multiple heterogeneous subplots, and Combination, which involves overlaying distinct geometric types on a shared coordinate system. Regarding code complexity on the Chart2NCode dataset, we utilized the Llama 3 tokenizer (Meta, 2024) to calculate token counts. The resulting statistics show a mean length of 384.1 tokens for Python (Ï = 189.7, median 348.0), 591.8 tokens for R (Ï = 242.0, median 545.0), and 637.1 tokens for LaTeX (Ï = 247.1, median 595.0). TypeAreaBarBoxBubble Percent5.5%11.6%5.3%2.0% TypeDensityDonutErrorBarErrorPoint Percent1.9%3.2%2.9%4.8% TypeHeatmapHistogramLineLollipop Percent6.9%1.3%12.4%0.5% TypePieQuiverRadarScatter Percent7.6%0.7%6.7%6.5% TypeViolin3DMultidiffCombination Percent6.3%1.0%9.1%3.8% Table 6: Distribution of chart types in Chart2NCode. A.5 Case Study of Annotation Pipeline We present two illustrative cases in Figure 12 and Figure 13 to demonstrate the functionality of our annotation pipeline. B Experimental Settings and Results B.1 Training and Evaluation Settings We adopt SigLIP (Zhai et al., 2023b) as the vision encoder and DeepSeek-Coder (Guo et al., 2024) as the LLM backbone, yielding two variants of our model: CharLuMA-1.3B and CharLuMA-6.7B. The multimodal projector is implemented as a stan- dard two-layer MLP block augmented with our low-rank subspace adapter. For alignment pretraining, we train the MLP block for one epoch on 900k chartâJSON pairs from ChartMoE-Align (Xu et al., 2025), while freezing both the vision encoder and LLM, with a learning rate of 2e-4. During instruction tuning, we first warm up the subspace pool and language- specific routers for 274 steps, and then perform full fine-tuning of the LLM backbone for one epoch on 175k chartâPythonâRâLaTeX quadruples from Chart2NCode. In this stage, the vision encoder and MLP block remain frozen, the adapter is updated, and the learning rates are set to 2e-4 for warm-up and 2e-5 for fine-tuning. The low-rank projectorA remains frozen throughout. Each training batch is constructed to include all three languages. All training experiments are conducted with a global batch size of 128 on 8ĂNVIDIA L40S GPUs. The training cost for CharLuMA-1.3B is ap- proximately 82 GPU hours, consisting of 35 GPU hours for pretraining, 6 GPU hours for warm-up, and 41 GPU hours for fine-tuning. For CharLuMA- 6.7B, the total cost is about 321 GPU hours, includ- ing 109 GPU hours for pretraining, 18 GPU hours for warm-up, and 193 GPU hours for fine-tuning. More training hyperparameters are in Table 7. For evaluation, we follow a standardized setup across all baselines, fixing the maximum token length to 2,048. The prompting format for the chart-to-code generation task is shown in Fig- ure 10, adapted from Shi et al. (2025). Proprietary MLLMs evaluated includegpt-4o-2024-08-06, gpt-4o-mini-2024-07-18, gpt-5-mini-2025-08-07, claude-3-5-haiku-20241022,and claude-sonnet-4-20250514,allaccessed through their official APIs.For open-source MLLMs, we directly run released checkpoints on NVIDIA L20 GPUs. Additionally, the total expenditure for MLLM-as-Judge metrics through the OpenAI API is 217.6 USD. Hyperparameter Alignment Pretraining Warm-up Instruction Tuning Learning rate2e-42e-42e-5 LR scheduleCosine decayCosine decayCosine decay OptimizerAdamWAdamWAdamW Max tokens2,0482,0482,048 Vision encoderFrozenFrozenFrozen LLMFrozenFrozenTrainable MLP BlockTrainableFrozenFrozen AdapterFrozenTrainableTrainable Table 7: Training hyperparameters for CharLuMA across stages in Section 5.1. B.2 Detailed MLLM-as-Judge Metric We employ an MLLM-as-Judge (MJ) approach to assess visual alignment of reproduced charts. Following Shi et al. (2025), we utilize GPT-4o (OpenAI, 2024b) to quantify the extent to which a generated chart corresponds to the ground truth. 14 Specifically, the generated chart and the ground- truth chart are both input into GPT-4o. The model is instructed to evaluate their similarity across six dimensionsâtext, layout, chart type, data integrity, style, and clarityâaccording to the criteria detailed in Figure 11. Subsequently, GPT-4o assigns a final similarity score ranging from 0 to 100. To validate the reliability of the MLLM-as-Judge metric, we analyze its correlation with human judg- ment. We select a subset of 100 examples from the Chart2NCode test set and gather the outputs of ChartLuMA-6.7B in Python, R, and LaTeX, result- ing in a total of 300 figures for assessment. Three independent annotators were recruited based on their expertise in data visualization and proficiency in the relevant programming languages. They con- ducted the human evaluation using the interface in Figure 15, which strictly mirrors the criteria in Figure 11. The final human score for each chart is derived by averaging the ratings from the three annotators. We calculate the Pearson correlation coefficient (Shi et al., 2025) between the MLLM-as- Judge scores and the human evaluations, yielding a value of 0.7387. This strong correlation demon- strates that the MLLM-as-Judge approach serves as a reliable proxy for human visual assessment. To verify the stability of the MLLM-as-Judge metric, we conduct five independent evaluation runs using the outputs of ChartLuMA-6.7B on the Chart2NCode test set. This yields consistent mean scores for Python (88.2), R (80.9), and LaTeX (74.3), with negligible standard deviations of 0.07, 0.06, and 0.08, respectively. These results confirm the high stability of MLLM-as-Judge metric. To further address concerns regarding the re- producibility of closed-source APIs, we compare our primary judge (GPT-4o) against two leading open-source alternatives: Qwen3-VL-8B (Team, 2025) and InternVL3.5-8B (Wang et al., 2025). Us- ing the same subset of 100 examples and identical scoring criteria (Figure 11), we observe high Pear- son correlations between the open-source judges and GPT-4o (0.8728 for Qwen3-VL-8B and 0.8540 for InternVL3.5-8B). Furthermore, both models demonstrate high alignment with human annota- tors (achieving correlations of 0.6975 and 0.6733 respectively). These results confirm that our evalu- ation protocol is robust and can be reliably repro- duced using accessible open-source weights. Python+R Python+LaTeX Python+R R+LaTeX Python+LaTeX R+LaTeX Python Python+R+LaTeXPython+R+LaTeX Python+R+LaTeX R LaTex Unaligned Unaligned Unaligned Figure 7: Ablation study of language structure using CharLuMA-1.3B on the Chart2NCode test set. B.3 Detailed Analysis Setting Alternative Architecture.We compare our language-guided low-rank subspace adapter with two alternative connector architectures: a lin- ear MLP and a Mixture-of-MLP. In the linear MLP setting, the pretrained MLP block, initial- ized on chartâJSON pairs, is directly fine-tuned on Chart2NCode. In the Mixture-of-MLP setting, four experts are initialized from the pretrained MLP block, one of which is frozen as a shared expert, while the remaining three serve as language- specific experts. Hard routing is applied such that, in a Python generation task, the Python-specific ex- pert is activated jointly with the shared expert. This setup mirrors the configuration with four experts in total, of which two are activated for each time, as reported in prior studies (Li et al., 2025; Xu et al., 2025). Warm-up training is also employed in this setting, followed by continued training with the LLM backbone. Language Structure Ablation. We examine the impact of language diversity by restricting the num- ber of plotting languages involved during training. For the language-controlled settings, we utilize strictly the target language scripts for each chart image. We further include an unaligned baseline where each chart image is paired with its original raw script from the source data described in Ap- pendix A.1. To normalize the total training steps, we inversely scale the visual data: while the single- language models utilize the full 175K charts in the Chart2NCode training set, the two-language and three-language settings are restricted to random subsets of 1/2 (about 87.5K) and 1/3 (about 58.3K) of the chart images, respectively. The ensures a constant 175K chart-script pairs during training across all configurations. The training strategy is 15 consistent with Section 4.2 for all configurations. We adjust the number of routers to match the target language count. To validate that our findings are not artifacts of the downsampling strategy, we conduct a com- plementary ablation where the training budget is aligned to the three-language training without vi- sual data reduction. In this regime, we allow all configurations to utilize the complete set of 175k unique chart images. To equate the compu- tational cost with the three-language setting that trains on 525K chart-script pairs, we oversample the configurations with fewer targets: the single- language dataset is replicated three times, and the two-language dataset is augmented by randomly duplicating half of the available samples to reach the equivalent scale. Results in Figure 7 show that the three-language model remains the top per- former across all evaluation languages. Shared Subspace Ratio.We visualize the subspace activation pattern of language-specific routers in ChartLuMA in Figure 5. For quan- tification, we introduce the shared-subspace ra- tio, which measures how much different language- specific routers rely on the same experts when pro- cessing the same chart. Formally, for each chart examplec, letS c,l â 0,...,N â 1denote the set of activated experts chosen by the router for lan- guagel, withN = 32in our standard setting. Each router activates a fixed number of experts (topâk, withk = 16in our experiments). Given the set of languagesL c available for chartc, we define I c = T lâL c S c,l andU c = S lâL c S c,l , whereI c is the set of experts shared across all languages andU c is the total set of experts activated by any language. The shared-subspace ratio for chartcis thenR c = |I c | |U c | , which lies in[0, 1]. A higher value indicates a dense shared core and a lower value implies strong language-specific specialization. B.4 Prompt Sensitivity Study To ensure robustness to specific lexical cues, we compare the standard ChartMimic prompt (Shi et al., 2025) against two variants, while maintain- ing fixed system messages and output formats. The first variant strips contextual framing to retain only the core directive: âGenerate the <language> code to reproduce the chart in this image.â The second variant employs alternative wording: âCreate a script in <language> that renders the figure shown. Ensure the output matches the visual details of the provided image.â As shown in Table 8, the per- Model Prompt Version Chart2NCode ERDSMJ Claude-Sonnet-4 Default94.981.681.1 Variant 194.981.781.2 Variant 295.181.681.2 Qwen3-VL-8B Default80.774.465.0 Variant 180.874.364.8 Variant 280.574.365.1 CharLuMA-1.3B Default91.178.972.3 Variant 191.079.172.5 Variant 291.279.072.3 Table 8: Sensitivity study of evaluation prompt on the Chart2NCode test set. formance variance across these three settings is negligible, confirming that the modelâs capabili- ties are robust to instructional phrasing rather than being artifacts of a specific prompt template. B.5 Error Analysis We conduct an error analysis to identify the com- mon sources of execution failures and reproduc- tion limitations of CharLuMA-6.7B. Execution fail- ures in Python and R stem primarily from logic and data discrepancies, led by dimension mis- matches (72.3%, 56.1%) and undefined variables (11.9%, 22.0%). In contrast, LaTeX errors are predominantly syntactic, with syntax omissions (55.5%) significantly outweighing undefined vari- ables (33.1%) and dimension mismatches (11.4%). For example, the Python case in Figure 16(a) pro- duces incompatible xây list lengths when call- ing theax.plotfunction. The R case in Fig- ure 16(b) invokes an undefined variableanglein ageom_polygoncall. The LaTeX case in Fig- ure 16(c) fails due to an omitted closing curly brace in the title and x-tick label definition. Regarding re- production fidelity, our qualitative assessment iden- tifies annotation gaps as the dominant failure mode, manifested as mislabeled groups in Figure 16(a) or hallucinated text annotations in Figure 16(d). We also observe chart subtypes inaccuracies, illustrated by the generation of stacked instead of grouped er- ror bars in Figure 16(b). Finally, stylistic inconsis- tencies remain prevalent, ranging from malformed x-ticks and incorrect ordering in R (Figure 16(c)) to deviant color schemes in LaTeX (Figure 16(d)). B.6 Comparison with Python Translation An intuitive approach to multi-language chart gen- eration involves a two-step translation pipeline, 16 GeneratorTranslator Chart2RChart2LaTeX ERDSMJERDSMJ Twp-step Translation Qwen3-VL-8B Qwen3-VL-8B 67.3 53.7 41.3 72.9 50.3 37.4 Qwen3-VL-8BGPT-4o87.5 62.5 47.8 81.6 52.7 41.9 GPT-4oQwen3-VL-8B 89.6 67.2 65.1 77.4 59.1 52.8 GPT-4oGPT-4o95.3 73.6 71.3 82.4 64.2 60.7 Direct Generation GPT-4o94.5 78.8 78.3 88.4 72.4 69.8 Qwen3-VL-8B73.6 72.7 57.2 77.3 66.8 57.1 CharLuMA-1.3B94.5 78.9 73.3 84.5 71.3 65.1 CharLuMA-6.7B96.5 81.8 80.9 89.0 72.5 74.2 Table 9: Performance comparison of direct chart-to- code generation and two-step translation from Python on the R and LaTeX subsets of Chart2NCode. wherein a model first generates a script in a pri- mary languageâsuch as Pythonâwhich is then translated into secondary formats like R or LaTeX. To benchmark this paradigm, we evaluate Qwen3- VL-8B and GPT-4o as chart-to-Python generators followed by a subsequent translation phase into R and LaTeX. As evidenced in Table 9, this two- step process consistently compromises visual fi- delity compared to direct generation. While using GPT-4o to translate the Python scripts of Qwen3- VL-8B can improve execution rates, it results in cascading errors that minor deviations in the ini- tial Python code are amplified during translation, significantly degrading the final outputâs visual fi- delity. In contrast, CharLuMA-6.7B, trained on our Chart2NCode dataset, bypasses these intermediate bottlenecks by learning direct, universal visual-to- code mappings. These findings demonstrate that a specialized, end-to-end approach is essential for achieving high-fidelity performance across diverse software ecosystems. B.7 Case Study Weconductaqualitativecomparisonof CharLuMA-6.7B against GPT-4o and ChartCoder using representative cases from Chart2NCode and ChartMimic. In the Chart2NCode examples (Fig- ure 18, Figure 19, and Figure 20), CharLuMA-6.7B demonstrates robust cross-language consistency, successfully reproducing high-quality charts where GPT-4o exhibits reduced reliability and ChartCoder frequently fails to generate valid R or LaTeX scripts. Furthermore, through the four chart-to-Python examples from ChartMimic (Figure 21), we find that CharLuMA-6.7B matches the state-of-the-art performance of GPT-4o and ChartCoder, confirming its ability to handle advanced visual reasoning without compromising single-language proficiency. C LLM Usage Large Language Models (LLMs) were used solely for grammatical and stylistic refinement of text originally drafted by the authors. They did not contribute to the research conceptualization, design, or analysis. The authors retain full responsibility for the accuracy and integrity of the final content. 17 Instruction Prompt for Handling Missing Templates in Post-Debugging You are provided with a original language plotting script as shown below. Your task is to transform it to target language language, starting with ââtarget language symbol and ending with ââ. original plotting script Figure 8: Instruction prompt for handling missing templates in the post-debugging stage of the automatic annotation pipeline. Instruction Prompt for Failed Template Execution in Post-Debugging You are provided with two code snippets. The first is the original code, a original language plotting script serving as the reference implementation. The second is the transformed code, a version of the original script translated intotarget language, which is currently unexecutable due to syntax or logic errors. Original Code: original plotting script Transformed Code: failed template Your task is to identify and correct all errors in the transformed code that prevent it from executing. The corrected script must produce a chart that is semantically equivalent to the one generated by the original code. High-level chart semantics such as axis labels, tick values, bar orientation, or grouping should remain unchanged unless modification is required for successful execution. You may reorder code lines, fix syntax issues, and adjust function arguments as needed. Please output only the corrected code, starting with ââtarget language symbol and ending with ââ. Figure 9: Instruction prompt for failed template execution in the post-debugging stage of the automatic annotation pipeline. Prompt Template of Chart-to-code Generation Task You are an expert target language developer who specializes in writing code based on a given picture. I found a very nice picture in a STEM paper, but there is no corresponding source code available. I need your help to generate thetarget languagecode that can reproduce the picture based on the picture I provide. Now, please give me the code that reproduces the picture below, starting with ââtarget language symbol and ending with ââ. Figure 10: Prompt template of chart-to-code generation task (adapted from ChartMimic (Shi et al., 2025)). 18 Prompt Template of MLLM-as-Judge approach enhanced You are an excellent judge at evaluating visualization chart plots. The first image (reference image) is created using ground truth matplotlib code, and the second image (AI-generated image) is created using matplotlib code generated by an AI assistant. Your task is to score how well the AI-generated plot matches the ground truth plot. ### Scoring Methodology: The AI-generated imageâs score is based on the following criteria, totaling a score out of 100 points: 1. Chart Types (20 points): Does the AI-generated image include all chart types present in the reference image (e.g., line charts, bar charts, etc.)? 2. Layout (10 points): Does the arrangement of subplots in the AI-generated image match the reference image (e.g., number of rows and columns)? 3. Text Content (20 points): Does the AI-generated image include all text from the reference image (e.g., titles, annotations, axis labels), excluding axis tick labels? 4. Data (20 points): How accurately do the data trends in the AI-generated image resemble those in the original image and is the number of data groups the same as in the reference image? 5. Style (20 points): Does the AI-generated image match the original in terms of colors (line colors, fill colors, etc.), marker types (point shapes, line styles, etc.), legends, grids, and other stylistic details? 6. Clarity (10 points): Is the AI-generated image clear and free of overlapping elements? ### Evaluation: Compare the two images head to head and provide a detailed assessment. Use the following format for your response: â Comments: - Chart Types: $your comment and subscore - Layout: $your comment and subscore - Text Content: $your comment and subscore - Data: $your comment and subscore - Style: $your comment and subscore - Clarity: $your comment and subscore Score: $your final score out of 100 â Please use the above format to ensure the evaluation is clear and comprehensive. Figure 11: MLLLM-as-Judge prompt template for chart-to-code generation evaluation (adapted from ChartMimic (Shi et al., 2025)) 19 "object": "patches": [ "object_type": "Rectangle", "facecolor": "#ffdab9", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": -0.3, "y": 0.0, "width": 0.2, "height": 120.0, "object_type": "Rectangle", "facecolor": "#ffdab9", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 0.7, "y": 0.0,"width": 0.2, "height": 150.0, "object_type": "Rectangle", "facecolor": "#ffdab9", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 1.7, "y": 0.0, "width": 0.2, "height": 170.0, "object_type": "Rectangle", "facecolor": "#ffdab9", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 2.7, "y": 0.0, "width": 0.2, "height": 200.0, "object_type": "Rectangle", "facecolor": "#ffdab9", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 3.7, "y": 0.0, "width": 0.2, "height": 210.0, "object_type": "Rectangle", "facecolor": "#191970", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": -0.1, "y": 0.0, "width": 0.2, "height": 60.0, "object_type": "Rectangle", "facecolor": "#191970", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 0.9, "y": 0.0, "width": 0.2, "height": 80.0, "object_type": "Rectangle", "facecolor": "#191970", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 1.9, "y": 0.0, "width": 0.2, "height": 90.0, "object_type": "Rectangle", "facecolor": "#191970", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 2.9, "y": 0.0, "width": 0.2, "height": 100.0, "object_type": "Rectangle", "facecolor": "#191970", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 3.9, "y": 0.0, "width": 0.2, "height": 110.0, "object_type": "Rectangle", "facecolor": "#deb887", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 0.1, "y": 0.0, "width": 0.2, "height": 30.0, "object_type": "Rectangle", "facecolor": "#deb887", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 1.1, "y": 0.0, "width": 0.2, "height": 50.0, "object_type": "Rectangle", "facecolor": "#deb887", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 2.1, "y": 0.0, "width": 0.2, "height": 40.0, "object_type": "Rectangle", "facecolor": "#deb887", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 3.1, "y": 0.0, "width": 0.2, "height": 70.0, "object_type": "Rectangle", "facecolor": "#deb887", "linewidth": 1.0, "linestyle": "solid", "hatch": null, "geometry": "x": 4.1, "y": 0.0, "width": 0.2, "height": 60.0], "lines": [], "collections": [], "images": [] import matplotlib.pyplot as plt import numpy as np dates = ['2023-10-01', '2023-10-02', '2023-10-03', '2023-10-04', '2023-10-05'] posts = [120, 150, 170, 200, 210] comments = [60, 80, 90, 100, 110] shares = [30, 50, 40, 70, 60] fig, ax = plt.subplots(figsize=(8, 6)) bar_width = 0.2 x = np.arange(len(dates)) palette = ['#FFDAB9', '#191970', '#DEB887'] edge_color = 'black' bars1 = ax.bar(x - bar_width, posts, width=bar_width, color=palette[0], edgecolor=edge_color, label='Posts') bars2 = ax.bar(x, comments, width=bar_width, color=palette[1], edgecolor=edge_color, label='Comments') bars3 = ax.bar(x + bar_width, shares, width=bar_width, color=palette[2], edgecolor=edge_color, label='Shares') ax.set_title('Social Media Engagement over Days', fontsize=15) ax.set_xticks(x) ax.set_xticklabels(dates) ax.set_ylabel('Count', fontsize=12) ax.set_xlabel('Date', fontsize=12) ax.grid(True, which='both', axis='y', linestyle='--', alpha=0.7) handles, labels = ax.get_legend_handles_labels() ax.legend(handles, labels, loc='upper right', bbox_to_anchor=(1, 1), ncol=1) plt.tight_layout() plt.show() library(ggplot2) tick_labels <- c('2023-10-01','2023-10-02','2023-10-03','2023-10-04','2023-10-05') group_labels <- c('Posts','Comments','Shares') values <- list(c(120,150,170,200,210), c( 60, 80, 90,100,110), c( 30, 50, 40, 70, 60)) colors <- c('#ffdab9','#191970','#deb887') df <- data.frame( Category = factor(rep(tick_labels, times = length(group_labels)), levels = tick_labels), Group = factor(rep(group_labels, each = length(tick_labels)), levels = group_labels), Value = unlist(values) ) p <- ggplot(df, aes(x = Category, y = Value, fill = Group)) + geom_bar(stat = "identity", position = position_dodge(width = 0.8), width = 0.8, show.legend = TRUE) + scale_fill_manual(values = colors, breaks = group_labels, labels = group_labels) + labs(title = "Social Media Engagement over Days", x = "Date", y = "Count", fill = "Group") + theme( plot.title = element_text(size = 15, hjust = 0.5, face = "plain"), axis.title.x = element_text(size = 12, face = "plain"), axis.title.y = element_text(size = 12, face = "plain"), panel.background = element_rect(fill = "#f"), panel.grid.major = element_line(color = "grey"), panel.border = element_rect(colour = "black", fill = NA, size = 0.5), legend.position = "right" ) p <- p + scale_y_continuous(breaks = c(0.0, 25.0, 50.0, 75.0, 100.0, 125.0, 150.0, 175.0, 200.0, 225.0), labels = c('0', '25', '50', '75', '100', '125', '150', '175', '200', '225')) p <- p + guides(fill = guide_legend(ncol = 1)) print(p) standalone pgfplots compat=1.18 groupplots [x11names, rgb]xcolor c00HTMLFFDAB9 c01HTML191970 c02HTMLDEB887 cbHTMLF document tikzpicture axis[ ybar, bar width=0.2, width=8.0in, height=6.0in, title=Social Media Engagement over Days, title style=font= , align=center, xlabel=Date, x tick label style=font= , align=center, ylabel=Count, y tick label style=font= , align=center, xtick=0, 1, 2, 3, 4, xticklabels=2023-10-01, 2023-10-02, 2023-10-03, 2023-10-04, 2023-10-05, xtick align=center, enlarge x limits=0.2, ymin=0, grid=major, axis lines=box, legend style=legend pos=north east, legend columns=1, axis background/.style=fill=cb ] +[ ybar, fill=c00, bar shift=-0.180 ] coordinates (0, 120.0) (1, 150.0) (2, 170.0) (3, 200.0) (4, 210.0); +[ ybar, fill=c01, bar shift=0.000 ] coordinates (0, 60.0) (1, 80.0) (2, 90.0) (3, 100.0) (4, 110.0); +[ ybar, fill=c02, bar shift=0.180 ] coordinates (0, 30.0) (1, 50.0) (2, 40.0) (3, 70.0) (4, 60.0); Posts, Comments, Shares axis tikzpicture document "plot_size": "width": 8.0, "height": 6.0, "unit": "inch", "twin_axes": , "axes_layout": "n_row": 1, "n_col": 1, "facecolor": "#f", "ax_0": "type_agnostic": "axis": "type": "rectilinear", "aspect": "auto", "title": "content": "Social Media Engagement over Days", "size": 15.0, "style": "normal,normal", "x_label": "content": "Date", "size": 12.0, "style": "normal,normal", "y_label": "content": "Count", "size": 12.0, "style": "normal,normal" , "x_ticks": ["text": "2023-10-01", "position": ["0",0], "text": "2023-10-02", "position": ["1",0], "text": "2023-10-03", "position": ["2",0], "text": "2023-10-04", "position": ["3",0], "text": "2023-10-05", "position": ["4",0]], "y_ticks": ["text": "0", "position": [0,0.0], "text": â25â, "position": [0,25.0], "text": â50â, "position": [0,50.0], "text": â75â, "position": [0,75.0], "text": â100â, "position": [0,100.0], "text": â125â, "position": [0,125.0], "text": â150â, "position": [0,150.0], "text": â175â, "position": [0,175.0], "text": â200â, "position": [0,200.0], "text": â225â, "position": [0,225.0],], "legend": "exist": true, "loc": 1,"ncol": 1, "grid": "x": true, "y": true, "panel_box": true, "background_color": "#f", "annotation": [], "label_to_color": "Posts": "#ffdab9", "Comments": "#191970","Shares": "#deb887", "container_type": [ "BarContainer","BarContainer","BarContainer"] , "type_specific": "type": ["bar"], "sub_type": "grouped-bar", "orientation": "vertical", "template": ["bar_grouped_vertical_r.jinja", "bar_grouped_vertical_latex.jinja"] Source Script in Python Metadata Metadata-Template Matching Script in RScript in LaTex Figure 12: Case study of annotation pipeline in a vertical grouped bar chart. 20 "object": "patches": [], "lines": [ "object_type": "GeomLine", "color": "#6FB585", "linewidth": 0.5, "linestyle": 1, "geometry": "x": [1,2,3,4,5,6,7,8,9,10], "y": [2.1,2.3,2.8,3.2,3.7,4.1,4.6,4.9,5.4,5.9], "object_type": "GeomLine", "color": "#E8BF80", "linewidth": 0.5, "linestyle": 1, "geometry": "x": [1,2,3,4,5,6,7,8,9,10], "y": [2.25,2.3,2.4,2.5,2.6,2.675,2.8,2.9,2.975,3.075], "object_type": "GeomLine", "color": "#A8BF85", "linewidth": 0.5, "linestyle": 1, "geometry": "x": [1,2,3,4,5,6,7,8,9,10], "y": [1.875,1.95,2.05,2.125,2.25,2.325,2.4,2.475,2.575,2.625] ], "collections": [ "object_type": "GeomPoint", "facecolors": [None]*10, "edgecolors": ["#6FB585"]*10, "linewidths": [0.5]*10, "sizes": [3]*10, "shape": [19]*10, "geometry": [[1,2.1],[2,2.3],[3,2.8],[4,3.2],[5,3.7],[6,4.1],[7,4.6],[8,4.9],[9,5.4], [10,5.9]], "object_type": "GeomPoint", "facecolors": [None]*10, "edgecolors": ["#E8BF80"]*10, "linewidths": [0.5]*10, "sizes": [3]*10, "shape": [19]*10, "geometry": [[1,2.25],[2,2.3],[3,2.4],[4,2.5],[5,2.6],[6,2.675],[7,2.8],[8,2.9],[9,2.975], [10,3.075]], "object_type": "GeomPoint", "facecolors": [None]*10, "edgecolors": ["#A8BF85"]*10, "linewidths": [0.5]*10, "sizes": [3]*10, "shape": [19]*10, "geometry": [[1,1.875],[2,1.95],[3,2.05],[4,2.125],[5,2.25],[6,2.325],[7,2.4],[8,2.475], [9,2.575],[10,2.625]] ], "images": [] library(ggplot2) data <- data.frame( D = 1:10, R = c(2.1, 2.3, 2.8, 3.2, 3.7, 4.1, 4.6, 4.9, 5.4, 5.9), M = c(5.5, 5.7, 6.1, 6.5, 6.9, 7.2, 7.7, 8.1, 8.4, 8.8), A = c(4.0, 4.3, 4.7, 5.0, 5.5, 5.8, 6.1, 6.4, 6.8, 7.0) ) ggplot(data, aes(x = D)) + geom_line(aes(y = R), color = "#6FB585") + geom_point(aes(y = R), size = 3, color = "#6FB585") + geom_line(aes(y = M * 0.25 + 0.875), color = "#E8BF80") + geom_point(aes(y = M * 0.25 + 0.875), size = 3, color = "#E8BF80") + geom_line(aes(y = A * 0.25 + 0.875), color = "#A8BF85") + geom_point(aes(y = A * 0.25 + 0.875), size = 3, color = "#A8BF85") + scale_y_continuous(name = 'R', sec.axis = sec_axis(~(.-0.875)/0.25, name = 'M and A')) + labs( title = "Relationship between D and R, M, A", x = "D", y = "R" ) + theme_minimal() + theme(plot.title = element_text(hjust = 0.5, size = 14, face = "bold")) dev.off() import matplotlib.pyplot as plt num_group = 3 x_values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] y_values = [[2.1, 2.3, 2.8, 3.2, 3.7, 4.1, 4.6, 4.9, 5.4, 5.9], [2.25, 2.3, 2.4, 2.5, 2.6, 2.675, 2.8, 2.9, 2.975, 3.075], [1.875, 1.95, 2.05, 2.125, 2.25, 2.325, 2.4, 2.475, 2.575, 2.625]] line_color = ['#6fb585', '#e8bf80', '#a8bf85'] line_style = ['-', '-', '-'] line_width = [1.0, 1.0, 1.0] marker_color = ['#6fb585', '#e8bf80', '#a8bf85'] marker_style = ['o', 'o', 'o'] marker_size = [8, 8, 8] fig, ax = plt.subplots(figsize=(7, 7)) for i in range(num_group): ax.plot( x_values, y_values[i], color=line_color[i], linestyle=line_style[i], linewidth=line_width[i], marker=marker_style[i], markersize=marker_size[i], markerfacecolor=marker_color[i] ) ax.set_xlabel("D", fontsize=12, fontweight="normal", fontstyle="normal") ax.set_ylabel("R", fontsize=12, fontweight="normal", fontstyle="normal") ax.set_title("Relationship between D and R, M, A", fontsize=14, fontweight="bold", fontstyle="normal") ax.set_yticks([2.0, 3.0, 4.0, 5.0, 6.0]) ax.set_yticklabels(['2', '3', '4', '5', '6']) ax.grid(True) for spine in ax.spines.values(): spine.set_visible(False) ax.set_facecolor("#f") plt.tight_layout() plt.show() standalone pgfplots compat=1.18 fillbetween [x11names, rgb]xcolor c00HTML6FB585 c01HTMLE8BF80 c02HTMLA8BF85 cbHTMLF document tikzpicture axis[ width=7in, height=7in, title=Relationship between D and R, M, A, title style=font= , xlabel=D, x tick label style=font= , align=center, ylabel=R, y tick label style=font= , align=center, ytick=2.0, 3.0, 4.0, 5.0, 6.0, yticklabels=2,3,4,5,6,, enlarge x limits=0.05, enlarge y limits=0.05, grid=major, axis lines=none, axis background/.style=fill=cb ] +[ color=c00, mark=o, mark options=fill=c00, scale=3pt, line width=0.2pt, style=solid ] coordinates (1, 2.1) (2, 2.3) (3, 2.8) (4, 3.2) (5, 3.7) (6, 4.1) (7, 4.6) (8, 4.9) (9, 5.4) (10, 5.9); +[ color=c01, mark=o, mark options=fill=c01, scale=3pt, line width=0.2pt, style=solid ] coordinates (1, 2.25) (2, 2.3) (3, 2.4) (4, 2.5) (5, 2.6) (6, 2.675) (7, 2.8) (8, 2.9) (9, 2.975) (10, 3.075); +[ color=c02, mark=o, mark options=fill=c02, scale=3pt, line width=0.2pt, style=solid ] coordinates (1, 1.875) (2, 1.95) (3, 2.05) (4, 2.125) (5, 2.25) (6, 2.325) (7, 2.4) (8, 2.475) (9, 2.575) (10, 2.625); axis tikzpicture document "plot_size": "width": 7, "height": 7, "unit": "inch", "twin_axes": [], "axes_layout": "n_row": 1, "n_col": 1, "facecolor": "#f", "ax_0": "type_agnostic": "axis": "position": null, "type": "cartesian", "aspect": null, "title": "content": "Relationship between D and R, M, A", "size": 14, "style": "bold", "x_label": "content": "D", "size": "NA", "style": null, "y_label": "content": "R", "size": "NA", "style": null, "x_ticks": ["text": "2.5", "position": [2, 0], "text": "5", "position": [3, 0], "text": "7.5", "position": [4, 0], "text": "10", "position": [5, 0]], " y_ticks": [ "text": "2", "position": [0, 1], "text": "3", "position": [0, 2], "text": "4", "position": [0, 3], "text": "5", "position": [0, 4], "text": "6", "position": [0, 5]], "legend": "exist": false, "loc": null, "ncol": null, "grid": "x": true, "y": true, "panel_box": false, "background_color": "#f", "annotation": [], "label_to_color": [] , "type_specific": "type": ["line"], "sub_type": "dotted-line", "orientation": "vertical",, "template": ["line_multi_marker_python.jinja", "line_multi_marker_latex.jinja"] Source Script in R Metadata Metadata-Template Matching Script in Python Script in LaTex Figure 13: Case study of annotation pipeline in a dotted line chart. 21 ORIGINAL CHARTREPRODUCED CHART RainfallDistributionAcrossSeasons inFourRegions 1- 0.75- Rainfall Proportion 0.5- East North South West 0.25- Autumn Spring Summer Winter Seasons 1. Structural Fidelity Assess the preservation of the chart's geometric configuration. Verify that the subplot arrangement, axis orientation, and overall spatial layout strictly adhere to the reference structure. 1 Severe MismatchModerate DeviationPerfect Alignment 2. Data Integrity Evaluate the accuracy of the underlying quantitative data. Ensure the reconstructed visualization precisely reflects the original data values, trends, and distributions without distortion. 1 Severe MismatchModerate DeviationPerfect Alignment 3. Semantic Consistency Verify the correctness of all textual and categorical information. Confirm that titles, labels, legends, and annotations are textually accurate, free from omissions, substitutions, or hallucinations. 1 Severe MismatchModerate DeviationPerfect Alignment 4. Stylistic Coherence Examine the fidelity of non-semantic visual attributes. Check for strict alignment in color palettes, font specifications, marker styles, and gridline visibility relative to the reference chart. 1 Severe MismatchModerate DeviationPerfect Alignment Submit Evaluation Total Score: 12 / 20 Figure 14: Screenshot of the human quality checking questionnaire. REFERENCE IMAGEAI-GENERATED IMAGE 1. Type Max 20 Does the AI-generated image include all chart types present in the reference image (e.g., line charts, bar charts, etc.)? 0 Entirely different (0)Partly the same (10)Exactly the same (20) 2. Layout Max 10 Does the arrangement of subplots in the AI-generated image match the reference image (e.g., number of rows and columns)? 0 Entirely different (0)Partly the same (5)Exactly the same (10) 3. Text Content Max 20 Does the AI-generated image include all text from the reference image (e.g., titles, annotations, axis labels), excluding axis tick labels? 0 Entirely different (0)Partly the same (10)Exactly the same (20) 4. Data Max 20 How accurately do the data trends in the AI-generated image resemble those in the original image and is the number of data groups the same as in the reference image? 0 Entirely different (0)Partly the same (10)Exactly the same (20) 5. Style Max 20 Does the AI-generated image match the original in terms of colors (line colors, fill colors, etc.), marker types (point shapes, line styles, etc.), legends, grids, and other stylistic details? 0 Entirely different (0)Partly the same (10)Exactly the same (20) 6. Clarity Max 10 Is the AI-generated image clear and free of overlapping elements? 0 Entirely different (0)Partly the same (5)Exactly the same (10) Submit Total Score: 50 / 100 Figure 15: Screenshot of the human evaluation questionnaire for MLLM-as-judge metrics. 22 import matplotlib.pyplot as plt import numpy as np categories_1 = ['Cost Reduction', 'Eco Factor', 'User Options', 'Long-term', 'Short- term'] values_1 = [ [2500, 3000, 3500], [3200, 3600, 4000], [3800, 4200, 4600], [2800, 3100, 3400], [3000, 3300, 3600] ] categories_2 = ['Technology', 'Throughput', 'Latency', 'Speed', 'Scalability'] values_2 = [ [8000, 12000, 15000], [10000, 14000, 16000], [11000, 15000, 17000], [9000, 13000, 14000], [9500, 13500, 15500] ] fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(10, 12)) bar_width = 0.35 index = np.arange(len(categories_1)) bars1 = ax1.bar(index, [v[0] for v in values_1], bar_width, label='Method 1') bars2 = ax1.bar(index + bar_width, [v[1] for v in values_1], bar_width, label='Method 2') ax1.set_xlabel('Categories', fontsize=10) ax1.set_ylabel('Values', fontsize=10) ax1.set_title('Efficiency Analysis', fontsize=14) ax1.set_xticks(index + bar_width / 2) ax1.set_xticklabels(categories_1, fontsize=8, rotation=45) ax1.legend(loc='upper right', bbox_to_anchor=(1, 1), ncol=1) ax1.grid(True, which='major', axis='y', linestyle='--', linewidth=0.7) for i, (v1, v2) in enumerate(zip(values_2, values_2)): ax2.plot(categories_2, v1, marker='o', linestyle='-', label='Method 1' if i == 0 else "") ax2.plot(categories_2, v2, marker='s', linestyle='--', label='Method 2' if i == 0 else "") ax2.set_xlabel('Measures', fontsize=10) ax2.set_ylabel('Performance Metrics', fontsize=10) ax2.set_title('Performance Evaluation', fontsize=14) ax2.legend(loc='upper right', bbox_to_anchor=(1, 1), ncol=1) ax2.grid(True, which='major', axis='y', linestyle='-.', linewidth=0.7) plt.tight_layout() (a) Error Case for Python library(ggplot2) library(dplyr) data_labels <- c('3500', '4200', '5100') data <- data.frame( resource = c(3500, 4200, 5100), resource = c(3700, 4300, 5200), resource = c(3900, 4400, 5300) ) data <- data %>% mutate(angle = seq(0, 2 * pi, length.out = ncol(data) + 1)[-1]) data_long <- data %>% tidyr::pivot_longer(cols = everything(), names_to = "variable", values_to = "value") ggplot(data_long, aes(x = angle, y = value, group = variable, color = variable)) + geom_polygon(fill = "green", alpha = 0.25) + geom_line(size = 1) + scale_x_continuous(breaks = data$angle, labels = data_labels) + coord_polar() + theme_minimal() + theme( axis.text.x = element_text(size = 12, family = "sans"), axis.title = element_blank(), legend.position = "right", legend.title = element_blank() ) + labs(title = "Supply Chain Resources") dev.off() (b) Error Case for R(c) Error Case for LaTex standalone pgfplots groupplots colorbrewer xcolor colormaps cbHTMLF document tikzpicture axis[ axis equal image, width=10.0in, height=8.0in, title=Economic Indicators, title style=font= , xtick=data, ytick=data, xticklabels= GDP Growth Rate (\ Unemployment Rate (\ Inflation Rate (\ , yticklabels=2018, 2019, 2020, 2021, 2022, enlarge x limits=0.05, enlarge y limits=0.05, grid=major, nodes near coords, axis lines=box, colormap/Blues, point meta=explicit, colorbar, axis background/.style=fill=cb ] [ matrix plot*, shader=flat corner, draw=none, mesh/cols=3, point meta=explicit ] table[row sep=\\, meta=value] x y value \\ 1 1 3.5 \\ 2 1 5.2 \\ 3 1 2.1 \\ 1 2 3.0 \\ 2 2 4.8 \\ 3 2 1.8 \\ 1 3 -1.9 \\ 2 3 2.4 \\ 3 3 1.2 \\ 1 4 2.3 \\ 2 4 6.0 \\ 3 4 2.5 \\ 1 5 3.7 \\ 2 5 5.1 \\ 3 5 3.0 \\ ; axis tikzpicture document ValueError: x and y must have same first dimension, but have shapes (5,) and (3,) Error in `geom_polygon()`: ! Problem while computing aesthetics. âč Error occurred in the 1st layer. Caused by error: ! object 'angle' not found (Continue) (Continue) Runaway argument? axis equal image, width=10.0in, height=8.0in, title=Economic Indicat . Figure 16: Case study of execution errors in generated code for CharLuMA-6.7B. (a) Case from ChartMimic using Python Gold ChartReproduced Chart (b) Case from ChartMimic using Python (c) Case from Chart2NCode using R (d) Case from Chart2NCode using LaTex Figure 17: Case study of reproduction errors in generated charts for CharLuMA-6.7B. 23 Gold Chart CharLuMA-6.7B PythonRLatex GPT-4o ChartCoder CharLuMA-1.3B Fail to Execute Figure 18: Case study of a grouped bar chart input and generated outputs from the Chart2NCode test set across three plotting languages. 24 Gold Chart CharLuMA-6.7B PythonRLatex GPT-4o ChartCoder CharLuMA-1.3B Fail to ExecuteFail to Execute Figure 19: Case study of a box chart input and generated outputs from the Chart2NCode test set across three plotting languages. 25 Gold Chart CharLuMA-6.7B PythonRLatex GPT-4o ChartCoder CharLuMA-1.3B Fail to ExecuteFail to Execute Figure 20: Case study of a two-subplot chart input and generated outputs from the Chart2NCode test set across three plotting languages. 26 Gold ChartCharLuMA-6.7BGPT-4oChartCoder Figure 21: Case study of model inputs and generated outputs from ChartMimic in Python. 27