[ { "id": "test_0", "content": { "Department": [ "HR", "Finance", "Sales", "IT", "Operations" ], "Revenue": [ 15.3, 29.2, 35.8, 46.0, 55.7 ], "Profit": [ 52.0, 41.2, 32.3, 27.1, 38.1 ], "Growth Rate": [ 40.9, 20.6, 23.9, 12.5, 22.6 ], "Customer Satisfaction": [ 37.0, 17.8, 26.2, 14.1, 34.5 ], "Market Share": [ 23.4, 31.3, 45.5, 28.1, 48.6 ], "R&D Spend": [ 86.3, 73.9, 54.3, 49.2, 39.5 ] }, "visual_intent": "A balloon plot heatmap about Departments and KPIs, titled Business Performance Metrics by Department(size of the desired plot: width=12.0, height=9.0)", "path_to_gt_image": "images/heatmap_58.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\nfrom matplotlib.colors import LogNorm\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n\n# Sample business performance data: a 5x6 grid\ndata = np.array(\n [\n [15.3, 52.0, 40.9, 37.0, 23.4, 86.3],\n [29.2, 41.2, 20.6, 17.8, 31.3, 73.9],\n [35.8, 32.3, 23.9, 26.2, 45.5, 54.3],\n [46.0, 27.1, 12.5, 14.1, 28.1, 49.2],\n [55.7, 38.1, 22.6, 34.5, 48.6, 39.5],\n ]\n)\n\n# X and Y labels\nx_labels = [\"Revenue\", \"Profit\", \"Growth Rate\", \"Customer Satisfaction\", \"Market Share\", \"R&D Spend\"]\ny_labels = [\"HR\", \"Finance\", \"Sales\", \"IT\", \"Operations\"]\nxlabel = \"KPIs\"\nylabel = \"Departments\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set up the figure and axis\nfig, ax = plt.subplots(figsize=(12, 9))\n# Defining the colormap from green to red\ncmap = plt.cm.RdYlGn_r\n# Set up the colormap and norm (log scale)\nnorm = LogNorm(vmin=0.1, vmax=100)\n\n# Create the scatter plot\nfor i in range(data.shape[0]):\n for j in range(data.shape[1]):\n # Calculate the color based on the original value\n color = cmap(norm(data[i, j]))\n\n # Draw the circle with a fixed size\n circle = plt.Circle((j, i), 0.4, color=color)\n ax.add_artist(circle)\n\n # Add the text inside the circle\n ax.text(j, i, f\"{data[i, j]:.1f}%\", ha=\"center\", va=\"center\", color=\"black\", fontsize=12)\n\n# Set labels for x and y axes\nax.set_xticks(range(len(x_labels)))\nax.set_xticklabels(x_labels, ha=\"center\", fontsize=12)\nax.set_yticks(range(len(y_labels)))\nax.set_yticklabels(y_labels, va=\"center\", fontsize=12)\n\n# Adding titles for the axes\nax.set_xlabel(xlabel, fontsize=14, weight='bold')\nax.set_ylabel(ylabel, fontsize=14, weight='bold')\nax.set_title(\"Business Performance Metrics by Department\", fontsize=16, weight='bold')\n\n# Set the limits of the axes; they should be one more than your data range\nax.set_xlim(-0.5, data.shape[1] - 0.5)\nax.set_ylim(-0.5, data.shape[0] - 0.5)\n\n# Set the aspect of the plot to be equal and add a frame\nax.set_aspect(\"equal\")\nfor spine in ax.spines.values():\n spine.set_visible(True)\n\n# Create a colorbar\nsm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)\nsm.set_array([])\ncbar = plt.colorbar(sm, ax=ax, ticks=[0.1, 1, 10, 100], orientation=\"vertical\")\ncbar.ax.set_yticklabels([\"0.1\", \"1\", \"10\", \"100\"])\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Save the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"heatmap_58.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 9.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_1", "content": { "Product Aspects": [ "User Interface", "Performance", "Features", "Security", "Support", "Documentation", "Price" ], "Satisfaction Score": [ 85, 88, 90, 92, 86, 79, 77 ], "Complaint Rate": [ -10, -12, -8, -7, -15, -20, -18 ], "Satisfaction Error": [ 3, 2, 4, 2, 3, 4, 5 ], "Complaint Error": [ 2, 1, 3, 2, 2, 3, 2 ] }, "visual_intent": "A diverging bar chart about Product Aspects and Percentage (%), titled Customer Feedback on Tech Product Aspects(size of the desired plot: width=12.0, height=8.0)", "path_to_gt_image": "images/errorbar_111.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.colors as mcolors\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for different service categories\ncategories = [\n \"User Interface\",\n \"Performance\",\n \"Features\",\n \"Security\",\n \"Support\",\n \"Documentation\",\n \"Price\",\n]\nsatisfaction_scores = [\n 85,\n 88,\n 90,\n 92,\n 86,\n 79,\n 77,\n] # Percentage scores for customer satisfaction\ncomplaint_rates = [\n -10,\n -12,\n -8,\n -7,\n -15,\n -20,\n -18,\n] # Negative values for complaint rates\n\n# Error data for each category\nsatisfaction_errors = [3, 2, 4, 2, 3, 4, 5]\ncomplaint_errors = [2, 1, 3, 2, 2, 3, 2]\n\n# Labels and text for chart\nxlabel = 'Product Aspects'\nylabel = 'Percentage (%)'\ntitle = 'Customer Feedback on Tech Product Aspects'\ntextlabels = [\"Complaints\", \"Satisfaction\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and axis\nfig, ax = plt.subplots(figsize=(12, 8)) # Adjusted size for clarity\n\n# Define colors\nsatisfaction_colors = [\n \"#6a0dad\", # Purple\n \"#6495ed\", # CornflowerBlue\n \"#20b2aa\", # LightSeaGreen\n \"#ff6347\", # Tomato\n \"#ffd700\", # Gold\n \"#dda0dd\", # Plum\n \"#90ee90\", # LightGreen\n]\ncomplaint_colors = [\n mcolors.to_rgba(color, alpha=0.7) for color in satisfaction_colors\n] # Slightly lighter for complaints\n\n# Plot vertical bar charts with error bars\nax.bar(\n categories,\n complaint_rates,\n color=complaint_colors,\n edgecolor=\"black\",\n yerr=complaint_errors,\n capsize=5,\n)\nax.bar(\n categories,\n satisfaction_scores,\n bottom=0,\n color=satisfaction_colors,\n edgecolor=\"black\",\n yerr=satisfaction_errors,\n capsize=5,\n)\n\n# Adding labels within bars for values\nfor i, (com_val, sat_val) in enumerate(zip(complaint_rates, satisfaction_scores)):\n ax.text(i, com_val / 2, f\"{abs(com_val)}%\", va=\"center\", ha=\"center\", color=\"black\")\n ax.text(i, sat_val / 2, f\"{sat_val}%\", va=\"center\", ha=\"center\", color=\"black\")\n\n# Customizing axis and layout\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\nax.set_title(title)\nax.tick_params(axis=\"x\", which=\"both\", bottom=False) # Remove x-axis tick marks\n\n# Draw a horizontal line at y=0 for separation\nax.axhline(0, color=\"black\", linewidth=0.8)\n\n# Adding labels at the ends of y-axis\nax.text(-0.5, -25, textlabels[0], ha=\"right\", va=\"bottom\", rotation=\"vertical\", fontsize=12)\nax.text(-0.5, 25, textlabels[1], ha=\"right\", va=\"bottom\", rotation=\"vertical\", fontsize=12)\n\n# Add grid lines for better readability\nax.grid(True, linestyle='--', alpha=0.7)\n\n# Remove unnecessary spines\nax.spines[\"left\"].set_visible(False)\nax.spines[\"right\"].set_visible(False)\nax.spines[\"top\"].set_visible(False)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot\nplt.tight_layout()\nplt.savefig(\"errorbar_111.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 8.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" }, { "id": "test_2", "content": { "Disorder": [ "Depression\n30.0%", "Anxiety Disorders\n20.0%", "Bipolar Disorder\n15.0%", "Eating Disorders\n10.0%", "PTSD\n8.0%", "OCD\n6.0%", "Other Disorders\n11.0%" ], "Prevalence (%)": [ 30.0, 20.0, 15.0, 10.0, 8.0, 6.0, 11.0 ] }, "visual_intent": "A treemap about psychological disorders and their prevalence percentages, titled Prevalence of Various Psychological Disorders(size of the desired plot: width=12.0, height=10.0)", "path_to_gt_image": "images/tree_80.jpg", "original_category": "tree", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data\nsizes = [30.0, 20.0, 15.0, 10.0, 8.0, 6.0, 11.0] # Example percentages\nlabels = [\n \"Depression\\n30.0%\",\n \"Anxiety Disorders\\n20.0%\",\n \"Bipolar Disorder\\n15.0%\",\n \"Eating Disorders\\n10.0%\",\n \"PTSD\\n8.0%\",\n \"OCD\\n6.0%\",\n \"Other Disorders\\n11.0%\",\n]\ntitle = \"Prevalence of Various Psychological Disorders\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with the specified size\nfig = plt.figure(figsize=(12, 10))\n\ncolors = [\"#7986CB\", \"#64B5F6\", \"#4DD0E1\", \"#81C784\", \"#FFD54F\", \"#FF8A65\", \"#A1887F\"]\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes,\n label=labels,\n color=colors,\n alpha=0.8,\n text_kwargs={\"fontsize\": 14, \"color\": \"white\", \"weight\": \"bold\"},\n pad=True,\n ec=\"black\",\n)\n\n# Remove axes\nplt.axis(\"off\")\n\n# Add title\nplt.title(title, fontsize=18, weight=\"bold\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout and save to file\nplt.tight_layout()\nplt.savefig(\"tree_80.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 10.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_3", "content": { "Region": [ "Region 1", "Region 1", "Region 1", "Region 1", "Region 2", "Region 2", "Region 2", "Region 2", "Region 3", "Region 3", "Region 3", "Region 3", "Overall", "Overall", "Overall", "Overall" ], "Policy": [ "Policy A", "Policy B", "Policy C", "AVG", "Policy A", "Policy B", "Policy C", "AVG", "Policy A", "Policy B", "Policy C", "AVG", "Policy A", "Policy B", "Policy C", "AVG" ], "Support": [ 65, 55, 70, 63, 75, 60, 80, 66, 70, 55, 60, 65, 55, 70, 62, 68 ], "Neutral": [ 20, 30, 20, 23, 15, 20, 10, 17, 20, 30, 25, 20, 30, 15, 20, 19 ], "Oppose": [ 15, 15, 10, 14, 10, 20, 10, 17, 10, 15, 15, 15, 15, 15, 18, 13 ] }, "visual_intent": "A figure with 4 subplots showing stacked horizontal bar charts about policy support levels (Support, Neutral, Oppose) across different policies: (1) Region 1, (2) Region 2, (3) Region 3, and (4) Overall(size of the desired plot: width=13.0, height=6.0)", "path_to_gt_image": "images/bar_219.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# Data for the bar charts\ncategories = [\"Policy A\", \"Policy B\", \"Policy C\", \"AVG\"]\nsupport = [65, 55, 70, 63, 75, 60, 80, 66, 70, 55, 60, 65, 55, 70, 62, 68]\nneutral = [20, 30, 20, 23, 15, 20, 10, 17, 20, 30, 25, 20, 30, 15, 20, 19]\noppose = [15, 15, 10, 14, 10, 20, 10, 17, 10, 15, 15, 15, 15, 15, 18, 13]\n\nlabels = [\"Support\", \"Neutral\", \"Oppose\"]\ntitles = [\n \"Policy Support Analysis (Region 1)\",\n \"Policy Support Analysis (Region 2)\",\n \"Policy Support Analysis (Region 3)\",\n \"Policy Support Analysis (Overall)\",\n]\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with custom size\ncolors = [\"#1f78b4\", \"#a6cee3\", \"#b2df8a\"]\n\nfig, axes = plt.subplots(2, 2, figsize=(13, 6))\n\n\n# Function to create a bar chart\ndef create_bar_chart(ax, support, neutral, oppose, title):\n bar_width = 0.5\n indices = np.arange(len(categories))\n\n ax.barh(indices, support, bar_width, color=colors[0], label=labels[0])\n ax.barh(indices, neutral, bar_width, left=support, color=colors[1], label=labels[1])\n ax.barh(\n indices,\n oppose,\n bar_width,\n left=np.add(support, neutral),\n color=colors[2],\n label=labels[2],\n )\n\n ax.set_yticks(indices)\n ax.set_yticklabels(categories)\n ax.invert_yaxis()\n ax.set_title(title)\n ax.set_xlim(0, 100)\n\n # Add text labels inside bars\n for i, (s, n, o) in enumerate(zip(support, neutral, oppose)):\n ax.text(s / 2, i, f\"{s}%\", ha=\"center\", va=\"center\", color=\"white\")\n ax.text(s + n / 2, i, f\"{n}%\", ha=\"center\", va=\"center\", color=\"black\")\n ax.text(s + n + o / 2, i, f\"{o}%\", ha=\"center\", va=\"center\", color=\"black\")\n \n # Hide spines and add grid lines\n for spine in ax.spines.values():\n spine.set_visible(False)\n ax.grid(axis='x', linestyle='--', alpha=0.7)\n ax.set_yticklabels(categories, rotation=45)\n\n\n# Create each bar chart\ncreate_bar_chart(axes[0, 0], support[:4], neutral[:4], oppose[:4], titles[0])\ncreate_bar_chart(axes[1, 0], support[4:8], neutral[4:8], oppose[4:8], titles[1])\ncreate_bar_chart(axes[0, 1], support[8:12], neutral[8:12], oppose[8:12], titles[2])\ncreate_bar_chart(axes[1, 1], support[12:], neutral[12:], oppose[12:], titles[3])\n\n# Add a legend\nhandles, labels = axes[0, 0].get_legend_handles_labels()\nfig.legend(handles, labels, loc=\"lower center\", ncol=3)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the figure\nplt.tight_layout(rect=[0, 0.05, 1, 1])\nplt.savefig(\"bar_219.pdf\", bbox_inches=\"tight\")\n", "width": 13.0, "height": 6.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_4", "content": { "Religion": [ "Christianity", "Islam", "Hinduism", "Buddhism", "Judaism", "Others" ], "Global_Share_Percent": [ 31.2, 24.1, 15.0, 7.1, 0.2, 22.4 ], "Religion_Count": [ 312, 241, 150, 71, 2, 224 ], "Attendance_Type": [ "Regular attendance", "Occasional attendance", "Rare attendance", null, null, null ], "Attendance_Rate_Percent": [ 40, 35, 25, null, null, null ], "Attendance_Count": [ 240, 210, 150, null, null, null ] }, "visual_intent": "A figure with 2 subplots: (1) a pie chart about global religious demographics, titled Global Religious Demographics, (2) a stacked bar chart about attendance rates at religious services, titled Attendance Rates at Religious Services(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/CB_73.jpg", "original_category": "CB", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Data for pie chart\npie_labels = [\"Christianity\", \"Islam\", \"Hinduism\", \"Buddhism\", \"Judaism\", \"Others\"]\npie_sizes = [31.2, 24.1, 15.0, 7.1, 0.2, 22.4]\npie_counts = [312, 241, 150, 71, 2, 224]\n\n# Data for stacked bar chart\nbar_labels = [\"Regular attendance\", \"Occasional attendance\", \"Rare attendance\"]\nbar_sizes = [40, 35, 25]\nbar_counts = [240, 210, 150]\n\n# Labels and Titles\ntitle_pie = \"Global Religious Demographics\"\ntitle_bar = \"Attendance Rates at Religious Services\"\nbar_legend_labels = [\"Regular\", \"Occasional\", \"Rare\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Define Colors\npie_colors = [\"#8dd3c7\", \"#ffffb3\", \"#bebada\", \"#fb8072\", \"#80b1d3\", \"#fdb462\"]\nbar_colors = [\"#3182bd\", \"#6baed6\", \"#9ecae1\"]\n\n# Create figure and axes\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6), gridspec_kw={\"width_ratios\": [2, 1]})\n\n# Pie chart\nax1.pie(\n pie_sizes,\n labels=pie_labels,\n colors=pie_colors,\n autopct=lambda p: \"{:.1f}%\\n({})\".format(p, int(round(p * sum(pie_counts) / 100))),\n startangle=140,\n wedgeprops={\"edgecolor\": \"k\", \"linewidth\": 1}\n)\nax1.axis(\"equal\")\nax1.set_title(title_pie)\n\n# Stacked bar chart\nbar_positions = [0] # Single bar at position 0\nbottom = 0 # Initial bottom is 0 for the first bar segment\n\nfor size, color, count, bar_label in zip(bar_sizes, bar_colors, bar_counts, bar_labels):\n ax2.bar(\n bar_positions,\n [size],\n color=color,\n edgecolor=\"k\",\n bottom=[bottom],\n label=bar_label,\n width=0.3,\n )\n mid_pos = bottom + (size / 2)\n ax2.text(\n 0,\n mid_pos,\n \"{}%\".format(size),\n color=\"black\",\n ha=\"center\",\n va=\"center\",\n )\n bottom += size\n\nax2.set_axis_off()\nax2.set_title(title_bar)\nax2.legend(bar_legend_labels)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"CB_73.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_5", "content": { "Label": [ "Graphic Design - 40%", "Interior Design - 25%", "Web Design - 15%", "Fashion Design - 10%", "Product Design - 5%", "Illustration - 5%" ], "Size": [ 40, 25, 15, 10, 5, 5 ] }, "visual_intent": "A treemap about art and design categories and their distribution, titled Art and Design Categories Distribution(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/tree_15.jpg", "original_category": "tree", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data - Art and Design Categories\nsizes = [40, 25, 15, 10, 5, 5]\nlabels = [\"Graphic Design - 40%\", \"Interior Design - 25%\", \"Web Design - 15%\", \"Fashion Design - 10%\", \"Product Design - 5%\", \"Illustration - 5%\"]\ntitle=\"Art and Design Categories Distribution\"\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#FFD700\", \"#FF6347\", \"#4682B4\", \"#32CD32\", \"#FF69B4\", \"#BA55D3\"]\n# Create a figure with the specified size\nfig = plt.figure(figsize=(10, 8))\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes,\n label=labels,\n color=colors,\n alpha=0.8,\n text_kwargs={\"fontsize\": 12, \"color\": \"black\"},\n edgecolor=\"white\", # Improved border visibility\n linewidth=2 # Added edge line width for better visuals\n)\n\n# Set plot title\nplt.title(title, fontsize=18, color='black', weight='bold')\n\n# Remove axes\nplt.axis(\"off\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout and save to file\nplt.tight_layout()\nplt.savefig(\"tree_15.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_6", "content": { "True Category": [ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5 ], "Predicted Category": [ 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5 ], "Experiment 1 Count": [ 50, 2, 1, 0, 0, 0, 10, 45, 2, 0, 0, 0, 5, 2, 40, 3, 0, 0, 0, 0, 1, 47, 2, 0, 0, 0, 0, 5, 50, 1, 0, 0, 0, 0, 2, 48 ], "Experiment 2 Count": [ 45, 1, 0, 0, 0, 0, 20, 30, 0, 0, 0, 0, 10, 4, 38, 2, 0, 0, 0, 0, 1, 43, 4, 0, 0, 0, 0, 3, 45, 2, 0, 0, 0, 1, 2, 47 ] }, "visual_intent": "A figure with 2 subplots: (1) a confusion matrix about true and predicted categories for Experiment 1, (2) a confusion matrix about true and predicted categories for Experiment 2(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/heatmap_66.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nnp.random.seed(0)\n\n# Generate new data for scientific experiments' confusion matrices\ndata_experiment1 = np.array(\n [\n [50, 2, 1, 0, 0, 0],\n [10, 45, 2, 0, 0, 0],\n [5, 2, 40, 3, 0, 0],\n [0, 0, 1, 47, 2, 0],\n [0, 0, 0, 5, 50, 1],\n [0, 0, 0, 0, 2, 48],\n ]\n)\ndata_experiment2 = np.array(\n [\n [45, 1, 0, 0, 0, 0],\n [20, 30, 0, 0, 0, 0],\n [10, 4, 38, 2, 0, 0],\n [0, 0, 1, 43, 4, 0],\n [0, 0, 0, 3, 45, 2],\n [0, 0, 0, 1, 2, 47],\n ]\n)\n\n# Titles for the subplots\ntitles = [\"Experiment 1\", \"Experiment 2\"]\nylabel = \"True Category\"\nxlabel = \"Predicted Category\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Increase the figure height and adjust subplot layout\nfig, axes = plt.subplots(nrows=1, ncols=2, figsize=(8, 6))\n\n# Function to create a single confusion matrix plot\ndef plot_confusion_matrix(ax, data, title):\n im = ax.imshow(data, interpolation=\"nearest\", cmap=\"Blues\")\n ax.set(\n title=title,\n ylabel=ylabel,\n xlabel=xlabel,\n xticks=np.arange(data.shape[1]),\n yticks=np.arange(data.shape[0]),\n )\n ax.axhline(y=2.5, color=\"green\", linewidth=1.5, linestyle='--')\n ax.axvline(x=2.5, color=\"green\", linewidth=1.5, linestyle='--')\n # Unset the ticks\n ax.set_xticks([])\n ax.set_yticks([])\n # Unset the spines\n ax.spines[\"top\"].set_visible(False)\n ax.spines[\"right\"].set_visible(False)\n ax.spines[\"bottom\"].set_visible(False)\n ax.spines[\"left\"].set_visible(False)\n return im\n\n# Plot each confusion matrix\nim1 = plot_confusion_matrix(axes[0], data_experiment1, titles[0])\nim2 = plot_confusion_matrix(axes[1], data_experiment2, titles[1])\n\n# Adjust the position and size of the colorbars\ncbar_ax1 = fig.add_axes([0.1, 0.05, 0.35, 0.02]) # Adjusted for the first subplot\ncbar_ax2 = fig.add_axes([0.55, 0.05, 0.35, 0.02]) # Adjusted for the second subplot\nfig.colorbar(im1, cax=cbar_ax1, orientation=\"horizontal\")\nfig.colorbar(im2, cax=cbar_ax2, orientation=\"horizontal\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nfig.tight_layout()\nplt.savefig(\"heatmap_66.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_7", "content": { "Brand": [ "Toyota", "Volkswagen", "Ford", "Honda", "BMW", "Others" ], "Market Share": [ 0.3, 0.25, 0.2, 0.15, 0.07, 0.03 ] }, "visual_intent": "A treemap about market share and car brands, titled Market Share of Car Brands (2023)(size of the desired plot: width=12.0, height=8.0)", "path_to_gt_image": "images/tree_49.jpg", "original_category": "tree", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\nimport numpy as np\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data\nsizes = [0.30, 0.25, 0.20, 0.15, 0.07, 0.03]\nlabels = [\n \"Toyota\\n30%\",\n \"Volkswagen\\n25%\",\n \"Ford\\n20%\",\n \"Honda\\n15%\",\n \"BMW\\n7%\",\n \"Others\\n3%\",\n]\n\n# Text label parameters\ntitle = \"Market Share of Car Brands (2023)\"\nlegend_labels = [\"Toyota\", \"Volkswagen\", \"Ford\", \"Honda\", \"BMW\", \"Others\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#FF9999\", \"#66B2FF\", \"#99FF99\", \"#FFCC99\", \"#FFD700\", \"#FFB6C1\"]\n# Create a figure with the specified size\nfig = plt.figure(figsize=(12, 8))\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes,\n label=labels,\n color=colors,\n text_kwargs={\"fontsize\": 18, \"color\": \"white\"},\n pad=0.25,\n)\n\n# Remove axes\nplt.axis(\"off\")\n\n# Add title\nplt.title(title, fontsize=24, fontweight=\"bold\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\n# Show plot\nplt.savefig(\"tree_49.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 8.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_8", "content": { "City": [ "New York", "New York", "New York", "Los Angeles", "Los Angeles", "Los Angeles", "Chicago", "Chicago", "Chicago" ], "Metric": [ "Traffic Volume", "Public Transit", "Accident Rate", "Traffic Volume", "Public Transit", "Accident Rate", "Traffic Volume", "Public Transit", "Accident Rate" ], "Value": [ 220, 180, 220, 150, 120, 130, 130, 160, 110 ], "Error_Lower": [ 25, 15, 25, 20, 10, 20, 15, 15, 15 ], "Error_Upper": [ 20, 15, 20, 15, 15, 10, 20, 10, 15 ] }, "visual_intent": "A figure with 3 subplots: (1) a bar chart about urban transportation metrics in New York, (2) a bar chart about urban transportation metrics in Los Angeles, (3) a bar chart about urban transportation metrics in Chicago(size of the desired plot: width=10.0, height=4.0)", "path_to_gt_image": "images/errorbar_29.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Updated Urban Transportation Data for three major cities\nmetrics = [\"Traffic Volume\", \"Public Transit\", \"Accident Rate\"]\nvalues = np.array(\n [\n [220, 180, 220], # New York\n [150, 120, 130], # Los Angeles\n [130, 160, 110], # Chicago\n ]\n)\n\n# Updated asymmetric error values, now more proportionate to the data scale\nerrors = np.array(\n [\n [[25, 20], [15, 15], [25, 20]], # Errors for New York (lower, upper)\n [[20, 15], [10, 15], [20, 10]], # Errors for Los Angeles\n [[15, 20], [15, 10], [15, 15]], # Errors for Chicago\n ]\n)\n\n# Creating subplots for each city\ncities = [\"New York\", \"Los Angeles\", \"Chicago\"]\n\nylabel = \"Metric Values\"\nylim = [80, 280]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, axs = plt.subplots(1, 3, figsize=(10, 4)) # Compact and square figure layout\n\n\n# Function to plot each city's data\ndef plot_city_data(ax, errors, city_index, city_name):\n x = np.arange(len(metrics)) # the label locations\n bar_colors = [\"#6a8347\", \"#377eb8\", \"#d62728\"]\n barerrors = np.array(errors).T[:, :, city_index]\n bars = ax.bar(x, values[city_index], yerr=barerrors, color=bar_colors, capsize=5)\n for bar, lower_error, upper_error in zip(bars, barerrors[0], barerrors[1]):\n # Position for lower error text\n ax.text(\n bar.get_x() + bar.get_width() / 2,\n bar.get_height() - lower_error - 15,\n f\"-{lower_error}\",\n va=\"bottom\",\n ha=\"center\",\n color=\"black\",\n )\n # Position for upper error text\n ax.text(\n bar.get_x() + bar.get_width() / 2,\n bar.get_height() + upper_error + 3,\n f\"+{upper_error}\",\n ha=\"center\",\n color=\"black\",\n )\n\n ax.set_title(city_name)\n ax.set_xticks(x)\n ax.set_xticklabels(metrics, rotation=90)\n ax.set_ylabel(ylabel)\n ax.set_ylim(ylim) # Uniform scale for all charts\n\n\nfor i, city in enumerate(cities):\n plot_city_data(axs[i], errors, i, city)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorbar_29.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 4.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_9", "content": { "Time (Months)": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ], "Average Temperature (°C)": [ 3.0, 4.5, 9.6, 14.2, 18.7, 22.5, 24.0, 23.6, 19.1, 13.5, 8.1, 4.2 ], "Symmetric Error": [ 1.0, 1.2, 1.3, 1.5, 1.4, 1.6, 1.5, 1.4, 1.3, 1.2, 1.1, 1.0 ], "Asymmetric Lower Error": [ 0.6, 0.72, 0.78, 0.9, 0.84, 0.96, 0.9, 0.84, 0.78, 0.72, 0.66, 0.6 ] }, "visual_intent": "A figure with 2 subplots: (1) an errorbar chart showing average monthly temperature with symmetric error margins, (2) an errorbar chart showing average monthly temperature with asymmetric error margins on a logarithmic scale, titled Average Monthly Temperature with Error Margins(size of the desired plot: width=14.0, height=6.0)", "path_to_gt_image": "images/errorpoint_72.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# example weather data\nx = np.arange(1, 13, 1) # representing months\ny = [3.0, 4.5, 9.6, 14.2, 18.7, 22.5, 24.0, 23.6, 19.1, 13.5, 8.1, 4.2] # average temperature in Celsius\nerror = np.array([1.0, 1.2, 1.3, 1.5, 1.4, 1.6, 1.5, 1.4, 1.3, 1.2, 1.1, 1.0]) # symmetric error\nlower_error = 0.6 * error # Adjusted asymmetric error\nupper_error = error\nasymmetric_error = [lower_error, upper_error]\n\nsuptitle = \"Average Monthly Temperature with Error Margins\"\ntitle1 = \"Symmetric Error Margins\"\ntitle2 = \"Asymmetric Error Margins\"\nxlabel = \"Time (Months)\"\nylabel = \"Average Temperature (°C)\"\nlegend_label = \"Temperature Data\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, (ax0, ax1) = plt.subplots(figsize=(14, 6), ncols=2, sharex=True)\nfig.suptitle(suptitle, fontsize=16)\n\n# Plot with symmetric error\nax0.errorbar(\n x,\n y,\n yerr=error,\n fmt=\"o\",\n color=\"dodgerblue\",\n ecolor=\"deepskyblue\",\n elinewidth=2,\n capsize=5,\n label=legend_label,\n)\nax0.set_title(title1, fontsize=14)\nax0.set_xlabel(xlabel, fontsize=12)\nax0.set_ylabel(ylabel, fontsize=12)\nax0.legend()\nax0.grid(True)\n\n# Plot with asymmetric error\nax1.errorbar(\n x,\n y,\n yerr=asymmetric_error,\n fmt=\"^\",\n color=\"darkorange\",\n ecolor=\"orangered\",\n elinewidth=2,\n capsize=5,\n label=legend_label,\n)\nax1.set_title(title2, fontsize=14)\nax1.set_xlabel(xlabel, fontsize=12)\nax1.set_yscale(\"log\")\nax1.legend()\nax1.grid(True)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout(rect=[0, 0.03, 1, 0.95])\nplt.savefig(\"errorpoint_72.pdf\", bbox_inches=\"tight\")\n", "width": 14.0, "height": 6.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_10", "content": { "Conference": [ "WWDC", "Google I/O", "Microsoft Build", "CES", "SXSW" ], "Influence": [ 30.0, 25.0, 20.0, 15.0, 10.0 ] }, "visual_intent": "A pie chart about tech conferences and their influence shares, titled Tech Conference Influence(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/pie_44.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nnp.random.seed(42)\n\n# Data to plot\nlabels = [\"WWDC\", \"Google I/O\", \"Microsoft Build\", \"CES\", \"SXSW\"]\nsizes = [30.0, 25.0, 20.0, 15.0, 10.0]\ntitle = \"Tech Conference Influence\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot setup\nfig, ax = plt.subplots(figsize=(8, 8))\ncolors = plt.cm.tab20c(np.linspace(0, 1, len(sizes)))\nexplode = (0.1, 0, 0.1, 0, 0) # Explode the 1st and 3rd slices\n\nwedges, texts, autotexts = ax.pie(\n sizes,\n explode=explode,\n colors=colors,\n autopct=\"%1.1f%%\",\n shadow=True,\n startangle=140,\n)\n\n# Adding annotations\nbbox_props = dict(boxstyle=\"round,pad=0.3\", fc=\"w\", ec=\"k\", lw=0.72)\nkw = dict(arrowprops=dict(arrowstyle=\"-\"), bbox=bbox_props, zorder=0, va=\"center\")\n\nfor i, p in enumerate(wedges):\n ang = (p.theta2 - p.theta1) / 2.0 + p.theta1\n y = np.sin(np.deg2rad(ang))\n x = np.cos(np.deg2rad(ang))\n horizontalalignment = {-1: \"right\", 1: \"left\"}[int(np.sign(x))]\n connectionstyle = \"angle,angleA=0,angleB={}\".format(ang)\n kw[\"arrowprops\"].update({\"connectionstyle\": connectionstyle})\n ax.annotate(\n labels[i],\n xy=(x, y),\n xytext=(1.35 * np.sign(x), 1.2 * y),\n horizontalalignment=horizontalalignment,\n **kw\n )\n\n# Title and equal axis\nax.set_title(title, fontsize=17, x=0.5, y=1.05)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot\nplt.tight_layout()\nplt.savefig(\"pie_44.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_11", "content": { "Continent": [ "Asia", "Africa", "Europe", "North America", "South America", "Oceania" ], "Population Percentage": [ 59.5, 17.2, 9.6, 7.7, 5.5, 0.5 ] }, "visual_intent": "A pie chart about world population distribution by continent, titled World Population Distribution by Continent(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/pie_42.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nnp.random.seed(0)\n# Data to plot\nlabels = [\"Asia\", \"Africa\", \"Europe\", \"North America\", \"South America\", \"Oceania\"]\nsizes = [59.5, 17.2, 9.6, 7.7, 5.5, 0.5]\n\n# Text parameters\ntitle = \"World Population Distribution by Continent\"\nsuptitle = \"A Visual Representation of Population Percentage\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot setup\nfig, ax = plt.subplots(figsize=(8, 8))\n\n# New color scheme\ncolors = [\"#ff9999\",\"#66b3ff\",\"#99ff99\",\"#ffcc99\",\"#c2c2f0\",\"#ffb3e6\"]\nexplode = (0.1, 0, 0, 0, 0, 0) # Highlighting Asia\n\nwedges, texts, autotexts = ax.pie(\n sizes,\n explode=explode,\n colors=colors,\n autopct=\"%1.1f%%\",\n shadow=False,\n startangle=140,\n)\n\n# Adding annotations\nbbox_props = dict(boxstyle=\"square,pad=0.3\", fc=\"w\", ec=\"k\", lw=0.72)\nkw = dict(arrowprops=dict(arrowstyle=\"-\"), bbox=bbox_props, zorder=0, va=\"center\")\n\nfor i, p in enumerate(wedges):\n ang = (p.theta2 - p.theta1) / 2.0 + p.theta1\n y = np.sin(np.deg2rad(ang))\n x = np.cos(np.deg2rad(ang))\n horizontalalignment = {-1: \"right\", 1: \"left\"}[int(np.sign(x))]\n connectionstyle = \"angle,angleA=0,angleB={}\".format(ang)\n kw[\"arrowprops\"].update({\"connectionstyle\": connectionstyle})\n ax.annotate(\n labels[i],\n xy=(x, y),\n xytext=(1.35 * np.sign(x), 1.2 * y),\n horizontalalignment=horizontalalignment,\n **kw\n )\n\n# Title and equal axis\nfig.suptitle(suptitle, fontsize=18, x=0.5, y=1.05)\nax.set_title(title, fontsize=16, x=0.5, y=1)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot\nplt.tight_layout()\nplt.savefig(\"pie_42.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_12", "content": { "Maximum Predicted Probability": [ 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9 ], "Known": [ 100, 200, 300, 400, 500, 500, 600, 800, 1000, 2000, 10000 ], "Unknown": [ 100, 200, 300, 400, 500, 800, 1000, 2000, 3000, 4000, 7000 ] }, "visual_intent": "A stacked bar chart about maximum predicted probability and number of examples for Known and Unknown categories, featuring an inset plot zooming in on the 0.35 to 0.7 probability range(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/PIP_2.jpg", "original_category": "PIP", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Generate some dummy data\ncategory1 = [\n 100,\n 200,\n 300,\n 400,\n 500,\n 500,\n 600,\n 800,\n 1000,\n 2000,\n 10000,\n] # Known category\ncategory2 = [\n 100,\n 200,\n 300,\n 400,\n 500,\n 800,\n 1000,\n 2000,\n 3000,\n 4000,\n 7000,\n] # Unknown category\nbins = [0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9]\nlabels = [\"Known\", \"Unknown\"]\nxlabel = \"maximum predicted probability\"\nxlim = [-0.1, 1.1]\nylim = [0, 20000]\nylabel = \"number of examples\"\nxticks = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]\nyticks = [0, 5000, 10000, 15000, 20000]\nleft, bottom, width, height = [0.3, 0.3, 0.3, 0.4]\ninsetxlim = [0.35, 0.7]\ninsetxticks = [0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70]\ninsetylim = [0, 1500]\ninsetyticks = [0, 500, 1000, 1500]\nmainpointleft = [0.39, 0.74]\nmainpointright = [0.74, 1000]\ninsetleft = [0.35, 0]\ninsetright = [0.7, 0]\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create main plot with adjusted bar widths and white borders\nfig, ax_main = plt.subplots(figsize=(10, 6))\nbar_width = 0.05 # Slightly less than the bin width to create a gap\nax_main.bar(\n bins,\n category1,\n width=bar_width,\n color=\"green\",\n align=\"center\",\n label=labels[0],\n edgecolor=\"white\",\n)\nax_main.bar(\n bins,\n category2,\n width=bar_width,\n color=\"blue\",\n align=\"center\",\n bottom=category1,\n label=labels[1],\n edgecolor=\"white\",\n)\nax_main.set_xlabel(xlabel)\nax_main.set_xlim(xlim)\nax_main.set_xticks(xticks)\nax_main.set_ylabel(ylabel)\nax_main.set_ylim(ylim)\nax_main.set_yticks(yticks)\nax_main.legend(loc=\"upper left\", prop={\"size\": 16})\nax_main.grid()\n\n# Create inset plot with adjusted bar widths and white borders\n\nax_inset = fig.add_axes([left, bottom, width, height])\nax_inset.bar(\n bins[:6],\n category1[:6],\n width=bar_width,\n color=\"green\",\n align=\"center\",\n edgecolor=\"white\",\n)\nax_inset.bar(\n bins[:6],\n category2[:6],\n width=bar_width,\n color=\"blue\",\n align=\"center\",\n bottom=category1[:6],\n edgecolor=\"white\",\n)\nax_inset.set_xlim(insetxlim) # Zoom in on the right part of the data\nax_inset.set_xticks(insetxticks) # Zoom in on the right part of the data\nax_inset.set_ylim(insetylim)\nax_inset.set_yticks(insetyticks)\nax_inset.grid()\n\n# Adding lines to connect the plots.\n# Coordinates of the main plot corners\nmain_plot_left = ax_main.transData.transform_point(mainpointleft)\nmain_plot_right = ax_main.transData.transform_point(mainpointright)\n\n# Coordinates of the inset corners\ninset_left = ax_inset.transData.transform_point(insetleft)\ninset_right = ax_inset.transData.transform_point(insetright)\n\n# Transform to figure coordinates for annotation\nmain_plot_left = fig.transFigure.inverted().transform(main_plot_left)\nmain_plot_right = fig.transFigure.inverted().transform(main_plot_right)\ninset_left = fig.transFigure.inverted().transform(inset_left)\ninset_right = fig.transFigure.inverted().transform(inset_right)\n\n# Draw lines connecting corners\nfig.add_artist(\n plt.Line2D(\n (main_plot_left[0], inset_left[0]),\n (main_plot_left[1], inset_left[1]),\n color=\"gray\",\n )\n)\nfig.add_artist(\n plt.Line2D(\n (main_plot_right[0], inset_right[0]),\n (main_plot_right[1], inset_right[1]),\n color=\"gray\",\n )\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"PIP_2.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_13", "content": { "Age Groups": [ "10-20", "21-30", "31-40", "41-50" ], "Happiness Baseline": [ 70, 75, 65, 60 ], "Happiness Post Stress Reduction": [ 85, 80, 75, 70 ], "Stress Baseline": [ 50, 55, 60, 65 ], "Stress Post Stress Reduction": [ 30, 35, 40, 45 ] }, "visual_intent": "A figure with 2 subplots: (1) a line chart about happiness levels across age groups comparing baseline and post stress reduction, titled Happiness Levels, (2) a line chart about stress levels across age groups comparing baseline and post stress reduction, titled Stress Levels, overall titled Psychological Well-being Across Age Groups(size of the desired plot: width=10.0, height=5.0)", "path_to_gt_image": "images/line_81.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for plotting\nage_groups = [\"10-20\", \"21-30\", \"31-40\", \"41-50\"] # Update for categorical x-axis\nhappiness_baseline = [70, 75, 65, 60]\nhappiness_stress_reduction = [85, 80, 75, 70]\nstress_baseline = [50, 55, 60, 65]\nstress_stress_reduction = [30, 35, 40, 45]\n\n# Axes Limits and Labels\nxticks_values = range(len(age_groups))\nylabel_value = \"Level (%)\"\nxlabel_value = \"Age Groups\"\n\n# Labels\nlabel_1 = \"Baseline\"\nlabel_2 = \"Post Stress Reduction\"\n\n# Titles\ntitle_1 = \"Happiness Levels\"\ntitle_2 = \"Stress Levels\"\nsupertitle = \"Psychological Well-being Across Age Groups\"\n\n# Texts\ntext_1 = \"Increase +15%\"\ntext_2 = \"Decrease -20%\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and axes\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5))\n\n# Plotting for Happiness Levels\nax1.set_xticks(xticks_values) # Setting categorical x-axis\nax1.plot(\n age_groups,\n happiness_baseline,\n marker=\"o\",\n color=\"#1f77b4\",\n label=label_1,\n linewidth=4,\n markersize=8,\n)\nax1.plot(\n age_groups,\n happiness_stress_reduction,\n marker=\"o\",\n linestyle=\"--\",\n color=\"#1f77b4\",\n label=label_2,\n linewidth=4,\n markersize=8,\n)\nax1.set_title(title_1, fontsize=16)\nax1.set_ylabel(ylabel_value, fontsize=16) # Adjusted font size\nax1.legend(loc=\"lower right\", fontsize=14)\nax1.set_xticklabels(age_groups, fontsize=12) # Adjust font size for x-axis labels\nax1.grid(True, which=\"both\", ls=\"--\", color=\"grey\", linewidth=1, axis=\"y\", alpha=0.5)\nax1.annotate(\n \"\",\n xy=(0, happiness_baseline[0]),\n xytext=(0, happiness_stress_reduction[0]),\n arrowprops=dict(color=\"green\", shrink=0.05, width=1.5, headwidth=8),\n annotation_clip=False,\n)\nax1.text(\n 0.1,\n (happiness_baseline[0] + happiness_stress_reduction[0]) / 2,\n text_1,\n ha=\"left\",\n va=\"center\",\n fontsize=14,\n color=\"black\",\n)\n\n# Plotting for Stress Levels\nax2.plot(\n age_groups,\n stress_baseline,\n marker=\"o\",\n color=\"#ff7f0e\",\n label=label_1,\n linewidth=4,\n markersize=8,\n)\nax2.plot(\n age_groups,\n stress_stress_reduction,\n marker=\"o\",\n linestyle=\"--\",\n color=\"#ff7f0e\",\n label=label_2,\n linewidth=4,\n markersize=8,\n)\nax2.set_title(title_2, fontsize=16) # Adjusted font size\nax2.legend(loc=\"upper left\", fontsize=14)\nax2.set_xticklabels(age_groups, fontsize=12) # Ensure x-axis labels are set for both axes\nax2.grid(True, which=\"both\", ls=\"--\", color=\"grey\", linewidth=1, axis=\"y\", alpha=0.5)\nax2.annotate(\n \"\",\n xy=(0, stress_baseline[0]),\n xytext=(0, stress_stress_reduction[0]),\n arrowprops=dict(color=\"red\", shrink=0.05, width=1.5, headwidth=8),\n annotation_clip=False,\n)\nax2.text(\n 0.1,\n (stress_baseline[0] + stress_stress_reduction[0]) / 2,\n text_2,\n ha=\"left\",\n va=\"center\",\n fontsize=14,\n color=\"black\",\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and add common annotation for resolution\nplt.suptitle(supertitle, fontsize=18, weight='bold')\nplt.tight_layout(rect=[0, 0, 1, 0.96])\nplt.savefig(\"line_81.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 5.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "line" }, { "id": "test_14", "content": { "Modes of Transport": [ "Bicycles", "Buses", "Trains", "Cars", "Walking" ], "Usage (%)": [ 35, 20, 25, 15, 45 ], "Theta": [ 0, 0.65, 2.0, 3.8, 5.2 ], "Width": [ 0.6, 0.5, 1.0, 0.8, 1.0 ] }, "visual_intent": "A polar bar chart about Modes of Transport and Usage (%), titled Usage of Different Modes of Transportation(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/HR_72.jpg", "original_category": "HR", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data and labels\ntheta = [0, 0.65, 2.0, 3.8, 5.2] # Angles for the bars\nradii = np.array([35, 20, 25, 15, 45]) # Radii of the bars representing usage percentage\nwidth = [0.6, 0.5, 1.0, 0.8, 1.0] # Width of the bars\ncategories = [\n \"Bicycles\",\n \"Buses\",\n \"Trains\",\n \"Cars\",\n \"Walking\",\n] # Labels for the bars\n\n# Text parameters\ntitle = \"Usage of Different Modes of Transportation\"\nxlabel = \"Modes of Transport\"\nylabel = \"Usage (%)\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = ['#4CAF50', '#8BC34A', '#00BCD4', '#2196F3', '#3F51B5'] # Custom color palette\n\n# Create the figure\nplt.figure(figsize=(8, 8))\nax = plt.subplot(111, projection=\"polar\") # Set up polar plot\n\n# Plot the bars\nbars = ax.bar(theta, radii, width=width, bottom=0, color=colors, alpha=0.7, zorder=3)\n\n# Add labels to the bars\nfor bar, angle, label in zip(bars, theta, categories):\n rotation = np.degrees(angle) # Convert angle to degrees\n alignment = \"center\" # Center align the labels\n # Place the text inside the bar, rotated correctly\n ax.text(\n angle,\n bar.get_height() + 0.5,\n label,\n ha=alignment,\n va=\"center\",\n rotation_mode=\"anchor\",\n )\n\n# Remove the polar angle labels to declutter the plot\nax.set_xticklabels([])\n\n# Remove the radial labels\nax.set_yticklabels([])\n\n# Add title\nplt.title(title, va='bottom')\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Save the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"HR_72.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "misc" }, { "id": "test_15", "content": { "Category": [ "Research & Analysis", "Court Fees", "Consultations", "Legal Documentation", "Miscellaneous" ], "Firm Expenses": [ 400, 300, 250, 150, 100 ], "Specific Case Expenses": [ 200, 120, 100, 50, 30 ] }, "visual_intent": "A double layer pie chart displaying legal expenses by category for a firm and a specific case, titled Legal Expenses - Firm vs. Specific Case(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/pie_52.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Define new data for legal expenses\ncategories = [\"Research & Analysis\", \"Court Fees\", \"Consultations\", \"Legal Documentation\", \"Miscellaneous\"]\nouter_sizes = [400, 300, 250, 150, 100] # Expenses distribution for the law firm\ninner_sizes = [200, 120, 100, 50, 30] # Expenses distribution for a specific case\n\n# Text label parameters\ntitle = \"Legal Expenses - Firm vs. Specific Case\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, ax = plt.subplots(figsize=(8, 8))\n\n# Define new colors and styles\nouter_colors = [\"#8B0000\", \"#000080\", \"#228B22\", \"#FFD700\", \"#A9A9A9\"]\ninner_colors = [\"#CD5C5C\", \"#4169E1\", \"#32CD32\", \"#FFD700\", \"#C0C0C0\"]\nouter_hatch = [\"/\", \"\", \"|\", \".\", \"x\"]\ninner_hatch = [\"\\\\\", \"\", \".\", \"-\", \"\"]\n\nexplode_outer = (0.05, 0, 0, 0, 0) # Small explosion for first slice\n\n# Outer ring\nwedges, texts, autotexts = ax.pie(\n outer_sizes,\n labels=categories,\n radius=1.2,\n colors=outer_colors,\n explode=explode_outer,\n autopct=\"%1.1f%%\",\n pctdistance=0.85,\n startangle=90,\n wedgeprops=dict(width=0.3, edgecolor=\"w\", hatch=\"*\"),\n)\n\n# Inner ring\nwedges2, texts2, autotexts2 = ax.pie(\n inner_sizes,\n radius=0.9,\n colors=inner_colors,\n autopct=\"%1.1f%%\",\n pctdistance=0.75,\n startangle=90,\n wedgeprops=dict(width=0.3, edgecolor=\"w\", hatch=\"o\"),\n)\n\n# Customizing the autotexts for better visibility\nfor autotext in autotexts + autotexts2:\n autotext.set_color(\"black\")\n autotext.set_fontsize(10)\n\n# Title for the double layer pie chart\nax.set_title(title, fontsize=16, y=1.05)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Improve layout to make room for legend or labels if necessary\nplt.tight_layout()\n\n# Show the plot\nplt.savefig(\"pie_52.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_16", "content": { "Art Form": [ "Painting", "Sculpture", "Digital Art", "Photography", "Crafts" ], "Popularity": [ 35, 20, 25, 15, 5 ] }, "visual_intent": "A pie chart about Art Forms and Popularity, titled Popularity of Art Forms(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/pie_43.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data to plot\nlabels = [\"Painting\", \"Sculpture\", \"Digital Art\", \"Photography\", \"Crafts\"]\nsizes = [35, 20, 25, 15, 5]\ntitle = \"Popularity of Art Forms\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot setup\nfig, ax = plt.subplots(figsize=(8, 8))\n\n# Custom color palette\ncolors = [\"#FF9999\", \"#66B2FF\", \"#99FF99\", \"#FFCC99\", \"#FFD700\"]\nexplode = (0.1, 0, 0, 0, 0) # only \"explode\" the 1st slice (Painting)\n\nwedges, texts, autotexts = ax.pie(\n sizes,\n explode=explode,\n colors=colors,\n autopct=\"%1.1f%%\",\n shadow=False,\n startangle=140,\n textprops=dict(color=\"w\"),\n)\n\n# Adding annotations\nbbox_props = dict(boxstyle=\"round,pad=0.3\", fc=\"white\", ec=\"black\", lw=0.72)\nkw = dict(arrowprops=dict(arrowstyle=\"-\"), bbox=bbox_props, zorder=0, va=\"center\")\n\nfor i, p in enumerate(wedges):\n ang = (p.theta2 - p.theta1) / 2.0 + p.theta1\n y = np.sin(np.deg2rad(ang))\n x = np.cos(np.deg2rad(ang))\n horizontalalignment = {-1: \"right\", 1: \"left\"}[int(np.sign(x))]\n connectionstyle = \"angle,angleA=0,angleB={}\".format(ang)\n kw[\"arrowprops\"].update({\"connectionstyle\": connectionstyle})\n ax.annotate(\n labels[i],\n xy=(x, y),\n xytext=(1.35 * np.sign(x), 1.2 * y),\n horizontalalignment=horizontalalignment,\n **kw\n )\n\n# Title and equal axis\nax.set_title(title, fontsize=16, x=0.5, y=1)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot\nplt.tight_layout()\nplt.savefig(\"pie_43.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_17", "content": { "Month": [ "January", "February", "March", "April" ], "New York": [ 3.1, 2.8, 3.9, 4.1 ], "Los Angeles": [ 3.4, 3.7, 2.9, 0.8 ], "Chicago": [ 1.8, 1.5, 2.2, 3.7 ], "Houston": [ 3.5, 2.9, 3.3, 4.5 ] }, "visual_intent": "A complex bar chart combining grouped and stacked bars about monthly average rainfall across four cities, titled Average Monthly Rainfall in Different Cities(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/bar_227.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(1)\n\n# Data\nmonths = [\"January\", \"February\", \"March\", \"April\"]\nnew_york = [3.1, 2.8, 3.9, 4.1]\nlos_angeles = [3.4, 3.7, 2.9, 0.8]\nchicago = [1.8, 1.5, 2.2, 3.7]\nhouston = [3.5, 2.9, 3.3, 4.5]\n\nlabels = [\"New York\", \"Los Angeles\", \"Chicago\", \"Houston\"]\nxlabel = \"Months\"\nylabel = \"Average Rainfall (inches)\"\ntitle = \"Average Monthly Rainfall in Different Cities\"\nyaxhline = 4.0\nylim = [0, 9]\nyticks = np.arange(0, 10, 1)\n\n# Positions of bars on x-axis\nind = np.arange(len(months))\n\ntexts = [\"1.2\", \"0.8\", \"1.0\", \"0.1\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Bar width\nbar_width = 0.2\n\n# Figure size\nplt.figure(figsize=(10, 7))\n\n# Plotting\nplt.bar(ind, new_york, width=bar_width, label=labels[0], color=\"#1f77b4\")\nplt.bar(\n ind,\n los_angeles,\n width=bar_width,\n label=labels[1],\n color=\"#aec7e8\",\n hatch=\"//\",\n bottom=new_york,\n)\nplt.bar(ind + bar_width, chicago, width=bar_width, label=labels[2], color=\"#ff7f0e\")\nplt.bar(\n ind + bar_width,\n houston,\n width=bar_width,\n label=labels[3],\n color=\"#ffbb78\",\n hatch=\"/\",\n bottom=chicago,\n)\n\n# Highlighting the most significant deviation\ndistance = 0.05\nplt.annotate(\n \"\",\n xy=(ind[0] + bar_width, 4),\n xytext=(ind[0] + bar_width,1.8),\n arrowprops=dict(facecolor=\"black\", shrink=0.02),\n)\nplt.text(ind[0] + bar_width + distance, 2.65, texts[0])\nplt.annotate(\n \"\",\n xy=(ind[1], 4),\n xytext=(ind[1], 2.9),\n arrowprops=dict(facecolor=\"black\", shrink=0.02),\n va=\"center\",\n)\nplt.text(ind[1] - distance * 6, 3.5, texts[1])\nplt.annotate(\n \"\",\n xy=(ind[2] + bar_width,4),\n xytext=(ind[2] + bar_width, 2.2),\n arrowprops=dict(facecolor=\"black\", shrink=0.02),\n)\nplt.text(ind[2] + bar_width + distance, 3.7, texts[2])\nplt.annotate(\n \"\",\n xy=(ind[3] + bar_width * 2, 4),\n xytext=(ind[3] + bar_width * 2, 3.7),\n arrowprops=dict(facecolor=\"red\", shrink=0.02),\n ha=\"center\",\n)\nplt.text(ind[3] + bar_width * 2 + distance, 3.5, texts[3])\nplt.axhline(y=yaxhline, color=\"blue\", linestyle=\"--\", linewidth=2)\n# X-axis labels\nplt.xticks(ind + bar_width / 2, months)\n\n# Y-axis labels\nplt.ylim(ylim)\nplt.yticks(yticks)\n\n# Legend\nplt.legend(loc=\"upper center\", bbox_to_anchor=(0.5, 1.15), ncol=2)\n\n# Grid lines\nplt.grid(axis=\"y\")\n\n# Labels and Title\nplt.xlabel(xlabel)\nplt.ylabel(ylabel)\nplt.title(title)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"bar_227.pdf\", bbox_inches=\"tight\")\n\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" }, { "id": "test_18", "content": { "City": [ "New York, NY", "Houston, TX", "Chicago, IL", "Atlanta, GA", "Seattle, WA", "San Francisco, CA", "Miami, FL", "Denver, CO" ], "Average Annual Precipitation (in)": [ 49.7, 47.3, 45.5, 43.7, 42.2, 40.3, 37.5, 36.2 ] }, "visual_intent": "A treemap about cities and average annual precipitation, titled Average Annual Precipitation in Various US Cities(size of the desired plot: width=12.0, height=8.0)", "path_to_gt_image": "images/tree_22.jpg", "original_category": "tree", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data: Average annual precipitation (in inches) for various cities\nprecipitation_sizes = [49.7, 47.3, 45.5, 43.7, 42.2, 40.3, 37.5, 36.2]\ncity_labels = [\n \"New York, NY\\n49.7 in\",\n \"Houston, TX\\n47.3 in\",\n \"Chicago, IL\\n45.5 in\",\n \"Atlanta, GA\\n43.7 in\",\n \"Seattle, WA\\n42.2 in\",\n \"San Francisco, CA\\n40.3 in\",\n \"Miami, FL\\n37.5 in\",\n \"Denver, CO\\n36.2 in\",\n]\n\ntitle = \"Average Annual Precipitation in Various US Cities\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with the specified size\nfig = plt.figure(figsize=(12, 8))\n\n# Color scheme for precipitation\nprecipitation_colors = [\n \"#c7e9b4\",\n \"#7fcdbb\",\n \"#41b6c4\",\n \"#1d91c0\",\n \"#225ea8\",\n \"#253494\",\n \"#081d58\",\n \"#4d004b\",\n]\n\n\n# Create a treemap\nsquarify.plot(\n sizes=precipitation_sizes,\n label=city_labels,\n color=precipitation_colors,\n alpha=0.8,\n text_kwargs={\"fontsize\": 15, \"weight\": \"bold\"},\n)\n\n# Remove axes\nplt.axis(\"off\")\n\n# Add a title to the plot\nplt.title(title, fontsize=20)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout and save to file\nplt.tight_layout()\nplt.savefig(\"tree_22.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 8.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_19", "content": { "Region": [ "Region A", "Region B", "Region C", "Region D", "Region E", "Region A", "Region B", "Region C", "Region D", "Region E" ], "Period": [ "January", "January", "January", "January", "January", "July", "July", "July", "July", "July" ], "Temperature": [ 22.5, 25.2, 20.8, 30.0, 15.7, 18.3, 22.4, 19.6, 21.5, 18.0 ], "Precipitation": [ 120.0, 100.2, 130.3, 95.1, 140.8, 160.0, 115.5, 150.5, 105.2, 130.0 ], "Wind Speed": [ 0.7, 0.6, 0.8, 0.5, 1.2, 1.0, 0.9, 0.7, 0.8, 1.2 ], "Humidity": [ 78.0, 65.8, 80.2, 50.1, 90.5, 110.4, 85.0, 120.3, 98.5, 95.0 ], "CO2 Levels": [ 1.4, 3.3, 2.5, 4.1, 1.1, 3.2, 2.8, 2.0, 3.6, 4.0 ], "Sunshine Hours": [ 60.3, 70.5, 75.0, 40.2, 25.5, 50.0, 80.0, 60.0, 70.0, 65.0 ] }, "visual_intent": "A figure with 2 subplots: (1) a bubble chart grid displaying climate metrics for five regions in January, (2) a bubble chart grid displaying climate metrics for five regions in July.(size of the desired plot: width=20.0, height=8.0)", "path_to_gt_image": "images/heatmap_85.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom matplotlib.colors import LogNorm\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Defining the colormap from white to green-blue\ncmap = plt.cm.cubehelix\n\n# Data for the two subplots (Climate metrics across different regions)\ndata1 = np.array(\n [\n [22.5, 120.0, 0.7, 78.0, 1.4, 60.3],\n [25.2, 100.2, 0.6, 65.8, 3.3, 70.5],\n [20.8, 130.3, 0.8, 80.2, 2.5, 75.0],\n [30.0, 95.1, 0.5, 50.1, 4.1, 40.2],\n [15.7, 140.8, 1.2, 90.5, 1.1, 25.5],\n ]\n)\n\ndata2 = np.array(\n [\n [18.3, 160.0, 1.0, 110.4, 3.2, 50.0],\n [22.4, 115.5, 0.9, 85.0, 2.8, 80.0],\n [19.6, 150.5, 0.7, 120.3, 2.0, 60.0],\n [21.5, 105.2, 0.8, 98.5, 3.6, 70.0],\n [18.0, 130.0, 1.2, 95.0, 4.0, 65.0],\n ]\n)\n\n# X and Y labels\nx_labels = [\"Temperature\", \"Precipitation\", \"Wind Speed\", \"Humidity\", \"CO2 Levels\", \"Sunshine Hours\"]\ny_labels = [\"Region A\", \"Region B\", \"Region C\", \"Region D\", \"Region E\"]\n\n# Subplot titles\ntitles = [\"(a) Climate Metrics in January\", \"(b) Climate Metrics in July\"]\n\n# Set up the colormap and norm (log scale)\nnorm = LogNorm(vmin=0.1, vmax=200)\n\n# Axes Limits and Labels\nxticks_values = range(len(x_labels))\nyticks_values = range(len(y_labels))\ncolorbar_ticks = [0.1, 1, 10, 100, 200]\nyticklabels = [\"0.1\", \"1\", \"10\", \"100\", \"200\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set up the figure\nfig, axes = plt.subplots(\n 1, 2, figsize=(20, 8), gridspec_kw={\"width_ratios\": [1, 1], \"wspace\": 0.3}\n)\n\n\n# Function to create a subplot\ndef create_subplot(ax, data, title):\n # Create the scatter plot\n for i in range(data.shape[0]):\n for j in range(data.shape[1]):\n # Calculate the color based on the original value\n color = cmap(norm(data[i, j]))\n\n # Draw the circle with a fixed size\n circle = plt.Circle((j, i), 0.4, color=color) # Fixed size\n ax.add_artist(circle)\n\n # Determine text color based on the value\n text_color = \"white\" if data[i, j] > 50 else \"black\"\n\n # Add the text inside the circle\n ax.text(\n j, i, f\"{data[i, j]:.1f}\", ha=\"center\", va=\"center\", color=text_color\n )\n\n # Set labels for x and y axes\n ax.set_xticks(range(len(x_labels)))\n ax.set_xticklabels(x_labels, ha=\"center\")\n ax.set_yticks(range(len(y_labels)))\n ax.set_yticklabels(y_labels, va=\"center\")\n\n # Adding the title for the subplot\n ax.set_title(title, fontsize=16)\n\n # Set the limits of the axes; they should be one more than your data range\n ax.set_xlim(-0.5, data.shape[1] - 0.5)\n ax.set_ylim(-0.5, data.shape[0] - 0.5)\n\n # Set the aspect of the plot to be equal and add a frame\n ax.set_aspect(\"equal\")\n for spine in ax.spines.values():\n spine.set_visible(True)\n\n\n# Create each subplot\ncreate_subplot(axes[0], data1, titles[0])\ncreate_subplot(axes[1], data2, titles[1])\n\n# Create a colorbar on the far right side of the figure\nsm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)\nsm.set_array([])\ncbar = fig.colorbar(\n sm,\n ax=axes,\n ticks=colorbar_ticks,\n orientation=\"vertical\",\n fraction=0.015,\n pad=0.05,\n)\ncbar.ax.set_yticklabels(yticklabels)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"heatmap_85.pdf\", bbox_inches=\"tight\")\n", "width": 20.0, "height": 8.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_20", "content": { "Chart_Title": [ "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(a) Role voting in the Werewolf game", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles", "(b) Final state of roles" ], "Source_Role": [ "Werewolf", "Werewolf", "Werewolf", "Werewolf", "Werewolf", "Werewolf", "Seer", "Seer", "Seer", "Seer", "Seer", "Seer", "Witch", "Witch", "Witch", "Witch", "Witch", "Witch", "Hunter", "Hunter", "Hunter", "Hunter", "Hunter", "Hunter", "Villager", "Villager", "Villager", "Villager", "Villager", "Villager", "Werewolf", "Werewolf", "Werewolf", "Werewolf", "Werewolf", "Werewolf", "Seer", "Seer", "Seer", "Seer", "Seer", "Seer", "Witch", "Witch", "Witch", "Witch", "Witch", "Witch", "Hunter", "Hunter", "Hunter", "Hunter", "Hunter", "Hunter", "Villager", "Villager", "Villager", "Villager", "Villager", "Villager" ], "Target_Role": [ "Werewolf", "Seer", "Witch", "Hunter", "Villager", "Abstain", "Werewolf", "Seer", "Witch", "Hunter", "Villager", "Abstain", "Werewolf", "Seer", "Witch", "Hunter", "Villager", "Abstain", "Werewolf", "Seer", "Witch", "Hunter", "Villager", "Abstain", "Werewolf", "Seer", "Witch", "Hunter", "Villager", "Abstain", "Werewolf", "Seer", "Witch", "Hunter", "Villager", "Abstain", "Werewolf", "Seer", "Witch", "Hunter", "Villager", "Abstain", "Werewolf", "Seer", "Witch", "Hunter", "Villager", "Abstain", "Werewolf", "Seer", "Witch", "Hunter", "Villager", "Abstain", "Werewolf", "Seer", "Witch", "Hunter", "Villager", "Abstain" ], "Percentage": [ 50.3, 12.0, 0.9, 7.0, 13.4, 16.3, 49.2, 11.2, 0.6, 7.8, 17.3, 13.9, 50.8, 12.3, 0.9, 6.2, 15.5, 14.3, 76.0, 2.1, 0.5, 4.1, 8.1, 9.2, 15.7, 28.1, 2.6, 14.5, 28.6, 10.5, 61.5, 2.0, 8.7, 14.9, 13.0, 4.0, 44.4, 10.0, 7.8, 22.9, 25.0, 2.0, 38.6, 2.2, 0.8, 55.3, 3.1, 1.0, 35.3, 2.2, 4.0, 32.5, 26.0, 0.8, 31.5, 4.3, 17.4, 2.5, 27.1, 17.3 ] }, "visual_intent": "A figure with 2 subplots: (1) a bubble heatmap about role voting percentages in the Werewolf game, titled (a) Role voting in the Werewolf game, (2) a bubble heatmap about the final state of roles, titled (b) Final state of roles(size of the desired plot: width=20.0, height=8.0)", "path_to_gt_image": "images/heatmap_19.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom matplotlib.colors import LogNorm\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Defining the colormap from white to blue\ncmap = plt.cm.Blues\n\n# Data for the two subplots\ndata1 = np.array(\n [\n [50.3, 12.0, 0.9, 7.0, 13.4, 16.3],\n [49.2, 11.2, 0.6, 7.8, 17.3, 13.9],\n [50.8, 12.3, 0.9, 6.2, 15.5, 14.3],\n [76.0, 2.1, 0.5, 4.1, 8.1, 9.2],\n [15.7, 28.1, 2.6, 14.5, 28.6, 10.5],\n ]\n)\n\ndata2 = np.array(\n [\n [61.5, 2.0, 8.7, 14.9, 13.0, 4.0],\n [44.4, 10.0, 7.8, 22.9, 25.0, 2.0],\n [38.6, 2.2, 0.8, 55.3, 3.1, 1.0],\n [35.3, 2.2, 4.0, 32.5, 26.0, 0.8],\n [31.5, 4.3, 17.4, 2.5, 27.1, 17.3],\n ]\n)\n\n# X and Y labels\nx_labels = [\"Werewolf\", \"Seer\", \"Witch\", \"Hunter\", \"Villager\", \"Abstain\"]\ny_labels = [\"Werewolf\", \"Seer\", \"Witch\", \"Hunter\", \"Villager\"]\n\n# Subplot titles\ntitles = [\"(a) Role voting in the Werewolf game\", \"(b) Final state of roles\"]\n\n# Set up the colormap and norm (log scale)\nnorm = LogNorm(vmin=0.1, vmax=100)\n\n# Axes Limits and Labels\nxticks_values = range(len(x_labels))\nyticks_values = range(len(y_labels))\ncolorbar_ticks = [0.1, 1, 10, 100]\nyticklabels = [\"0.1\", \"1\", \"10\", \"100\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set up the figure\nfig, axes = plt.subplots(\n 1, 2, figsize=(20, 8), gridspec_kw={\"width_ratios\": [1, 1], \"wspace\": 0.3}\n)\n\n\n# Function to create a subplot\ndef create_subplot(ax, data, title):\n # Create the scatter plot\n for i in range(data.shape[0]):\n for j in range(data.shape[1]):\n # Calculate the color based on the original value\n color = cmap(norm(data[i, j]))\n\n # Draw the circle with a fixed size\n circle = plt.Circle((j, i), 0.4, color=color) # Fixed size\n ax.add_artist(circle)\n\n # Determine text color based on the value\n text_color = \"white\" if data[i, j] > 25 else \"black\"\n\n # Add the text inside the circle\n ax.text(\n j, i, f\"{data[i, j]:.1f}%\", ha=\"center\", va=\"center\", color=text_color\n )\n\n # Set labels for x and y axes\n ax.set_xticks(range(len(x_labels)))\n ax.set_xticklabels(x_labels, ha=\"center\")\n ax.set_yticks(range(len(y_labels)))\n ax.set_yticklabels(y_labels, va=\"center\")\n\n # Adding the title for the subplot\n ax.set_title(title, fontsize=16)\n\n # Set the limits of the axes; they should be one more than your data range\n ax.set_xlim(-0.5, data.shape[1] - 0.5)\n ax.set_ylim(-0.5, data.shape[0] - 0.5)\n\n # Set the aspect of the plot to be equal and add a frame\n ax.set_aspect(\"equal\")\n for spine in ax.spines.values():\n spine.set_visible(True)\n\n\n# Create each subplot\ncreate_subplot(axes[0], data1, titles[0])\ncreate_subplot(axes[1], data2, titles[1])\n\n# Create a colorbar on the far right side of the figure\nsm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)\nsm.set_array([])\ncbar = fig.colorbar(\n sm,\n ax=axes,\n ticks=colorbar_ticks,\n orientation=\"vertical\",\n fraction=0.015,\n pad=0.05,\n)\ncbar.ax.set_yticklabels(yticklabels)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"heatmap_19.pdf\", bbox_inches=\"tight\")\n", "width": 20.0, "height": 8.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_21", "content": { "Days": [ 1, 2, 3, 4, 5, 6, 7 ], "Company A Stock Price ($)": [ 125.5, 127.8, 128.4, 129.6, 130.1, 131.0, 132.3 ], "Company B Stock Price ($)": [ 102.4, 103.1, 104.3, 105.2, 105.9, 107.4, 108.0 ] }, "visual_intent": "A dual-axis line chart about days and company stock prices, titled Stock Prices Over a Week(size of the desired plot: width=8.0, height=7.0)", "path_to_gt_image": "images/line_171.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom matplotlib.lines import Line2D # Importing Line2D for creating custom legend items\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np # Importing numpy for numerical operations\n\n# Data\ndays = np.arange(1, 8)\ncompany_a_prices = [125.5, 127.8, 128.4, 129.6, 130.1, 131.0, 132.3]\ncompany_b_prices = [102.4, 103.1, 104.3, 105.2, 105.9, 107.4, 108.0]\n\n# Axes Limits and Labels\nxlabel_value = \"Days\"\n\nylabel_value_1 = \"Company A Stock Price ($)\"\nylabel_value_2 = \"Company B Stock Price ($)\"\nylim_values_1 = [120, 135]\nylim_values_2 = [100, 110]\nyticks_values_1 = range(120, 136, 5)\nyticks_values_2 = range(100, 111, 5)\n\n# Labels\nlabel_1 = \"Company A\"\nlabel_2 = \"Company B\"\ntitle = \"Stock Prices Over a Week\"\nsuptitle = \"Financial Data Visualization\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot\nfig, ax1 = plt.subplots(figsize=(8, 7))\n\n# Company A plot\n(company_a_line,) = ax1.plot(\n days,\n company_a_prices,\n \"o-\",\n color=\"#2ca02c\",\n label=label_1,\n markersize=10,\n linewidth=3,\n mec=\"black\",\n)\nax1.set_xlabel(xlabel_value, fontsize=14)\nax1.set_ylabel(ylabel_value_1, fontsize=14, color=\"#2ca02c\")\nax1.tick_params(\n axis=\"y\", labelcolor=\"#2ca02c\", direction=\"in\", rotation=90, labelsize=12\n)\nax1.tick_params(\n axis=\"x\",\n direction=\"in\",\n labelsize=12,\n)\nax1.set_yticks(yticks_values_1)\nax1.set_ylim(ylim_values_1)\n\n# Adding stock prices to the plot for Company A\nfor i, txt in enumerate(company_a_prices):\n ax1.annotate(\n f\"${txt}\",\n (days[i], txt),\n textcoords=\"offset points\",\n xytext=(10, 10),\n ha=\"center\",\n fontsize=12,\n )\n\n# Company B plot with a secondary y-axis\nax2 = ax1.twinx()\n(company_b_line,) = ax2.plot(\n days,\n company_b_prices,\n \"s-\",\n color=\"#d62728\",\n label=label_2,\n markersize=10,\n linewidth=3,\n mec=\"black\",\n)\nax2.set_ylabel(ylabel_value_2, color=\"#d62728\", fontsize=14)\nax2.tick_params(\n axis=\"y\", labelcolor=\"#d62728\", direction=\"in\", rotation=90, labelsize=12\n)\nax2.set_yticks(yticks_values_2)\nax2.set_ylim(ylim_values_2)\n\n# Adding stock prices to the plot for Company B\nfor i, txt in enumerate(company_b_prices):\n ax2.annotate(\n f\"${txt}\",\n (days[i], txt),\n textcoords=\"offset points\",\n xytext=(0, -30),\n ha=\"center\",\n fontsize=12,\n )\n\n# Creating custom legend items\ncompany_a_legend = Line2D([0], [0], color=\"#2ca02c\", linewidth=3, label=label_1)\ncompany_b_legend = Line2D([0], [0], color=\"#d62728\", linewidth=3, label=label_2)\n\n# Adding legends\nfirst_legend = ax1.legend(\n handles=[company_a_legend, company_b_legend],\n loc=\"upper left\",\n ncol=2,\n fontsize=14,\n edgecolor=\"black\",\n)\nax1.add_artist(first_legend) # Add the first legend manually\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.title(title, fontsize=16)\nplt.suptitle(suptitle, fontsize=18)\nplt.tight_layout(rect=[0, 0, 1, 0.95])\nplt.savefig(\"line_171.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 7.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "line" }, { "id": "test_22", "content": { "Rank": [ 0, 1, 2, 3 ], "LLaMA_Baseline": [ "#17", "#3", "#13", "#5" ], "LLaMA_Reversed_Order": [ "#24", "#8", "#10", "#4" ], "LLaMA_Reversed_IDs": [ "#23", "#17", "#3", "#10" ], "GPT_Baseline": [ "#5", "#17", "#11", "#24" ], "GPT_Reversed_Order": [ "#17", "#5", "#24", "#1" ], "GPT_Reversed_IDs": [ "#1", "#23", "#9", "#15" ] }, "visual_intent": "A figure with 2 subplots: (1) a heatmap showing LLaMA ranking IDs across different experimental conditions, titled LLaMA, (2) a heatmap showing GPT ranking IDs across different experimental conditions, titled GPT(size of the desired plot: width=6.0, height=3.0)", "path_to_gt_image": "images/heatmap_22.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport pandas as pd\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Creating dummy data based on the visual observation of the provided image\ndata_LLaMA = pd.DataFrame(\n {\n \"Baseline\": [\"#17\", \"#3\", \"#13\", \"#5\"],\n \"Reversed Order\": [\"#24\", \"#8\", \"#10\", \"#4\"],\n \"Reversed IDs\": [\"#23\", \"#17\", \"#3\", \"#10\"],\n }\n)\n\ndata_GPT = pd.DataFrame(\n {\n \"Baseline\": [\"#5\", \"#17\", \"#11\", \"#24\"],\n \"Reversed Order\": [\"#17\", \"#5\", \"#24\", \"#1\"],\n \"Reversed IDs\": [\"#1\", \"#23\", \"#9\", \"#15\"],\n }\n)\n\n\n# Creating a function to convert the string indices to numeric values for plotting\ndef convert_to_numeric(cell):\n return int(cell.replace(\"#\", \"\"))\n\n\n# Convert the dataframes\ndata_LLaMA_numeric = data_LLaMA.applymap(convert_to_numeric)\ndata_GPT_numeric = data_GPT.applymap(convert_to_numeric)\n\n# Axes Limits and Labels\nax1_title = \"LLaMA\"\nax1_ylabel = \"Rank\"\nax2_title = \"GPT\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Creating the heatmap using matplotlib with increased linewidths for separation\nfig, (ax1, ax2) = plt.subplots(\n ncols=2, figsize=(6, 3), gridspec_kw={\"width_ratios\": [1, 1], \"wspace\": 0.1}\n)\n\n# Setting the color map to match the image: Oranges for LLaMA, Blues for GPT\ncmap_LLaMA = plt.get_cmap(\"Oranges\")\ncmap_GPT = plt.get_cmap(\"Blues\")\n\n# Heatmap for LLaMA with increased cell borders\nim1 = ax1.imshow(data_LLaMA_numeric, cmap=cmap_LLaMA)\nax1.set_title(ax1_title)\nax1.set_ylabel(ax1_ylabel)\nax1.set_xticks(range(len(data_LLaMA.columns)))\nax1.set_xticklabels(data_LLaMA.columns, rotation=45)\nax1.set_yticks(range(len(data_LLaMA.index)))\nax1.set_yticklabels(data_LLaMA.index, rotation=0)\n\n# Add annotations for LLaMA\nfor i in range(len(data_LLaMA.index)):\n for j in range(len(data_LLaMA.columns)):\n ax1.text(j, i, data_LLaMA.iloc[i, j], ha=\"center\", va=\"center\", color=\"black\")\n\n# Heatmap for GPT with increased cell borders\nim2 = ax2.imshow(data_GPT_numeric, cmap=cmap_GPT)\nax2.set_title(ax2_title)\nax2.set_xticks(range(len(data_GPT.columns)))\nax2.set_xticklabels(data_GPT.columns, rotation=45)\nax2.set_yticks(range(len(data_GPT.index)))\nax2.set_yticklabels(data_GPT.index, rotation=0)\n\n# Add annotations for GPT\nfor i in range(len(data_GPT.index)):\n for j in range(len(data_GPT.columns)):\n ax2.text(j, i, data_GPT.iloc[i, j], ha=\"center\", va=\"center\", color=\"black\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"heatmap_22.pdf\", bbox_inches=\"tight\")\n", "width": 6.0, "height": 3.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_23", "content": { "Year": [ 2010, 2012, 2014, 2016, 2018, 2020 ], "Apple | Exponential Growth": [ 500000, 550000, 605000, 665500, 732050, 805255 ], "Apple | Linear Growth": [ 500000, 510000, 520000, 530000, 540000, 550000 ], "Microsoft | Exponential Growth": [ 1000000, 1100000, 1210000, 1331000, 1464100, 1610510 ], "Microsoft | Linear Growth": [ 1000000, 1030000, 1060000, 1090000, 1120000, 1150000 ] }, "visual_intent": "A line chart about years and revenue with an inset plot zooming in on specific data segments, titled Revenue Growth of Apple and Microsoft (2010-2020)(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/PIP_17.jpg", "original_category": "PIP", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# --------------------\n# Part 2: Data Preparation\n# --------------------\n# Simulated Revenue Data for plotting\n\nyears = np.array([2010, 2012, 2014, 2016, 2018, 2020])\nrevenue_exp_apple = np.array(\n [500000, 550000, 605000, 665500, 732050, 805255]\n) # Exponential growth for Apple\nrevenue_lin_apple = np.array(\n [500000, 510000, 520000, 530000, 540000, 550000]\n) # Linear growth for Apple\nrevenue_exp_microsoft = np.array(\n [1000000, 1100000, 1210000, 1331000, 1464100, 1610510]\n) # Exponential growth for Microsoft\nrevenue_lin_microsoft = np.array(\n [1000000, 1030000, 1060000, 1090000, 1120000, 1150000]\n) # Linear growth for Microsoft\n\nlabels = [\n \"Apple | Exponential Growth\",\n \"Apple | Linear Growth\",\n \"Microsoft | Exponential Growth\",\n \"Microsoft | Linear Growth\",\n]\nxlabel = \"Year\"\nylabel = \"Revenue (USD)\"\ntitle = \"Revenue Growth of Apple and Microsoft (2010-2020)\"\n\n# Labels and tick mark settings\nxticks = years\nyticks = np.linspace(0, 2000000, 5)\nyticklabels = [f\"${int(x):,}\" for x in yticks]\ninset_axes = [0.22, 0.67, 0.3, 0.25]\ninset_ylim = [400000, 1000000]\nyticks_inset = np.linspace(400000, 1000000, 4)\nx_years = [f\"{int(x)}\" for x in years]\n\n\n# --------------------\n# Part 3: Plot Configuration and Rendering\n# --------------------\n# Create the main figure and axis\nfig, ax = plt.subplots(figsize=(8, 6))\n\n# Plot the data with different styles and colors\nax.plot(years, revenue_exp_apple, \"o-\", label=labels[0], color=\"brown\")\nax.plot(years, revenue_lin_apple, \"x--\", label=labels[1], color=\"brown\")\nax.plot(years, revenue_exp_microsoft, \"o-\", label=labels[2], color=\"purple\")\nax.plot(years, revenue_lin_microsoft, \"x--\", label=labels[3], color=\"purple\")\n\n# Set labels and title\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\nax.set_title(title)\n\n# Adjust y-axis limits and ticks\nax.set_ylim([0, 400000])\nax.set_yticks(yticks)\nax.set_yticklabels(yticklabels)\n\n# Add a legend\nax.legend()\n\n# Create an inset axis for Apple data\nax_inset = fig.add_axes(inset_axes)\nax_inset.plot(years, revenue_exp_apple, \"o-\", color=\"brown\")\nax_inset.plot(years, revenue_lin_apple, \"x--\", color=\"brown\")\n\n# Adjust y-axis limits for inset\nax_inset.set_ylim(inset_ylim)\nax_inset.set_xlim([2010, 2020])\nax_inset.set_yticks(yticks_inset)\n\n# Change x-axis tick labels to years\nax.set_xticks(years)\nax.set_xticklabels(x_years)\nax_inset.set_xticks(years)\nax_inset.set_xticklabels(x_years)\n\n# --------------------\n# Part 4: Saving Output\n# --------------------\n# Show the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"PIP_17.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "misc" }, { "id": "test_24", "content": { "Method": [ "CoT", "ToT", "Self-refine", "MAD+judge", "SPP", "DefInt" ], "Scatter_Size": [ 50, 100, 100, 175, 300, 300 ], "Subplot1_Diversity": [ 1.2, 2.1, 1.7, 1.9, 1.6, 1.3 ], "Subplot1_Accuracy": [ 50, 45, 25, 65, 40, 70 ], "Subplot2_Diversity": [ 3.8, 5.1, 5.7, 4.9, 4.6, 4.3 ], "Subplot2_Accuracy": [ 30, 40, 90, 85, 80, 82 ] }, "visual_intent": "A figure with 2 subplots: (1) a scatter plot about diversity and accuracy for different methods, (2) a scatter plot about diversity and accuracy for different methods(size of the desired plot: width=6.0, height=6.0)", "path_to_gt_image": "images/scatter_3.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.lines as mlines\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Sample data for the plot; replace with actual data.\nmethods = [\"CoT\", \"ToT\", \"Self-refine\", \"MAD+judge\", \"SPP\", \"DefInt\"]\n\n# Data for the subplots; each list within diversity_data and accuracy_data corresponds to a subplot.\ndiversity_data = [[1.2, 2.1, 1.7, 1.9, 1.6, 1.3], [3.8, 5.1, 5.7, 4.9, 4.6, 4.3]]\n\naccuracy_data = [[50, 45, 25, 65, 40, 70], [30, 40, 90, 85, 80, 82]]\n\n# Sizes for the scatter points, shared across both subplots.\nscatter_sizes = [50, 100, 100, 175, 300, 300]\n\n# Legend labels for the subplots.\nax1_legend_names = [\"1.0\", \"2.5\", \"10.0\", \"25.0\"]\nax2_legend_names = [\"2.0e+04\", \"1.0e+05\", \"4.0e+05\", \"1.6e+06\"]\nax1_legend_title = \"Token cost($)\"\nax2_legend_title = \"TFLOPS\"\nxlabel = \"Diversity\"\nylabel = \"Accuracy (%)\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create 2x1 grid of subplots with a specified figure size.\nfig, axs = plt.subplots(2, 1, figsize=(6, 6))\n\ncolors = [\n \"black\",\n \"green\",\n \"red\",\n \"orange\",\n \"purple\",\n \"brown\",\n] # Colors for each method.\n\n# Populate the subplots with scatter points and add text labels.\nfor idx, ax in enumerate(axs):\n for method, div, acc, size, color in zip(\n methods, diversity_data[idx], accuracy_data[idx], scatter_sizes, colors\n ):\n ax.scatter(div, acc, s=size, color=color, alpha=0.5) # Plot the scatter points.\n ax.text(\n div, acc + 5, method, fontsize=9\n ) # Add text labels above scatter points.\n\n ax.set_xlabel(xlabel) # X-axis label.\n ax.set_ylabel(ylabel) # Y-axis label.\n\n# Adjust the x and y limits and ticks for the subplots.\naxs[0].set_xlim(1.0, 2.6)\naxs[0].set_ylim(10, 90)\naxs[0].set_xticks([1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4])\naxs[0].set_yticks([10, 30, 50, 70, 90])\naxs[1].set_xlim(3.5, 6.5)\naxs[1].set_ylim(20, 100)\naxs[1].set_xticks([4.0, 4.5, 5.0, 5.5, 6.0])\naxs[1].set_yticks([20, 40, 60, 80, 100])\n\n\nsize_legend_handles = [50, 100, 175, 250] # Sizes for the legend handles.\n\n# Create custom legend handles for the first subplot.\nax1_legend_handles = [\n mlines.Line2D(\n [],\n [],\n color=\"#8080f7\",\n marker=\"o\",\n linestyle=\"None\",\n markersize=(size**0.5) * 0.8,\n label=name,\n ) # Adjust marker size here.\n for size, name in zip(size_legend_handles, ax1_legend_names)\n]\n\n# Create custom legend handles for the second subplot.\nax2_legend_handles = [\n mlines.Line2D(\n [],\n [],\n color=\"#8080f7\",\n marker=\"o\",\n linestyle=\"None\",\n markersize=(size**0.5) * 0.8,\n label=name,\n ) # Adjust marker size here.\n for size, name in zip(size_legend_handles, ax2_legend_names)\n]\n\n# Add legends to the subplots.\naxs[0].legend(\n handles=ax1_legend_handles,\n loc=\"lower right\",\n title=ax1_legend_title,\n labelspacing=2.0,\n edgecolor=\"black\",\n)\naxs[1].legend(\n handles=ax2_legend_handles,\n loc=\"lower right\",\n title=ax2_legend_title,\n labelspacing=2.0,\n edgecolor=\"black\",\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"scatter_3.pdf\", bbox_inches=\"tight\")\n", "width": 6.0, "height": 6.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_25", "content": { "Philosopher": [ "Socrates", "Plato", "Aristotle", "Descartes", "Kant", "Nietzsche" ], "Popularity_Initial": [ 80, 70, 90, 60, 65, 55 ], "Popularity_Change": [ 15, 10, 20, 8, 12, 7 ], "Influence_Initial": [ 75, 85, 95, 80, 70, 60 ], "Influence_Change": [ 10, 5, 8, 6, 9, 5 ] }, "visual_intent": "A figure with 2 subplots illustrating arrow charts regarding the growth of philosophical impact, titled Growth of Philosophical Impact. Subplot (1) displays popularity and influence growth for ancient philosophers, while subplot (2) displays the same metrics for modern philosophers.(size of the desired plot: width=12.0, height=5.0)", "path_to_gt_image": "images/quiver_39.jpg", "original_category": "quiver", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.lines as mlines\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data for the plot (Philosophers)\nphilosophers_1 = [\"Socrates\", \"Plato\", \"Aristotle\"]\npopularity_initial_1 = [80, 70, 90]\npopularity_change_1 = [15, 10, 20]\ninfluence_initial_1 = [75, 85, 95]\ninfluence_change_1 = [10, 5, 8]\nax1_labels = [\"Popularity Growth\", \"Influence Growth\"]\n\nphilosophers_2 = [\"Descartes\", \"Kant\", \"Nietzsche\"]\npopularity_initial_2 = [60, 65, 55]\npopularity_change_2 = [8, 12, 7]\ninfluence_initial_2 = [80, 70, 60]\ninfluence_change_2 = [6, 9, 5]\nax2_labels = [\"Popularity Growth\", \"Influence Growth\"]\n\n# Chart labels\nxlabel = \"Index\"\nylabel = \"Philosophers\"\nsupertitle = \"Growth of Philosophical Impact\"\nlegendlabels = [\"Popularity Growth\", \"Influence Growth\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure with two subplots\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))\nfig.suptitle(supertitle, fontsize=16)\n\n# Set the y-axis offsets to be in the middle of each grid\noffset = 0.5\n\n# First subplot (philosophers_1)\nfor i, philosopher in enumerate(philosophers_1):\n # Popularity growth line with arrow and green circle markers at start and end\n ax1.annotate(\n \"\",\n xy=(popularity_initial_1[i], i + offset * 3 / 2),\n xytext=(popularity_initial_1[i] + popularity_change_1[i], i + offset * 3 / 2),\n arrowprops=dict(arrowstyle=\"<|-\", color=\"green\"),\n )\n ax1.scatter(\n [popularity_initial_1[i], popularity_initial_1[i] + popularity_change_1[i]],\n [i + offset * 3 / 2, i + offset * 3 / 2],\n color=\"darkgreen\",\n s=20,\n marker=\"o\",\n )\n ax1.annotate(\n f\"{popularity_change_1[i]:.2f}\",\n (popularity_initial_1[i] + popularity_change_1[i], i + offset * 1.75),\n color=\"green\",\n ha=\"right\",\n va=\"center\",\n )\n\n # Influence growth line with arrow and blue circle markers at start and end\n ax1.annotate(\n \"\",\n xy=(influence_initial_1[i], i + offset / 2),\n xytext=(influence_initial_1[i] + influence_change_1[i], i + offset / 2),\n arrowprops=dict(arrowstyle=\"<|-\", color=\"blue\"),\n )\n ax1.scatter(\n [\n influence_initial_1[i],\n influence_initial_1[i] + influence_change_1[i],\n ],\n [i + offset / 2, i + offset / 2],\n color=\"darkblue\",\n s=20,\n marker=\"o\",\n )\n ax1.annotate(\n f\"{influence_change_1[i]:.2f}\",\n (influence_initial_1[i] + influence_change_1[i], i + offset * 0.75),\n color=\"blue\",\n ha=\"left\",\n va=\"center\",\n )\n\n# Second subplot (philosophers_2)\nfor i, philosopher in enumerate(philosophers_2):\n ax2.annotate(\n \"\",\n xy=(popularity_initial_2[i], i + offset * 3 / 2),\n xytext=(popularity_initial_2[i] + popularity_change_2[i], i + offset * 3 / 2),\n arrowprops=dict(arrowstyle=\"<|-\", color=\"green\"),\n )\n ax2.scatter(\n [popularity_initial_2[i], popularity_initial_2[i] + popularity_change_2[i]],\n [i + offset * 3 / 2, i + offset * 3 / 2],\n color=\"darkgreen\",\n s=20,\n marker=\"o\",\n )\n ax2.annotate(\n f\"{popularity_change_2[i]:.2f}\",\n (popularity_initial_2[i] + popularity_change_2[i], i + offset * 1.75),\n color=\"green\",\n ha=\"right\",\n va=\"center\",\n )\n\n ax2.annotate(\n \"\",\n xy=(influence_initial_2[i], i + offset / 2),\n xytext=(influence_initial_2[i] + influence_change_2[i], i + offset / 2),\n arrowprops=dict(arrowstyle=\"<|-\", color=\"blue\"),\n )\n ax2.scatter(\n [\n influence_initial_2[i],\n influence_initial_2[i] + influence_change_2[i],\n ],\n [i + offset / 2, i + offset / 2],\n color=\"darkblue\",\n s=20,\n marker=\"o\",\n )\n ax2.annotate(\n f\"{influence_change_2[i]:.2f}\",\n (influence_initial_2[i] + influence_change_2[i], i + offset * 0.75),\n color=\"blue\",\n ha=\"left\",\n va=\"center\",\n )\n\n# Set y-axis limits\nax1.set_ylim(0, len(philosophers_1))\nax2.set_ylim(0, len(philosophers_2))\n\n# Set x-axis limits uniformly\nax1.set_xlim(0, 120)\nax2.set_xlim(0, 120)\n\n# Adjust the y-axis tick positions\nax1.set_yticks([i + offset for i in range(len(philosophers_1))])\nax1.set_yticklabels(philosophers_1)\nax2.set_yticks([i + offset for i in range(len(philosophers_2))])\nax2.set_yticklabels(philosophers_2)\nax2.yaxis.tick_right()\nax2.yaxis.set_label_position(\"right\")\nax1.set_xlabel(xlabel)\nax2.set_xlabel(xlabel)\nax1.set_ylabel(ylabel)\n\n# Offset grid lines on the y-axis\nax1.set_yticks([i for i in range(len(philosophers_1))], minor=True)\nax2.set_yticks([i for i in range(len(philosophers_2))], minor=True)\nax1.yaxis.grid(True, which=\"minor\", linewidth=0.5, alpha=0.7, color=\"black\")\nax2.yaxis.grid(True, which=\"minor\", linewidth=0.5, alpha=0.7, color=\"black\")\n\n# Add x-axis grid lines and set gap to 10\nax1.xaxis.set_major_locator(plt.MultipleLocator(10))\nax2.xaxis.set_major_locator(plt.MultipleLocator(10))\nax1.grid(axis=\"x\", linestyle=\"--\", linewidth=0.5)\nax2.grid(axis=\"x\", linestyle=\"--\", linewidth=0.5)\n\n# Create arrow-shaped legend entries with a line that aligns with the arrowhead\ngreen_arrow = mlines.Line2D(\n [],\n [],\n color=\"green\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=legendlabels[0],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nblue_arrow = mlines.Line2D(\n [],\n [],\n color=\"blue\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=legendlabels[1],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nfig.legend(handles=[green_arrow, blue_arrow], bbox_to_anchor=(0.45, 0), ncol=2)\n\ngreen_arrow = mlines.Line2D(\n [],\n [],\n color=\"green\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax2_labels[0],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nblue_arrow = mlines.Line2D(\n [],\n [],\n color=\"blue\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax2_labels[1],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nfig.legend(handles=[green_arrow, blue_arrow], bbox_to_anchor=(0.85, 0), ncol=2)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout()\nplt.savefig(\"quiver_39.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 5.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_26", "content": { "Art Movements": [ "Abstract Expressionism", "Cubism", "Surrealism", "Pop Art", "Dada" ], "Popularity Percentage": [ 0.75, 0.6, 0.55, 0.5, 0.35 ], "Popularity Error": [ 0.05, 0.04, 0.03, 0.02, 0.01 ], "Number of Famous Artists": [ 18, 12, 10, 14, 8 ], "Artists Error": [ 2, 1.5, 1, 1.2, 0.8 ] }, "visual_intent": "A figure with 2 subplots: (1) a horizontal bar chart about Art Movements and Percentage, titled Popularity of Art Movements in the 20th Century (%), (2) a horizontal bar chart about Art Movements and Number of Artists, titled Number of Famous Artists(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/errorbar_81.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data: Popular Art Movements in the 20th Century\ncategories = [\"Abstract Expressionism\", \"Cubism\", \"Surrealism\", \"Pop Art\", \"Dada\"]\nvalues = [0.75, 0.60, 0.55, 0.50, 0.35]\nerrors = [0.05, 0.04, 0.03, 0.02, 0.01]\n\n# Data: Number of Famous Artists\ncategories2 = [\"Abstract Expressionism\", \"Cubism\", \"Surrealism\", \"Pop Art\", \"Dada\"]\nvalues2 = [18, 12, 10, 14, 8]\nerrors2 = [2, 1.5, 1, 1.2, 0.8]\n\ntitles = [\"Popularity of Art Movements in the 20th Century (%)\", \"Number of Famous Artists\"]\n\n# Text Labels\nxlabel1 = \"Percentage\"\nxlabel2 = \"Number of Artists\"\nylabel = \"Art Movements\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#ff7f0e\", \"#2ca02c\", \"#1f77b4\", \"#d62728\", \"#9467bd\"] # Vibrant colors\nfig, (ax1, ax2) = plt.subplots(2, 1, figsize=(8, 8))\n\n# First subplot\nax1.barh(categories, values, xerr=errors, color=colors, capsize=5, edgecolor='black')\nax1.set_title(titles[0])\nax1.set_xlabel(xlabel1)\nax1.set_ylabel(ylabel)\n\n# Second subplot\nax2.barh(categories2, values2, xerr=errors2, color=colors, capsize=5, edgecolor='black')\nax2.set_title(titles[1])\nax2.set_xlabel(xlabel2)\nax2.set_ylabel(ylabel)\n\n# Improve layout\nplt.tight_layout()\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.savefig(\"errorbar_81.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "bar" }, { "id": "test_27", "content": { "Media Field": [ "Streaming", "Social Media", "Augmented Reality", "Podcasting", "Virtual Reality", "Digital Content", "E-Sports", "Interactive Media", "3D Media", "AI in Media" ], "Patents 2013": [ 45, 120, 30, 22, 34, 55, 18, 27, 15, 10 ], "Patents 2022": [ 210, 350, 150, 120, 160, 250, 100, 130, 70, 60 ] }, "visual_intent": "A figure with 2 subplots: (1) a horizontal bar chart and line plot about media fields and patent filings in 2013, titled Patent Filings in Media - 2013, (2) a horizontal bar chart and line plot about media fields and patent filings in 2022, titled Patent Filings in Media - 2022(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/CB_117.jpg", "original_category": "CB", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Media fields\nmedia_fields = [\n \"Streaming\",\n \"Social Media\",\n \"Augmented Reality\",\n \"Podcasting\",\n \"Virtual Reality\",\n \"Digital Content\",\n \"E-Sports\",\n \"Interactive Media\",\n \"3D Media\",\n \"AI in Media\",\n]\n\n# Patent filings in 2013\npatents_2013 = [45, 120, 30, 22, 34, 55, 18, 27, 15, 10]\n# Patent filings in 2022\npatents_2022 = [210, 350, 150, 120, 160, 250, 100, 130, 70, 60]\n\nx_label = \"Number of Patents\"\ny_label = \"Media Field\"\nax1_title = \"Patent Filings in Media - 2013\"\nax2_title = \"Patent Filings in Media - 2022\"\nplot_color_2013 = \"lightblue\"\nplot_color_2022 = \"lightcoral\"\nline_color = \"#8a2be2\" # Purple\nmarker_shape = \"s\" # Square markers\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with two subplots (1x2) and shared y-axis\nfig, axes = plt.subplots(1, 2, figsize=(12, 6), sharey=True)\n\n# Plotting the bar graphs\nfor i, (patents, color, ax_title) in enumerate(zip([patents_2013, patents_2022], [plot_color_2013, plot_color_2022], [ax1_title, ax2_title])):\n axes[i].barh(media_fields, patents, color=color, edgecolor=\"gray\")\n axes[i].set_xlabel(x_label)\n axes[i].set_title(ax_title)\n # Adding line graph on the same axes\n axes[i].plot(patents, media_fields, marker_shape + \"-\", color=line_color, markerfacecolor=\"black\")\n\n# Adding data labels\nfor ax, patents in zip(axes, [patents_2013, patents_2022]):\n for index, value in enumerate(patents):\n ax.text(value + 1, index, f\" {value}\", va=\"center\")\n\n# Set y-axis label for the first subplot\naxes[0].set_ylabel(y_label)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout to prevent clipping and overlap\nplt.tight_layout()\nplt.savefig(\"CB_117.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_28", "content": { "City": [ "New York", "New York", "New York", "New York", "Los Angeles", "Los Angeles", "Los Angeles", "Los Angeles", "Chicago", "Chicago", "Chicago", "Chicago" ], "Metric": [ "Punctuality", "Passenger Satisfaction", "Coverage Area", "Cost Efficiency", "Punctuality", "Passenger Satisfaction", "Coverage Area", "Cost Efficiency", "Punctuality", "Passenger Satisfaction", "Coverage Area", "Cost Efficiency" ], "Performance_Percentage": [ 85, 75, 90, 70, 80, 85, 88, 65, 78, 82, 85, 60 ], "Error": [ 3, 5, 4, 6, 4, 6, 5, 7, 5, 6, 6, 8 ] }, "visual_intent": "A figure with 3 subplots displaying bar charts with error bars about transportation performance metrics for New York, Los Angeles, and Chicago, titled Transportation Performance Metrics in Major Cities(size of the desired plot: width=10.0, height=9.0)", "path_to_gt_image": "images/errorbar_86.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data representing transportation performance for three different cities\ncategories = [\"New York\", \"Los Angeles\", \"Chicago\"]\nmetrics = [\n \"Punctuality\",\n \"Passenger Satisfaction\",\n \"Coverage Area\",\n \"Cost Efficiency\",\n]\nperformance = np.array(\n [\n [85, 75, 90, 70],\n [80, 85, 88, 65],\n [78, 82, 85, 60],\n ]\n)\nerrors = np.array(\n [\n [3, 5, 4, 6],\n [4, 6, 5, 7],\n [5, 6, 6, 8],\n ]\n)\nylim = [50, 100]\nylabel = \"Performance Percentage\"\nxlabel_suffix = \"Transportation Metrics\"\nlegend_labels = metrics\nfigure_title = \"Transportation Performance Metrics in Major Cities\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Figure size to match a 3x1 subplot layout\nfig, axes = plt.subplots(3, 1, figsize=(10, 9), sharex=True)\n# Colors, choosing a different palette to differentiate the plots\ncolors = [\"#1f77b4\", \"#ff7f0e\", \"#2ca02c\", \"#d62728\"]\n\n# Plotting bars\nfor i, ax in enumerate(axes):\n for j, metric in enumerate(metrics):\n ax.bar(\n j,\n performance[i, j],\n width=0.8,\n color=colors[j],\n yerr=errors[i, j],\n capsize=5,\n label=metric if i == 0 else \"\",\n )\n\n # Setting x-axis labels, y-axis limits, and titles\n ax.set_xticks(range(len(metrics)))\n ax.set_xticklabels(metrics, rotation=45)\n ax.set_ylim(ylim)\n ax.set_xlabel(f\"({chr(97+i)}) {categories[i]}\")\n ax.set_ylabel(ylabel)\n ax.yaxis.grid(True)\n ax.set_axisbelow(True)\n\n# Adding a legend outside of the plot on top\nfig.legend(legend_labels, loc=\"upper center\", bbox_to_anchor=(0.5, 1.05), ncol=len(metrics))\nplt.suptitle(figure_title, y=1.02)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to prevent overlap and ensure labels are visible\nplt.tight_layout()\nplt.savefig(\"errorbar_86.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 9.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "bar" }, { "id": "test_29", "content": { "Quarters": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], "Standard Error": [ 2.3, 2.4, 2.35, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8 ], "Upper Limits": [ 2.4, 2.5, 2.45, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9 ], "Lower Limits": [ 2.2, 2.3, 2.25, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7 ], "Both Limits": [ 2.5, 2.6, 2.55, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3.0 ], "Varied Error": [ 2.6, 2.7, 2.65, 2.8, 2.85, 2.9, 2.95, 3.0, 3.05, 3.1 ] }, "visual_intent": "An error bar chart about Quarters and CPI, titled CPI Variation with Error Limits(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/errorpoint_38.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Simulated economic data (e.g., Consumer Price Index over 10 quarters)\nquarters = np.arange(1, 11)\ncpi = np.array([2.3, 2.4, 2.35, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8])\ncpi_err = 0.05 # constant error\ncpi_err_varied = np.array([0.05, 0.04, 0.06, 0.05, 0.04, 0.07, 0.06, 0.05, 0.04, 0.06])\n\n# upper & lower limits to simulate different scenarios\nlower_limits = np.array([0, 1, 0, 1, 0, 1, 0, 0, 1, 0], dtype=bool)\nupper_limits = np.array([1, 0, 1, 0, 1, 0, 0, 1, 0, 1], dtype=bool)\nno_line = \"None\"\nchart_title = \"CPI Variation with Error Limits\"\nx_axis_label = \"Quarters\"\ny_axis_label = \"CPI\"\nxlim = [0, 10.5]\nlabels = [\n \"Standard Error\",\n \"Upper Limits\",\n \"Lower Limits\",\n \"Both Limits\",\n \"Varied Error\",\n]\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#377eb8\", \"#ff7f00\", \"#4daf4a\", \"#f781bf\", \"#a65628\"]\n\nfig, ax = plt.subplots(figsize=(10, 7))\n\n# Standard error bars\nax.errorbar(quarters, cpi, yerr=cpi_err, label=labels[0], linestyle=no_line, color=colors[0])\n# Including upper limits\nax.errorbar(\n quarters,\n cpi + 0.1,\n yerr=cpi_err,\n uplims=upper_limits,\n label=labels[1],\n linestyle=no_line,\n color=colors[1],\n)\n# Including lower limits\nax.errorbar(\n quarters,\n cpi - 0.1,\n yerr=cpi_err,\n lolims=lower_limits,\n label=labels[2],\n linestyle=no_line,\n color=colors[2],\n)\n# Including both upper and lower limits\nax.errorbar(\n quarters,\n cpi + 0.2,\n yerr=cpi_err,\n uplims=upper_limits,\n lolims=lower_limits,\n marker=\"o\",\n markersize=8,\n label=labels[3],\n linestyle=no_line,\n color=colors[3],\n)\n# Varied error bars\nax.errorbar(\n quarters,\n cpi + 0.3,\n yerr=cpi_err_varied,\n xlolims=lower_limits,\n xuplims=upper_limits,\n marker=\"s\",\n markersize=8,\n linestyle=no_line,\n label=labels[4],\n color=colors[4],\n)\n\n# Tidy up figure\nax.set_xlim(xlim)\nax.set_title(chart_title)\nax.set_xlabel(x_axis_label)\nax.set_ylabel(y_axis_label)\nplt.legend(bbox_to_anchor=(0.5, 1.15), ncol=3, loc=\"upper center\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorpoint_38.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_30", "content": { "Number of microphones": [ 2, 3, 4, 5, 6, 7, 8 ], "LibriCSS (test)": [ 6.74, 4.54, 3.96, 3.71, 3.49, 3.34, null ], "AMI (dev)": [ 27.44, 24.75, 23.38, 22.77, 22.32, 21.47, 21.51 ] }, "visual_intent": "A dual-axis line chart about Number of microphones and WER(%) comparing LibriCSS (test) and AMI (dev) datasets, including baseline reference lines for IHM and SDM(size of the desired plot: width=8.0, height=7.0)", "path_to_gt_image": "images/line_34.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom matplotlib.lines import Line2D # Importing Line2D for creating custom legend items\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data\nmicrophones = [2, 3, 4, 5, 6, 7, 8]\nlibricss_wer = [\n 6.74,\n 4.54,\n 3.96,\n 3.71,\n 3.49,\n 3.34,\n None,\n] # The None value will be handled in the plot commands\nami_wer = [27.44, 24.75, 23.38, 22.77, 22.32, 21.47, 21.51]\nihm_wer = [3] * len(microphones)\nsdm_wer = [10] * len(microphones)\n\n# Axes Limits and Labels\nxlabel_value = \"Number of microphones\"\n\nylabel_value_1 = \"WER(%)\"\nylabel_value_2 = \"AMI WER(%)\"\nylim_values_1 = [1, 11]\nylim_values_2 = [15, 32]\nyticks_values_1 = range(2, 11, 2)\nyticks_values_2 = range(15, 31, 5)\n\n# Labels\nlabel_1 = \"LibriCSS (test)\"\nlabel_2 = \"ImageNet-C/P (Fog)\"\nlabel_3 = \"AMI (dev)\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot\nfig, ax1 = plt.subplots(figsize=(8, 7))\n\n# LibriCSS plot\n(libricss_line,) = ax1.plot(\n microphones,\n libricss_wer,\n \"o-\",\n color=\"#377eb8\",\n label=label_1,\n markersize=10,\n linewidth=3,\n mec=\"black\",\n)\nax1.set_xlabel(xlabel_value, fontsize=14)\nax1.set_ylabel(ylabel_value_1, fontsize=14, color=\"#377eb8\")\nax1.tick_params(\n axis=\"y\", labelcolor=\"#377eb8\", direction=\"in\", rotation=90, labelsize=12\n)\nax1.tick_params(\n axis=\"x\",\n direction=\"in\",\n labelsize=12,\n)\nax1.set_yticks(yticks_values_1)\nax1.set_ylim(ylim_values_1)\n\n# Adding WER values to the plot for libricss\nfor i, txt in enumerate(libricss_wer):\n if txt is not None: # Skip plotting the text for None values\n ax1.annotate(\n f\"{txt}%\",\n (microphones[i], txt),\n textcoords=\"offset points\",\n xytext=(10, 10),\n ha=\"center\",\n fontsize=12,\n )\n\n# AMI plot with a secondary y-axis\nax2 = ax1.twinx()\n(ami_line,) = ax2.plot(\n microphones,\n ami_wer,\n \"^-\",\n color=\"#ff7f00\",\n label=label_3,\n markersize=10,\n linewidth=3,\n mec=\"black\",\n)\nax2.set_ylabel(ylabel_value_2, color=\"#ff7f00\", fontsize=14)\nax2.tick_params(\n axis=\"y\", labelcolor=\"#ff7f00\", direction=\"in\", rotation=90, labelsize=12\n)\nax2.set_yticks(yticks_values_2)\nax2.set_ylim(ylim_values_2)\n\n# Adding WER values to the plot for ami\nfor i, txt in enumerate(ami_wer):\n ax2.annotate(\n f\"{txt}%\",\n (microphones[i], txt),\n textcoords=\"offset points\",\n xytext=(0, -30),\n ha=\"center\",\n fontsize=12,\n )\n\n# IHM dashed lines\nax1.axhline(y=2.2, color=\"#377eb8\", linestyle=\":\", linewidth=2)\nax1.axhline(y=2.4, color=\"#ff7f00\", linestyle=\":\", linewidth=2)\n\n# SDM dashed lines\nax1.axhline(y=9.6, color=\"#377eb8\", linestyle=\"--\", linewidth=2)\nax1.axhline(y=9.4, color=\"#ff7f00\", linestyle=\"--\", linewidth=2)\n\n# Creating custom legend items\nihm_legend = Line2D([0], [0], color=\"black\", linestyle=\":\", linewidth=2, label=\"IHM\")\nsdm_legend = Line2D([0], [0], color=\"black\", linestyle=\"--\", linewidth=2, label=\"SDM\")\n\n# Adding legends\nfirst_legend = ax1.legend(\n handles=[ihm_legend, sdm_legend],\n loc=\"upper left\",\n ncol=2,\n fontsize=14,\n edgecolor=\"black\",\n)\nax1.add_artist(first_legend) # Add the first legend manually\nsecond_legend = ax1.legend(\n handles=[libricss_line, ami_line], loc=\"upper right\", fontsize=14, edgecolor=\"black\"\n) # Add the second legend\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"line_34.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 7.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "line" }, { "id": "test_31", "content": { "Benchmark": [ "TextVQA", "SQA-I", "GQA", "VQAv2", "MMB", "MME", "LLaVA-W", "POPE", "MM-Vet" ], "TinyLLaVA-3.1B": [ 59.1, 69.1, 62.0, 79.9, 66.9, 64.9, 75.8, 86.4, 52.0 ], "TinyLLaVA-3.1A": [ 78.2, 86.8, 62.0, 58.5, 54.3, 51.7, 63.4, 72.9, 60.5 ] }, "visual_intent": "A radar chart comparing performance scores of two models, TinyLLaVA-3.1B and TinyLLaVA-3.1A, across nine different benchmarks.(size of the desired plot: width=8.0, height=7.0)", "path_to_gt_image": "images/radar_1.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data\ncategories = [\n \"TextVQA\",\n \"SQA-I\",\n \"GQA\",\n \"VQAv2\",\n \"MMB\",\n \"MME\",\n \"LLaVA-W\",\n \"POPE\",\n \"MM-Vet\",\n]\nvalues1 = [59.1, 69.1, 62.0, 79.9, 66.9, 64.9, 75.8, 86.4, 52.0]\nvalues2 = [78.2, 86.8, 62.0, 58.5, 54.3, 51.7, 63.4, 72.9, 60.5]\nyticks = [20, 40, 60, 80]\nylim = [0, 90]\nlabels = [\"TinyLLaVA-3.1B\", \"TinyLLaVA-3.1A\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Size of the figure\nfig, ax = plt.subplots(figsize=(8, 7), subplot_kw=dict(polar=True))\n\n# Number of variables\nnum_vars = len(categories)\n# Compute angle for each category\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n\n# The plot is circular, so we need to \"complete the loop\" and append the start to the end.\nvalues1 += values1[:1]\nvalues2 += values2[:1]\nangles += angles[:1]\n\nmargin = 0.1 # Adjust margin for labels\n# Draw one axe per variable and add labels with a margin\nlabels = []\nfor angle, label in zip(angles[:-1], categories):\n x_offset = margin * np.cos(angle)\n y_offset = margin * np.sin(angle)\n labels.append(\n ax.text(\n angle + x_offset,\n 100 + y_offset,\n label,\n color=\"black\",\n size=10,\n horizontalalignment=\"center\",\n verticalalignment=\"center\",\n )\n )\nplt.xticks(angles[:-1], [])\n\n# Draw ylabels\nax.set_rlabel_position(0)\nplt.yticks(yticks, [], color=\"#bceced\", size=7)\nplt.ylim(ylim)\n\n# Plot data\nax.plot(\n angles,\n values2,\n linewidth=1,\n linestyle=\"solid\",\n label=labels[0],\n color=\"#d1553e\",\n)\nax.fill(angles, values2, \"#d1553e\", alpha=0.2)\n\nax.plot(\n angles,\n values1,\n linewidth=1,\n linestyle=\"solid\",\n label=labels[1],\n color=\"#4d88b9\",\n)\nax.fill(angles, values1, \"#4d88b9\", alpha=0.2)\n\n# Add data labels\nfor angle, value in zip(angles, values1):\n ax.text(\n angle,\n value,\n str(value),\n color=\"black\",\n size=10,\n horizontalalignment=\"center\",\n verticalalignment=\"bottom\",\n )\nfor angle, value in zip(angles, values2):\n ax.text(\n angle,\n value,\n str(value),\n color=\"black\",\n size=10,\n horizontalalignment=\"center\",\n verticalalignment=\"bottom\",\n )\n\n# Add legend\nplt.legend(\n loc=\"lower center\",\n ncol=2,\n bbox_to_anchor=(0.5, -0.15),\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_1.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 7.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_32", "content": { "Transport Means": [ "Car", "Bus", "Bicycle", "Train", "Walking", "Airplane" ], "Usage Percentage": [ 40, 25, 10, 15, 5, 5 ] }, "visual_intent": "A donut chart about transport means and usage distribution, titled Transportation Usage Distribution(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/pie_50.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\ntransport_means = [\n \"Car\",\n \"Bus\",\n \"Bicycle\",\n \"Train\",\n \"Walking\",\n \"Airplane\",\n]\n\ndata = [40, 25, 10, 15, 5, 5]\ntitle = \"Transportation Usage Distribution\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, ax = plt.subplots(figsize=(8, 6), subplot_kw=dict(aspect=\"equal\"))\ncolors = [\"#66b3ff\",\"#99ff99\",\"#ffcc99\",\"#c2c2f0\",\"#ff6666\",\"#c4e17f\"]\nwedges, texts = ax.pie(data, wedgeprops=dict(width=0.4), startangle=-40, colors=colors)\n\nbbox_props = dict(boxstyle=\"round,pad=0.3\", fc=\"w\", ec=\"k\", lw=0.72)\nkw = dict(arrowprops=dict(arrowstyle=\"-|>\", lw=1), bbox=bbox_props, zorder=0, va=\"center\")\n\nfor i, p in enumerate(wedges):\n ang = (p.theta2 - p.theta1) / 2.0 + p.theta1\n y = np.sin(np.deg2rad(ang))\n x = np.cos(np.deg2rad(ang))\n horizontalalignment = {-1: \"right\", 1: \"left\"}[int(np.sign(x))]\n connectionstyle = f\"angle,angleA=0,angleB={ang}\"\n kw[\"arrowprops\"].update({\"connectionstyle\": connectionstyle})\n ax.annotate(\n transport_means[i] + f\": {data[i]}%\",\n xy=(x, y),\n xytext=(1.35 * np.sign(x), 1.4 * y),\n horizontalalignment=horizontalalignment,\n **kw,\n )\n\nax.set_title(title)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"pie_50.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_33", "content": { "Financial Step": [ "Initial Funding", "Q1 Sales", "Q2 Sales", "Research Investment", "Q3 Sales", "Operational Cost", "Q4 Sales", "Marketing Expense", "Product Launch", "Q1 Next Year", "Year-End Adjustment" ], "Value Change": [ 500, 200, -100, -150, 300, -50, 100, -80, 150, 75, -400 ] }, "visual_intent": "A waterfall chart about financial steps and value changes, titled Technology Company Financial Performance Waterfall Chart(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/HR_93.jpg", "original_category": "HR", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\nfrom matplotlib.ticker import FuncFormatter\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n\n# Define the increments and decrements for each step of the waterfall chart in the technology domain\nincrements = [500, 200, -100, -150, 300, -50, 100, -80, 150, 75, -400]\n\n# Define the labels for each step\nlabels = [\n \"Initial Funding\",\n \"Q1 Sales\",\n \"Q2 Sales\",\n \"Research Investment\",\n \"Q3 Sales\",\n \"Operational Cost\",\n \"Q4 Sales\",\n \"Marketing Expense\",\n \"Product Launch\",\n \"Q1 Next Year\",\n \"Year-End Adjustment\",\n]\n\n# Determine starting point and end point\nstart_value = 1000\nend_value = start_value + sum(increments)\n\n# Calculate the bottom of each bar (cumulative)\nbottoms = np.hstack(([start_value], np.cumsum(increments)[:-1])) + start_value\n\n# Axes Limits and Labels\nylabel_value = \"Financial Value ($)\"\ntitle = \"Technology Company Financial Performance Waterfall Chart\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the colors based on increment or decrement\ncolors = [\"#1f77b4\" if x > 0 else \"#ff7f0e\" for x in increments]\n\nfig, ax = plt.subplots(figsize=(10, 6))\n\n# Plot bars\nbars = ax.bar(labels, increments, bottom=bottoms, color=colors)\n\n# Plot lines connecting the tops of each bar\nfor i in range(len(increments) - 1): # Exclude the last increment\n start_top = bottoms[i] + increments[i]\n end_top = bottoms[i + 1] + increments[i + 1]\n ax.plot([i, i + 1], [start_top, end_top], color=\"k\", linestyle=\"--\", linewidth=1.5)\n\n# Annotate bars with value labels\nfor i, bar in enumerate(bars):\n height = bar.get_height()\n ax.annotate(\n f\"${height}\",\n xy=(bar.get_x() + bar.get_width() / 2, bar.get_y() + height),\n xytext=(\n 0,\n 3 if height > 0 else -12,\n ), # 3 points vertical offset or -12 if negative\n textcoords=\"offset points\",\n ha=\"center\",\n va=\"bottom\",\n fontsize=9,\n fontweight='bold'\n )\n\n# Set the y-axis label and title\nax.set_ylabel(ylabel_value, fontsize=12, fontweight='bold')\nax.set_title(title, fontsize=14, fontweight='bold')\n\n# Format y-axis as currency\nformatter = FuncFormatter(lambda y, _: f\"${int(y):,}\")\nax.yaxis.set_major_formatter(formatter)\n\n# Remove x-axis line and ticks\nax.spines[\"bottom\"].set_visible(False)\nax.xaxis.set_ticks([])\n\n# Set grid\nax.grid(True, axis=\"y\", linestyle=\"--\", linewidth=0.7, alpha=0.7)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"HR_93.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_34", "content": { "Time (Months)": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], "PM2.5 Concentration (µg/m³)": [ 35.7, 40.2, 38.5, 37.8, 36.5, 35.0, 37.2, 38.0, 39.0, 36.8 ], "Symmetric Error": [ 3.0, 2.5, 2.8, 3.5, 3.2, 2.5, 2.8, 3.0, 3.1, 2.9 ], "Asymmetric Lower Error": [ 1.2, 1.0, 1.12, 1.4, 1.28, 1.0, 1.12, 1.2, 1.24, 1.16 ], "Asymmetric Upper Error": [ 3.0, 2.5, 2.8, 3.5, 3.2, 2.5, 2.8, 3.0, 3.1, 2.9 ] }, "visual_intent": "A figure with 2 subplots: (1) an error bar plot about time and PM2.5 concentration with symmetric error margins, titled Average PM2.5 Concentration with Symmetric Error Margins, (2) an error bar plot about time and PM2.5 concentration with asymmetric error margins, titled Average PM2.5 Concentration with Asymmetric Error Margins(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/errorpoint_73.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# Environmental data: average PM2.5 concentration (µg/m³) over 10 months\nx = np.arange(1, 11, 1)\ny = [\n 35.7,\n 40.2,\n 38.5,\n 37.8,\n 36.5,\n 35.0,\n 37.2,\n 38.0,\n 39.0,\n 36.8,\n]\nerror = np.array([3.0, 2.5, 2.8, 3.5, 3.2, 2.5, 2.8, 3.0, 3.1, 2.9]) # symmetric error\nlower_error = 0.4 * error # Adjusted asymmetric error\nupper_error = error\nasymmetric_error = [lower_error, upper_error]\n\ntitle1 = \"Average PM2.5 Concentration with Symmetric Error Margins\"\ntitle2 = \"Average PM2.5 Concentration with Asymmetric Error Margins\"\nxlabel = \"Time (Months)\"\nylabel = \"PM2.5 Concentration (µg/m³)\"\nlegend_label = \"PM2.5 Data\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, (ax0, ax1) = plt.subplots(figsize=(12, 6), ncols=2, sharex=True)\n\n# Plot with symmetric error\nax0.errorbar(\n x,\n y,\n yerr=error,\n fmt=\"o\",\n color=\"mediumseagreen\",\n ecolor=\"darkred\",\n elinewidth=2,\n capsize=5,\n label=legend_label,\n)\nax0.set_title(title1, fontsize=14)\nax0.set_xlabel(xlabel, fontsize=12)\nax0.set_ylabel(ylabel, fontsize=12)\nax0.legend()\n\n# Plot with asymmetric error\nax1.errorbar(\n x,\n y,\n yerr=asymmetric_error,\n fmt=\"d\",\n color=\"royalblue\",\n ecolor=\"darkorange\",\n elinewidth=2,\n capsize=5,\n label=legend_label,\n)\nax1.set_title(title2, fontsize=14)\nax1.set_xlabel(xlabel, fontsize=12)\nax1.set_yscale(\"log\")\nax1.legend()\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorpoint_73.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_35", "content": { "Research Hours": [ 100, 500, 1000, 1500, 2000, 2500 ], "Efficiency Improvement [%]": [ 10, 15, 20, 25, 30, 35 ], "Label": [ null, "Solar", null, "Wind", "Hydro", "Geothermal" ] }, "visual_intent": "A scatter plot about research hours and efficiency improvement, titled Renewable Energy Research Efficiency(size of the desired plot: width=8.0, height=5.0)", "path_to_gt_image": "images/scatter_53.jpg", "original_category": "scatter", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data points\nresearch_hours = [100, 500, 1000, 1500, 2000, 2500]\nefficiency = [10, 15, 20, 25, 30, 35]\nlabels = [None, \"Solar\", None, \"Wind\", \"Hydro\", \"Geothermal\"]\ndashed_lines = [(100, 10, 500, 15), (2000, 30, 2500, 35)]\n\ntitle = \"Renewable Energy Research Efficiency\"\nxlabel = \"Research Hours\"\nylabel = \"Efficiency Improvement [%]\"\ntexts = [\"+5%\", \"Baseline\", \"Geothermal\", \"Conclusion\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data points\nplt.figure(figsize=(8, 5))\nplt.scatter(research_hours, efficiency, color=\"darkgreen\", s=100, marker='o') # Adjusted marker shape and color\n\n# Annotating the data points\nfor i, label in enumerate(labels):\n plt.annotate(\n label,\n (research_hours[i], efficiency[i]),\n textcoords=\"offset points\",\n xytext=(0, 10),\n ha=\"center\",\n )\n\n# Plotting the dashed lines with correct colors and annotations\nplt.plot([100, 500], [10, 15], linestyle=\"--\", color=\"blue\", linewidth=1.5)\nplt.annotate(texts[0], (300, 12.5), color=\"blue\")\nplt.plot([1000, 1500], [20, 25], linestyle=\"--\", color=\"red\", linewidth=1.5)\nplt.annotate(texts[1], (1250, 22.5), color=\"red\")\nplt.plot([2000, 2500], [30, 35], linestyle=\"--\", color=\"orange\", linewidth=1.5)\nplt.annotate(\n texts[2],\n (2250, 32.5),\n color=\"orange\",\n textcoords=\"offset points\",\n xytext=(0, 10),\n ha=\"center\",\n)\n\n# Annotating the dashed lines correctly\nplt.annotate(texts[3], (2500, 33), color=\"orange\")\n\n# Setting the title and labels\nplt.title(title)\nplt.xlabel(xlabel)\nplt.ylabel(ylabel)\n\n# Adjusting y-axis scale\nplt.ylim(5, 40)\nplt.yticks([10, 15, 20, 25, 30, 35])\nplt.xlim(0, 3000)\nplt.xticks([0, 500, 1000, 1500, 2000, 2500, 3000])\nplt.grid(True)\n\n# removing the top, left, and right spines\nplt.gca().spines[\"top\"].set_visible(False)\nplt.gca().spines[\"left\"].set_visible(False)\nplt.gca().spines[\"right\"].set_visible(False)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show the plot with tight layout\nplt.tight_layout()\nplt.savefig(\"scatter_53.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 5.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_36", "content": { "Text Length in Words": [ 100, 200, 300, 400 ], "BERT Model": [ 0.65, 0.7, 0.75, 0.8 ], "RoBERTa Model": [ 0.6, 0.65, 0.78, 0.82 ], "GPT-3 Model": [ 0.68, 0.72, 0.76, 0.85 ], "Transformer Model": [ 0.62, 0.67, 0.73, 0.79 ] }, "visual_intent": "A line chart about Text Length in Words and Accuracy, titled Accuracy of Text Analysis Models on Philosophical Texts(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/line_161.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# New data for philosophical text analysis\ntext_length = np.arange(100, 401, 100) # philosophical text lengths in words\nbert_accuracy = [0.65, 0.70, 0.75, 0.80]\nroberta_accuracy = [0.60, 0.65, 0.78, 0.82]\ngpt3_accuracy = [0.68, 0.72, 0.76, 0.85]\ntransformer_accuracy = [0.62, 0.67, 0.73, 0.79]\n\n# Placeholder error values\nbert_error = np.random.uniform(0.01, 0.03, len(text_length))\nroberta_error = np.random.uniform(0.01, 0.03, len(text_length))\ngpt3_error = np.random.uniform(0.01, 0.03, len(text_length))\ntransformer_error = np.random.uniform(0.01, 0.03, len(text_length))\n\n# Axes Limits and Labels\nxlabel_value = \"Text Length in Words\"\nylabel_value = \"Accuracy\"\nylim_values = [0.55, 0.90]\nyticks_values = np.arange(0.55, 0.91, 0.05)\n\n# Labels\nlabel_1 = \"BERT Model\"\nlabel_2 = \"RoBERTa Model\"\nlabel_3 = \"GPT-3 Model\"\nlabel_4 = \"Transformer Model\"\ntitle=\"Accuracy of Text Analysis Models on Philosophical Texts\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nplt.figure(figsize=(10, 6))\n\nplt.errorbar(\n text_length,\n bert_accuracy,\n yerr=bert_error,\n fmt=\"-o\",\n label=label_1,\n color=\"#4B8BBE\",\n linestyle=\"--\",\n linewidth=1.5,\n markersize=8,\n)\nplt.errorbar(\n text_length,\n roberta_accuracy,\n yerr=roberta_error,\n fmt=\"-s\",\n label=label_2,\n color=\"#306998\",\n linestyle=\"--\",\n linewidth=1.5,\n markersize=8,\n)\nplt.errorbar(\n text_length,\n gpt3_accuracy,\n yerr=gpt3_error,\n fmt=\"-^\",\n label=label_3,\n color=\"#FFD43B\",\n linestyle=\"--\",\n linewidth=1.5,\n markersize=8,\n)\nplt.errorbar(\n text_length,\n transformer_accuracy,\n yerr=transformer_error,\n fmt=\"-d\",\n label=label_4,\n color=\"#646464\",\n linestyle=\"--\",\n linewidth=1.5,\n markersize=8,\n)\n\n# Adding labels and title\nplt.xlabel(xlabel_value)\nplt.ylabel(ylabel_value)\nplt.xticks(text_length)\nplt.ylim(ylim_values)\nplt.yticks(yticks_values)\nplt.title(title)\n\n# Adding legend, lower right corner\nplt.legend(loc=\"lower right\")\n\n# Moving axes spines\nax = plt.gca() # get current axes\nax.spines[\"right\"].set_color(\"none\")\nax.spines[\"top\"].set_color(\"none\")\nax.grid(True, which=\"both\", axis=\"both\", color=\"lightgray\", linestyle=\"--\", linewidth=0.5)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Display the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"line_161.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "line" }, { "id": "test_37", "content": { "State": [ "California", "Texas", "Florida", "New York", "Pennsylvania", "Illinois" ], "Very Satisfied": [ 15, 20, 10, 5, 5, 10 ], "Satisfied": [ 25, 30, 15, 10, 10, 20 ], "Neutral": [ 30, 25, 30, 25, 20, 25 ], "Dissatisfied": [ 20, 15, 25, 30, 35, 30 ], "Very Dissatisfied": [ 10, 10, 20, 30, 30, 15 ] }, "visual_intent": "A diverging horizontal bar chart about states and voter satisfaction levels, titled Voter Satisfaction Across Different States(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/bar_254.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\ncategory_names = [\"Very Satisfied\", \"Satisfied\", \"Neutral\", \"Dissatisfied\", \"Very Dissatisfied\"]\nresults = {\n \"California\": [15, 25, 30, 20, 10],\n \"Texas\": [20, 30, 25, 15, 10],\n \"Florida\": [10, 15, 30, 25, 20],\n \"New York\": [5, 10, 25, 30, 30],\n \"Pennsylvania\": [5, 10, 20, 35, 30],\n \"Illinois\": [10, 20, 25, 30, 15],\n}\nxlim = [-90, 90]\nxticks = np.arange(-90, 91, 10)\nxvline = 0\nxlabel = 'Number of Voters'\nylabel = 'States'\ntitle = 'Voter Satisfaction Across Different States'\nlegend_title = 'Satisfaction Level'\n\ndef create_bar_chart(results, category_names):\n fig, ax = plt.subplots(figsize=(10, 6))\n\n labels = list(results.keys())\n data = np.array(list(results.values()))\n data_cum = data.cumsum(axis=1)\n middle_index = data.shape[1] // 2\n offsets = data[:, range(middle_index)].sum(axis=1) + data[:, middle_index] / 2\n\n # Color Mapping\n category_colors = plt.get_cmap(\"coolwarm\")(np.linspace(0.15, 0.85, data.shape[1]))\n\n # Plot Bars\n for i, (colname, color) in enumerate(zip(category_names, category_colors)):\n widths = data[:, i]\n starts = data_cum[:, i] - widths - offsets\n rects = ax.barh(\n labels,\n widths,\n left=starts,\n height=0.5,\n label=colname,\n color=color,\n edgecolor=\"black\",\n )\n\n # Add Zero Reference Line\n ax.axvline(xvline, linestyle=\"--\", color=\"black\", alpha=0.75)\n\n # X Axis\n ax.set_xlim(xlim)\n ax.set_xticks(xticks)\n ax.xaxis.set_major_formatter(lambda x, pos: str(abs(int(x))))\n ax.set_xlabel(xlabel, fontsize=12)\n\n # Y Axis\n ax.set_ylabel(ylabel, fontsize=12)\n ax.invert_yaxis()\n\n # Remove spines\n ax.spines[\"right\"].set_visible(False)\n ax.spines[\"top\"].set_visible(False)\n ax.spines[\"left\"].set_visible(False)\n\n # Legend\n ax.legend(\n ncol=len(category_names), bbox_to_anchor=(0.5, 1.2), loc=\"upper center\", title=legend_title\n )\n\n # Title\n ax.set_title(title, fontsize=14)\n\n # Set Background Color\n fig.set_facecolor(\"#FFFFFF\")\n\n return fig, ax\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, ax = create_bar_chart(results, category_names)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"bar_254.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_38", "content": { "Region": [ "North America", "Europe", "Asia-Pacific", "South America", "Africa", "Middle East" ], "Market Share Initial (%)": [ 35, 50, 60, 25, 15, 40 ], "Market Share Change (%)": [ 5, 7, 8, 4, 2, 6 ], "Customer Satisfaction Initial (%)": [ 80, 75, 82, 70, 65, 78 ], "Customer Satisfaction Change (%)": [ 2, 3, 5, 3, 1, 4 ] }, "visual_intent": "A figure with 2 subplots showing vector plots illustrating the initial values and changes in Market Share and Customer Satisfaction for different global regions, titled Smartphone Market Trends by Region(size of the desired plot: width=14.0, height=7.0)", "path_to_gt_image": "images/quiver_47.jpg", "original_category": "quiver", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.lines as mlines\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for the plot\nregions_1 = [\"North America\", \"Europe\", \"Asia-Pacific\"]\nmarket_share_1 = [35, 50, 60] # Smartphone market share in percentage\nmarket_share_change_1 = [5, 7, 8] # Change in smartphone market share\ncustomer_satisfaction_1 = [80, 75, 82] # Customer satisfaction with smartphones\ncustomer_satisfaction_change_1 = [2, 3, 5] # Change in customer satisfaction\n\nregions_2 = [\"South America\", \"Africa\", \"Middle East\"]\nmarket_share_2 = [25, 15, 40] # Smartphone market share in percentage\nmarket_share_change_2 = [4, 2, 6] # Change in smartphone market share\ncustomer_satisfaction_2 = [70, 65, 78] # Customer satisfaction with smartphones\ncustomer_satisfaction_change_2 = [3, 1, 4] # Change in customer satisfaction\n\n# Axis labels and legend labels\nax1_labels = [\"Market Share Change (%)\", \"Customer Satisfaction Change (%)\"]\nax2_labels = [\"Market Share Change (%)\", \"Customer Satisfaction Change (%)\"]\n\nsuptitle = \"Smartphone Market Trends by Region\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure with two subplots\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 7))\noffset = 0.5\n\n# First subplot (regions_1)\nfor i, region in enumerate(regions_1):\n # Market Share change line with arrow and black dots at start and end\n ax1.annotate(\n \"\",\n xy=(market_share_1[i], i + offset * 3 / 2),\n xytext=(market_share_1[i] + market_share_change_1[i], i + offset * 3 / 2),\n arrowprops=dict(arrowstyle=\"<|-\", color=\"green\"),\n )\n ax1.scatter(\n [market_share_1[i], market_share_1[i] + market_share_change_1[i]],\n [i + offset * 3 / 2, i + offset * 3 / 2],\n color=\"green\",\n s=50,\n edgecolor=\"black\",\n )\n ax1.annotate(\n f\"{market_share_change_1[i]:.2f}\",\n (market_share_1[i] + market_share_change_1[i], i + offset * 1.75),\n color=\"green\",\n ha=\"right\",\n va=\"center\",\n )\n\n # Customer Satisfaction change line with arrow and dots at start and end\n ax1.annotate(\n \"\",\n xy=(customer_satisfaction_1[i], i + offset / 2),\n xytext=(\n customer_satisfaction_1[i] + customer_satisfaction_change_1[i],\n i + offset / 2,\n ),\n arrowprops=dict(arrowstyle=\"<|-\", color=\"purple\"),\n )\n ax1.scatter(\n [\n customer_satisfaction_1[i],\n customer_satisfaction_1[i] + customer_satisfaction_change_1[i],\n ],\n [i + offset / 2, i + offset / 2],\n color=\"purple\",\n s=50,\n edgecolor=\"black\",\n )\n ax1.annotate(\n f\"{customer_satisfaction_change_1[i]:.2f}\",\n (\n customer_satisfaction_1[i] + customer_satisfaction_change_1[i],\n i + offset * 0.75,\n ),\n color=\"purple\",\n ha=\"left\",\n va=\"center\",\n )\n\n# Second subplot (regions_2)\nfor i, region in enumerate(regions_2):\n ax2.annotate(\n \"\",\n xy=(market_share_2[i], i + offset * 3 / 2),\n xytext=(market_share_2[i] + market_share_change_2[i], i + offset * 3 / 2),\n arrowprops=dict(arrowstyle=\"<|-\", color=\"green\"),\n )\n ax2.scatter(\n [market_share_2[i], market_share_2[i] + market_share_change_2[i]],\n [i + offset * 3 / 2, i + offset * 3 / 2],\n color=\"green\",\n s=50,\n edgecolor=\"black\",\n )\n ax2.annotate(\n f\"{market_share_change_2[i]:.2f}\",\n (market_share_2[i] + market_share_change_2[i], i + offset * 1.75),\n color=\"green\",\n ha=\"right\",\n va=\"center\",\n )\n\n ax2.annotate(\n \"\",\n xy=(customer_satisfaction_2[i], i + offset / 2),\n xytext=(\n customer_satisfaction_2[i] + customer_satisfaction_change_2[i],\n i + offset / 2,\n ),\n arrowprops=dict(arrowstyle=\"<|-\", color=\"purple\"),\n )\n ax2.scatter(\n [\n customer_satisfaction_2[i],\n customer_satisfaction_2[i] + customer_satisfaction_change_2[i],\n ],\n [i + offset / 2, i + offset / 2],\n color=\"purple\",\n s=50,\n edgecolor=\"black\",\n )\n ax2.annotate(\n f\"{customer_satisfaction_change_2[i]:.2f}\",\n (\n customer_satisfaction_2[i] + customer_satisfaction_change_2[i],\n i + offset * 0.75,\n ),\n color=\"purple\",\n ha=\"left\",\n va=\"center\",\n )\n\n# Set y-axis limits\nax1.set_ylim(0, len(regions_1))\nax2.set_ylim(0, len(regions_2))\n\n# Set x-axis limits uniformly\nax1.set_xlim(0, 100)\nax2.set_xlim(0, 100)\n\n# Adjust the y-axis tick positions\nax1.set_yticks([i + offset for i in range(len(regions_1))])\nax1.set_yticklabels(regions_1)\nax2.set_yticks([i + offset for i in range(len(regions_2))])\nax2.set_yticklabels(regions_2)\nax2.yaxis.tick_right()\nax2.yaxis.set_label_position(\"right\")\n\n# Offset grid lines on the y-axis\nax1.set_yticks([i for i in range(len(regions_1))], minor=True)\nax2.set_yticks([i for i in range(len(regions_2))], minor=True)\nax1.yaxis.grid(True, which=\"minor\", linewidth=0.5, alpha=0.7, color=\"grey\")\nax2.yaxis.grid(True, which=\"minor\", linewidth=0.5, alpha=0.7, color=\"grey\")\n\n# Add x-axis grid lines\nax1.xaxis.set_major_locator(plt.MultipleLocator(10))\nax2.xaxis.set_major_locator(plt.MultipleLocator(10))\nax1.grid(axis=\"x\", linestyle=\"--\", linewidth=0.5)\nax2.grid(axis=\"x\", linestyle=\"--\", linewidth=0.5)\n\n# Create legend entries\ngreen_arrow = mlines.Line2D(\n [],\n [],\n color=\"green\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax1_labels[0],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\npurple_arrow = mlines.Line2D(\n [],\n [],\n color=\"purple\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax1_labels[1],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nfig.legend(\n handles=[green_arrow, purple_arrow],\n bbox_to_anchor=(0.70, 0.01),\n ncol=2,\n frameon=False,\n)\n\n# plt.subplots_adjust(bottom=0.15)\nplt.suptitle(suptitle, fontsize=16)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout()\nplt.savefig(\"quiver_47.pdf\", bbox_inches=\"tight\")\n", "width": 14.0, "height": 7.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_39", "content": { "Company": [ "Company A", "Company B", "Company C", "Company D", "Company E" ], "Annual Revenue (in billions USD)": [ 1.5, 2.1, 1.8, 2.4, 1.9 ], "Standard Deviation": [ 0.2, 0.15, 0.1, 0.25, 0.18 ] }, "visual_intent": "A horizontal error bar plot about companies and annual revenue, titled Annual Revenue by Company(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/errorpoint_55.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data for plotting\ncompanies = [\"Company A\", \"Company B\", \"Company C\", \"Company D\", \"Company E\"]\nannual_revenue = [1.5, 2.1, 1.8, 2.4, 1.9] # Annual revenue (in billions USD)\nstd_devs = [0.2, 0.15, 0.1, 0.25, 0.18] # Standard deviation (in billions USD)\nworld_mean_revenue = [2.0] # Global average annual revenue (in billions USD)\n\nxlabel = \"Annual Revenue (in billions USD)\"\nlabel = \"Global Average Annual Revenue\"\nplot_title = 'Annual Revenue by Company'\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nplt.figure(figsize=(10, 7)) # Adjusting figure size for better readability\nplt.errorbar(\n annual_revenue,\n companies,\n xerr=std_devs,\n fmt=\"o\",\n color=\"#0073e6\", # Blue for markers\n ecolor=\"#6699cc\", # Light blue for error bars\n capsize=4,\n elinewidth=2,\n markeredgewidth=2,\n label=\"Company Revenue\",\n)\nplt.axvline(world_mean_revenue[0], color=\"#ff6600\", linestyle=\"--\", linewidth=3, label=label)\n\n# Customizing the plot\nplt.xlabel(xlabel)\nplt.title(plot_title)\nplt.legend(loc='upper right')\nplt.grid(True, linestyle='--', linewidth=0.5, alpha=0.7)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting the layout and saving the figure\nplt.tight_layout()\nplt.savefig(\"errorpoint_55.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_40", "content": { "Company": [ "Apple 30%", "Microsoft 25%", "Google 20%", "Amazon 15%", "Facebook 10%" ], "Market Share": [ 30, 25, 20, 15, 10 ] }, "visual_intent": "A pie chart about tech companies and market share, titled Market Share of Tech Companies(size of the desired plot: width=7.0, height=7.0)", "path_to_gt_image": "images/pie_32.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for the pie chart\nlabels = [\"Apple 30%\", \"Microsoft 25%\", \"Google 20%\", \"Amazon 15%\", \"Facebook 10%\"]\nsizes = [30, 25, 20, 15, 10]\n\n# Additional text labels\ntitle = \"Market Share of Tech Companies\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a custom color palette\ncolors = ['#ff9999','#66b3ff','#99ff99','#ffcc99','#c2c2f0']\n\n# Create the pie chart\nfig, ax = plt.subplots(figsize=(7, 7))\nax.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%', startangle=140, \n wedgeprops={'linewidth': 1, 'edgecolor': 'black'})\n\n# Title configuration\nplt.title(title, fontsize=16, weight='bold')\n\n# Additional adjustments\nplt.tight_layout()\nplt.axis('equal') # Equal aspect ratio ensures the pie chart is circular\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.savefig(\"pie_32.pdf\", bbox_inches=\"tight\")\n\n", "width": 7.0, "height": 7.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_41", "content": { "Time Interval (days)": [ 1, 2, 3, 4, 5 ], "Energy Efficiency (%)": [ 85, 88, 87, 89, 90 ], "Energy Efficiency Error": [ 2, 1, 2, 1, 2 ], "Power Consumption (kW)": [ 400, 380, 390, 370, 360 ], "Power Consumption Error": [ 20, 15, 25, 20, 10 ], "Renewable Energy Usage (%)": [ 60, 62, 61, 63, 64 ], "Renewable Energy Usage Error": [ 3, 2, 3, 2, 3 ], "CO2 Emissions (tons)": [ 200, 190, 195, 185, 180 ], "CO2 Emissions Error": [ 10, 12, 15, 10, 5 ] }, "visual_intent": "A figure with 4 subplots: (1) a line chart with error bars about Energy Efficiency over time, (2) a line chart with error bars about Power Consumption over time, (3) a line chart with error bars about Renewable Energy Usage over time, (4) a line chart with error bars about CO2 Emissions over time(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/line_225.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Sample data for energy domain\ntime_intervals = np.array([1, 2, 3, 4, 5])\nenergy_efficiency = np.array([85, 88, 87, 89, 90])\nenergy_efficiency_error = np.array([2, 1, 2, 1, 2])\n\npower_consumption = np.array([400, 380, 390, 370, 360])\npower_consumption_error = np.array([20, 15, 25, 20, 10])\n\nrenewable_energy_usage = np.array([60, 62, 61, 63, 64])\nrenewable_energy_usage_error = np.array([3, 2, 3, 2, 3])\n\nco2_emissions = np.array([200, 190, 195, 185, 180])\nco2_emissions_error = np.array([10, 12, 15, 10, 5])\n\n# Titles\ntitles = [\n \"(a) Energy Efficiency\",\n \"(b) Power Consumption\",\n \"(d) Renewable Energy Usage\",\n \"(c) CO2 Emissions\"\n]\n\n# Axis labels\nxlabel = \"Time Interval (days)\"\nylabel_efficiency = \"Efficiency (%)\"\nylabel_consumption = \"Power (kW)\"\nylabel_renewable = \"Usage (%)\"\nylabel_co2 = \"Emissions (tons)\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create 2x2 subplots\nfig, axs = plt.subplots(2, 2, figsize=(10, 8))\n\n# Flatten the axis array for easy iteration\naxs = axs.flatten()\n\n# Setting data for each subplot\ndata = [\n (time_intervals, energy_efficiency, energy_efficiency_error, ylabel_efficiency), \n (time_intervals, power_consumption, power_consumption_error, ylabel_consumption), \n (time_intervals, renewable_energy_usage, renewable_energy_usage_error, ylabel_renewable), \n (time_intervals, co2_emissions, co2_emissions_error, ylabel_co2)\n]\n\n# Custom colors\ncolors = [\"#1f77b4\", \"#ff7f0e\", \"#2ca02c\", \"#d62728\"]\n\n# Plot with error bars in each subplot\nfor ax, (x, y, e, ylabel), title, color in zip(axs, data, titles, colors):\n ax.errorbar(x, y, yerr=e, fmt=\"--s\", color=color, ecolor=\"gray\", capsize=8, markersize=8, markerfacecolor=\"white\")\n ax.set_title(title, fontsize=16)\n ax.set_xlabel(xlabel, fontsize=14)\n ax.set_ylabel(ylabel, fontsize=14)\n ax.grid(True, alpha=0.5)\n ax.set_xticks(x)\n ax.set_yticks(np.linspace(min(y) - min(e), max(y) + max(e), num=5, endpoint=True))\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the figure\nplt.tight_layout()\nplt.savefig(\"line_225.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "line" }, { "id": "test_42", "content": { "Training_Method": [ "Training Method A", "Training Method A", "Training Method A", "Training Method A", "Training Method B", "Training Method B", "Training Method B", "Training Method B" ], "Metric": [ "Speed", "Strength", "Endurance", "Flexibility", "Speed", "Strength", "Endurance", "Flexibility" ], "Very_Poor": [ 5, 10, 5, 20, 15, 10, 10, 15 ], "Poor": [ 15, 20, 10, 25, 20, 15, 15, 20 ], "Average": [ 25, 20, 30, 15, 20, 30, 20, 20 ], "Good": [ 35, 30, 35, 20, 30, 25, 35, 25 ], "Excellent": [ 20, 20, 20, 20, 15, 20, 20, 20 ] }, "visual_intent": "A figure with 2 subplots: (1) a diverging bar chart about performance distribution for Training Method A across various metrics, (2) a diverging bar chart about performance distribution for Training Method B across various metrics(size of the desired plot: width=12.0, height=8.0)", "path_to_gt_image": "images/bar_141.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.gridspec as gridspec\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nnp.random.seed(0)\n\n# Data for Training Method A\ntraining_method_a_data = {\n \"Speed\": [5, 15, 25, 35, 20],\n \"Strength\": [10, 20, 20, 30, 20],\n \"Endurance\": [5, 10, 30, 35, 20],\n \"Flexibility\": [20, 25, 15, 20, 20],\n}\ntraining_method_a_data2 = {\n \"Agility\": [10, 20, 25, 25, 20],\n}\n\n# Data for Training Method B\ntraining_method_b_data = {\n \"Speed\": [15, 20, 20, 30, 15],\n \"Strength\": [10, 15, 30, 25, 20],\n \"Endurance\": [10, 15, 20, 35, 20],\n \"Flexibility\": [15, 20, 20, 25, 20],\n}\ntraining_method_b_data2 = {\"Agility\": [5, 20, 20, 35, 20]}\n\ncategories = [\"Very Poor\", \"Poor\", \"Average\", \"Good\", \"Excellent\"]\ncategories2 = [\"Very Poor\", \"Poor\", \"Average\", \"Good\", \"Excellent\"]\n\nlabels = [\"Training Method A\", \"Training Method B\"]\n\n# Chart Title and Labels\nchart_title = \"Comparison of Training Methods Across Metrics\"\nx_label = \"Percentage of Participants\"\nlegend_labels = categories\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#66c2a5\", \"#fc8d62\", \"white\", \"#8da0cb\", \"#e78ac3\"]\nxlim = [-69, 69]\nxticks = np.arange(-60, 61, 20)\n# Create a gridspec\ngs = gridspec.GridSpec(3, 2, height_ratios=[1.2, 0.2, 0.2]) # Adjusted height ratios\n\nfig = plt.figure(figsize=(12, 8))\n\n# Create axes using the gridspec\naxes = [plt.subplot(gs[0, 0]), plt.subplot(gs[0, 1])]\n\n\ndef create_bar_chart(ax, results, category_names, title):\n labels = list(results.keys())\n data = np.array(list(results.values()))\n data_cum = data.cumsum(axis=1)\n middle_index = data.shape[1] // 2\n offsets = data[:, range(middle_index)].sum(axis=1) + data[:, middle_index] / 2\n\n # Color Mapping\n category_colors = plt.get_cmap(\"coolwarm_r\")(np.linspace(0.15, 0.85, data.shape[1]))\n\n # Plot Bars\n for i, (colname, color) in enumerate(zip(category_names, category_colors)):\n widths = data[:, i]\n starts = data_cum[:, i] - widths - offsets\n rects = ax.barh(\n labels,\n widths,\n left=starts,\n height=0.5,\n label=colname,\n color=color,\n edgecolor=\"black\",\n )\n for j, (start, width) in enumerate(zip(starts, widths)):\n # Calculate the center position of each bar segment for the text\n text_x = start + width / 2\n text_y = j # y-coordinate is based on the bar's index (j)\n ax.text(\n text_x,\n text_y,\n f\"{abs(width):.1f}%\",\n va=\"center\",\n ha=\"center\",\n color=\"black\",\n fontsize=8,\n )\n # Add Zero Reference Line\n ax.axvline(0, linestyle=\"-\", color=\"black\", alpha=0.25)\n # X Axis\n ax.set_xlim(xlim)\n ax.set_xticks(xticks)\n ax.xaxis.set_major_formatter(lambda x, pos: str(abs(int(x))))\n # Y Axis\n ax.invert_yaxis()\n ax.set_title(title)\n\n\n# Create bar charts for Training Method A and Training Method B\ncreate_bar_chart(axes[0], training_method_a_data, categories, labels[0])\ncreate_bar_chart(axes[1], training_method_b_data, categories2, labels[1])\n\n# Add legend\nhandles, labels = axes[0].get_legend_handles_labels()\nfig.legend(\n handles,\n labels,\n loc=\"lower center\",\n ncol=len(categories),\n bbox_to_anchor=(0.5, 0.25),\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"bar_141.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 8.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" }, { "id": "test_43", "content": { "Dataset": [ "LIVE", "CSIQ", "TID2013", "KADID", "LIVE-C", "KonIQ", "LIVE-M", "PIPAL" ], "Truth0_Pred0": [ 44, 35, 115, 360, 33, 339, 20, 754 ], "Truth0_Pred1": [ 12, 8, 28, 108, 17, 121, 0, 271 ], "Truth0_Pred2": [ 0, 0, 3, 23, 5, 23, 0, 96 ], "Truth0_Pred3": [ 0, 0, 6, 13, 3, 13, 0, 43 ], "Truth1_Pred0": [ 5, 4, 26, 61, 13, 100, 8, 180 ], "Truth1_Pred1": [ 42, 24, 81, 263, 24, 220, 8, 498 ], "Truth1_Pred2": [ 3, 13, 33, 141, 16, 90, 6, 362 ], "Truth1_Pred3": [ 0, 1, 18, 27, 7, 67, 0, 133 ], "Truth2_Pred0": [ 0, 2, 0, 3, 5, 27, 1, 48 ], "Truth2_Pred1": [ 8, 8, 21, 60, 14, 164, 1, 278 ], "Truth2_Pred2": [ 23, 13, 80, 305, 21, 143, 11, 472 ], "Truth2_Pred3": [ 9, 18, 42, 155, 18, 184, 5, 321 ], "Truth3_Pred0": [ 0, 0, 0, 0, 1, 7, 0, 25 ], "Truth3_Pred1": [ 0, 0, 0, 7, 11, 67, 0, 109 ], "Truth3_Pred2": [ 2, 3, 25, 102, 16, 88, 4, 300 ], "Truth3_Pred3": [ 44, 31, 112, 388, 20, 347, 18, 750 ] }, "visual_intent": "A figure with 8 subplots displaying confusion matrices for different datasets (LIVE, CSIQ, TID2013, KADID, LIVE-C, KonIQ, LIVE-M, PIPAL), plotting ground truth categories against predicted categories.(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/heatmap_5.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Placeholder data for confusion matrices\ndata_live = np.array([[44, 12, 0, 0], [5, 42, 3, 0], [0, 8, 23, 9], [0, 0, 2, 44]])\ndata_csiq = np.array([[35, 8, 0, 0], [4, 24, 13, 1], [2, 8, 13, 18], [0, 0, 3, 31]])\ndata_tid2013 = np.array(\n [[115, 28, 3, 6], [26, 81, 33, 18], [0, 21, 80, 42], [0, 0, 25, 112]]\n)\ndata_kadid = np.array(\n [[360, 108, 23, 13], [61, 263, 141, 27], [3, 60, 305, 155], [0, 7, 102, 388]]\n)\ndata_live_c = np.array(\n [[33, 17, 5, 3], [13, 24, 16, 7], [5, 14, 21, 18], [1, 11, 16, 20]]\n)\ndata_koniq = np.array(\n [[339, 121, 23, 13], [100, 220, 90, 67], [27, 164, 143, 184], [7, 67, 88, 347]]\n)\ndata_live_m = np.array([[20, 0, 0, 0], [8, 8, 6, 0], [1, 1, 11, 5], [0, 0, 4, 18]])\ndata_pipal = np.array(\n [[754, 271, 96, 43], [180, 498, 362, 133], [48, 278, 472, 321], [25, 109, 300, 750]]\n)\n\n# Titles for the subplots\ntitles = [\"LIVE\", \"CSIQ\", \"TID2013\", \"KADID\", \"LIVE-C\", \"KonIQ\", \"LIVE-M\", \"PIPAL\"]\nxlabel = \"Predicted category\"\nylabel = \"Ground truth category\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, axes = plt.subplots(nrows=2, ncols=4, figsize=(12, 6)) # Adjusted for 1080x2376\n\n\n# Function to create a single confusion matrix plot\ndef plot_confusion_matrix(ax, data, title):\n im = ax.imshow(data, interpolation=\"nearest\", cmap=\"viridis\")\n ax.figure.colorbar(im, ax=ax)\n ax.set(\n title=title,\n xlabel=xlabel,\n ylabel=ylabel,\n xticks=np.arange(data.shape[1]),\n yticks=np.arange(data.shape[0]),\n )\n # Loop over data dimensions and create text annotations.\n for i in range(data.shape[0]):\n for j in range(data.shape[1]):\n ax.text(j, i, data[i, j], ha=\"center\", va=\"center\", color=\"w\")\n\n\n# Plot each confusion matrix\nplot_confusion_matrix(axes[0, 0], data_live, titles[0])\nplot_confusion_matrix(axes[0, 1], data_csiq, titles[1])\nplot_confusion_matrix(axes[0, 2], data_tid2013, titles[2])\nplot_confusion_matrix(axes[0, 3], data_kadid, titles[3])\nplot_confusion_matrix(axes[1, 0], data_live_c, titles[4])\nplot_confusion_matrix(axes[1, 1], data_koniq, titles[5])\nplot_confusion_matrix(axes[1, 2], data_live_m, titles[6])\nplot_confusion_matrix(axes[1, 3], data_pipal, titles[7])\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit and save the figure\nplt.tight_layout()\nplt.savefig(\"heatmap_5.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_44", "content": { "Sample Ratio": [ 0.25, 0.5, 0.75, 1.0 ], "MAXN=512": [ 0.07, 0.06, 0.01, 0.05 ], "MAXN=1024": [ 0.055, 0.045, 0.04, 0.035 ], "MAXN=2048": [ 0.03, 0.025, 0.02, 0.015 ] }, "visual_intent": "A line chart about Sample Ratio and Std of ACC comparing three different MAXN configurations(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/line_12.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\nsample_ratio = [0.25, 0.50, 0.75, 1.00]\nstd_acc_512 = [0.07, 0.06, 0.01, 0.05]\nstd_acc_1024 = [0.055, 0.045, 0.04, 0.035]\nstd_acc_2048 = [0.03, 0.025, 0.02, 0.015]\n\n# Extracted variables\nline_label_512 = \"MAXN=512\"\nline_label_1024 = \"MAXN=1024\"\nline_label_2048 = \"MAXN=2048\"\nxlim_values = (0.25, 1)\nylim_values = (0.00, 0.08)\nxlabel_value = \"Sample Ratio\"\nylabel_value = \"Std of ACC\"\nxticks_values = sample_ratio\nyticks_values = None # Not explicitly set in the code\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nxtickslabel_fontsize = 14\nytickslabel_fontsize = 14\ntitle_value = None # Not explicitly set in the code\naxhline_value = None # Not explicitly set in the code\naxvline_value = None # Not explicitly set in the code\n# Plotting the lines with increased marker size and line width\nplt.figure(figsize=(8, 6))\nplt.plot(\n sample_ratio,\n std_acc_512,\n marker=\"*\",\n markersize=10,\n linewidth=2,\n color=\"#2ab34a\",\n label=line_label_512,\n clip_on=False,\n zorder=10,\n)\nplt.plot(\n sample_ratio,\n std_acc_1024,\n marker=\"^\",\n markerfacecolor=\"white\",\n markersize=10,\n linewidth=2,\n markeredgecolor=\"#ee756e\",\n color=\"#ee756e\",\n clip_on=False,\n zorder=10,\n label=line_label_1024,\n)\nplt.plot(\n sample_ratio,\n std_acc_2048,\n marker=\"o\",\n markerfacecolor=\"white\",\n markersize=10,\n linewidth=2,\n markeredgecolor=\"#4995c6\",\n color=\"#4995c6\",\n clip_on=False,\n zorder=10,\n label=line_label_2048,\n)\n\n# Setting the x-axis and y-axis limits\nplt.ylim(*ylim_values) # Set y-axis to go from 0 to 7\nplt.yticks(fontsize=ytickslabel_fontsize)\nplt.xlim(*xlim_values) # Set y-axis to go from 0 to 7\n# Set x-axis to show only the values in the sample_ratio list\nplt.xticks(xticks_values, fontsize=xtickslabel_fontsize)\n\n# Adding labels and title\nplt.xlabel(xlabel_value, fontsize=18)\nplt.ylabel(ylabel_value, fontsize=18)\n\n# Adding legend with increased font size\nplt.legend(\n fontsize=\"large\",\n loc=\"upper center\",\n ncol=3,\n frameon=False,\n bbox_to_anchor=(0.5, 1.1),\n)\n\n# Adding grid\nplt.grid(True, alpha=0.6)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to reduce white space\nplt.tight_layout()\nplt.savefig(\"line_12.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_45", "content": { "School": [ "School A", "School A", "School A", "School B", "School B", "School B", "School C", "School C", "School C" ], "Metric": [ "Test Scores", "Graduation Rate", "Student Satisfaction", "Test Scores", "Graduation Rate", "Student Satisfaction", "Test Scores", "Graduation Rate", "Student Satisfaction" ], "Value": [ 85, 95, 92, 78, 88, 85, 82, 90, 88 ], "Error_Lower": [ 5, 2, 3, 4, 3, 4, 3, 2, 3 ], "Error_Upper": [ 3, 2, 2, 2, 3, 2, 3, 5, 4 ] }, "visual_intent": "A figure with 3 subplots displaying bar charts with asymmetric error bars for education performance metrics (Test Scores, Graduation Rate, Student Satisfaction) for School A, School B, and School C respectively, titled Education Performance Metrics by School(size of the desired plot: width=12.0, height=5.0)", "path_to_gt_image": "images/errorbar_117.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nnp.random.seed(42)\n# Education Data for three schools\nmetrics = [\"Test Scores\", \"Graduation Rate\", \"Student Satisfaction\"]\nvalues = np.array(\n [\n [85, 95, 92], # School A\n [78, 88, 85], # School B\n [82, 90, 88], # School C\n ]\n)\n\n# Asymmetric error values for the education data\nerrors = np.array(\n [\n [[5, 3], [2, 2], [3, 2]], # Errors for School A (lower, upper)\n [[4, 2], [3, 3], [4, 2]], # Errors for School B\n [[3, 3], [2, 5], [3, 4]], # Errors for School C\n ]\n)\n\n# Creating subplots for each school\nschools = [\"School A\", \"School B\", \"School C\"]\n\nylabel = \"Performance Metrics\"\nylim = [70, 100]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, axs = plt.subplots(1, 3, figsize=(12, 5)) # Enlarged figure layout\n\n# Function to plot each school's data\ndef plot_school_data(ax, errors, school_index, school_name):\n x = np.arange(len(metrics)) # the label locations\n bar_colors = [\"#4daf4a\", \"#ff7f00\", \"#377eb8\"]\n barerrors = np.array(errors).T[:, :, school_index]\n bars = ax.bar(x, values[school_index], yerr=barerrors, color=bar_colors, capsize=7)\n for bar, lower_error, upper_error in zip(bars, barerrors[0], barerrors[1]):\n # Position for lower error text\n ax.text(\n bar.get_x() + bar.get_width() / 2,\n bar.get_height() - lower_error - 3,\n f\"-{lower_error}\",\n va=\"bottom\",\n ha=\"center\",\n color=\"black\",\n )\n # Position for upper error text\n ax.text(\n bar.get_x() + bar.get_width() / 2,\n bar.get_height() + upper_error + 1,\n f\"+{upper_error}\",\n ha=\"center\",\n color=\"black\",\n )\n\n ax.set_title(school_name)\n ax.set_xticks(x)\n ax.set_xticklabels(metrics, rotation=45, ha=\"right\")\n ax.set_ylabel(ylabel)\n ax.set_ylim(ylim) # Uniform scale for all charts\n\nfor i, school in enumerate(schools):\n plot_school_data(axs[i], errors, i, school)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.suptitle(\"Education Performance Metrics by School\", fontsize=16)\nplt.tight_layout(rect=[0, 0, 1, 0.96])\nplt.savefig(\"errorbar_117.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 5.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_46", "content": { "Medical Specialties": [ "CARDIOLOGY", "NEUROLOGY", "ORTHOPEDICS", "PEDIATRICS", "DERMATOLOGY" ], "Treatment Success Rate": [ 0.75, 0.65, 0.8, 0.7, 0.6 ], "Lower Error": [ 0.05, 0.1, 0.06, 0.07, 0.08 ], "Upper Error": [ 0.04, 0.08, 0.05, 0.06, 0.07 ] }, "visual_intent": "An errorbar plot about Medical Specialties and Treatment Success Rate, titled Success Rates in Medical Specialties(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/errorpoint_33.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data for plotting\ncategories = [\n \"CARDIOLOGY\",\n \"NEUROLOGY\",\n \"ORTHOPEDICS\",\n \"PEDIATRICS\",\n \"DERMATOLOGY\",\n] # Capitalized category labels\nmeans = [0.75, 0.65, 0.80, 0.70, 0.60]\nerrors = [0.05, 0.10, 0.06, 0.07, 0.08]\ndownerrors = [0.04, 0.08, 0.05, 0.06, 0.07]\nlegendtitles = [\"Overall Treatment Success Rate\", \"Individual Category Mean\"]\ntexttitle = \"Overall Mean Success Rate\"\nylabel = \"Treatment Success Rate (Fraction of patients)\"\nxlabel = \"Medical Specialties\"\ndataset_mean = 0.72\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nfig, ax = plt.subplots(figsize=(10, 7)) # Adjusting figure size for clarity\n\n# Custom color scheme\ncolor = \"teal\"\nerror_color = \"darkslateblue\"\n\nax.errorbar(\n categories,\n means,\n yerr=[errors, downerrors],\n fmt=\"s\",\n color=color,\n ecolor=error_color,\n capsize=5,\n markersize=8,\n markerfacecolor='white',\n)\n\n# Adding a legend with both \"Overall Treatment Success Rate\" and \"Individual Category Mean\"\nmean_line = ax.errorbar([], [], yerr=[], fmt=\"s\", color=color, ecolor=error_color, capsize=5)\ndataset_mean_line = ax.axhline(y=dataset_mean, color=\"gray\", linestyle=\"--\", linewidth=1.5)\nax.legend(\n [dataset_mean_line, mean_line],\n legendtitles,\n loc=\"upper right\",\n fancybox=True,\n framealpha=1,\n shadow=True,\n borderpad=1,\n)\n\n# Adding a horizontal line for dataset mean and text annotation with a white background\nax.text(\n 0.95,\n dataset_mean,\n texttitle,\n va=\"center\",\n ha=\"right\",\n backgroundcolor=\"white\",\n transform=ax.get_yaxis_transform(),\n)\n\n# Setting labels\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\nax.set_title(\"Success Rates in Medical Specialties\")\nplt.xticks(rotation=30)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorpoint_33.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_47", "content": { "Method": [ "Lecture", "Group Study", "Online Course", "Self-learning", "Interactive Session" ], "Traditional Score": [ 3.2, 3.8, 4.1, 2.9, 4.3 ], "Innovative Score": [ 4.5, 4.7, 4.8, 3.6, 4.9 ] }, "visual_intent": "A grouped bar chart comparing effectiveness scores of traditional and innovative approaches across various teaching methods, titled Comparison of Teaching Methods(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/bar_183.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data\nmethods = [\"Lecture\", \"Group Study\", \"Online Course\", \"Self-learning\", \"Interactive Session\"]\nscores_traditional = [3.2, 3.8, 4.1, 2.9, 4.3]\nscores_innovative = [4.5, 4.7, 4.8, 3.6, 4.9]\n\n# Labels for legend and plot type\nlabels = methods\n\n# Limits, labels, and title for the plot\nylim_values = (2.5, 5.0)\nylabel_value = \"Effectiveness Score\"\ntitle_value = \"Comparison of Teaching Methods\"\nsupertitle_value = \"Educational Methods Evaluation\"\nxticks_values = [6, 12]\nxtickslabel_values = [\"Traditional\", \"Innovative\"]\nlegend_labels = methods\n\n# Bar width\nbar_width = 1\n# X-axis positions\nr1 = np.arange(len(methods))\nr2 = [x + bar_width + len(r1) for x in r1]\n\n\n# Text labels for bars\ntraditional_labels = [\"3.2\", \"3.8\", \"4.1\", \"2.9\", \"4.3\"]\ninnovative_labels = [\"4.5\", \"4.7\", \"4.8\", \"3.6\", \"4.9\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nplt.figure(figsize=(10, 6))\n# Colors (using a vibrant, educational color scheme)\ncolors = [\"#FF6347\", \"#4682B4\", \"#3CB371\", \"#FFD700\", \"#8A2BE2\"]\n\n# Create bars for Traditional scores\nfor i in range(len(r1)):\n plt.bar(\n xticks_values[0] + (i - 2) * bar_width,\n scores_traditional[i],\n color=colors[i],\n width=bar_width,\n edgecolor=\"white\",\n label=labels[i] if i == 0 else \"\"\n )\n\n# Create bars for Innovative scores\nfor i in range(len(r2)):\n plt.bar(\n xticks_values[1] + (i - 2) * bar_width,\n scores_innovative[i],\n color=colors[i],\n width=bar_width,\n edgecolor=\"white\",\n )\n\n# Add text on top of the bars\nfor i in range(len(r1)):\n plt.text(\n xticks_values[0] + (i - 2) * bar_width,\n scores_traditional[i] + 0.05,\n traditional_labels[i],\n ha=\"center\",\n )\n plt.text(\n xticks_values[1] + (i - 2) * bar_width,\n scores_innovative[i] + 0.05,\n innovative_labels[i],\n ha=\"center\",\n )\n\n# Layout and style adjustments\nplt.xticks(xticks_values, xtickslabel_values)\nplt.ylabel(ylabel_value)\nplt.title(title_value)\nplt.suptitle(supertitle_value, fontsize=14, fontweight='bold')\nplt.ylim(*ylim_values)\nplt.legend(legend_labels, loc=\"upper center\", ncol=5, bbox_to_anchor=(0.5, 1.0), frameon=False)\n\nplt.tick_params(axis=\"x\", which=\"both\", length=0)\nplt.gca().yaxis.grid(True)\nplt.gca().set_axisbelow(True)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout(rect=[0, 0, 1, 1])\nplt.savefig(\"bar_183.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_48", "content": { "Number of Sampling Points": [ 1, 2, 3, 4, 5, 6, 7 ], "PM2.5 Levels (µg/m³)": [ 35.2, 33.1, 30.5, 28.4, 26.3, 24.8, 23.5 ], "NO2 Levels (ppb)": [ 50.5, 48.2, 45.6, 43.1, 40.8, 38.9, 37.4 ] }, "visual_intent": "A dual-axis line chart about Number of Sampling Points, PM2.5 Levels, and NO2 Levels(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/line_172.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom matplotlib.lines import Line2D # Importing Line2D for creating custom legend items\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data: Environmental Science Context - Air Quality Monitoring\nsampling_points = [1, 2, 3, 4, 5, 6, 7]\npm25_levels = [35.2, 33.1, 30.5, 28.4, 26.3, 24.8, 23.5]\nno2_levels = [50.5, 48.2, 45.6, 43.1, 40.8, 38.9, 37.4]\navg_pm25_levels = [30] * len(sampling_points)\navg_no2_levels = [45] * len(sampling_points)\n\n# Axes Limits and Labels\nxlabel_value = \"Number of Sampling Points\"\nylabel_value_1 = \"PM2.5 Levels (µg/m³)\"\nylabel_value_2 = \"NO2 Levels (ppb)\"\nylim_values_1 = [20, 40]\nylim_values_2 = [35, 55]\nyticks_values_1 = range(20, 41, 5)\nyticks_values_2 = range(35, 56, 5)\n\n# Labels\nlabel_pm25 = \"PM2.5 Levels\"\nlabel_no2 = \"NO2 Levels\"\navg_label_pm25 = \"Avg PM2.5\"\navg_label_no2 = \"Avg NO2\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot\nfig, ax1 = plt.subplots(figsize=(10, 6))\n\n# PM2.5 plot\n(pm25_line,) = ax1.plot(\n sampling_points,\n pm25_levels,\n \"o-\",\n color=\"#66c2a5\", # Soft green\n label=label_pm25,\n markersize=10,\n linewidth=3,\n mec=\"black\",\n)\nax1.set_xlabel(xlabel_value, fontsize=14)\nax1.set_ylabel(ylabel_value_1, fontsize=14, color=\"#66c2a5\")\nax1.tick_params(\n axis=\"y\", labelcolor=\"#66c2a5\", direction=\"in\", rotation=90, labelsize=12\n)\nax1.tick_params(\n axis=\"x\",\n direction=\"in\",\n labelsize=12,\n)\nax1.set_yticks(yticks_values_1)\nax1.set_ylim(ylim_values_1)\n\n# Adding PM2.5 values to the plot\nfor i, txt in enumerate(pm25_levels):\n ax1.annotate(\n f\"{txt} µg/m³\",\n (sampling_points[i], txt),\n textcoords=\"offset points\",\n xytext=(0, 10),\n ha=\"center\",\n fontsize=12,\n )\n\n# NO2 plot with a secondary y-axis\nax2 = ax1.twinx()\n(no2_line,) = ax2.plot(\n sampling_points,\n no2_levels,\n \"s-\",\n color=\"#fc8d62\", # Soft brown\n label=label_no2,\n markersize=10,\n linewidth=3,\n mec=\"black\",\n)\nax2.set_ylabel(ylabel_value_2, color=\"#fc8d62\", fontsize=14)\nax2.tick_params(\n axis=\"y\", labelcolor=\"#fc8d62\", direction=\"in\", rotation=90, labelsize=12\n)\nax2.set_yticks(yticks_values_2)\nax2.set_ylim(ylim_values_2)\n\n# Adding NO2 values to the plot\nfor i, txt in enumerate(no2_levels):\n ax2.annotate(\n f\"{txt} ppb\",\n (sampling_points[i], txt),\n textcoords=\"offset points\",\n xytext=(0, -20),\n ha=\"center\",\n fontsize=12,\n )\n\n# Avg PM2.5 and NO2 dashed lines\nax1.axhline(y=30, color=\"#66c2a5\", linestyle=\":\", linewidth=2)\nax2.axhline(y=45, color=\"#fc8d62\", linestyle=\"--\", linewidth=2)\n\n# Creating custom legend items\navg_pm25_legend = Line2D([0], [0], color=\"#66c2a5\", linestyle=\":\", linewidth=2, label=avg_label_pm25)\navg_no2_legend = Line2D([0], [0], color=\"#fc8d62\", linestyle=\"--\", linewidth=2, label=avg_label_no2)\n\n# Adding legends\nfirst_legend = ax1.legend(\n handles=[avg_pm25_legend, avg_no2_legend],\n loc=\"upper left\",\n ncol=2,\n fontsize=14,\n edgecolor=\"black\",\n)\nax1.add_artist(first_legend) # Add the first legend manually\nsecond_legend = ax1.legend(\n handles=[pm25_line, no2_line], loc=\"upper right\", fontsize=14, edgecolor=\"black\"\n) # Add the second legend\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"line_172.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "line" }, { "id": "test_49", "content": { "Row_Affiliation": [ "Liberal", "Liberal", "Liberal", "Liberal", "Liberal", "Conservative", "Conservative", "Conservative", "Conservative", "Conservative", "Independent", "Independent", "Independent", "Independent", "Independent", "Socialist", "Socialist", "Socialist", "Socialist", "Socialist", "Libertarian", "Libertarian", "Libertarian", "Libertarian", "Libertarian" ], "Column_Affiliation": [ "Liberal", "Conservative", "Independent", "Socialist", "Libertarian", "Liberal", "Conservative", "Independent", "Socialist", "Libertarian", "Liberal", "Conservative", "Independent", "Socialist", "Libertarian", "Liberal", "Conservative", "Independent", "Socialist", "Libertarian", "Liberal", "Conservative", "Independent", "Socialist", "Libertarian" ], "Election_1_Percent": [ 34.2, 18.7, 2.8, 21.5, 14.8, 28.4, 22.1, 3.1, 18.9, 27.5, 37.0, 14.4, 1.6, 40.5, 6.5, 42.5, 10.3, 3.7, 25.1, 18.4, 33.8, 15.5, 5.2, 12.6, 32.9 ], "Election_2_Percent": [ 45.3, 3.8, 22.1, 13.9, 14.9, 22.7, 17.5, 19.0, 32.6, 8.2, 30.4, 5.9, 2.3, 52.4, 9.0, 28.6, 6.7, 12.4, 38.3, 14.0, 20.5, 22.5, 25.7, 11.5, 19.8 ] }, "visual_intent": "A figure with 2 subplots: (1) a bubble chart heatmap showing voting distribution for Election 1, (2) a bubble chart heatmap showing voting distribution for Election 2, both comparing political affiliations across rows and columns.(size of the desired plot: width=20.0, height=8.0)", "path_to_gt_image": "images/heatmap_86.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom matplotlib.colors import LogNorm\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Defining a more vibrant colormap\ncmap = plt.cm.viridis\n\n# Data for the two subplots representing political voting patterns\ndata1 = np.array(\n [\n [34.2, 18.7, 2.8, 21.5, 14.8],\n [28.4, 22.1, 3.1, 18.9, 27.5],\n [37.0, 14.4, 1.6, 40.5, 6.5],\n [42.5, 10.3, 3.7, 25.1, 18.4],\n [33.8, 15.5, 5.2, 12.6, 32.9],\n ]\n)\n\ndata2 = np.array(\n [\n [45.3, 3.8, 22.1, 13.9, 14.9],\n [22.7, 17.5, 19.0, 32.6, 8.2],\n [30.4, 5.9, 2.3, 52.4, 9.0],\n [28.6, 6.7, 12.4, 38.3, 14.0],\n [20.5, 22.5, 25.7, 11.5, 19.8],\n ]\n)\n\n# X and Y labels\nx_labels = [\"Liberal\", \"Conservative\", \"Independent\", \"Socialist\", \"Libertarian\"]\ny_labels = [\"Liberal\", \"Conservative\", \"Independent\", \"Socialist\", \"Libertarian\"]\n\n# Subplot titles\ntitles = [\"(a) Voting Distribution in Election 1\", \"(b) Voting Distribution in Election 2\"]\n\n# Set up the colormap and norm (log scale)\nnorm = LogNorm(vmin=0.1, vmax=100)\n\n# Axes Limits and Labels\nxticks_values = range(len(x_labels))\nyticks_values = range(len(y_labels))\ncolorbar_ticks = [0.1, 1, 10, 100]\nyticklabels = [\"0.1\", \"1\", \"10\", \"100\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set up the figure\nfig, axes = plt.subplots(\n 1, 2, figsize=(20, 8), gridspec_kw={\"width_ratios\": [1, 1], \"wspace\": 0.3}\n)\n\n\n# Function to create a subplot\ndef create_subplot(ax, data, title):\n # Create the scatter plot\n for i in range(data.shape[0]):\n for j in range(data.shape[1]):\n # Calculate the color based on the original value\n color = cmap(norm(data[i, j]))\n\n # Draw the circle with a fixed size\n circle = plt.Circle((j, i), 0.4, color=color) # Fixed size\n ax.add_artist(circle)\n\n # Determine text color based on the value\n text_color = \"white\" if data[i, j] > 25 else \"black\"\n\n # Add the text inside the circle\n ax.text(\n j, i, f\"{data[i, j]:.1f}%\", ha=\"center\", va=\"center\", color=text_color\n )\n\n # Set labels for x and y axes\n ax.set_xticks(range(len(x_labels)))\n ax.set_xticklabels(x_labels, ha=\"center\")\n ax.set_yticks(range(len(y_labels)))\n ax.set_yticklabels(y_labels, va=\"center\")\n\n # Adding the title for the subplot\n ax.set_title(title, fontsize=16)\n\n # Set the limits of the axes; they should be one more than your data range\n ax.set_xlim(-0.5, data.shape[1] - 0.5)\n ax.set_ylim(-0.5, data.shape[0] - 0.5)\n\n # Set the aspect of the plot to be equal and add a frame\n ax.set_aspect(\"equal\")\n for spine in ax.spines.values():\n spine.set_visible(True)\n\n\n# Create each subplot\ncreate_subplot(axes[0], data1, titles[0])\ncreate_subplot(axes[1], data2, titles[1])\n\n# Create a colorbar on the far right side of the figure\nsm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)\nsm.set_array([])\ncbar = fig.colorbar(\n sm,\n ax=axes,\n ticks=colorbar_ticks,\n orientation=\"vertical\",\n fraction=0.015,\n pad=0.05,\n)\ncbar.ax.set_yticklabels(yticklabels)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"heatmap_86.pdf\", bbox_inches=\"tight\")\n\n", "width": 20.0, "height": 8.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_50", "content": { "Law Firm Label": [ "Baker & McKenzie\n35%", "Skadden\n20%", "Clifford Chance\n18%", "Latham & Watkins\n12%", "Allen & Overy\n10%", "Others\n5%" ], "Market Share": [ 35, 20, 18, 12, 10, 5 ] }, "visual_intent": "A treemap about law firms and market share, titled Market Share of Global Law Firms(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/tree_69.jpg", "original_category": "tree", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data\nsizes = [35, 20, 18, 12, 10, 5]\nlabels = [\n \"Baker & McKenzie\\n35%\",\n \"Skadden\\n20%\",\n \"Clifford Chance\\n18%\",\n \"Latham & Watkins\\n12%\",\n \"Allen & Overy\\n10%\",\n \"Others\\n5%\",\n]\ntitle = \"Market Share of Global Law Firms\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#2E86C1\", \"#A569BD\", \"#45B39D\", \"#F4D03F\", \"#E74C3C\", \"#5D6D7E\"]\n# Create a figure with the specified size\nfig = plt.figure(figsize=(8, 6))\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes,\n label=labels,\n color=colors,\n alpha=0.9,\n text_kwargs={\"fontsize\": 12, \"color\": \"white\"},\n ec=\"white\",\n)\n\n# Set the title\nplt.title(title, fontsize=18)\n\n# Remove axes\nplt.axis(\"off\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout and save to file\nplt.tight_layout()\nplt.savefig(\"tree_69.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_51", "content": { "Category": [ "Advertising", "Staff Salaries", "Events", "Travel", "Miscellaneous" ], "Total_Campaign_Budget": [ 500, 300, 150, 100, 50 ], "Specific_Rally_Budget": [ 120, 90, 30, 20, 10 ] }, "visual_intent": "A nested pie chart about political campaign budget categories comparing total allocation and specific rally allocation, titled Political Campaign Budget Allocation(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/pie_53.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n\n# New data for a political campaign budget\nlabels = [\"Advertising\", \"Staff Salaries\", \"Events\", \"Travel\", \"Miscellaneous\"]\nouter_sizes = [500, 300, 150, 100, 50] # Total campaign budget allocation\ninner_sizes = [120, 90, 30, 20, 10] # Budget allocation for a specific rally\n\ntitle = \"Political Campaign Budget Allocation\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, ax = plt.subplots(figsize=(8, 8))\n\nouter_colors = [\"#4c72b0\", \"#55a868\", \"#c44e52\", \"#8172b3\", \"#ccb974\"]\ninner_colors = [\"#77bedb\", \"#59c794\", \"#f28e2b\", \"#f2c398\", \"#e15759\"]\nouter_hatch = [\"/\", \"\\\\\", \"|\", \"-\", \"+\"] # Different hatching for outer ring\ninner_hatch = [\"x\", \"*\", \"o\", \"O\", \".\"] # Different hatching for inner ring\n\nexplode_outer = (0.1, 0, 0, 0, 0) # only explode the 1st slice\n\n# Outer ring\nwedges, texts, autotexts = ax.pie(\n outer_sizes,\n labels=labels,\n radius=1.2,\n colors=outer_colors,\n explode=explode_outer,\n autopct=\"%1.1f%%\",\n pctdistance=0.85,\n startangle=140,\n wedgeprops=dict(width=0.3, edgecolor=\"w\", hatch=\"*\"),\n)\n\n# Inner ring\nwedges2, texts2, autotexts2 = ax.pie(\n inner_sizes,\n radius=0.9,\n colors=inner_colors,\n autopct=\"%1.1f%%\",\n pctdistance=0.75,\n startangle=140,\n wedgeprops=dict(width=0.3, edgecolor=\"w\", hatch=\"o\"),\n)\n\n# Customizing the autotexts for better visibility\nfor autotext in autotexts + autotexts2:\n autotext.set_color(\"black\")\n autotext.set_fontsize(10)\n\n# Title for the double layer pie chart\nax.set_title(title, fontsize=16, y=1.05)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Improve layout to make room for legend or labels if necessary\nplt.tight_layout()\n\n# Show the plot\nplt.savefig(\"pie_53.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_52", "content": { "Art Movement": [ "Cubism", "Impressionism", "Surrealism", "Abstract", "Modernism", "Renaissance", "Baroque", "Romanticism", "Realism" ], "Color Theory": [ 1.5, 1.7, 1.9, 1.3, 1.8, 1.4, 1.6, 1.2, 1.1 ], "Composition": [ 0.9, 1.1, 1.3, 0.7, 1.0, 1.4, 1.5, 0.8, 0.6 ], "Creativity": [ 0.8, 1.0, 1.2, 0.5, 0.9, 1.3, 1.1, 0.7, 0.4 ], "Technical Skill": [ 1.2, 1.4, 1.6, 0.9, 1.5, 1.8, 1.7, 1.0, 0.8 ] }, "visual_intent": "A figure with 4 subplots showing scatter plots about art movements and artistic scores across Color Theory, Composition, Creativity, and Technical Skill, titled Art Movement Characteristics(size of the desired plot: width=10.0, height=10.0)", "path_to_gt_image": "images/scatter_93.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\nmodels = [\n \"Cubism\",\n \"Impressionism\",\n \"Surrealism\",\n \"Abstract\",\n \"Modernism\",\n \"Renaissance\",\n \"Baroque\",\n \"Romanticism\",\n \"Realism\",\n]\nvalues = {\n \"Color Theory\": [1.5, 1.7, 1.9, 1.3, 1.8, 1.4, 1.6, 1.2, 1.1],\n \"Composition\": [0.9, 1.1, 1.3, 0.7, 1.0, 1.4, 1.5, 0.8, 0.6],\n \"Creativity\": [0.8, 1.0, 1.2, 0.5, 0.9, 1.3, 1.1, 0.7, 0.4],\n \"Technical Skill\": [1.2, 1.4, 1.6, 0.9, 1.5, 1.8, 1.7, 1.0, 0.8],\n \"Conceptual Thinking\": [0.6, 0.8, 1.0, 0.4, 0.7, 1.2, 1.3, 0.5, 0.3],\n \"Innovation\": [1.3, 1.5, 1.7, 1.1, 1.4, 0.9, 1.0, 0.7, 0.5],\n}\nxlabel = \"Art Movements\"\nylabel = \"Artistic Score\"\ntitle = \"Art Movement Characteristics\"\nsubtitle = \"Comparison of Different Art Movements Across Various Attributes\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create subplots 2x2\nfig, axs = plt.subplots(2, 2, figsize=(10, 10), sharey=True)\naxes = axs.flatten()\n\n# Colors from a pastel palette\ncolors = [\"#ff9999\", \"#66b3ff\", \"#99ff99\", \"#ffcc99\", \"#c2c2f0\", \"#ffb3e6\"]\n\n# Plot each category\nfor ax, (category, color) in zip(axes, zip(values.keys(), colors)):\n ax.scatter(\n models,\n values[category],\n color=color,\n label=category,\n s=100,\n edgecolor=\"black\",\n alpha=0.7,\n marker=\"o\",\n )\n ax.set_title(category, fontsize=12)\n ax.set_xticks(models)\n ax.set_xticklabels(models, rotation=45, ha=\"right\", fontsize=10)\n ax.set_xlabel(xlabel, fontsize=10)\n ax.set_ylabel(ylabel, fontsize=10)\n ax.legend()\n\n# Enhance style\nfor ax in axes:\n ax.spines[\"top\"].set_visible(False)\n ax.spines[\"right\"].set_visible(False)\n ax.grid(True, linestyle=\"--\", alpha=0.5)\n ax.set_ylim(0, 2) # Ensure all plots have the same y-axis limits\n\n# Adding titles and subtitle\nplt.suptitle(title, fontsize=14, weight=\"bold\")\nplt.figtext(0.5, 0.01, subtitle, ha=\"center\", fontsize=12, style=\"italic\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save plot\nplt.tight_layout(rect=[0, 0.03, 1, 0.95])\nplt.savefig(\"scatter_93.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 10.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_53", "content": { "Party": [ "Party A", "Party B", "Party C", "Party D" ], "Judge_A_Wins": [ 52, 30, 18, 45 ], "Judge_A_Ties": [ 20, 25, 30, 20 ], "Judge_A_Losses": [ 28, 45, 52, 35 ], "Judge_B_Wins": [ 55, 28, 20, 40 ], "Judge_B_Ties": [ 18, 22, 27, 25 ], "Judge_B_Losses": [ 27, 50, 53, 35 ] }, "visual_intent": "A figure with 2 subplots: (1) a horizontal stacked bar chart showing election results (wins, ties, losses) for four parties judged by Judge A, (2) a horizontal stacked bar chart showing comparable election results judged by Judge B(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/bar_153.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\n\n# ===================\n# Part 2: Data Preparation and Text\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data\ncategories = [\"Party A\", \"Party B\", \"Party C\", \"Party D\"]\nwins = [52, 30, 18, 45]\nties = [20, 25, 30, 20]\nlosses = [28, 45, 52, 35]\n\nwins2 = [55, 28, 20, 40]\nties2 = [18, 22, 27, 25]\nlosses2 = [27, 50, 53, 35]\n\nindices = np.arange(len(categories))\n\nxlabel = \"Election 2022 (Judge A)\"\nxlabel2 = \"Election 2022 (Judge B)\"\n\nlabels = [\n \"Party A - Wins\",\n \"Party B - Wins\",\n \"Party C - Wins\",\n \"Party D - Wins\",\n \"Party A - Ties\",\n \"Party B - Ties\",\n \"Party C - Ties\",\n \"Party D - Ties\",\n \"Party A - Losses\",\n \"Party B - Losses\",\n \"Party C - Losses\",\n \"Party D - Losses\",\n]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Define colors\ncolors_wins = [\"#E94E77\", \"#6192C7\", \"#77C29A\", \"#FFC107\"]\ncolors_ties = [\"#F7A9A8\", \"#A9C6E8\", \"#C6E7B5\", \"#FFECB3\"]\ncolors_losses = [\"#F6D2D0\", \"#D5E2F4\", \"#E8F5E2\", \"#FFF3CD\"]\n\n# Plot data\nbar_width = 0.5\n\n# Create figure and axes\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))\n\n# Function to plot bars\ndef plot_bars(ax, wins, ties, losses, colors_wins, colors_ties, colors_losses):\n for i, (win, tie, loss) in enumerate(zip(wins, ties, losses)):\n ax.barh(i, win, bar_width, color=colors_wins[i], edgecolor=\"white\")\n ax.barh(i, tie, bar_width, left=win, color=colors_ties[i], edgecolor=\"white\")\n ax.barh(\n i,\n loss,\n bar_width,\n left=win + tie,\n color=colors_losses[i],\n edgecolor=\"white\",\n )\n ax.text(win / 2, i, f\"{win}\", ha=\"center\", va=\"center\", color=\"white\")\n ax.text(win + tie / 2, i, f\"{tie}\", ha=\"center\", va=\"center\", color=\"black\")\n ax.text(\n win + tie + loss / 2, i, f\"{loss}\", ha=\"center\", va=\"center\", color=\"black\"\n )\n\nplot_bars(ax1, wins, ties, losses, colors_wins, colors_ties, colors_losses)\n\n# Set labels, title, and legend for ax1\nax1.set_yticks(indices)\nax1.set_yticklabels(categories)\nax1.invert_yaxis() # labels read top-to-bottom\nax1.set_xlabel(xlabel)\nax1.set_xticks([])\n\nplot_bars(ax2, wins2, ties2, losses2, colors_wins, colors_ties, colors_losses)\n# Set labels, title, and legend for ax2\nax2.set_yticks(indices)\nax2.set_yticklabels(categories)\nax2.invert_yaxis() # labels read top-to-bottom\nax2.set_xlabel(xlabel2)\nax2.set_xticks([])\n\n# Adjust layout and set background color\nfig.patch.set_facecolor(\"white\")\nfor ax in [ax1, ax2]:\n ax.set_facecolor(\"white\")\n ax.spines[\"top\"].set_edgecolor(\"gray\")\n ax.spines[\"right\"].set_edgecolor(\"gray\")\n ax.spines[\"bottom\"].set_edgecolor(\"gray\")\n ax.spines[\"left\"].set_edgecolor(\"gray\")\n\n# Create a global legend\npatch1 = mpatches.Patch(color=\"#E94E77\", label=labels[0])\npatch2 = mpatches.Patch(color=\"#6192C7\", label=labels[1])\npatch3 = mpatches.Patch(color=\"#77C29A\", label=labels[2])\npatch4 = mpatches.Patch(color=\"#FFC107\", label=labels[3])\npatch5 = mpatches.Patch(color=\"#F7A9A8\", label=labels[4])\npatch6 = mpatches.Patch(color=\"#A9C6E8\", label=labels[5])\npatch7 = mpatches.Patch(color=\"#C6E7B5\", label=labels[6])\npatch8 = mpatches.Patch(color=\"#FFECB3\", label=labels[7])\npatch9 = mpatches.Patch(color=\"#F6D2D0\", label=labels[8])\npatch10 = mpatches.Patch(color=\"#D5E2F4\", label=labels[9])\npatch11 = mpatches.Patch(color=\"#E8F5E2\", label=labels[10])\npatch12 = mpatches.Patch(color=\"#FFF3CD\", label=labels[11])\nfig.legend(\n handles=[patch1, patch2, patch3, patch4, patch5, patch6, patch7, patch8, patch9, patch10, patch11, patch12],\n loc=\"upper center\",\n ncol=4,\n bbox_to_anchor=(0.5, 1.1),\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the figure\nplt.tight_layout()\nplt.savefig(\"bar_153.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_54", "content": { "Learning Rate": [ 0.01, 0.05, 0.1, 0.2 ], "Error Rate (Batch 64)": [ 0.18, 0.15, 0.12, 0.1 ], "Error Rate (Batch 128)": [ 0.16, 0.13, 0.11, 0.09 ], "Error Rate (Batch 256)": [ 0.14, 0.11, 0.08, 0.07 ], "Dropout Rate": [ 0.0, 0.1, 0.2, 0.3 ], "Accuracy (Batch 64)": [ 0.82, 0.85, 0.83, 0.8 ], "Accuracy (Batch 128)": [ 0.84, 0.87, 0.86, 0.83 ] }, "visual_intent": "A figure with 6 subplots organized in a 3x2 grid, visualizing the impact of Learning Rate on Error Rate (left column) and Dropout Rate on Accuracy (right column) for different Batch Sizes (64, 128, 256)(size of the desired plot: width=12.0, height=9.0)", "path_to_gt_image": "images/line_57.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n\n# Simulated data based on the previous setup\nlearning_rate = [0.01, 0.05, 0.1, 0.2]\nerror_rate_64 = np.array([0.18, 0.15, 0.12, 0.10])\nerror_rate_128 = np.array([0.16, 0.13, 0.11, 0.09])\nerror_rate_256 = np.array([0.14, 0.11, 0.08, 0.07])\ndropout_rate = [0.0, 0.1, 0.2, 0.3]\naccuracy_64 = np.array([0.82, 0.85, 0.83, 0.80])\naccuracy_128 = np.array([0.84, 0.87, 0.86, 0.83])\n\n# Axes Limits and Labels\nxlabel_value = \"Parameter Rate\"\n\nylabel_value = \"Metric\"\n\n# Labels\nlabel_1 = \" (Batch Size=64)\"\nlabel_2 = \" (Batch Size=128)\"\nlabel_3 = \"Error Rate vs. Learning Rate\"\nlabel_4 = \"Accuracy vs. Dropout\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with a 3x2 grid\nfig, axs = plt.subplots(3, 2, figsize=(12, 9))\n\n# Custom colors for the plots\ncolors = [\"dodgerblue\", \"tomato\", \"limegreen\", \"gold\", \"purple\"]\n\n\n# Function to plot the data\ndef plot_data(ax, x, y1, y2, title, marker1, marker2, color1, color2):\n ax.plot(\n x,\n y1,\n marker=marker1,\n markersize=8,\n linewidth=2,\n color=color1,\n label=f\"{title}{label_1}\",\n )\n ax.plot(\n x,\n y2,\n marker=marker2,\n markersize=8,\n linewidth=2,\n color=color2,\n label=f\"{title}{label_2}\",\n )\n ax.set_title(title, fontsize=14)\n ax.set_xlabel(xlabel_value, fontsize=12)\n ax.set_ylabel(ylabel_value, fontsize=12)\n ax.legend(loc=\"best\", fontsize=10, frameon=True, shadow=True)\n ax.grid(True, linestyle=\"--\", alpha=0.5)\n\n\n# Assigning data to each subplot\nplot_data(\n axs[0, 0],\n learning_rate,\n error_rate_64,\n error_rate_128,\n label_3,\n \"o\",\n \"s\",\n colors[0],\n colors[1],\n)\nplot_data(\n axs[0, 1],\n dropout_rate,\n accuracy_64,\n accuracy_128,\n label_4,\n \"^\",\n \"d\",\n colors[2],\n colors[3],\n)\nplot_data(\n axs[1, 0],\n learning_rate,\n error_rate_128,\n error_rate_256,\n label_3,\n \">\",\n \"<\",\n colors[4],\n colors[0],\n)\nplot_data(\n axs[1, 1],\n dropout_rate,\n accuracy_128,\n accuracy_64,\n label_4,\n \"p\",\n \"*\",\n colors[1],\n colors[2],\n)\nplot_data(\n axs[2, 0],\n learning_rate,\n error_rate_256,\n error_rate_64,\n label_3,\n \"H\",\n \"X\",\n colors[3],\n colors[4],\n)\nplot_data(\n axs[2, 1],\n dropout_rate,\n accuracy_64,\n accuracy_128,\n label_4,\n \"+\",\n \"x\",\n colors[0],\n colors[1],\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and display the plots\nplt.tight_layout()\nplt.savefig(\"line_57.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 9.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "line" }, { "id": "test_55", "content": { "Value": [ 12, 28, 30, 40, 45, 55 ] }, "visual_intent": "A pie chart about numerical values, titled Slice of a pie chart(size of the desired plot: width=5.0, height=5.0)", "path_to_gt_image": "images/pie_5.jpg", "original_category": "pie", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nnp.random.seed(0)\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data to plot\nsizes = [12, 28, 30, 40, 45, 55]\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot\nfig, ax = plt.subplots(figsize=(5, 5))\ncolors = plt.cm.Reds(np.linspace(0, 1, 6)) # Use colormap to color the slices\nexplode = (0.1, 0.1, 0.1, 0.1, 0.1, 0.1) # add explode parameter to separate slices\nax.pie(\n sizes,\n colors=colors,\n autopct=\"%1.1f%%\",\n startangle=140,\n wedgeprops=dict(edgecolor=\"w\"),\n explode=explode,\n)\n\n# Set aspect ratio to be equal so that pie is drawn as a circle.\nax.axis(\"equal\")\n\nplt.title(\"Slice of a pie chart\", fontsize=16)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"pie_5.pdf\", bbox_inches=\"tight\")\n", "width": 5.0, "height": 5.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_56", "content": { "Focus Area": [ "Cloud Computing", "Cybersecurity", "Artificial Intelligence", "Blockchain", "Data Privacy", "Quantum Computing" ], "Size": [ 35, 30, 20, 8, 5, 2 ] }, "visual_intent": "A treemap about Tech Industry Focus Areas and their distribution sizes, titled Tech Industry Focus Areas Distribution(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/tree_16.jpg", "original_category": "tree", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data\nsizes = [35, 30, 20, 8, 5, 2]\nlabels = [\"Cloud Computing\", \"Cybersecurity\", \"Artificial Intelligence\", \"Blockchain\", \"Data Privacy\", \"Quantum Computing\"]\ntitle = \"Tech Industry Focus Areas Distribution\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#4A90E2\", \"#50E3C2\", \"#B8E986\", \"#7ED321\", \"#417505\", \"#BD10E0\"]\n# Create a figure with the specified size\nfig = plt.figure(figsize=(10, 6))\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes,\n label=labels,\n color=colors,\n alpha=0.7,\n text_kwargs={\"fontsize\": 12, \"color\": \"white\"},\n ec=\"black\", # edge color\n)\n\n# Add title\nplt.title(title, fontsize=18)\n\n# Remove axes\nplt.axis(\"off\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout and save to file\nplt.tight_layout()\nplt.savefig(\"tree_16.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_57", "content": { "Category": [ "line", "heatmap", "line_num", "candlestick", "3D-bar", "rose", "multi-axes", "bubble", "radar", "area", "pie", "funnel", "histogram", "bar_num", "box", "treemap" ], "QWen-VL": [ 3.0, 3.5, 4.2, 4.0, 4.8, 5.0, 4.0, 3.2, 4.0, 4.3, 3.6, 3.8, 4.4, 4.2, 3.6, 4.0 ], "SPHINX-V2": [ 3.5, 3.2, 3.6, 3.5, 3.7, 3.1, 3.4, 4.0, 4.5, 3.7, 4.0, 2.8, 3.0, 4.0, 2.9, 3.0 ], "ChartLlama": [ 2.0, 2.4, 2.3, 2.4, 2.5, 2.4, 2.3, 2.2, 1.4, 2.5, 1.3, 1.4, 2.2, 2.3, 1.4, 1.5 ] }, "visual_intent": "A radar chart comparing the performance scores of three models (QWen-VL, SPHINX-V2, ChartLlama) across various chart types(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/radar_7.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\nfrom math import pi\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Define the data for each line\nlabels = np.array(\n [\n \"line\",\n \"heatmap\",\n \"line_num\",\n \"candlestick\",\n \"3D-bar\",\n \"rose\",\n \"multi-axes\",\n \"bubble\",\n \"radar\",\n \"area\",\n \"pie\",\n \"funnel\",\n \"histogram\",\n \"bar_num\",\n \"box\",\n \"treemap\",\n ]\n)\nnum_vars = len(labels)\n\nvalues1 = np.array([3, 3.5, 4.2, 4, 4.8, 5, 4, 3.2, 4, 4.3, 3.6, 3.8, 4.4, 4.2, 3.6, 4])\nvalues2 = np.array(\n [3.5, 3.2, 3.6, 3.5, 3.7, 3.1, 3.4, 4, 4.5, 3.7, 4, 2.8, 3, 4, 2.9, 3]\n)\nvalues3 = np.array(\n [2, 2.4, 2.3, 2.4, 2.5, 2.4, 2.3, 2.2, 1.4, 2.5, 1.3, 1.4, 2.2, 2.3, 1.4, 1.5]\n)\nlabels2 = [\"QWen-VL\", \"SPHINX-V2\", \"ChartLlama\"]\nyticks = [1, 2, 3, 4, 5]\nytickslabel = [\"1\", \"2\", \"3\", \"4\", \"5\"]\nylim = [0, 5]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot\nfig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True))\n\n# Compute angle for each axis\nangles = [n / float(num_vars) * 2 * pi for n in range(num_vars)]\nvalues1 = np.concatenate((values1, [values1[0]]))\nvalues2 = np.concatenate((values2, [values2[0]]))\nvalues3 = np.concatenate((values3, [values3[0]]))\nangles += angles[:1]\n\n# Draw one axe per variable and add labels\nplt.xticks(angles[:-1], labels)\n\n# Draw ylabels\nax.set_rlabel_position(0)\nplt.yticks(yticks, ytickslabel, color=\"black\", size=7)\nplt.ylim(ylim)\n\n# Plot data\nax.plot(\n angles,\n values1,\n linewidth=1,\n linestyle=\"solid\",\n label=labels2[0],\n color=\"#971d2b\",\n marker=\"o\",\n)\nax.fill(angles, values1, \"#971d2b\", alpha=0.1)\n\nax.plot(\n angles,\n values2,\n linewidth=1,\n linestyle=\"dashed\",\n label=labels2[1],\n color=\"#6f98c3\",\n marker=\"s\",\n)\nax.fill(angles, values2, \"#6f98c3\", alpha=0.1)\n\nax.plot(\n angles,\n values3,\n linewidth=1,\n linestyle=\"dotted\",\n label=labels2[2],\n color=\"#f4c17d\",\n marker=\"D\",\n)\nax.fill(angles, values3, \"#f4c17d\", alpha=0.1)\n\n# Add legend\nplt.legend(loc=\"lower left\", bbox_to_anchor=(-0.15, -0.1))\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_7.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_58", "content": { "Year": [ "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022" ], "Tech-A Adoption": [ 20, 30, 45, 55, 65, 75, 80, 85 ], "Tech-A Error": [ 2, 3, 2, 4, 3, 3, 2, 3 ], "Tech-B Adoption": [ 15, 25, 35, 50, 60, 68, 73, 78 ], "Tech-B Error": [ 3, 2, 3, 4, 3, 2, 3, 2 ] }, "visual_intent": "A line chart with error bars about years and adoption rates for two technologies, titled Technology Adoption Rates Over Time(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/line_77.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for Technology Adoption Rates\nyears = np.array([\"2015\", \"2016\", \"2017\", \"2018\", \"2019\", \"2020\", \"2021\", \"2022\"])\ntech_a_adoption = np.array([20, 30, 45, 55, 65, 75, 80, 85])\ntech_a_err = np.array([2, 3, 2, 4, 3, 3, 2, 3])\n\ntech_b_adoption = np.array([15, 25, 35, 50, 60, 68, 73, 78])\ntech_b_err = np.array([3, 2, 3, 4, 3, 2, 3, 2])\n\n# Labels\nlabel_tech_a = \"Tech-A Adoption\"\nlabel_tech_b = \"Tech-B Adoption\"\ntitle = \"Technology Adoption Rates Over Time\"\nxlabel_value = \"Year\"\nylabel_value = \"Adoption Rate (%)\"\nlegend_location = \"upper left\"\n\n# Axes Limits and Labels\nyticks_values = np.arange(0, 101, 20)\nylim_values = [0, 100]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nplt.figure(figsize=(10, 6))\n\nplt.errorbar(\n years,\n tech_a_adoption,\n yerr=tech_a_err,\n fmt=\"o-\",\n label=label_tech_a,\n color=\"#1f77b4\",\n capsize=5,\n linewidth=2,\n markersize=8\n)\nplt.errorbar(\n years,\n tech_b_adoption,\n yerr=tech_b_err,\n fmt=\"--\",\n label=label_tech_b,\n color=\"#2ca02c\",\n marker=\"s\",\n capsize=5,\n linewidth=2,\n markersize=8\n)\n\n# Set x,y-axis to only display specific ticks and extend y-axis to leave space at top\nplt.yticks(yticks_values, fontsize=14)\nplt.ylim(ylim_values)\n\n# Set x-axis label to be rotated and styled\nplt.xticks(rotation=45, fontsize=12)\n\n# Adding labels and title\nplt.title(title, fontsize=18)\nplt.xlabel(xlabel_value, fontsize=16)\nplt.ylabel(ylabel_value, fontsize=16)\nplt.legend(loc=legend_location, fontsize=14)\n\n# Adjusting figure size\nplt.gcf().set_size_inches(10, 6)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to reduce white space\nplt.tight_layout()\nplt.savefig(\"line_77.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "line" }, { "id": "test_59", "content": { "Label": [ "Facebook\n25.00%", "YouTube\n20.00%", "WhatsApp\n15.00%", "Instagram\n13.00%", "TikTok\n10.00%", "Snapchat\n8.00%", "Twitter\n5.00%", "LinkedIn\n4.00%" ], "Size": [ 25.0, 20.0, 15.0, 13.0, 10.0, 8.0, 5.0, 4.0 ] }, "visual_intent": "A treemap about social media platforms and their usage percentages(size of the desired plot: width=12.0, height=8.0)", "path_to_gt_image": "images/tree_7.jpg", "original_category": "tree", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data\nsizes = [25.00, 20.00, 15.00, 13.00, 10.00, 8.00, 5.00, 4.00]\nlabels = [\n \"Facebook\\n25.00%\",\n \"YouTube\\n20.00%\",\n \"WhatsApp\\n15.00%\",\n \"Instagram\\n13.00%\",\n \"TikTok\\n10.00%\",\n \"Snapchat\\n8.00%\",\n \"Twitter\\n5.00%\",\n \"LinkedIn\\n4.00%\",\n]\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\n \"#66c2a5\", # Facebook\n \"#fc8d62\", # YouTube\n \"#8da0cb\", # WhatsApp\n \"#e78ac3\", # Instagram\n \"#a6d854\", # TikTok\n \"#ffd92f\", # Snapchat\n \"#e5c494\", # Twitter\n \"#b3b3b3\", # LinkedIn\n]\n# Create a figure with the specified size\nfig = plt.figure(figsize=(12, 8))\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes, label=labels, color=colors, alpha=0.8, text_kwargs={\"fontsize\": 18}\n)\n\n# Remove axes\nplt.axis(\"off\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout and save to file\nplt.tight_layout()\nplt.savefig(\"tree_7.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 8.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_60", "content": { "Instance size": [ "15x15", "20x15", "20x20", "30x15", "30x20", "50x15", "50x20", "100x20" ], "PetriRL": [ 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500 ], "GAM": [ 2200, 2700, 3200, 3700, 4200, 4700, 5200, 5700 ], "GIN": [ 2400, 2900, 3400, 3900, 4400, 4900, 5400, 5900 ], "DGERD": [ 2600, 3100, 3600, 4100, 4600, 5100, 5600, 6100 ], "Improvement %": [ 0.18, 0.14, 0.13, 0.12, 0.09, 0.0, 0.0, -0.05 ] }, "visual_intent": "A combination chart with grouped bars displaying Makespan metrics for different methods and a line plot showing Improvement % across various instance sizes(size of the desired plot: width=8.0, height=5.0)", "path_to_gt_image": "images/CB_25.jpg", "original_category": "CB", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Sample data\ninstance_sizes = [\n \"15x15\",\n \"20x15\",\n \"20x20\",\n \"30x15\",\n \"30x20\",\n \"50x15\",\n \"50x20\",\n \"100x20\",\n]\npetriRL = [2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500]\nGAM = [2200, 2700, 3200, 3700, 4200, 4700, 5200, 5700]\nGIN = [2400, 2900, 3400, 3900, 4400, 4900, 5400, 5900]\nDGERD = [2600, 3100, 3600, 4100, 4600, 5100, 5600, 6100]\nimprovement = [0.18, 0.14, 0.13, 0.12, 0.09, 0, 0, -0.05]\nlabels = [\"PetriRL\", \"GAM\", \"GIN\", \"DGERD\"]\nxlabel = \"Instance size\"\nylabel1 = \"Makespan (step)\"\nylabel2 = \"Improvement %\"\nlegend_title = \"Methods\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and axis\nfig, ax1 = plt.subplots(figsize=(8, 5))\n\n# Bar plot\nbar_width = 0.2\nindex = np.arange(len(instance_sizes))\nax1.bar(index, petriRL, bar_width, label=labels[0], color=\"limegreen\")\nax1.bar(index + bar_width, GAM, bar_width, label=labels[1], color=\"sandybrown\")\nax1.bar(index + 2 * bar_width, GIN, bar_width, label=labels[2], color=\"cornflowerblue\")\nax1.bar(index + 3 * bar_width, DGERD, bar_width, label=labels[3], color=\"plum\")\n\n# Line plot\nax2 = ax1.twinx()\nax2.plot(\n instance_sizes,\n improvement,\n color=\"orangered\",\n marker=\"o\",\n linestyle=\"-\",\n linewidth=2,\n markersize=5,\n)\n\n# Annotate improvement percentages\nfor i, imp in enumerate(improvement):\n ax2.annotate(\n f\"{imp*100:.0f}%\",\n (index[i] + bar_width * 1.2, imp),\n textcoords=\"offset points\",\n xytext=(0, 0),\n ha=\"center\",\n color=\"orangered\",\n )\n\n# Set labels and title\nax1.set_xlabel(xlabel)\nax1.set_ylabel(ylabel1)\nax2.set_ylabel(ylabel2)\n\n# Set x-axis tick labels\nax1.set_xticks(index + bar_width * 1.5)\nax1.set_xticklabels(instance_sizes)\n\n# Add legend\nax1.legend(loc=\"lower center\", ncol=4, bbox_to_anchor=(0.5, -0.3), title=legend_title)\nax1.grid(axis=\"y\")\nax1.set_axisbelow(True)\n\n# set ax2.yticklabels to be percentage\nax2.set_yticklabels([f\"{x*100:.0f}%\" for x in ax2.get_yticks()])\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout\nplt.tight_layout()\n# Save the plot as a PDF file\nplt.savefig(\"CB_25.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 5.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "misc" }, { "id": "test_61", "content": { "Year": [ 2010, 2012, 2014, 2016, 2018 ], "Facebook": [ 500, 800, 1200, 1500, 1800 ], "Twitter": [ 200, 400, 600, 800, 900 ], "Instagram": [ 100, 300, 800, 1200, 1600 ], "Snapchat": [ 50, 300, 500, 800, 1000 ] }, "visual_intent": "A line chart about Year and Active Users (in millions) for various social media platforms, titled Growth of Active Users on Social Media Platforms(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/line_103.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# New data for social media platforms\ntime_periods = [2010, 2012, 2014, 2016, 2018]\nfacebook_users = [500, 800, 1200, 1500, 1800]\ntwitter_users = [200, 400, 600, 800, 900]\ninstagram_users = [100, 300, 800, 1200, 1600]\nsnapchat_users = [50, 300, 500, 800, 1000]\nthreshold = [0, 2000]\nthreshold_time = [2008, 2020]\n\n# Axes Limits and Labels\nxlabel_value = \"Year\"\nxlim_values = [2008, 2020]\n\nylabel_value = \"Active Users (in millions)\"\nylim_values = [0, 2000]\nyticks_values = [0, 500, 1000, 1500, 2000]\n\n# Labels\nlabel_fb = \"Facebook\"\nlabel_tw = \"Twitter\"\nlabel_ig = \"Instagram\"\nlabel_sc = \"Snapchat\"\nlabel_threshold = \"Growth Threshold\"\n\n# Titles\ntitle_1 = \"Growth of Active Users on Social Media Platforms\"\ntitle_2 = \"Platforms\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create the plot\nplt.figure(figsize=(8, 6)) # Adjust figure size\n# Plot with different line styles and marker shapes\nplt.plot(time_periods, facebook_users, label=label_fb, color=\"#3b5998\", marker=\"o\", linewidth=2)\nplt.plot(time_periods, twitter_users, label=label_tw, color=\"#1da1f2\", marker=\"s\", linestyle=\"--\", linewidth=2)\nplt.plot(time_periods, instagram_users, label=label_ig, color=\"#e4405f\", marker=\"^\", linestyle=\":\", linewidth=2)\nplt.plot(time_periods, snapchat_users, label=label_sc, color=\"#fffc00\", marker=\"d\", linestyle=\"-.\", linewidth=2)\n# Threshold line\nplt.plot(threshold_time, threshold, label=label_threshold, color=\"black\", linestyle=\"--\")\n\n# Add title and labels\nplt.title(title_1)\nplt.xlabel(xlabel_value)\nplt.ylabel(ylabel_value)\nplt.xticks(time_periods)\nplt.xlim(xlim_values)\nplt.yticks(yticks_values)\nplt.ylim(ylim_values)\n# Add legend with additional entry\nplt.legend(title=title_2, loc=\"upper left\")\n\n# Adding the white grid manually\nplt.grid(color=\"#e0e0e0\", linestyle=\"-\", linewidth=0.5)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"line_103.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_62", "content": { "Genre_Label": [ "Fiction\n25.0%", "Non-Fiction\n20.0%", "Science Fiction\n15.0%", "Mystery\n10.0%", "Fantasy\n10.0%", "Romance\n10.0%", "Horror\n10.0%" ], "Market_Share": [ 25.0, 20.0, 15.0, 10.0, 10.0, 10.0, 10.0 ] }, "visual_intent": "A treemap about book genre market share, titled Distribution of Book Genres in the Market(size of the desired plot: width=12.0, height=8.0)", "path_to_gt_image": "images/tree_28.jpg", "original_category": "tree", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data\nsizes = [25.0, 20.0, 15.0, 10.0, 10.0, 10.0, 10.0]\nlabels = [\n \"Fiction\\n25.0%\",\n \"Non-Fiction\\n20.0%\",\n \"Science Fiction\\n15.0%\",\n \"Mystery\\n10.0%\",\n \"Fantasy\\n10.0%\",\n \"Romance\\n10.0%\",\n \"Horror\\n10.0%\",\n]\n# Titles and Text Labels\ntitle = \"Distribution of Book Genres in the Market\"\nsuptitle = \"Literature Genre Analysis\"\nsavefile = \"tree_3_7.pdf\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with the specified size\nfig = plt.figure(figsize=(12, 8))\n\n# Colors: Warm and inviting palette for literature theme\ncolors = [\"#FA8072\", \"#87CEEB\", \"#FFA07A\", \"#20B2AA\", \"#9370DB\", \"#FFD700\", \"#FF69B4\"]\n\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes,\n label=labels,\n color=colors,\n alpha=0.7,\n text_kwargs={\"fontsize\": 18, \"weight\": \"bold\"},\n ec=\"black\",\n)\n\n# Remove axes\nplt.axis(\"off\")\n\n# Add Titles\nplt.title(title, fontsize=20, fontweight=\"bold\")\nplt.suptitle(suptitle, fontsize=24, fontweight=\"bold\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout\nplt.tight_layout()\nplt.savefig(\"tree_28.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 8.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_63", "content": { "Index": [ 0, 1, 2, 3 ], "Truthful Recall": [ 46.3, 57.9, 53.8, 19.4 ], "Misleading Recall": [ 30.1, 34.0, 43.7, 20.0 ] }, "visual_intent": "A bidirectional bar chart about Truthful Recall and Misleading Recall, titled Truthful:Misleading = 2:0(size of the desired plot: width=6.0, height=4.0)", "path_to_gt_image": "images/bar_75.jpg", "original_category": "bar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for the bar charts\ntruthful_recall = [46.3, 57.9, 53.8, 19.4]\nmisleading_recall = [30.1, 34, 43.7, 20]\nx = np.arange(len(truthful_recall)) # x-coordinates for the bars\nlabels = [\"Truthful Recall\", \"Misleading Recall\"] # Labels for the legend\ntitle = \"Truthful:Misleading = 2:0\" # Title for the plot\nylim1 = [-60, 60] # y-axis limits for the first subplot\nylim2 = [-50, 50] # y-axis limits for the second subplot\nyticks1 = [0, 20, 40, 60] # y-ticks for the first subplot\nyticks2 = [-40, -20, 0] # y-ticks for the second subplot\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the figure size to match the original image's dimensions\nfig, ax1 = plt.subplots(figsize=(6, 4))\n\n# Create the first subplot for 'truthful_recall' using the left y-axis\nax1.bar(\n x,\n truthful_recall,\n width=0.4,\n label=labels[0],\n color=\"#404346\",\n align=\"center\",\n)\nax1.set_ylabel(labels[0], color=\"#404346\")\nax1.tick_params(axis=\"y\", labelcolor=\"#404346\")\n\n# Create the second y-axis for 'misleading_recall'\nax2 = ax1.twinx()\nax2.bar(\n x,\n [-i for i in misleading_recall],\n width=0.4,\n label=labels[1],\n color=\"#dc9dae\",\n align=\"center\",\n)\nax2.set_ylabel(labels[1], color=\"#dc9dae\")\nax2.tick_params(axis=\"y\", labelcolor=\"#dc9dae\")\n\n# Title for the plot\ntitle = title\nax1.set_title(title)\n\n# Set x-axis labels (empty in this case as per original code)\nax1.set_xticks(x)\nax1.set_xticklabels([])\n\n# Drawing a horizontal line at y=0\nax1.axhline(0, color=\"black\", linewidth=0.8)\n\n# Annotate bars with their values\nfor j in range(4):\n ax1.text(\n x[j],\n truthful_recall[j] - 5,\n f\"{truthful_recall[j]}%\",\n ha=\"center\",\n color=\"white\",\n )\n ax2.text(\n x[j],\n -misleading_recall[j] - 5,\n f\"{misleading_recall[j]}%\",\n ha=\"center\",\n color=\"#dc9dae\",\n )\n\nax1.set_ylim(ylim1)\nax1.set_yticks(yticks1)\n\nax2.set_ylim(ylim2)\nax2.set_yticks(yticks2)\nax2.set_yticklabels(yticks2)\n# Add legend to the subplot\nax1.legend(loc=\"upper left\", bbox_to_anchor=(0.0, 1.2))\nax1.grid(axis=\"y\", linestyle=\"--\")\nax1.set_axisbelow(True)\nax2.legend(loc=\"upper right\", bbox_to_anchor=(1, 1.2))\nax2.grid(axis=\"y\", linestyle=\"--\")\nax2.set_axisbelow(True)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout\nplt.tight_layout()\nplt.savefig(\"bar_75.pdf\", bbox_inches=\"tight\")\n", "width": 6.0, "height": 4.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" }, { "id": "test_64", "content": { "Land Type": [ "Forest", "Urban", "Agriculture", "Water Bodies", "Desert", "Others" ], "Percentage": [ 40, 20, 25, 5, 7, 3 ] }, "visual_intent": "A donut chart about land types and percentage distribution, titled Geographical Distribution of Land Types(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/pie_49.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\nland_types = [\n \"Forest\",\n \"Urban\",\n \"Agriculture\",\n \"Water Bodies\",\n \"Desert\",\n \"Others\",\n]\n\ndata = [40, 20, 25, 5, 7, 3] # Percentage distribution of land types\ntitle = \"Geographical Distribution of Land Types\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#228B22\", \"#A9A9A9\", \"#FFD700\", \"#1E90FF\", \"#DEB887\", \"#D3D3D3\"]\nfig, ax = plt.subplots(figsize=(8, 6), subplot_kw=dict(aspect=\"equal\"))\nwedges, texts = ax.pie(data, wedgeprops=dict(width=0.5), startangle=-40, colors=colors)\n\n\nbbox_props = dict(boxstyle=\"square,pad=0.3\", fc=\"w\", ec=\"k\", lw=0.72)\nkw = dict(arrowprops=dict(arrowstyle=\"-\"), bbox=bbox_props, zorder=0, va=\"center\")\n\nfor i, p in enumerate(wedges):\n ang = (p.theta2 - p.theta1) / 2.0 + p.theta1\n y = np.sin(np.deg2rad(ang))\n x = np.cos(np.deg2rad(ang))\n horizontalalignment = {-1: \"right\", 1: \"left\"}[int(np.sign(x))]\n connectionstyle = f\"angle,angleA=0,angleB={ang}\"\n kw[\"arrowprops\"].update({\"connectionstyle\": connectionstyle})\n ax.annotate(\n land_types[i],\n xy=(x, y),\n xytext=(1.35 * np.sign(x), 1.4 * y),\n horizontalalignment=horizontalalignment,\n **kw,\n )\n\n# Adding a legend\nax.legend(wedges, land_types, title=\"Land Types\", loc=\"center left\", bbox_to_anchor=(1, 0, 0.5, 1))\n\nax.set_title(title)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"pie_49.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_65", "content": { "Company": [ "Company A", "Company B", "Company C", "Company D" ], "Quarterly Revenue Growth": [ 12.5, 15.2, 8.7, 19.3 ], "Revenue Growth Error": [ 1.2, 1.5, 1.1, 1.8 ], "Profit Margin": [ 5.3, 6.8, 4.1, 7.2 ], "Profit Margin Error": [ 0.8, 0.7, 0.6, 0.9 ] }, "visual_intent": "A dual-axis bar chart about companies, quarterly revenue growth, and profit margin, titled Financial Performance of Companies(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/errorbar_104.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for the bar charts\ncompanies = [\"Company A\", \"Company B\", \"Company C\", \"Company D\"]\nrevenue_growth = [12.5, 15.2, 8.7, 19.3]\nprofit_margin = [5.3, 6.8, 4.1, 7.2]\nerror_revenue_growth = [1.2, 1.5, 1.1, 1.8]\nerror_profit_margin = [0.8, 0.7, 0.6, 0.9]\n\nx = np.arange(len(revenue_growth)) # x-coordinates for the bars\nlabels = [\"Quarterly Revenue Growth\", \"Profit Margin\"]\ntitle = \"Financial Performance of Companies\"\nylims = [[0, 25], [0, 10]]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the figure size\nfig, ax1 = plt.subplots(figsize=(10, 6))\n# Bar width\nwidth = 0.35\n\n# Plotting 'revenue_growth' on the primary y-axis\nbars1 = ax1.bar(\n x - width / 2,\n revenue_growth,\n width,\n label=labels[0],\n color=\"#4CAF50\", # Green color for growth\n yerr=error_revenue_growth,\n capsize=5,\n edgecolor=\"black\",\n)\n\n# Create the secondary y-axis for 'profit_margin'\nax2 = ax1.twinx()\nbars2 = ax2.bar(\n x + width / 2,\n profit_margin,\n width,\n label=labels[1],\n color=\"#2196F3\", # Blue color for stability\n yerr=error_profit_margin,\n capsize=5,\n edgecolor=\"black\",\n)\n\n# Adding annotations directly on the bars for clarity\nfor i, bar in enumerate(bars1):\n height = bar.get_height()\n label_x_pos = bar.get_x() + bar.get_width() / 2\n ax1.text(\n label_x_pos,\n height - error_revenue_growth[i] - 0.5,\n f\"{height}%\",\n rotation=90,\n ha=\"center\",\n va=\"bottom\" if height < 0 else \"top\",\n )\nfor j, bar in enumerate(bars2):\n height = bar.get_height()\n label_x_pos = bar.get_x() + bar.get_width() / 2\n ax2.text(\n label_x_pos,\n height - error_profit_margin[j] - 0.3,\n f\"{height}%\",\n rotation=90,\n ha=\"center\",\n va=\"bottom\" if height < 0 else \"top\",\n )\n\nfig.suptitle(title)\n# Adding labels, title, and custom x-axis tick labels\nax1.set_ylabel(labels[0], color=\"#4CAF50\")\nax2.set_ylabel(labels[1], color=\"#2196F3\")\nax1.set_xticks(x)\nax1.set_xticklabels(companies)\n\n# Add a horizontal line at y=0 if needed\nax1.axhline(0, color=\"grey\", linewidth=0.8)\n\n# Adjusting y-axis limits to fit the annotations and errors\nax1.set_ylim(ylims[0])\nax2.set_ylim(ylims[1])\n\n# Adding grid lines for better readability\nax1.yaxis.grid(linestyle=\"--\", linewidth=\"0.5\", color=\"grey\")\nax1.set_axisbelow(True)\n\nax2.yaxis.grid(linestyle=\"--\", color=\"grey\")\nax2.set_axisbelow(True)\n\n# Adding legend\nfig.legend(loc=\"upper center\", bbox_to_anchor=(0.5, 1.1), ncol=2)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout\nplt.tight_layout()\nplt.savefig(\"errorbar_104.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_66", "content": { "Weeks After Release": [ 0, 2, 4, 6, 8, 10 ], "Action - Average Rating": [ 7.5, 7.4, 7.3, 7.2, 7.1, 7.0 ], "Comedy - Average Rating": [ 6.5, 6.6, 6.7, 6.8, 6.9, 7.0 ], "Drama - Average Rating": [ 8.0, 8.1, 8.2, 8.3, 8.4, 8.5 ], "Sci-Fi - Average Rating": [ 7.0, 7.1, 7.2, 7.3, 7.4, 7.5 ], "Action - Box Office (Millions)": [ 50, 150, 300, 400, 450, 480 ], "Comedy - Box Office (Millions)": [ 30, 80, 150, 200, 230, 250 ], "Drama - Box Office (Millions)": [ 20, 70, 140, 180, 220, 250 ], "Sci-Fi - Box Office (Millions)": [ 40, 120, 220, 300, 360, 400 ] }, "visual_intent": "A figure with 2 subplots: (1) a line chart about weeks after release and average ratings by genre, titled Average Ratings Over Time, (2) a line chart about weeks after release and cumulative box office revenue by genre, titled Cumulative Box Office Revenue(size of the desired plot: width=12.0, height=5.0)", "path_to_gt_image": "images/line_237.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Library for numerical operations\nimport numpy as np\n\n# Seed for reproducibility\nnp.random.seed(42)\n\n# Week data\nweeks = np.array([0, 2, 4, 6, 8, 10])\n\n# Average ratings\nratings_action = np.array([7.5, 7.4, 7.3, 7.2, 7.1, 7.0])\nratings_comedy = np.array([6.5, 6.6, 6.7, 6.8, 6.9, 7.0])\nratings_drama = np.array([8.0, 8.1, 8.2, 8.3, 8.4, 8.5])\nratings_scifi = np.array([7.0, 7.1, 7.2, 7.3, 7.4, 7.5])\n\n# Cumulative box office revenue (in millions)\nbox_office_action = np.array([50, 150, 300, 400, 450, 480])\nbox_office_comedy = np.array([30, 80, 150, 200, 230, 250])\nbox_office_drama = np.array([20, 70, 140, 180, 220, 250])\nbox_office_scifi = np.array([40, 120, 220, 300, 360, 400])\n\n# Axes Limits and Labels\nxlabel_value = \"Weeks After Release\"\nxlim_values = [-1, 11]\nylabel_ratings = \"Average Rating\"\nylabel_box_office = \"Cumulative Box Office (Millions)\"\nylim_ratings = [6.0, 9.0]\nylim_box_office = [0, 500]\n\n# Labels for legends\nlabel_action = \"Action\"\nlabel_comedy = \"Comedy\"\nlabel_drama = \"Drama\"\nlabel_scifi = \"Sci-Fi\"\n\n# Titles for subplots\ntitle_ratings = \"Average Ratings Over Time\"\ntitle_box_office = \"Cumulative Box Office Revenue\"\n\n# Super title for the overall plots\nsupertitle = \"Movie Performance Over Time by Genre\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Define a custom color palette\ncolors = [\"#FF5733\", \"#33FF57\", \"#3357FF\", \"#FF33A6\"]\n\n# Create the 1x2 subplot configuration\nfig, axs = plt.subplots(1, 2, figsize=(12, 5))\n\n# Plot customization for a fancy look\nmarker_styles = [\"o\", \"^\", \"s\", \"x\"]\nline_styles = [\"-\", \"--\", \":\", \"-.\"]\n\n# First subplot for average ratings\naxs[0].plot(\n weeks,\n ratings_action,\n label=label_action,\n color=colors[0],\n marker=marker_styles[0],\n linestyle=line_styles[0],\n markersize=8,\n linewidth=2,\n)\naxs[0].plot(\n weeks,\n ratings_comedy,\n label=label_comedy,\n color=colors[1],\n marker=marker_styles[1],\n linestyle=line_styles[1],\n markersize=8,\n linewidth=2,\n)\naxs[0].plot(\n weeks,\n ratings_drama,\n label=label_drama,\n color=colors[2],\n marker=marker_styles[2],\n linestyle=line_styles[2],\n markersize=8,\n linewidth=2,\n)\naxs[0].plot(\n weeks,\n ratings_scifi,\n label=label_scifi,\n color=colors[3],\n marker=marker_styles[3],\n linestyle=line_styles[3],\n markersize=8,\n linewidth=2,\n)\naxs[0].set_title(title_ratings, fontsize=14)\naxs[0].set_xlabel(xlabel_value, fontsize=12)\naxs[0].set_ylabel(ylabel_ratings, fontsize=12)\n\n# Second subplot for box office revenue\naxs[1].plot(\n weeks,\n box_office_action,\n label=label_action,\n color=colors[0],\n marker=marker_styles[0],\n linestyle=line_styles[0],\n markersize=8,\n linewidth=2,\n)\naxs[1].plot(\n weeks,\n box_office_comedy,\n label=label_comedy,\n color=colors[1],\n marker=marker_styles[1],\n linestyle=line_styles[1],\n markersize=8,\n linewidth=2,\n)\naxs[1].plot(\n weeks,\n box_office_drama,\n label=label_drama,\n color=colors[2],\n marker=marker_styles[2],\n linestyle=line_styles[2],\n markersize=8,\n linewidth=2,\n)\naxs[1].plot(\n weeks,\n box_office_scifi,\n label=label_scifi,\n color=colors[3],\n marker=marker_styles[3],\n linestyle=line_styles[3],\n markersize=8,\n linewidth=2,\n)\naxs[1].set_title(title_box_office, fontsize=14)\naxs[1].set_xlabel(xlabel_value, fontsize=12)\naxs[1].set_ylabel(ylabel_box_office, fontsize=12)\n\n# Set global properties and customize each subplot individually\nfor ax in axs:\n ax.set_xticks(weeks)\n ax.set_xlim(xlim_values)\n ax.legend(loc=\"upper left\", fontsize=10)\n\n# Set super title\nplt.suptitle(supertitle, fontsize=16)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout to ensure no overlap and labels are clearly visible\nplt.tight_layout(rect=[0, 0.03, 1, 0.95])\n\n# Show the plot\nplt.savefig(\"line_237.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 5.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "line" }, { "id": "test_67", "content": { "Region": [ "Region A", "Region B", "Region C", "Region D", "Region A", "Region B", "Region C", "Region D" ], "Year": [ "2022", "2022", "2022", "2022", "2023", "2023", "2023", "2023" ], "Wins": [ 85.1, 75.3, 68.9, 80.4, 83.6, 74.5, 69.8, 78.9 ], "Ties": [ 10.2, 15.8, 20.0, 14.1, 12.4, 16.3, 19.5, 13.8 ], "Losses": [ 4.7, 8.9, 11.1, 5.5, 4.0, 9.2, 10.7, 7.3 ] }, "visual_intent": "A figure with 2 subplots: (1) a horizontal stacked bar chart about Year 2022 yields and regions, (2) a horizontal stacked bar chart about Year 2023 yields and regions.(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/bar_154.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.patches as mpatches\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# Data\ncategories = [\"Region A\", \"Region B\", \"Region C\", \"Region D\"]\nwins = [85.1, 75.3, 68.9, 80.4]\nties = [10.2, 15.8, 20.0, 14.1]\nlosses = [4.7, 8.9, 11.1, 5.5]\n\n# Repeat for the second subplot with different data\nwins2 = [83.6, 74.5, 69.8, 78.9]\nties2 = [12.4, 16.3, 19.5, 13.8]\nlosses2 = [4.0, 9.2, 10.7, 7.3]\n\nindices = np.arange(len(categories))\n\nxlabel = \"Year 2022 Yields\"\nxlabel2 = \"Year 2023 Yields\"\n\nlabels = [\n \"High Yields\",\n \"Moderate Yields\",\n \"Consistent Yields\",\n \"Fluctuating Yields\",\n \"Low Yields\",\n \"Very Low Yields\",\n]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Define colors\ncolors_wins = [\"#4CAF50\", \"#4CAF50\", \"#4CAF50\", \"#FF9800\"]\ncolors_ties = [\"#81C784\", \"#81C784\", \"#81C784\", \"#FFB74D\"]\ncolors_losses = [\"#C8E6C9\", \"#C8E6C9\", \"#C8E6C9\", \"#FFCC80\"]\n\n# Plot data\nbar_width = 0.5\n\n# Create figure and axes\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))\n\n# Function to plot bars\ndef plot_bars(ax, wins, ties, losses, colors_wins, colors_ties, colors_losses):\n for i, (win, tie, loss) in enumerate(zip(wins, ties, losses)):\n ax.barh(i, win, bar_width, color=colors_wins[i], edgecolor=\"white\")\n ax.barh(i, tie, bar_width, left=win, color=colors_ties[i], edgecolor=\"white\")\n ax.barh(\n i,\n loss,\n bar_width,\n left=win + tie,\n color=colors_losses[i],\n edgecolor=\"white\",\n )\n ax.text(win / 2, i, f\"{win}%\", ha=\"center\", va=\"center\", color=\"white\")\n ax.text(win + tie / 2, i, f\"{tie}%\", ha=\"center\", va=\"center\", color=\"black\")\n ax.text(\n win + tie + loss / 2, i, f\"{loss}%\", ha=\"center\", va=\"center\", color=\"black\"\n )\n\nplot_bars(ax1, wins, ties, losses, colors_wins, colors_ties, colors_losses)\n\n# Set labels, title, and legend for ax1\nax1.set_yticks(indices)\nax1.set_yticklabels(categories)\nax1.invert_yaxis() # labels read top-to-bottom\nax1.set_xlabel(xlabel)\nax1.set_xticks([])\n\nplot_bars(ax2, wins2, ties2, losses2, colors_wins, colors_ties, colors_losses)\n\n# Set labels, title, and legend for ax2\nax2.set_yticks(indices)\nax2.set_yticklabels(categories)\nax2.invert_yaxis() # labels read top-to-bottom\nax2.set_xlabel(xlabel2)\nax2.set_xticks([])\n\n# Adjust layout and set background color\nfig.patch.set_facecolor(\"white\")\nfor ax in [ax1, ax2]:\n ax.set_facecolor(\"white\")\n ax.spines[\"top\"].set_edgecolor(\"gray\")\n ax.spines[\"right\"].set_edgecolor(\"gray\")\n ax.spines[\"bottom\"].set_edgecolor(\"gray\")\n ax.spines[\"left\"].set_edgecolor(\"gray\")\n\n# Create a global legend\npatch1 = mpatches.Patch(color=\"#FF9800\", label=labels[0])\npatch2 = mpatches.Patch(color=\"#4CAF50\", label=labels[1])\npatch3 = mpatches.Patch(color=\"#FFB74D\", label=labels[2])\npatch4 = mpatches.Patch(color=\"#81C784\", label=labels[3])\npatch5 = mpatches.Patch(color=\"#FFCC80\", label=labels[4])\npatch6 = mpatches.Patch(color=\"#C8E6C9\", label=labels[5])\nfig.legend(\n handles=[patch1, patch2, patch3, patch4, patch5, patch6],\n loc=\"upper center\",\n ncol=3,\n bbox_to_anchor=(0.5, 1.1),\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the figure\nplt.tight_layout()\nplt.savefig(\"bar_154.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_68", "content": { "Quarter": [ "Q1", "Q2", "Q3", "Q4" ], "Hospital A": [ 150, 180, 210, 240 ], "Hospital B": [ 160, 190, 220, 250 ], "Hospital C": [ 170, 200, 230, 260 ], "Hospital D": [ 180, 210, 240, 270 ], "Recovery Rate": [ 0.88, 0.85, 0.9, 0.92 ] }, "visual_intent": "A dual-axis chart combining a grouped bar chart about successful surgeries for different hospitals and a line chart about recovery rates across quarters(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/CB_118.jpg", "original_category": "CB", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Sample health data\nquarters = [\"Q1\", \"Q2\", \"Q3\", \"Q4\"]\nhospitalA = [150, 180, 210, 240]\nhospitalB = [160, 190, 220, 250]\nhospitalC = [170, 200, 230, 260]\nhospitalD = [180, 210, 240, 270]\nrecovery_rate = [0.88, 0.85, 0.90, 0.92]\n\n# Errors (e.g., standard deviation)\nerrorA = [10, 15, 12, 14]\nerrorB = [11, 16, 13, 15]\nerrorC = [12, 17, 14, 16]\nerrorD = [13, 18, 15, 17]\nerror_recovery = [0.02, 0.03, 0.02, 0.01]\nlabels = [\"Hospital A\", \"Hospital B\", \"Hospital C\", \"Hospital D\"]\nxlabel = \"Quarter\"\nylabel1 = \"Successful Surgeries (#)\"\nylabel2 = \"Recovery Rate (%)\"\nlegend_title = \"Hospitals\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and axis\nfig, ax1 = plt.subplots(figsize=(8, 6))\n\n# Bar plot with error bars\nbar_width = 0.2\nindex = np.arange(len(quarters))\nax1.bar(\n index,\n hospitalA,\n bar_width,\n label=labels[0],\n color=\"lightblue\",\n yerr=errorA,\n capsize=5,\n ecolor=\"navy\",\n)\nax1.bar(\n index + bar_width,\n hospitalB,\n bar_width,\n label=labels[1],\n color=\"lightgreen\",\n yerr=errorB,\n capsize=5,\n ecolor=\"darkgreen\",\n)\nax1.bar(\n index + 2 * bar_width,\n hospitalC,\n bar_width,\n label=labels[2],\n color=\"lavender\",\n yerr=errorC,\n capsize=5,\n ecolor=\"purple\",\n)\nax1.bar(\n index + 3 * bar_width,\n hospitalD,\n bar_width,\n label=labels[3],\n color=\"peachpuff\",\n yerr=errorD,\n capsize=5,\n ecolor=\"sienna\",\n)\n\n# Line plot with error bars\nax2 = ax1.twinx()\nax2.errorbar(\n index + 1.5 * bar_width,\n recovery_rate,\n yerr=error_recovery,\n fmt=\"o-\",\n color=\"coral\",\n label=\"Recovery Rate\",\n linewidth=2,\n markersize=5,\n capsize=5,\n)\n\n# Set labels and title\nax1.set_xlabel(xlabel)\nax1.set_ylabel(ylabel1)\nax2.set_ylabel(ylabel2)\n\n# Set x-axis tick labels\nax1.set_xticks(index + 1.5 * bar_width)\nax1.set_xticklabels(quarters)\n\n# Add legends\nax1.legend(loc=\"lower center\", ncol=4, bbox_to_anchor=(0.5, -0.25), title=legend_title)\nax2.legend(loc=\"upper left\", ncol=1)\n\n# Set ax2.yticklabels to be percentage\nax2.set_ylim(0, 1)\nax2.set_yticks(np.linspace(0, 1, 11))\nax2.set_yticklabels([f\"{x*100:.0f}%\" for x in ax2.get_yticks()])\n\n# Grid and layout adjustment\nax1.grid(axis=\"y\")\nax1.set_axisbelow(True)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"CB_118.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "misc" }, { "id": "test_69", "content": { "Literature Categories": [ "Classics", "Science Fiction", "Fantasy", "Non-Fiction", "Mystery", "Biographies" ], "Unique speaker count mean": [ 8, 10, 12, 9, 11, 13 ], "Unique speaker count error": [ 0.8, 1.2, 1.0, 1.1, 0.9, 1.4 ], "Unique shouter count mean": [ 3, 5, 6, 4, 5, 7 ], "Unique shouter count error": [ 0.4, 0.6, 0.8, 0.5, 0.7, 0.9 ] }, "visual_intent": "An error bar chart about Literature Categories and Number of Speakers, titled Speaker and Shouter Mean Count by Literature Category(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/errorpoint_30.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data\ncategories = [\n \"Classics\",\n \"Science Fiction\",\n \"Fantasy\",\n \"Non-Fiction\",\n \"Mystery\",\n \"Biographies\",\n]\nunique_speaker_mean = [8, 10, 12, 9, 11, 13]\nunique_shouter_mean = [3, 5, 6, 4, 5, 7]\nunique_speaker_error = [0.8, 1.2, 1.0, 1.1, 0.9, 1.4]\nunique_shouter_error = [0.4, 0.6, 0.8, 0.5, 0.7, 0.9]\nlabels = [\"Unique speaker count mean\", \"Unique shouter count mean\"]\nylabel = \"Number of Speakers\"\nxlabel = \"Literature Categories\"\nlegendlabel = \"Dataset unique shouter count mean\"\ntitle = \"Speaker and Shouter Mean Count by Literature Category\"\nsupertitle = \"Analysis of Speaker and Shouter Trends in Literature Domains\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting\nfig, ax = plt.subplots(figsize=(10, 6))\nax.errorbar(\n categories,\n unique_speaker_mean,\n yerr=unique_speaker_error,\n fmt=\"s\",\n color=\"green\",\n label=labels[0],\n)\nax.errorbar(\n categories,\n unique_shouter_mean,\n yerr=unique_shouter_error,\n fmt=\"^\",\n color=\"purple\",\n label=labels[1],\n)\n\n# Customization\nax.set_ylabel(ylabel)\nax.set_xlabel(xlabel)\nax.set_title(title)\nax.set_xticklabels(categories, rotation=45, ha=\"right\")\nax.axhline(\n y=np.mean(unique_shouter_mean),\n color=\"orange\",\n linestyle=\"--\",\n label=legendlabel,\n)\nax.legend()\n\n# Super Title\nfig.suptitle(supertitle, fontsize=14)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot\nplt.tight_layout()\nplt.savefig(\"errorpoint_30.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_70", "content": { "Months": [ "January", "February", "March", "April", "May" ], "City A": [ 5, 7, 10, 15, 18 ], "City B": [ 3, 5, 9, 14, 17 ] }, "visual_intent": "A bar chart about months and average temperatures for two cities, titled Average Monthly Temperatures for Two Cities(size of the desired plot: width=9.0, height=6.0)", "path_to_gt_image": "images/HR_82.jpg", "original_category": "HR", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nnp.random.seed(0)\n\n# initialise labels and a numpy array make sure you have\n# N labels of N number of values in the array\nxlabels = [\"January\", \"February\", \"March\", \"April\", \"May\"]\ncityA = np.array([5, 7, 10, 15, 18])\ncityB = np.array([3, 5, 9, 14, 17])\n\n# Labels and Plot Types\nhat_graph_label = [\"City A\", \"City B\"]\n\n# Axes Limits and Labels\nxlabel_value = \"Months\"\nylabel_value = \"Average Temperature (°C)\"\nylim_values = [0, 20]\ntitle = \"Average Monthly Temperatures for Two Cities\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#1f77b4\", \"#76b041\"]\n\ndef hat_graph(ax, xlabels, values, group_labels):\n def label_bars(heights, rects, ax):\n \"\"\"Attach a text label on top of each bar.\"\"\"\n for height, rect in zip(heights, rects):\n ax.annotate(\n f\"{height}°C\",\n xy=(rect.get_x() + rect.get_width() / 2, height),\n xytext=(0, 4), # 4 points vertical offset.\n textcoords=\"offset points\",\n ha=\"center\",\n va=\"bottom\",\n )\n\n values = np.asarray(values)\n x = np.arange(values.shape[1])\n ax.set_xticks(x, labels=xlabels)\n spacing = 0.3 # spacing between hat groups\n width = (1 - spacing) / values.shape[0]\n heights0 = values[0]\n for i, (heights, group_label, color) in enumerate(zip(values, group_labels, colors)):\n rects = ax.bar(\n x - spacing / 2 + i * width,\n heights - heights0,\n width,\n bottom=heights0,\n label=group_label,\n edgecolor='black',\n color=color,\n hatch=\"///\" if i == 1 else None,\n )\n label_bars(heights, rects, ax)\n\n\nfig, ax = plt.subplots(figsize=(9, 6))\nhat_graph(ax, xlabels, [cityA, cityB], hat_graph_label)\n\n# Add some text for labels, title and custom x-axis tick labels, etc.\nax.set_xlabel(xlabel_value)\nax.set_ylabel(ylabel_value)\nax.set_ylim(ylim_values)\nax.set_title(title)\nax.legend()\n\n# ===================\n# Part 4: Saving Output\n# ===================\nfig.tight_layout()\nplt.savefig(\"HR_82.pdf\", bbox_inches=\"tight\")\n", "width": 9.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "misc" }, { "id": "test_71", "content": { "Streaming Platform": [ "Netflix", "Netflix", "Netflix", "Netflix", "Netflix", "Netflix", "Hulu", "Hulu", "Hulu", "Hulu", "Hulu", "Hulu", "Amazon Prime", "Amazon Prime", "Amazon Prime", "Amazon Prime", "Amazon Prime", "Amazon Prime", "Disney+", "Disney+", "Disney+", "Disney+", "Disney+", "Disney+" ], "Genre": [ "Action", "Comedy", "Drama", "Horror", "Romance", "Sci-Fi", "Action", "Comedy", "Drama", "Horror", "Romance", "Sci-Fi", "Action", "Comedy", "Drama", "Horror", "Romance", "Sci-Fi", "Action", "Comedy", "Drama", "Horror", "Romance", "Sci-Fi" ], "Popularity Rating": [ 4.5, 2.3, 3.8, 5.0, null, 4.2, 3.8, 4.9, 2.8, 4.1, 3.2, 4.5, 4.3, 3.4, null, 2.7, 3.9, null, 3.6, 4.1, 3.5, 4.8, 5.0, 3.4 ] }, "visual_intent": "A heatmap about genres and streaming platforms showing average popularity ratings, titled Average Popularity Ratings of Genres on Streaming Platforms(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/heatmap_48.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Define the data with correct shape\ndata = np.array(\n [\n [4.5, 2.3, 3.8, 5.0, np.nan, 4.2],\n [3.8, 4.9, 2.8, 4.1, 3.2, 4.5],\n [4.3, 3.4, np.nan, 2.7, 3.9, np.nan],\n [3.6, 4.1, 3.5, 4.8, 5.0, 3.4],\n ]\n)\n\ntitle = \"Average Popularity Ratings of Genres on Streaming Platforms\"\nxlabel = \"Genres\"\nxticklabels = [\"Action\", \"Comedy\", \"Drama\", \"Horror\", \"Romance\", \"Sci-Fi\"]\nyticklabels = [\"Netflix\", \"Hulu\", \"Amazon Prime\", \"Disney+\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the heatmap with adjusted colorbar and new theme color\n# Create mask for NaN values to hatch them later\nmask = np.isnan(data)\n\n# Defining a new color palette\ncmap = plt.get_cmap(\"viridis\")\nnorm = plt.Normalize(vmin=np.nanmin(data), vmax=np.nanmax(data))\n\nfig, ax = plt.subplots(figsize=(10, 8))\ncax = ax.imshow(data, cmap=cmap, norm=norm)\ncbar = fig.colorbar(cax, ax=ax, extend=\"both\")\n\n# Add hatches for NaN values\nfor i, j in zip(*np.where(mask)):\n ax.add_patch(\n plt.Rectangle(\n (j - 0.5, i - 0.5), 1, 1, fill=False, hatch=\"//\", edgecolor=\"black\"\n )\n )\n\n# Adding titles and labels\nplt.title(title, fontsize=16, fontweight='bold')\nplt.xlabel(xlabel, fontsize=14)\nplt.ylabel(\"Streaming Platforms\", fontsize=14)\n\n# Define the labels for x and y axis\nax.set_xticks(range(6))\nax.set_xticklabels(xticklabels, rotation=45, ha=\"right\", fontsize=12)\nax.set_yticks(range(4))\nax.set_yticklabels(yticklabels, rotation=0, fontsize=12)\n\n# Add annotations\nfor i in range(4):\n for j in range(6):\n if not np.isnan(data[i, j]):\n if data[i, j] > np.nanmean(data) * 1.2:\n ax.text(\n j, i, f\"{data[i, j]:.1f}\", ha=\"center\", va=\"center\", color=\"white\", fontweight=\"bold\"\n )\n else:\n ax.text(\n j, i, f\"{data[i, j]:.1f}\", ha=\"center\", va=\"center\", color=\"black\"\n )\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"heatmap_48.pdf\", bbox_inches=\"tight\")\n\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_72", "content": { "Revenue Stream": [ "Box Office 40%", "Streaming 25%", "Merchandise 20%", "Other 15%" ], "Outer Ring Size": [ 40, 25, 20, 15 ], "Inner Ring Size": [ 15, 10, 8, 7 ] }, "visual_intent": "A nested pie chart about revenue streams and their sub-divisions, titled Revenue Distribution in Entertainment Industry(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/pie_25.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nlabels = [\"Box Office 40%\", \"Streaming 25%\", \"Merchandise 20%\", \"Other 15%\"]\ntitle = \"Revenue Distribution in Entertainment Industry\"\nsupertitle = \"Revenue Streams for 2023\"\n\nouter_sizes = [40, 25, 20, 15] # different revenue streams percentages\ninner_sizes = [15, 10, 8, 7] # sub-division within revenue streams\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, ax = plt.subplots(figsize=(8, 8))\n\nouter_colors = [\"#ffcccb\", \"#add8e6\", \"#90ee90\", \"#ffb6c1\"]\ninner_colors = [\"#ffd700\", \"#ff6347\", \"#4682b4\", \"#9acd32\"]\n\n\n# Outer ring\nwedges, texts, autotexts = ax.pie(\n outer_sizes,\n labels=labels,\n radius=1.2,\n colors=outer_colors,\n autopct=\"%1.1f%%\",\n pctdistance=0.85,\n startangle=140,\n wedgeprops=dict(width=0.3, edgecolor='w')\n)\n\n# Inner ring\nwedges2, texts2, autotexts2 = ax.pie(\n inner_sizes,\n radius=0.9,\n colors=inner_colors,\n autopct=\"%1.1f%%\",\n pctdistance=0.75,\n startangle=140,\n wedgeprops=dict(width=0.3, edgecolor='w')\n)\n\n# Equal aspect ratio ensures that pie chart is drawn as a circle\nax.axis(\"equal\")\n\n# Title, labels, and legend\nplt.suptitle(supertitle, fontsize=16, fontweight='bold')\nplt.title(title, fontsize=12)\nplt.legend(wedges, labels, title=\"Revenue Streams\", loc=\"center left\", bbox_to_anchor=(1, 0, 0.5, 1))\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Minimize white space and save the plot\nplt.tight_layout()\nplt.savefig(\"pie_25.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_73", "content": { "Companies": [ "Apple", "Samsung", "Microsoft", "Google", "Amazon" ], "Market Share (%)": [ 32.5, 24.8, 15.6, 18.3, 8.8 ], "Market Share Error": [ 1.5, 1.2, 1.0, 1.3, 0.9 ], "Annual Growth Rate (%)": [ 10.2, 8.4, 12.6, 9.3, 7.8 ], "Annual Growth Rate Error": [ 0.8, 0.6, 1.0, 0.7, 0.5 ] }, "visual_intent": "A figure with 2 subplots: (1) a horizontal bar chart about companies and market share, titled Tech Company Market Share, (2) a horizontal bar chart about companies and annual revenue growth rate, titled Annual Revenue Growth Rate(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/errorbar_80.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(1)\n\n# Data for Tech Company Market Share\ncompanies1 = [\"Apple\", \"Samsung\", \"Microsoft\", \"Google\", \"Amazon\"]\nmarket_shares = [32.5, 24.8, 15.6, 18.3, 8.8]\nmarket_share_errors = [1.5, 1.2, 1.0, 1.3, 0.9]\n\n# Data for Annual Revenue Growth Rate\ncompanies2 = [\"Apple\", \"Samsung\", \"Microsoft\", \"Google\", \"Amazon\"]\nrevenue_growth = [10.2, 8.4, 12.6, 9.3, 7.8]\nrevenue_growth_errors = [0.8, 0.6, 1.0, 0.7, 0.5]\n\n# Titles for the charts\nchart_titles = [\"Tech Company Market Share\", \"Annual Revenue Growth Rate\"]\n\n# Labels for the axes\nxlabel1 = \"Market Share (%)\"\nxlabel2 = \"Annual Growth Rate (%)\"\nylabel = \"Companies\"\n\n# Legend labels (if any customization needed)\n\n# Colors for the bars\ncolors = [\"#4c72b0\", \"#55a868\", \"#c44e52\", \"#8172b2\", \"#ccb974\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, (ax1, ax2) = plt.subplots(2, 1, figsize=(8, 8))\nax1.barh(companies1, market_shares, xerr=market_share_errors, color=colors, capsize=5, edgecolor='gray')\nax2.barh(companies2, revenue_growth, xerr=revenue_growth_errors, color=colors, capsize=5, edgecolor='gray')\n\nax1.set_title(chart_titles[0])\nax2.set_title(chart_titles[1])\n\nax1.set_xlabel(xlabel1)\nax1.set_ylabel(ylabel)\n\nax2.set_xlabel(xlabel2)\nax2.set_ylabel(ylabel)\n\n# Additional styles\nax1.grid(True, linestyle='--', alpha=0.6)\nax2.grid(True, linestyle='--', alpha=0.6)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorbar_80.pdf\", bbox_inches=\"tight\")\n\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "bar" }, { "id": "test_74", "content": { "Label": [ "explicit, random", "explicit, block size 10", "explicit, block size 100", "implicit, random", "implicit, block size 10", "implicit, block size 100" ], "Flops/byte": [ 2, 3, 4, 5, 6, 7 ], "Flops/s": [ 300000000000.0, 250000000000.0, 200000000000.0, 250000000000.0, 300000000000.0, 350000000000.0 ] }, "visual_intent": "A Roofline Model plot about Flops/byte and Flops/s comparing different implementation strategies against hardware performance limits(size of the desired plot: width=8.0, height=7.0)", "path_to_gt_image": "images/HR_11.jpg", "original_category": "HR", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data\nflops_per_byte = [0.1, 10]\nflops = [2e10, 2e12]\n\n# Points\npoints_x = [2, 3, 4, 5, 6, 7]\npoints_y = [3e11, 2.5e11, 2e11, 2.5e11, 3e11, 3.5e11]\nlabels = [\n \"explicit, random\",\n \"explicit, block size 10\",\n \"explicit, block size 100\",\n \"implicit, random\",\n \"implicit, block size 10\",\n \"implicit, block size 100\",\n]\ncolors = [\"blue\", \"orange\", \"green\", \"cyan\", \"darkorange\", \"olive\"]\nmarkers = [\"o\", \"o\", \"o\", \"v\", \"^\", \"s\"]\naxlines = [\n [[10, 20], [2e12, 2e12]],\n [[6, 20], [1.2e12, 1.2e12]],\n [[1, 20], [2e11, 2e11]],\n]\nx_fill = [0.1, 10, 20, 20] # x goes from 0.1 to 20 and back to 0.1\ny_fill_top = [\n 2e10,\n 2e12,\n 2e12,\n 2e12,\n] # y follows the line segment, then the horizontal line, and back to the start\ny_fill_bottom = [\n 1e10,\n 1e10,\n 1e10,\n 1e10,\n] # y is constant at 1e10 for the bottom boundary\nxlabel = \"Flops/byte\"\nylabel = \"Flops/s\"\nxlim = [0.1, 2e1]\nylim = [1e10, 1e12 * 3]\ntextlabels = [\"DAXPY memory bandwidth\", \"peak\", \"w/o FMA\", \"w/o vectorization\"]\ntextposition = [[0.2, 1e11], [19, 2.1e12], [19, 1e12 * 1.3], [19, 2.1e11]]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and axis\nfig, ax = plt.subplots(figsize=(8, 7))\n\n# Plot the roofline model\nax.plot(flops_per_byte, flops, color=\"black\")\nax.plot(axlines[0][0], axlines[0][1], color=\"black\", linestyle=\"-\")\nax.plot(axlines[1][0], axlines[1][1], color=\"black\", linestyle=\"-\")\nax.plot(axlines[2][0], axlines[2][1], color=\"black\", linestyle=\"-\")\n\nax.fill_between(x_fill, y_fill_top, y_fill_bottom, color=\"lightblue\", alpha=0.3)\n\n# Add text annotations\nax.text(\n textposition[0][0],\n textposition[0][1],\n textlabels[0],\n rotation=40,\n verticalalignment=\"center\",\n)\nax.text(\n textposition[1][0],\n textposition[1][1],\n textlabels[1],\n rotation=0,\n va=\"bottom\",\n ha=\"right\",\n)\nax.text(\n textposition[2][0],\n textposition[2][1],\n textlabels[2],\n rotation=0,\n va=\"bottom\",\n ha=\"right\",\n)\nax.text(\n textposition[3][0],\n textposition[3][1],\n textlabels[3],\n rotation=0,\n va=\"bottom\",\n ha=\"right\",\n)\n\n# Plot the points\nfor x, y, label, color, marker in zip(points_x, points_y, labels, colors, markers):\n ax.plot(x, y, label=label, color=color, marker=marker, linestyle=\"-\", markersize=10)\n\n# Set scale to log\nax.set_xscale(\"log\")\nax.set_yscale(\"log\")\n\n# Set labels\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\n\n# Set limits\nax.set_xlim(xlim)\nax.set_ylim(ylim)\nax.grid(True)\n\n# Add legend\nax.legend()\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"HR_11.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 7.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "misc" }, { "id": "test_75", "content": { "SNR": [ 5, 10, 15, 20, 25 ], "JPEG+LDPC": [ 10, 30, 50, 70, 90 ], "DEEPJSCC w/o ofdm": [ 5, 15, 25, 35, 45 ], "DEEPJSCC w/ ofdm": [ 20, 40, 60, 80, 95 ], "OURS": [ 30, 60, 80, 95, 100 ] }, "visual_intent": "A line chart about SNR and Classification Accuracy (%) comparing four different communication methods(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/line_1.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data (example values, the actual data should be extracted from the paper)\nsnr_values = [5, 10, 15, 20, 25]\njpeg_ldpc = [10, 30, 50, 70, 90]\ndeepjscc_wo_ofdm = [5, 15, 25, 35, 45]\ndeepjscc_w_ofdm = [20, 40, 60, 80, 95]\nours = [30, 60, 80, 95, 100]\n\n# Labels and Plot Types\nlabel_jpeg_ldpc = \"JPEG+LDPC\"\nlabel_deepjscc_wo_ofdm = \"DEEPJSCC w/o ofdm\"\nlabel_deepjscc_w_ofdm = \"DEEPJSCC w/ ofdm\"\nlabel_ours = \"OURS\"\n\n# Axes Limits and Labels\nxlim_values = [5, 25]\nylim_values = [0, 100]\nxlabel_value = \"SNR\"\nylabel_value = \"Classification Accuracy (%)\"\nxticks_values = np.arange(5, 25, 5)\nyticks_values = np.arange(0, 101, 20)\nxtickslabel_values = None # Not specified in the code\nytickslabel_values = None # Not specified in the code\ntitle_value = None # Not specified in the code\naxhiline_value = None # Not specified in the code\naxvline_value = None # Not specified in the code\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting\nplt.figure(figsize=(8, 6)) # Adjusting figure size to match original image dimensions\nplt.plot(\n snr_values,\n jpeg_ldpc,\n \"-o\",\n label=label_jpeg_ldpc,\n color=\"#1f77b4\",\n clip_on=False,\n zorder=10,\n)\nplt.plot(\n snr_values,\n deepjscc_wo_ofdm,\n \"-^\",\n label=label_deepjscc_wo_ofdm,\n color=\"#ff7f0e\",\n clip_on=False,\n zorder=10,\n)\nplt.plot(\n snr_values,\n deepjscc_w_ofdm,\n \"-x\",\n label=label_deepjscc_w_ofdm,\n color=\"#2ca02c\",\n clip_on=False,\n zorder=10,\n)\nplt.plot(snr_values, ours, \"-x\", label=label_ours, color=\"#d62728\")\n\n# Set y-axis to only display specific ticks and extend y-axis to leave space at top\nplt.yticks(yticks_values)\nplt.ylim(ylim_values) # Adjusted y-axis limit\nplt.xticks(xticks_values)\nplt.xlim(xlim_values)\n\n# Adding grid, legend, and labels\nplt.grid(True)\nplt.legend(loc=\"upper center\", bbox_to_anchor=(0.5, 1.08), ncol=4, frameon=False)\nplt.xlabel(xlabel_value)\nplt.ylabel(ylabel_value)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to reduce white space\nplt.tight_layout()\nplt.savefig(\"line_1.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_76", "content": { "Sports Categories": [ "Sprint", "Marathon", "Javelin", "High Jump", "Pole Vault" ], "Performance Mean": [ 12.1, 15.2, 13.5, 14.3, 13.8 ], "Performance Error": [ 0.5, 1.0, 0.8, 0.6, 0.7 ] }, "visual_intent": "A horizontal error bar plot about Sports Categories and Performance (Time/Distance), titled Sports Performance Metrics(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/errorpoint_24.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data for plotting\ncategories = [\"Sprint\", \"Marathon\", \"Javelin\", \"High Jump\", \"Pole Vault\"]\nmeans = [12.1, 15.2, 13.5, 14.3, 13.8] # Example average times/distances\nerrors = [0.5, 1.0, 0.8, 0.6, 0.7] # Example standard deviation/error\ndataset_mean = [13.5] # Example overall mean\nxlabel = \"Performance (Time/Distance)\"\nylabel = \"Sports Categories\"\ntitle = \"Sports Performance Metrics\"\nlabel = \"Overall Mean\"\ncolor_scheme = \"#1f77b4\" # Custom blue color for sports theme\nerror_color = \"#ff7f0e\" # Custom orange color for error bars\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nplt.figure(figsize=(10, 8)) # Adjust figure size to match the desired dimensions\nplt.errorbar(\n means,\n categories,\n xerr=errors,\n fmt=\"o\",\n color=color_scheme,\n ecolor=error_color,\n capsize=5,\n elinewidth=2,\n markeredgewidth=2,\n label=\"Mean\",\n)\nplt.axvline(dataset_mean, linestyle=\"--\", color=\"green\", label=label)\n\n# Customizing the plot\nplt.xlabel(xlabel)\nplt.ylabel(ylabel)\nplt.title(title)\nplt.legend()\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting the layout and saving the figure\nplt.tight_layout()\nplt.savefig(\"errorpoint_24.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_77", "content": { "Year": [ 2000.0, 2002.5, 2005.0, 2007.5, 2010.0, 2012.5, 2015.0, 2017.5, 2020.0 ], "Region": [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ], "Approval Rating (%)": [ 40, 42, 45, 48, 50, 52, 49, 51, 55 ] }, "visual_intent": "A 3D scatter and line plot about Year, Region, and Approval Rating (%), titled Political Party Approval Ratings Over Time(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/3d_55.jpg", "original_category": "3d", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Generate new data based on political domain (party approval ratings over time)\nnp.random.seed(0)\nx = np.linspace(2000, 2020, 9) # Years from 2000 to 2020\ny = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9]) # Placeholder for geographical regions or other metrics\nz = np.array([40, 42, 45, 48, 50, 52, 49, 51, 55]) # Example approval ratings with slight noise\nz_fit = np.poly1d(np.polyfit(x, z, 1))(x) # Linear fit for trend\n\n# Text labels and title\nxlabel = \"Year\"\nylabel = \"Region\"\nzlabel = \"Approval Rating (%)\"\ntitle = \"Political Party Approval Ratings Over Time\"\nlabels = [\"Actual Ratings\", \"Trend Line\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig = plt.figure(figsize=(10, 8))\nax = fig.add_subplot(111, projection=\"3d\")\n\n# Scatter plot for actual data points\nax.scatter(x, y, z, color=\"#D62728\", label=labels[0], marker=\"^\", s=100)\n\n# Line plot for trend line\nax.plot(x, y, z_fit, color=\"#1F77B4\", label=labels[1], linestyle=\"--\", linewidth=2)\n\n# Setting axes labels and title\nax.set_xlabel(xlabel, fontsize=12, labelpad=10)\nax.set_ylabel(ylabel, fontsize=12, labelpad=10)\nax.set_zlabel(zlabel, fontsize=12, labelpad=10)\nax.set_title(title, fontsize=14)\nax.legend()\n\n# Adjust box aspect ratio and zoom level for better visualization\nax.set_box_aspect(aspect=(1.5, 1, 1.5), zoom=0.9)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"3d_55.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "misc" }, { "id": "test_78", "content": { "Label": [ "Coal\n30%", "Oil\n25%", "Natural Gas\n20%", "Deforestation\n15%", "Industrial Processes\n7%", "Waste\n3%" ], "Percentage": [ 30, 25, 20, 15, 7, 3 ] }, "visual_intent": "A treemap chart about carbon emission sources and their percentages, titled Global Carbon Emissions by Source(size of the desired plot: width=12.0, height=8.0)", "path_to_gt_image": "images/tree_62.jpg", "original_category": "tree", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Data\nsizes = [30, 25, 20, 15, 7, 3]\nlabels = [\n \"Coal\\n30%\",\n \"Oil\\n25%\",\n \"Natural Gas\\n20%\",\n \"Deforestation\\n15%\",\n \"Industrial Processes\\n7%\",\n \"Waste\\n3%\",\n]\ntitle = 'Global Carbon Emissions by Source'\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with the specified size\ncolors = [\"#2E8B57\", \"#556B2F\", \"#66CDAA\", \"#8FBC8F\", \"#3CB371\", \"#20B2AA\"]\nfig = plt.figure(figsize=(12, 8))\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes,\n label=labels,\n color=colors,\n alpha=0.8,\n text_kwargs={\"fontsize\": 18, \"weight\": 'bold'},\n ec=\"black\",\n)\n\n# Add a title\nplt.title(title, fontsize=22, weight='bold')\n\n# Remove axes\nplt.axis(\"off\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout\nplt.tight_layout()\nplt.savefig(\"tree_62.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 8.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_79", "content": { "Age Group": [ "0-14", "15-24", "25-54", "55-64", "65+" ], "Population Percentage": [ 15, 10, 40, 20, 15 ] }, "visual_intent": "A pie chart about age groups and population percentage, titled Population Distribution by Age Group (in %)(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/pie_66.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data to plot\nage_groups = [\"0-14\", \"15-24\", \"25-54\", \"55-64\", \"65+\"]\npopulation_sizes = [15, 10, 40, 20, 15] # Example data in percentage\n\n# Plot configuration variables\ntitle_text = \"Population Distribution by Age Group (in %)\"\nxlabel_text = \"Age Groups\"\nylabel_text = \"Population Percentage\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nexplode = (0.1, 0, 0, 0, 0) # explode the first slice\ncolors = [\"#f4a582\", \"#92c5de\", \"#d5e0e0\", \"#fee0b6\", \"#b2182b\"]\ntitle_pad = 20\ntitle_fontsize = 18\nlegend_loc = \"center left\"\nlegend_bbox_to_anchor = (1, 0, 0.5, 1)\nautopct_format = \"%1.1f%%\"\nstartangle = 140\nwedgeprops = dict(edgecolor=\"k\")\n\n# Plot\nfig, ax = plt.subplots(figsize=(10, 7))\nax.pie(\n population_sizes,\n colors=colors,\n autopct=autopct_format,\n startangle=startangle,\n wedgeprops=wedgeprops,\n explode=explode,\n)\n\n# Adding a title and legend\nax.set_title(title_text, pad=title_pad, fontsize=title_fontsize)\nax.legend(age_groups, loc=legend_loc, bbox_to_anchor=legend_bbox_to_anchor)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout\nplt.tight_layout()\nplt.savefig(\"pie_66.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_80", "content": { "Weeks": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28 ], "Performance": [ 0.65, 0.64, 0.72, 0.83, 0.85, 0.73, 0.84, 0.79, 0.79, 0.79, 0.75, 0.78, 0.69, 0.61, 0.56, 0.5, 0.5, 0.36, 0.33, 0.23, 0.11, 0.25, 0.25, 0.16, 0.33, 0.16, 0.27, 0.3 ], "Efficiency": [ 0.87, 0.85, 0.76, 0.73, 0.62, 0.51, 0.53, 0.5, 0.49, 0.44, 0.3, 0.26, 0.19, 0.15, 0.12, 0.3, 0.18, 0.21, 0.2, 0.34, 0.27, 0.4, 0.42, 0.55, 0.56, 0.58, 0.69, 0.75 ], "Growth": [ 0.0, 0.27, 0.36, 0.48, 0.55, 0.63, 0.66, 0.66, 0.8, 0.81, 0.78, 0.92, 0.88, 0.95, 1.0, 1.0, 1.0, 0.98, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] }, "visual_intent": "A line chart about Weeks, Performance, Efficiency, and Growth, titled Detailed Performance and Efficiency Analysis Over Weeks(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/line_62.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\nweeks = [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n]\nperformance_data = [\n 0.65,\n 0.64,\n 0.72,\n 0.83,\n 0.85,\n 0.73,\n 0.84,\n 0.79,\n 0.79,\n 0.79,\n 0.75,\n 0.78,\n 0.69,\n 0.61,\n 0.56,\n 0.5,\n 0.5,\n 0.36,\n 0.33,\n 0.23,\n 0.11,\n 0.25,\n 0.25,\n 0.16,\n 0.33,\n 0.16,\n 0.27,\n 0.3,\n]\nefficiency_data = [\n 0.87,\n 0.85,\n 0.76,\n 0.73,\n 0.62,\n 0.51,\n 0.53,\n 0.5,\n 0.49,\n 0.44,\n 0.3,\n 0.26,\n 0.19,\n 0.15,\n 0.12,\n 0.3,\n 0.18,\n 0.21,\n 0.2,\n 0.34,\n 0.27,\n 0.4,\n 0.42,\n 0.55,\n 0.56,\n 0.58,\n 0.69,\n 0.75,\n]\ngrowth_data = [\n 0.0,\n 0.27,\n 0.36,\n 0.48,\n 0.55,\n 0.63,\n 0.66,\n 0.66,\n 0.8,\n 0.81,\n 0.78,\n 0.92,\n 0.88,\n 0.95,\n 1.0,\n 1.0,\n 1.0,\n 0.98,\n 1.0,\n 1.0,\n 1.0,\n 1.0,\n 1.0,\n 1.0,\n 1.0,\n 1.0,\n 1.0,\n 1.0,\n]\n\n# Extracted variables\nxlabel = \"Weeks\"\nylabel_performance = \"Performance\"\nylabel_efficiency = \"Efficiency\"\nxlim = (0, 30)\nylim = (0, 1.2)\ntitle = \"Detailed Performance and Efficiency Analysis Over Weeks\"\nline_label_performance = \"Performance\"\nline_label_efficiency = \"Efficiency\"\nline_label_growth = \"Growth\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure and axis\nfig, ax1 = plt.subplots(figsize=(10, 6))\n\n# Plot the performance data on the primary y-axis\ncolor = \"tab:blue\"\nax1.set_xlabel(xlabel)\nax1.set_ylabel(ylabel_performance, color=color)\n(line1,) = ax1.plot(\n weeks,\n performance_data,\n color=color,\n marker=\"o\",\n linestyle=\"-\",\n clip_on=False,\n zorder=10,\n linewidth=2,\n label=line_label_performance,\n)\nax1.tick_params(axis=\"y\", labelcolor=color)\nax1.set_ylim(ylim)\n\n# Create a secondary y-axis for the efficiency data\nax2 = ax1.twinx()\ncolor = \"tab:red\"\nax2.set_ylabel(ylabel_efficiency, color=color)\n(line2,) = ax2.plot(\n weeks,\n efficiency_data,\n color=color,\n marker=\"x\",\n linestyle=\"--\",\n clip_on=False,\n zorder=10,\n linewidth=2,\n label=line_label_efficiency,\n)\nax2.tick_params(axis=\"y\", labelcolor=color)\nax2.set_ylim(ylim)\n\n# Add a legend to the plot\ncolor = \"tab:green\"\n(line3,) = ax1.plot(\n weeks,\n growth_data,\n color=color,\n marker=\"^\",\n linestyle=\":\",\n linewidth=2,\n clip_on=False,\n zorder=10,\n label=line_label_growth,\n)\n# ax1.legend(loc='upper left')\n\n# Customize the plot with a title, grid, and background color\nfig.patch.set_facecolor(\"#f4f4f4\")\nax1.set_facecolor(\"#e5f5f9\")\nax2.set_facecolor(\"#f9e5e6\")\nax1.set_xlim(xlim)\nax1.tick_params(axis=\"both\", which=\"both\", length=0)\nax2.tick_params(axis=\"both\", which=\"both\", length=0)\nlines = [line1, line2, line3]\nlabels = [line.get_label() for line in lines]\nfig.legend(\n lines, labels, loc=\"upper center\", bbox_to_anchor=(0.5, 0.95), ncol=3, frameon=False\n)\n# Set the title and display the plot\nplt.title(title, y=1.05)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better spacing and display\nplt.tight_layout()\nplt.savefig(\"line_62.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "line" }, { "id": "test_81", "content": { "Name": [ "Aristotle", "Plato", "Descartes", "Kant", "Nietzsche", "Sartre", "Hume", "Heidegger", "Wittgenstein" ], "Popularity": [ 70, 80, 60, 75, 85, 65, 50, 55, 95 ], "Influence": [ 80, 85, 75, 90, 88, 78, 65, 60, 95 ], "Number of Publications": [ 300, 500, 700, 1000, 1200, 900, 400, 600, 1100 ] }, "visual_intent": "A bubble chart about Popularity and Influence of various philosophers, sized by Number of Publications(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/scatter_60.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\nnames = [\n \"Aristotle\",\n \"Plato\",\n \"Descartes\",\n \"Kant\",\n \"Nietzsche\",\n \"Sartre\",\n \"Hume\",\n \"Heidegger\",\n \"Wittgenstein\",\n]\nx = [70, 80, 60, 75, 85, 65, 50, 55, 95]\ny = [80, 85, 75, 90, 88, 78, 65, 60, 95]\nsizes = [300, 500, 700, 1000, 1200, 900, 400, 600, 1100]\nxlabel = \"Popularity\"\nylabel = \"Influence\"\nlegend_sizes = [300, 500, 1000, 1200, 1500]\nlegend_labels = [\"300P\", \"500P\", \"1KP\", \"1.2KP\", \">1.5KP\"]\nlegend_title = \"Number of Publications\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and plot\nfig, ax = plt.subplots(figsize=(10, 7))\ncolors = [\n \"#377eb8\",\n \"#377eb8\",\n \"#4daf4a\",\n \"#4daf4a\",\n \"#f781bf\",\n \"#f781bf\",\n \"#a65628\",\n \"#a65628\",\n \"#984ea3\",\n]\nscatter = ax.scatter(x, y, s=sizes, c=colors, alpha=0.6, edgecolors=\"w\", linewidth=0.5)\n\n# Add annotations\nfor i, name in enumerate(names):\n ax.annotate(\n name,\n (x[i], y[i]),\n textcoords=\"offset points\",\n xytext=(0, 5),\n ha=\"center\",\n fontsize=9,\n )\n\n# Customize the axes\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\nax.set_xlim(45, 100)\nax.set_ylim(55, 100)\n\n# Add legend for bubble sizes\nfor size, label in zip(legend_sizes, legend_labels):\n ax.scatter([], [], c=\"grey\", alpha=0.5, s=size, label=label)\n\n# Adjust the legend to have increased spacing\nlegend = ax.legend(\n scatterpoints=1,\n frameon=False,\n labelspacing=2,\n handletextpad=1,\n columnspacing=5,\n title=legend_title,\n fontsize=10,\n loc=\"upper center\",\n bbox_to_anchor=(0.5, 1.2),\n ncol=len(legend_sizes),\n)\n\nfor legend_handle in legend.legendHandles:\n legend_handle._sizes = [80]\n\nplt.grid(True)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"scatter_60.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_82", "content": { "Source Department": [ "Admissions", "Teaching", "Research", "Administration", "HR", "IT Services", "Library", "Teaching", "Student Affairs", "Finance", "Housing", "Security" ], "Target Department": [ "Teaching", "Research", "Administration", "HR", "IT Services", "Library", "Security", "Student Affairs", "Finance", "Housing", "Security", "Cafeteria" ], "Collaboration Weight": [ 3, 4, 4, 3, 2, 2, 4, 3, 4, 3, 2, 1 ] }, "visual_intent": "A directed network graph about university departments and collaboration weights, titled University Departments and Their Collaboration Relationships(size of the desired plot: width=14.0, height=10.0)", "path_to_gt_image": "images/graph_68.jpg", "original_category": "graph", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport networkx as nx\nimport numpy as np\n\n# Create a directed graph representing university departments\nG = nx.DiGraph()\n\n# Add nodes representing different departments\ndepartments = {\n 0: \"Admissions\",\n 1: \"Teaching\",\n 2: \"Research\",\n 3: \"Administration\",\n 4: \"HR\",\n 5: \"IT Services\",\n 6: \"Library\",\n 7: \"Student Affairs\",\n 8: \"Finance\",\n 9: \"Housing\",\n 10: \"Security\",\n 11: \"Cafeteria\",\n}\n\nG.add_nodes_from(departments.keys())\n\n# Add edges with weights representing communication flow or collaboration (weight = frequency/importance)\nedges = [\n (0, 1, 3),\n (1, 2, 4),\n (2, 3, 4),\n (3, 4, 3),\n (4, 5, 2),\n (5, 6, 2),\n (6, 10, 4),\n (1, 7, 3),\n (7, 8, 4),\n (8, 9, 3),\n (9, 10, 2),\n (10, 11, 1),\n]\n\nG.add_weighted_edges_from(edges)\n\n# Adjust node positions using spring layout for better visualization\npos = nx.spring_layout(G, seed=42)\ntitle = \"University Departments and Their Collaboration Relationships\"\n\n# Labels for nodes and edges\nnode_labels = departments\nedge_labels = {(start, end): f\"{weight}\" for start, end, weight in edges}\n\n# Set node size and color\nnode_size = [800 + 200 * (i % 3) for i in range(len(departments))]\nnode_color = [\"#1f77b4\" if i % 3 == 0 else \"#2ca02c\" if i % 3 == 1 else \"#d62728\" for i in range(len(departments))]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nplt.figure(figsize=(14, 10))\n\n# Draw nodes with varying sizes and colors\nnx.draw(\n G, pos, node_size=node_size, node_color=node_color, with_labels=False, arrows=True\n)\n\n# Draw labels for nodes and edges\nnx.draw_networkx_labels(G, pos, labels=node_labels, font_size=9)\nnx.draw_networkx_edge_labels(G, pos, edge_labels=edge_labels, font_color=\"purple\")\n\n# Adjust plot parameters for better visualization\nplt.title(title, fontsize=15)\nplt.axis(\"off\")\n\n# Create a legend\nlegend_labels = {\"Light Blue\": \"Node Group 1\", \"Green\": \"Node Group 2\", \"Red\": \"Node Group 3\"}\nhandles = [plt.Line2D([0], [0], color=color, marker='o', linestyle='', markersize=10) for color in [\"#1f77b4\", \"#2ca02c\", \"#d62728\"]]\nplt.legend(handles, legend_labels.values(), loc=\"upper left\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show the plot\nplt.tight_layout()\nplt.savefig(\"graph_68.pdf\", bbox_inches=\"tight\")\n", "width": 14.0, "height": 10.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "misc" }, { "id": "test_83", "content": { "Exercise Type": [ "Yoga", "Running", "Cycling", "Weightlifting" ], "Morning Energy": [ 8.0, 9.5, 8.5, 7.0 ], "Evening Energy": [ 7.5, 8.0, 7.8, 6.5 ], "Error Margin": [ 0.5, 0.4, 0.6, 0.3 ] }, "visual_intent": "A line chart with error bars comparing energy levels for different exercise types in the morning and evening, titled Energy Levels After Exercise(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/line_92.jpg", "original_category": "line", "additional_info": { "gt_code": " \n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data\nexercise_types = [\"Yoga\", \"Running\", \"Cycling\", \"Weightlifting\"]\nenergy_morning = [8.0, 9.5, 8.5, 7.0]\nenergy_evening = [7.5, 8.0, 7.8, 6.5]\nerror = [0.5, 0.4, 0.6, 0.3]\n\n# Axes Limits and Labels\nxlabel_value = \"Exercise Type\"\nylabel_value = \"Energy Level (AU)\"\nylim_values = [0, 10]\n\n# Labels\nlabel_Morning = \"Morning\"\nlabel_Evening = \"Evening\"\n\n# Titles\ntitle = \"Time of Day\"\nsupertitle = \"Energy Levels After Exercise\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot\nfig, ax = plt.subplots(figsize=(8, 6))\nax.errorbar(\n exercise_types,\n energy_morning,\n yerr=error,\n fmt=\"o-\",\n color=\"#1f77b4\", # Blue\n ecolor=\"#1f77b4\",\n elinewidth=2,\n capsize=5,\n capthick=2,\n label=label_Morning,\n markerfacecolor='#aec7e8'\n)\nax.errorbar(\n exercise_types,\n energy_evening,\n yerr=error,\n fmt=\"s-\",\n color=\"#ff7f0e\", # Orange\n ecolor=\"#ff7f0e\",\n elinewidth=2,\n capsize=5,\n capthick=2,\n label=label_Evening,\n markerfacecolor='#ffbb78'\n)\n\n# Customization\nax.set_xlabel(xlabel_value)\nax.set_ylabel(ylabel_value)\nax.set_ylim(ylim_values)\n\nax.tick_params(\n axis=\"both\", which=\"major\", length=6, direction=\"in\", top=True, right=True\n)\nax.legend(title=title, loc=\"lower right\", frameon=False)\nfig.suptitle(supertitle, fontsize=16)\nax.set_title(\"\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot\nplt.tight_layout(rect=[0, 0.03, 1, 0.95])\nplt.savefig(\"line_92.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_84", "content": { "Years of Experience": [ "1", "2", "3", "4", "5", "6", "7" ], "Public Defender": [ 0.4, 0.45, 0.5, 0.55, 0.6, 0.62, 0.65 ], "Private Attorney": [ 0.6, 0.68, 0.72, 0.76, 0.8, 0.82, 0.85 ], "Corporate Lawyer": [ 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.78 ] }, "visual_intent": "A line chart about years of experience and case success rates for different types of attorneys, titled Attorney Case Success Rate Over Years of Experience(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/line_148.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\nfrom matplotlib.ticker import MultipleLocator\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for plotting\nyears_experience = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"]\npublic_defender = [0.4, 0.45, 0.5, 0.55, 0.6, 0.62, 0.65]\nprivate_attorney = [0.6, 0.68, 0.72, 0.76, 0.8, 0.82, 0.85]\ncorporate_lawyer = [0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.78]\n\n# Variables for plot configuration\nline_labels = [\"Public Defender\", \"Private Attorney\", \"Corporate Lawyer\"]\nxlim_values = (0, len(years_experience) - 1)\nylim_values = (0.3, 0.9)\nxlabel_value = \"Years of Experience\"\nylabel_value = \"Case Success Rate\"\nxticks_values = range(len(years_experience))\nyticks_values = np.arange(0.3, 1.0, 0.1)\nxtickslabel_values = years_experience\nytickslabel_values = None\ntitle_value = \"Attorney Case Success Rate Over Years of Experience\"\naxhline_value = None\naxvline_value = None\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the lines\nplt.figure(figsize=(10, 7))\nplt.plot(\n years_experience,\n public_defender,\n \"s--\",\n clip_on=False,\n zorder=10,\n color=\"#1f77b4\", # Dark blue\n label=line_labels[0],\n linewidth=2,\n)\nplt.plot(\n years_experience,\n private_attorney,\n \"^--\",\n clip_on=False,\n zorder=10,\n color=\"#2ca02c\", # Dark green\n label=line_labels[1],\n linewidth=2,\n)\nplt.plot(\n years_experience,\n corporate_lawyer,\n \"o--\",\n clip_on=False,\n zorder=10,\n color=\"#d62728\", # Dark red\n label=line_labels[2],\n linewidth=2,\n)\n\n# Setting x and y ticks\nplt.xticks(xticks_values, xtickslabel_values, fontsize=14)\nplt.xlim(xlim_values)\nplt.yticks(yticks_values, fontsize=14)\n\n# Adding minor y-axis ticks with a step of 0.05\nax = plt.gca()\nax.yaxis.set_minor_locator(MultipleLocator(0.05))\n\n# Adjust tick parameters\nax.tick_params(axis=\"both\", which=\"both\", length=5, color=\"gray\") # Move ticks inside\nax.tick_params(\n axis=\"y\", which=\"minor\", length=3 # Adjusting minor tick length for better visibility\n)\n\n# Title and labels\nplt.title(title_value, fontsize=16)\nplt.xlabel(xlabel_value, fontsize=14)\nplt.ylabel(ylabel_value, fontsize=14)\n\n# Enable gridlines for major and minor ticks\nplt.grid(True, color=\"#b0b0b0\", which=\"both\", linestyle=\"-\", linewidth=0.5)\n\n# Legend with serif font family\nplt.legend(\n frameon=False, fontsize=12, loc=\"lower center\", bbox_to_anchor=(0.5, -0.2), ncol=3\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to add more space on the right\nplt.tight_layout()\n\nplt.savefig(\"line_148.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_85", "content": { "Number_of_Experts": [ 1, 2, 4, 8 ], "DoN_Baseline": [ 3.0, 3.1, 3.2, 3.2 ], "DoN_SoftMoE": [ 2.5, 2.7, 2.9, 3.1 ], "DoN_Top1-MoE": [ 2.0, 2.3, 2.5, 2.6 ], "Rainbow_Baseline": [ 4.0, 5.0, 6.0, 7.0 ], "Rainbow_SoftMoE": [ 5.0, 5.5, 6.5, 7.0 ], "Rainbow_Top1-MoE": [ 6.0, 6.3, 7.0, 7.5 ] }, "visual_intent": "A figure with 2 subplots showing IQM Human Normalized Score vs Number of experts: (1) a line chart with error bars about DoN scores for Baseline, SoftMoE, and Top1-MoE models, (2) a line chart with error bars about Rainbow scores for the same models(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/line_25.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Dummy data for the purpose of plotting. In a real scenario, you would use your actual data.\nnumber_of_experts = np.array([1, 2, 4, 8])\n\n# IQM Human Normalized Score for DoN\nbaseline_don = np.array([3, 3.1, 3.2, 3.2])\nsoftmoe_don = np.array([2.5, 2.7, 2.9, 3.1])\ntop1moe_don = np.array([2, 2.3, 2.5, 2.6])\n\n# Error for DoN\nerror_don = np.array([0.1, 0.1, 0.1, 0.1])\n\n# IQM Human Normalized Score for Rainbow\nbaseline_rainbow = np.array([4, 5, 6, 7])\nsoftmoe_rainbow = np.array([5, 5.5, 6.5, 7])\ntop1moe_rainbow = np.array([6, 6.3, 7, 7.5])\n\n# Error for Rainbow\nerror_rainbow = np.array([0.2, 0.2, 0.2, 0.2])\n\n# Axes Limits and Labels\nylabel_value_1 = \"DoN\"\nylabel_value_2 = \"Rainbow\"\nylim_values_1 = [1.8, 3.8]\nyticks_values_1 = [2.0, 2.5, 3.0, 3.5]\nylim_values_2 = [3.0, 8.0]\nyticks_values_2 = [\n 3.5,\n 4.5,\n 5.5,\n 6.5,\n 7.5,\n]\n\n# Labels\nlabel_Baseline = \"Baseline\"\nlabel_SoftMoE = \"SoftMoE\"\nlabel_Top1_MoE = \"Top1-MoE\"\n\n# Texts\ntext_1 = \"Number of experts\"\ntext_2 = \"IQM Human Normalized Score\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create two subplots and unpack the output array immediately\nf, (ax1, ax2) = plt.subplots(2, 1, sharex=True, figsize=(8, 6))\n\n# First subplot for DoN\nax1.errorbar(\n number_of_experts,\n baseline_don,\n yerr=error_don,\n label=label_Baseline,\n color=\"#3171ad\",\n marker=\"o\",\n)\nax1.errorbar(\n number_of_experts,\n softmoe_don,\n yerr=error_don,\n label=label_SoftMoE,\n color=\"#469c76\",\n marker=\"o\",\n)\nax1.errorbar(\n number_of_experts,\n top1moe_don,\n yerr=error_don,\n label=label_Top1_MoE,\n color=\"#c17cb9\",\n marker=\"o\",\n)\nax1.set_ylabel(ylabel_value_1)\n# Set grid\nax1.grid(True)\nax1.set_ylim(ylim_values_1)\nax1.set_yticks(yticks_values_1)\n\n# Second subplot for Rainbow\nax2.errorbar(\n number_of_experts,\n baseline_rainbow,\n yerr=error_rainbow,\n label=label_Baseline,\n color=\"#3171ad\",\n marker=\"o\",\n)\nax2.errorbar(\n number_of_experts,\n softmoe_rainbow,\n yerr=error_rainbow,\n label=label_SoftMoE,\n color=\"#469c76\",\n marker=\"o\",\n)\nax2.errorbar(\n number_of_experts,\n top1moe_rainbow,\n yerr=error_rainbow,\n label=label_Top1_MoE,\n color=\"#c17cb9\",\n marker=\"o\",\n)\nax2.set_ylabel(ylabel_value_2)\n# Set grid\nax2.grid(True)\nax2.set_ylim(ylim_values_2)\nax2.set_yticks(yticks_values_2)\n\n# Only show ticks on the bottom subplot\nplt.setp(ax1.get_xticklabels(), visible=False)\n\n# Create legend above the second subplot\nax2.legend(loc=\"upper center\", bbox_to_anchor=(0.5, 1.2), ncol=3)\n\n# Set the figure's layout so there is space for the xlabel at the bottom\nplt.tight_layout()\n\n# Now adjust the subplot to give space for the ylabel on the left\nf.subplots_adjust(left=0.15, bottom=0.12)\n\n# Place the legend and adjust subplot parameters\nax2.legend(loc=\"upper center\", bbox_to_anchor=(0.5, 1.2), ncol=3)\n\nf.text(0.55, 0.05, text_1, ha=\"center\", va=\"center\")\nf.text(\n 0.05,\n 0.5,\n text_2,\n ha=\"center\",\n va=\"center\",\n rotation=\"vertical\",\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.savefig(\"line_25.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "line" }, { "id": "test_86", "content": { "Language": [ "German", "French", "English", "Japanese", "Korean", "Chinese" ], "Out_Group_Start_Value": [ 6.5, 7.0, 7.0, 7.2, 6.2, 7.1 ], "Out_Group_Bias_Value": [ -2.44, -3.22, -4.0, -4.75, -0.5, -4.0 ], "In_Group_Start_Value": [ 5.5, 6.0, 7.0, 7.2, 7.0, 7.2 ], "In_Group_Bias_Value": [ 3.38, 2.88, 1.88, 0.78, 0.25, 1.11 ] }, "visual_intent": "A figure with 2 subplots: (1) an arrow chart displaying out-group and in-group bias for Western languages (German, French, English), (2) an arrow chart displaying out-group and in-group bias for Eastern languages (Japanese, Korean, Chinese)(size of the desired plot: width=10.0, height=4.0)", "path_to_gt_image": "images/quiver_1.jpg", "original_category": "quiver", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.lines as mlines\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for the plot\nlanguages_1 = [\"German\", \"French\", \"English\"]\nout_start_1 = [6.5, 7, 7]\nout_group_bias_1 = [-2.44, -3.22, -4.00]\nin_start_1 = [5.5, 6, 7]\nin_group_bias_1 = [+3.38, +2.88, +1.88]\nax1_labels = [\"Out-group bias\\n(Collectivism)\", \"In-group bias\\n(Individualism)\"]\n\nlanguages_2 = [\"Japanese\", \"Korean\", \"Chinese\"]\nout_start_2 = [7.2, 6.2, 7.1]\nout_group_bias_2 = [-4.75, -0.50, -4.00]\nin_start_2 = [7.2, 7, 7.2]\nin_group_bias_2 = [0.78, 0.25, 1.11]\nax2_labels = [\"Out-group bias\\n(Individualism)\", \"In-group bias\\n(Collectivism)\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure with two subplots\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4))\n\n# Set the y-axis offsets to be in the middle of each grid\noffset = 0.5\n\n# First subplot (languages_1)\nfor i, lang in enumerate(languages_1):\n # Out-group bias line with arrow and black dots at start and end\n ax1.annotate(\n \"\",\n xy=(out_start_1[i], i + offset * 3 / 2),\n xytext=(out_start_1[i] + out_group_bias_1[i], i + offset * 3 / 2),\n arrowprops=dict(arrowstyle=\"<-\", color=\"red\"),\n )\n ax1.scatter(\n [out_start_1[i], out_start_1[i] + out_group_bias_1[i]],\n [i + offset * 3 / 2, i + offset * 3 / 2],\n color=\"black\",\n s=10,\n )\n ax1.annotate(\n f\"{out_group_bias_1[i]:.2f}\",\n (out_start_1[i] + out_group_bias_1[i], i + offset * 1.75),\n color=\"red\",\n ha=\"right\",\n va=\"center\",\n )\n\n # In-group bias line with arrow and black dots at start and end\n ax1.annotate(\n \"\",\n xy=(in_start_1[i], i + offset / 2),\n xytext=(in_start_1[i] + in_group_bias_1[i], i + offset / 2),\n arrowprops=dict(arrowstyle=\"<-\", color=\"blue\"),\n )\n ax1.scatter(\n [in_start_1[i], in_start_1[i] + in_group_bias_1[i]],\n [i + offset / 2, i + offset / 2],\n color=\"black\",\n s=10,\n )\n ax1.annotate(\n f\"{in_group_bias_1[i]:.2f}\",\n (in_start_1[i] + in_group_bias_1[i], i + offset * 0.75),\n color=\"blue\",\n ha=\"left\",\n va=\"center\",\n )\n\n# Second subplot (languages_2)\nfor i, lang in enumerate(languages_2):\n ax2.annotate(\n \"\",\n xy=(out_start_2[i], i + offset * 3 / 2),\n xytext=(out_start_2[i] + out_group_bias_2[i], i + offset * 3 / 2),\n arrowprops=dict(arrowstyle=\"<-\", color=\"red\"),\n )\n ax2.scatter(\n [out_start_2[i], out_start_2[i] + out_group_bias_2[i]],\n [i + offset * 3 / 2, i + offset * 3 / 2],\n color=\"black\",\n s=10,\n )\n ax2.annotate(\n f\"{out_group_bias_2[i]:.2f}\",\n (out_start_2[i] + out_group_bias_2[i], i + offset * 1.75),\n color=\"red\",\n ha=\"right\",\n va=\"center\",\n )\n\n ax2.annotate(\n \"\",\n xy=(in_start_2[i], i + offset / 2),\n xytext=(in_start_2[i] + in_group_bias_2[i], i + offset / 2),\n arrowprops=dict(arrowstyle=\"<-\", color=\"blue\"),\n )\n ax2.scatter(\n [in_start_2[i], in_start_2[i] + in_group_bias_2[i]],\n [i + offset / 2, i + offset / 2],\n color=\"black\",\n s=10,\n )\n ax2.annotate(\n f\"{in_group_bias_2[i]:.2f}\",\n (in_start_2[i] + in_group_bias_2[i], i + offset * 0.75),\n color=\"blue\",\n ha=\"left\",\n va=\"center\",\n )\n\n# set y-axis limits\nax1.set_ylim(0, len(languages_1))\nax2.set_ylim(0, len(languages_2))\n\n# Set x-axis limits uniformly\nax1.set_xlim(0, 10)\nax2.set_xlim(0, 10)\n\n# Adjust the y-axis tick positions\nax1.set_yticks([i + offset for i in range(len(languages_1))])\nax1.set_yticklabels(languages_1)\nax2.set_yticks([i + offset for i in range(len(languages_2))])\nax2.set_yticklabels(languages_2)\nax2.yaxis.tick_right()\nax2.yaxis.set_label_position(\"right\")\n\n# Offset grid lines on the y-axis\nax1.set_yticks([i for i in range(len(languages_1))], minor=True)\nax2.set_yticks([i for i in range(len(languages_2))], minor=True)\nax1.yaxis.grid(True, which=\"minor\", linewidth=0.5, alpha=0.7, color=\"black\")\nax2.yaxis.grid(True, which=\"minor\", linewidth=0.5, alpha=0.7, color=\"black\")\n\n# add x-axis grid lines and set gap is 1\nax1.xaxis.set_major_locator(plt.MultipleLocator(1))\nax2.xaxis.set_major_locator(plt.MultipleLocator(1))\nax1.grid(axis=\"x\", linestyle=\"--\", linewidth=0.5)\nax2.grid(axis=\"x\", linestyle=\"--\", linewidth=0.5)\n\n# Create arrow-shaped legend entries with a line that aligns with the arrowhead\nred_arrow = mlines.Line2D(\n [],\n [],\n color=\"red\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax1_labels[0],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nblue_arrow = mlines.Line2D(\n [],\n [],\n color=\"blue\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax1_labels[1],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nfig.legend(handles=[red_arrow, blue_arrow], bbox_to_anchor=(0.45, 0), ncol=2)\n\nred_arrow = mlines.Line2D(\n [],\n [],\n color=\"red\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax2_labels[0],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nblue_arrow = mlines.Line2D(\n [],\n [],\n color=\"blue\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax2_labels[1],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nfig.legend(handles=[red_arrow, blue_arrow], bbox_to_anchor=(0.85, 0), ncol=2)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout()\nplt.savefig(\"quiver_1.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 4.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_87", "content": { "Art Genres": [ "Abstract Art", "Realism", "Impressionism", "Cubism", "Surrealism", "Pop Art", "Minimalism", "Fauvism", "Baroque" ], "Art Style A": [ 65, 70, 50, 80, 60, 75, 55, 78, 68 ], "Art Style B": [ 82, 75, 68, 88, 74, 80, 70, 83, 80 ] }, "visual_intent": "A radar chart about Art Style A and Art Style B scores across different Art Genres, titled Comparison of Different Art Styles(size of the desired plot: width=8.0, height=7.0)", "path_to_gt_image": "images/radar_22.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(1)\n# Data\ncategories = [\n \"Abstract Art\",\n \"Realism\",\n \"Impressionism\",\n \"Cubism\",\n \"Surrealism\",\n \"Pop Art\",\n \"Minimalism\",\n \"Fauvism\",\n \"Baroque\",\n]\nvalues1 = [65, 70, 50, 80, 60, 75, 55, 78, 68]\nvalues2 = [82, 75, 68, 88, 74, 80, 70, 83, 80]\nyticks = [20, 40, 60, 80, 100]\nylim = [0, 100]\nxlabel = \"Art Genres Comparison\"\nlegendlabels = [\"Art Style A\", \"Art Style B\"]\ntitle = \"Comparison of Different Art Styles\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Size of the figure\nfig, ax = plt.subplots(figsize=(8, 7), subplot_kw=dict(polar=True))\n\n# Number of variables\nnum_vars = len(categories)\n# Compute angle for each category\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n\n# The plot is circular, so we need to \"complete the loop\" and append the start to the end.\nvalues1 += values1[:1]\nvalues2 += values2[:1]\nangles += angles[:1]\n\nmargin = 0.1 # Adjust margin for labels\n# Draw one axe per variable and add labels with a margin\nlabels = []\nfor angle, label in zip(angles[:-1], categories):\n x_offset = margin * np.cos(angle)\n y_offset = margin * np.sin(angle)\n labels.append(\n ax.text(\n angle + x_offset,\n 120 + y_offset,\n label,\n color=\"black\",\n size=10,\n horizontalalignment=\"center\",\n verticalalignment=\"center\",\n )\n )\nplt.xticks(angles[:-1], [])\n\n# Draw ylabels\nax.set_rlabel_position(0)\nplt.yticks(yticks, [], color=\"#bceced\", size=7)\nplt.ylim(ylim)\n\n# Plot data\nax.plot(\n angles,\n values2,\n linewidth=1.5,\n linestyle=\"solid\",\n label=legendlabels[1],\n color=\"#FF7F0E\",\n marker=\"o\",\n)\nax.fill(angles, values2, \"#FF7F0E\", alpha=0.25)\n\nax.plot(\n angles,\n values1,\n linewidth=1.5,\n linestyle=\"solid\",\n label=legendlabels[0],\n color=\"#1F77B4\",\n marker=\"o\",\n)\nax.fill(angles, values1, \"#1F77B4\", alpha=0.25)\n\n# Add data labels\nfor angle, value in zip(angles, values1):\n ax.text(\n angle,\n value,\n str(value),\n color=\"black\",\n size=10,\n horizontalalignment=\"center\",\n verticalalignment=\"bottom\",\n )\nfor angle, value in zip(angles, values2):\n ax.text(\n angle,\n value,\n str(value),\n color=\"black\",\n size=10,\n horizontalalignment=\"center\",\n verticalalignment=\"bottom\",\n )\n\n# Add legend\nplt.legend(\n loc=\"lower center\",\n ncol=2,\n bbox_to_anchor=(0.5, -0.2),\n)\n\n# Add titles\nplt.title(title, size=14, color=\"black\", x=0.5, y=1.15)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_22.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 7.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_88", "content": { "Tourism Factors": [ "Accommodation", "Food", "Transport", "Activities", "Shopping", "Entertainment" ], "Region A": [ 85, 78, 92, 80, 75, 88 ], "Region B": [ 40, 42, 45, 45, 40, 40 ] }, "visual_intent": "A radar chart about Tourism Factors and Scores, titled Tourism Satisfaction Comparison(size of the desired plot: width=8.0, height=7.0)", "path_to_gt_image": "images/radar_46.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Seed for reproducibility\nnp.random.seed(0)\n\n# Data Categories and Values\ncategories = [\n \"Accommodation\",\n \"Food\",\n \"Transport\",\n \"Activities\",\n \"Shopping\",\n \"Entertainment\",\n]\nvalues1 = [85, 78, 92, 80, 75, 88]\nvalues2 = [40, 42, 45, 45, 40, 40]\nlabels = [\"Region A\", \"Region B\"]\n\n# Labels and Title\nxlabel = \"Tourism Factors\"\nylabel = \"Scores\"\ntitle = \"Tourism Satisfaction Comparison\"\nannotation_offset = 5\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Number of variables\nnum_vars = len(categories)\n\n# Compute angle for each category\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n\n# The plot is circular, so we need to \"complete the loop\" and append the start to the end.\nvalues1 += values1[:1]\nvalues2 += values2[:1]\nangles += angles[:1]\n\n# Plot\nfig, ax = plt.subplots(figsize=(8, 7), subplot_kw=dict(polar=True))\nax.fill(angles, values1, color=\"#66c2a5\", alpha=0.25)\nax.fill(angles, values2, color=\"#fc8d62\", alpha=0.25)\nax.plot(\n angles,\n values1,\n color=\"#66c2a5\",\n linewidth=2,\n label=labels[0],\n linestyle=\"-\",\n marker=\"o\",\n)\nax.plot(\n angles,\n values2,\n color=\"#fc8d62\",\n linewidth=2,\n label=labels[1],\n linestyle=\"--\",\n marker=\"s\",\n)\n\n# Labels and annotations for each point\nfor angle, value1, value2 in zip(angles[:-1], values1[:-1], values2[:-1]):\n ax.annotate(\n f\"{value1}\",\n xy=(angle, value1),\n xytext=(annotation_offset, annotation_offset),\n textcoords=\"offset points\",\n )\n ax.annotate(\n f\"{value2}\",\n xy=(angle, value2),\n xytext=(annotation_offset, -annotation_offset),\n textcoords=\"offset points\",\n )\n\n# Labels for each point\nax.set_xticks(angles[:-1])\nax.set_xticklabels(categories)\n\n# Remove ylabels\nax.set_yticklabels([])\n\n# Title\nplt.title(title, size=15, color=\"#444444\", pad=20)\n\n# Legend\nax.legend(\n loc=\"lower center\",\n bbox_to_anchor=(0.5, -0.1),\n ncol=2,\n frameon=True,\n facecolor=\"#f2f2f2\",\n edgecolor=\"#f2f2f2\",\n)\n\nax.xaxis.set_tick_params(pad=25)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_46.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 7.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_89", "content": { "Program": [ "Performing Arts", "Visual Arts", "Music", "Dance", "Literature" ], "Distribution_Pct": [ 30, 25, 20, 15, 10 ], "Performance_Metric": [ "Creativity", "Technique", "Expression", "Collaboration", "Dedication" ], "Score": [ 0.9, 0.85, 0.75, 0.8, 0.9 ] }, "visual_intent": "A figure with 2 subplots: (1) a pie chart about the distribution of arts education programs, titled Distribution of Arts Education Programs, (2) a radar chart about student performance metrics in arts education, titled Student Performance in Arts Education(size of the desired plot: width=10.0, height=5.0)", "path_to_gt_image": "images/multidiff_24.jpg", "original_category": "multidiff", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\nfrom matplotlib.gridspec import GridSpec\nfrom matplotlib.lines import Line2D\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Create a figure and a GridSpec layout\nfig = plt.figure(figsize=(10, 5))\ngs = GridSpec(1, 2, figure=fig)\n\n# ------- Pie Chart Data for Arts Education Programs -------\ncategories = [\"Performing Arts\", \"Visual Arts\", \"Music\", \"Dance\", \"Literature\"]\nsizes = [30, 25, 20, 15, 10] # Percentages of each program\n\nexplode = (0.1, 0, 0, 0, 0) # Highlight Performing Arts\n\n# ------- Radar Chart Data for Student Performance in Arts Education -------\nlabels = np.array(\n [\"Creativity\", \"Technique\", \"Expression\", \"Collaboration\", \"Dedication\"]\n)\nnum_vars = len(labels)\nvalues = np.array([0.9, 0.85, 0.75, 0.80, 0.90])\nvalues = np.concatenate((values, [values[0]]))\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\nangles += angles[:1]\n\ntitle_1 = \"Distribution of Arts Education Programs\"\ntitle_2 = \"Student Performance in Arts Education\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#ff9999\", \"#66b3ff\", \"#99ff99\", \"#ffcc99\", \"#c2c2f0\"]\n\n# Create the pie chart in the left panel\nax1 = fig.add_subplot(gs[0, 0])\nwedges, texts, autotexts = ax1.pie(\n sizes,\n labels=categories,\n colors=colors,\n autopct=\"%1.1f%%\",\n startangle=140,\n explode=explode,\n)\nax1.set_title(title_1)\nax1.axis(\"equal\") # Equal aspect ratio ensures that pie is drawn as a circle.\n\n# Create the radar chart in the right panel\nax2 = fig.add_subplot(gs[0, 1], polar=True)\nax2.fill(angles, values, color=\"blue\", alpha=0.25)\nax2.plot(angles, values, color=\"blue\", linewidth=1)\nax2.set_xticks(angles[:-1])\nax2.set_xticklabels(labels)\nax2.set_title(title_2)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Display the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"multidiff_24.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 5.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_90", "content": { "City": [ "City A", "City B", "City C", "City D", "City E", "City F" ], "Resident Count Mean": [ 50000, 75000, 30000, 120000, 45000, 60000 ], "Resident Count Error": [ 5000, 7000, 3000, 10000, 4000, 6000 ], "Tourist Count Mean": [ 15000, 30000, 20000, 50000, 25000, 35000 ], "Tourist Count Error": [ 2000, 5000, 3000, 7000, 3500, 4500 ] }, "visual_intent": "An errorbar plot about cities and number of people for residents and tourists, titled Population Analysis: Residents vs Tourists(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/errorpoint_65.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np # Importing numpy for handling data\n\n# Data for Population Analysis\ncategories = [\n \"City A\",\n \"City B\",\n \"City C\",\n \"City D\",\n \"City E\",\n \"City F\",\n]\nresident_mean = [50000, 75000, 30000, 120000, 45000, 60000] # Example mean values for residents\ntourist_mean = [15000, 30000, 20000, 50000, 25000, 35000] # Example mean values for tourists\nresident_error = [5000, 7000, 3000, 10000, 4000, 6000] # Example error values for residents\ntourist_error = [2000, 5000, 3000, 7000, 3500, 4500] # Example error values for tourists\nlabels = [\"Resident Count Mean\", \"Tourist Count Mean\"]\nylabel = \"Number of People\"\naxlabel = \"Average Tourist Count\"\ntitle = \"Population Analysis: Residents vs Tourists\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n\n# Plotting\nfig, ax = plt.subplots(figsize=(10, 6))\n\n# Error bars and markers\nax.errorbar(\n categories,\n resident_mean,\n yerr=resident_error,\n fmt=\"o\",\n color=\"skyblue\",\n marker=\"s\", # Square marker\n markersize=8,\n label=labels[0],\n)\nax.errorbar(\n categories,\n tourist_mean,\n yerr=tourist_error,\n fmt=\"o\",\n color=\"lightgreen\",\n marker=\"o\", # Circle marker\n markersize=8,\n label=labels[1],\n)\n\n# Customization\nax.set_ylabel(ylabel)\nax.set_xticklabels(categories, rotation=45, ha=\"right\")\nax.axhline(\n y=sum(tourist_mean) / len(tourist_mean),\n color=\"grey\",\n linestyle=\"--\",\n linewidth=1.5,\n label=axlabel,\n)\n\n# Title and Grid\nax.set_title(title)\nax.grid(True, linestyle=\"--\", linewidth=0.5)\n\n# Legend\nax.legend()\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot\nplt.tight_layout()\nplt.savefig(\"errorpoint_65.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_91", "content": { "Art Category": [ "Painting", "Painting", "Sculpture", "Sculpture", "Digital Art", "Textile Art", "Textile Art", "Textile Art" ], "Sub-category": [ "Type A", "Type D", "Type B", "Type D", "Type C", "Type A", "Type B", "Type D" ], "Count": [ 10, 2, 8, 3, 15, 2, 4, 12 ] }, "visual_intent": "A 3D bar chart about Art Category, Sub-category and Count, titled Distribution of Artifacts and Designs(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/3d_48.jpg", "original_category": "3d", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# Fixing random state for reproducibility\n\n# Define custom histogram data for art categories\nhist = np.array([[10, 0, 0, 2], [0, 8, 0, 3], [0, 0, 15, 0], [2, 4, 0, 12]])\n\n# Define the edges of the bins\nxedges = np.array([0, 1, 2, 3, 4])\nyedges = np.array([0, 1, 2, 3, 4])\n\n# Construct arrays for the anchor positions of the bars.\nxpos, ypos = np.meshgrid(xedges[:-1] + 0.25, yedges[:-1] + 0.25, indexing=\"ij\")\nxpos = xpos.ravel()\nypos = ypos.ravel()\nzpos = 0\n\n# Only keep positions where there is a non-zero bar\nnon_zero_indices = hist.ravel() > 0\nxpos = xpos[non_zero_indices]\nypos = ypos[non_zero_indices]\ndz = hist.ravel()[non_zero_indices]\n\n# All bars have the same width and depth\ndx = dy = 0.5 * np.ones_like(dz)\n\n# Axes Limits and Labels\nax_xlabel = \"Art Category\"\nax_ylabel = \"Sub-category\"\nax_zlabel = \"Count\"\n\n# Labels for the axes\nxtick_labels = [\"Painting\", \"Sculpture\", \"Digital Art\", \"Textile Art\"]\nytick_labels = [\"Type A\", \"Type B\", \"Type C\", \"Type D\"]\n\n# Chart title\nchart_title = \"Distribution of Artifacts and Designs\"\n\n# Color palette for bars\nbar_colors = [\"#FF5733\", \"#33FF57\", \"#3357FF\", \"#FF33A6\"]\n\n# Legend labels\nlegend_labels = [\"Type A\", \"Type B\", \"Type C\", \"Type D\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a new figure for the modified 3D bar plot\nfig = plt.figure(figsize=(10, 8))\nax = fig.add_subplot(projection=\"3d\")\n\n# Set different colors for the bars\ncolors = np.array([bar_colors[int(i)] for i in ypos])\n\n# Plotting the bars with custom colors\nax.bar3d(xpos, ypos, zpos, dx, dy, dz, zsort=\"average\", color=colors)\n\n# Set the labels and title\nax.set_xlabel(ax_xlabel,labelpad=10)\nax.set_ylabel(ax_ylabel,labelpad=10)\nax.set_zlabel(ax_zlabel,labelpad=10)\nax.set_title(chart_title)\n\n# Set custom tick labels\nax.set_xticks(np.arange(len(xtick_labels)))\nax.set_xticklabels(xtick_labels)\nax.set_yticks(np.arange(len(ytick_labels)))\nax.set_yticklabels(ytick_labels)\n\n# Add a legend with custom labels\ncustom_legend = [plt.Line2D([0], [0], color=bar_colors[i], lw=4) for i in range(len(bar_colors))]\nax.legend(custom_legend, legend_labels, loc=\"upper right\")\n\n# Adjust the aspect ratio\nax.set_box_aspect(aspect=None, zoom=0.9)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"3d_48.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "misc" }, { "id": "test_92", "content": { "Years": [ "2018", "2019", "2020", "2021", "2022" ], "CO2 Emissions (in ppm)": [ 400, 420, 430, 390, 410 ], "Water Pollution Index": [ 76, 80, 79, 75, 78 ], "Air Quality Index": [ 65, 68, 64, 66, 67 ] }, "visual_intent": "A grouped bar chart about environmental metrics (CO2 emissions, Water Pollution, Air Quality) across different years, titled Annual Pollution Index Across Different Years(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/bar_177.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data\nyears = [\"2018\", \"2019\", \"2020\", \"2021\", \"2022\"]\nco2_emissions = [400, 420, 430, 390, 410]\nwater_pollution_index = [76, 80, 79, 75, 78]\nair_quality_index = [65, 68, 64, 66, 67]\n\n# X-axis positions for each group of bars\nx = np.arange(len(years))\n\nlabels = [\n \"CO2 Emissions (in ppm)\",\n \"Water Pollution Index\",\n \"Air Quality Index\",\n]\ntitle = \"Annual Pollution Index Across Different Years\"\nxlabel = \"Years\"\nylabel = \"Index Values\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Bar width\nbar_width = 0.25\n\n# Adjust yticks based on the new data range.\nyticks = np.arange(0, 501, 50)\n\n# Figure and axis\nfig, ax = plt.subplots(figsize=(12, 6)) # Adjusted dimension for clarity\n\n# Plotting bars\nrects1 = ax.bar(\n x - bar_width,\n co2_emissions,\n bar_width,\n label=labels[0],\n color=\"#2f4b7c\",\n edgecolor=\"white\",\n)\nrects2 = ax.bar(\n x,\n water_pollution_index,\n bar_width,\n label=labels[1],\n color=\"#a05195\",\n edgecolor=\"white\",\n)\nrects3 = ax.bar(\n x + bar_width,\n air_quality_index,\n bar_width,\n label=labels[2],\n color=\"#d45087\",\n edgecolor=\"white\",\n)\n\n# Adding index labels on top of each bar\ndef add_labels(rects):\n for rect in rects:\n height = rect.get_height()\n ax.annotate(\n f\"{height:.1f}\",\n xy=(rect.get_x() + rect.get_width() / 2, height),\n xytext=(0, 3), # 3 points vertical offset\n textcoords=\"offset points\",\n ha=\"center\",\n va=\"bottom\",\n )\n\nadd_labels(rects1)\nadd_labels(rects2)\nadd_labels(rects3)\n\n# Title and labels\nax.set_title(title)\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\n\n# X and Y ticks\nax.set_xticks(x)\nax.set_xticklabels(years)\nax.set_yticks(yticks)\n\n# Legend\nax.legend(loc=\"upper center\", ncol=3, frameon=False)\n\n# Grid lines\nax.yaxis.grid(True, linestyle='--', linewidth=0.7)\nax.set_axisbelow(True)\n\ngrid_color = \"#bdbdbd\"\n# Set border color\nfor spine in ax.spines.values():\n spine.set_edgecolor(grid_color)\n# hidden ticks\nplt.tick_params(axis=\"both\", which=\"both\", length=0)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout\nplt.tight_layout()\nplt.savefig(\"bar_177.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_93", "content": { "Country": [ "USA", "Canada", "UK", "Brazil", "India", "China" ], "Threat_Perception_Start_Value": [ 7, 6.8, 7.5, 8.0, 7.5, 8.5 ], "Threat_Perception_Change": [ -1.2, -1.0, -1.5, -2.0, -1.8, -2.1 ], "Adoption_Rate_Start_Value": [ 6, 6.5, 6.8, 7.5, 7.0, 7.8 ], "Adoption_Rate_Change": [ 2.0, 1.5, 1.8, 1.5, 1.2, 1.7 ] }, "visual_intent": "A figure with 2 subplots showing arrow charts representing the change in threat perception and adoption rates of green technologies for different countries, titled 'Environmental Studies: Threat Perception vs Adoption Rate'. Subplot (1) covers Western countries (USA, Canada, UK) and Subplot (2) covers emerging economies (Brazil, India, China).(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/quiver_22.jpg", "original_category": "quiver", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.lines as mlines\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for the plot\ncountries_1 = [\"USA\", \"Canada\", \"UK\"]\nthreat_perception_start_1 = [7, 6.8, 7.5]\nthreat_perception_change_1 = [-1.2, -1.0, -1.5]\nadoption_start_1 = [6, 6.5, 6.8]\nadoption_rate_change_1 = [+2.0, +1.5, +1.8]\nax1_labels = [\"Decrease in Threat Perception\", \"Increase in Adoption Rate\"]\n\ncountries_2 = [\"Brazil\", \"India\", \"China\"]\nthreat_perception_start_2 = [8.0, 7.5, 8.5]\nthreat_perception_change_2 = [-2.0, -1.8, -2.1]\nadoption_start_2 = [7.5, 7.0, 7.8]\nadoption_rate_change_2 = [+1.5, +1.2, +1.7]\nax2_labels = [\"Decrease in Threat Perception\", \"Increase in Adoption Rate\"]\n\n# Chart text labels\nxlabel = \"Value\"\nylabel = \"Countries\"\ntitle = \"Perception and Adoption of Green Technologies\"\nsuptitle = \"Environmental Studies: Threat Perception vs Adoption Rate\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure with two subplots\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))\n\n# Set the y-axis offsets to be in the middle of each grid\noffset = 0.5\n\n# First subplot (countries_1)\nfor i, country in enumerate(countries_1):\n # Threat perception line with arrow and brown dots at start and end\n ax1.annotate(\n \"\",\n xy=(threat_perception_start_1[i], i + offset * 3 / 2),\n xytext=(\n threat_perception_start_1[i] + threat_perception_change_1[i],\n i + offset * 3 / 2,\n ),\n arrowprops=dict(arrowstyle=\"<-\", color=\"brown\"),\n )\n ax1.scatter(\n [\n threat_perception_start_1[i],\n threat_perception_start_1[i] + threat_perception_change_1[i],\n ],\n [i + offset * 3 / 2, i + offset * 3 / 2],\n color=\"black\",\n s=10,\n )\n ax1.annotate(\n f\"{threat_perception_change_1[i]:.2f}\",\n (\n threat_perception_start_1[i] + threat_perception_change_1[i],\n i + offset * 1.75,\n ),\n color=\"brown\",\n ha=\"right\",\n va=\"center\",\n )\n\n # Adoption rate line with arrow and green dots at start and end\n ax1.annotate(\n \"\",\n xy=(adoption_start_1[i], i + offset / 2),\n xytext=(adoption_start_1[i] + adoption_rate_change_1[i], i + offset / 2),\n arrowprops=dict(arrowstyle=\"<-\", color=\"green\"),\n )\n ax1.scatter(\n [adoption_start_1[i], adoption_start_1[i] + adoption_rate_change_1[i]],\n [i + offset / 2, i + offset / 2],\n color=\"black\",\n s=10,\n )\n ax1.annotate(\n f\"{adoption_rate_change_1[i]:.2f}\",\n (adoption_start_1[i] + adoption_rate_change_1[i], i + offset * 0.75),\n color=\"green\",\n ha=\"left\",\n va=\"center\",\n )\n\n# Second subplot (countries_2)\nfor i, country in enumerate(countries_2):\n ax2.annotate(\n \"\",\n xy=(threat_perception_start_2[i], i + offset * 3 / 2),\n xytext=(\n threat_perception_start_2[i] + threat_perception_change_2[i],\n i + offset * 3 / 2,\n ),\n arrowprops=dict(arrowstyle=\"<-\", color=\"brown\"),\n )\n ax2.scatter(\n [\n threat_perception_start_2[i],\n threat_perception_start_2[i] + threat_perception_change_2[i],\n ],\n [i + offset * 3 / 2, i + offset * 3 / 2],\n color=\"black\",\n s=10,\n )\n ax2.annotate(\n f\"{threat_perception_change_2[i]:.2f}\",\n (\n threat_perception_start_2[i] + threat_perception_change_2[i],\n i + offset * 1.75,\n ),\n color=\"brown\",\n ha=\"right\",\n va=\"center\",\n )\n\n ax2.annotate(\n \"\",\n xy=(adoption_start_2[i], i + offset / 2),\n xytext=(adoption_start_2[i] + adoption_rate_change_2[i], i + offset / 2),\n arrowprops=dict(arrowstyle=\"<-\", color=\"green\"),\n )\n ax2.scatter(\n [adoption_start_2[i], adoption_start_2[i] + adoption_rate_change_2[i]],\n [i + offset / 2, i + offset / 2],\n color=\"black\",\n s=10,\n )\n ax2.annotate(\n f\"{adoption_rate_change_2[i]:.2f}\",\n (adoption_start_2[i] + adoption_rate_change_2[i], i + offset * 0.75),\n color=\"green\",\n ha=\"left\",\n va=\"center\",\n )\n\n# set y-axis limits\nax1.set_ylim(0, len(countries_1))\nax2.set_ylim(0, len(countries_2))\n\n# Set x-axis limits uniformly\nax1.set_xlim(0, 10)\nax2.set_xlim(0, 10)\n\n# Adjust the y-axis tick positions\nax1.set_yticks([i + offset for i in range(len(countries_1))])\nax1.set_yticklabels(countries_1)\nax2.set_yticks([i + offset for i in range(len(countries_2))])\nax2.set_yticklabels(countries_2)\nax2.yaxis.tick_right()\nax2.yaxis.set_label_position(\"right\")\n\n# Offset grid lines on the y-axis\nax1.set_yticks([i for i in range(len(countries_1))], minor=True)\nax2.set_yticks([i for i in range(len(countries_2))], minor=True)\nax1.yaxis.grid(True, which=\"minor\", linewidth=0.5, alpha=0.7, color=\"black\")\nax2.yaxis.grid(True, which=\"minor\", linewidth=0.5, alpha=0.7, color=\"black\")\n\n# add x-axis grid lines and set gap is 1\nax1.xaxis.set_major_locator(plt.MultipleLocator(1))\nax2.xaxis.set_major_locator(plt.MultipleLocator(1))\nax1.grid(axis=\"x\", linestyle=\"--\", linewidth=0.5)\nax2.grid(axis=\"x\", linestyle=\"--\", linewidth=0.5)\n\n# Create arrow-shaped legend entries with a line that aligns with the arrowhead\nbrown_arrow = mlines.Line2D(\n [],\n [],\n color=\"brown\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax1_labels[0],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\ngreen_arrow = mlines.Line2D(\n [],\n [],\n color=\"green\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax1_labels[1],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nfig.legend(handles=[brown_arrow, green_arrow], bbox_to_anchor=(0.45, 0), ncol=2)\n\nbrown_arrow = mlines.Line2D(\n [],\n [],\n color=\"brown\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax2_labels[0],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\ngreen_arrow = mlines.Line2D(\n [],\n [],\n color=\"green\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax2_labels[1],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nfig.legend(handles=[brown_arrow, green_arrow], bbox_to_anchor=(0.85, 0), ncol=2)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.suptitle(suptitle, fontsize=14)\nplt.tight_layout(rect=[0, 0.03, 1, 0.95])\nplt.savefig(\"quiver_22.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_94", "content": { "Country": [ "USA", "Germany", "China", "India", "Spain", "Brazil" ], "Energy_Type": [ "Solar", "Solar", "Solar", "Wind", "Wind", "Wind" ], "Start_Time_Years": [ 8.0, 7.5, 9.0, 6.0, 5.5, 6.5 ], "Growth_GW": [ 2.5, 3.0, 2.0, 1.8, 2.2, 1.6 ] }, "visual_intent": "A horizontal arrow plot showing renewable energy growth periods for various countries, titled Renewable Energy Production Growth(size of the desired plot: width=7.0, height=5.0)", "path_to_gt_image": "images/quiver_24.jpg", "original_category": "quiver", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.lines as mlines\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for the plot\n# Set 1: Solar Energy\ncountries_1 = [\"USA\", \"Germany\", \"China\"]\nsolar_start = [8, 7.5, 9]\nsolar_growth = [2.5, 3, 2]\n\n# Set 2: Wind Energy\ncountries_2 = [\"India\", \"Spain\", \"Brazil\"]\nwind_start = [6, 5.5, 6.5]\nwind_growth = [1.8, 2.2, 1.6]\n\n# Axes Limits and Labels\nxlim_values = [0, 12]\nxlabel = \"Time (Years)\"\nylabel = \"Energy Production (GW)\"\ntitle = \"Renewable Energy Production Growth\"\nlabel_solar = \"Solar Energy Growth\"\nlabel_wind = \"Wind Energy Growth\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure with a single subplot\nfig, ax1 = plt.subplots(figsize=(7, 5))\n\n# Set the y-axis offsets to be in the middle of each grid\noffset = 0.5\n\n# First subplot (countries_1)\nfor i, country in enumerate(countries_1):\n # Solar Energy growth line with arrow and black dots at start and end\n ax1.annotate(\n \"\",\n xy=(solar_start[i], i + offset * 3 / 2),\n xytext=(solar_start[i] + solar_growth[i], i + offset * 3 / 2),\n arrowprops=dict(arrowstyle=\"<-\", color=\"green\"),\n )\n ax1.scatter(\n [solar_start[i], solar_start[i] + solar_growth[i]],\n [i + offset * 3 / 2, i + offset * 3 / 2],\n color=\"black\",\n s=10,\n )\n ax1.annotate(\n f\"{solar_growth[i]:.1f}GW\",\n (solar_start[i] + solar_growth[i], i + offset * 1.75),\n color=\"green\",\n ha=\"right\",\n va=\"center\",\n )\n\n# Second subplot (countries_2)\nfor i, country in enumerate(countries_2):\n # Wind Energy growth line with arrow and black dots at start and end\n ax1.annotate(\n \"\",\n xy=(wind_start[i], len(countries_1) + i + offset * 3 / 2),\n xytext=(wind_start[i] + wind_growth[i], len(countries_1) + i + offset * 3 / 2),\n arrowprops=dict(arrowstyle=\"<-\", color=\"blue\"),\n )\n ax1.scatter(\n [wind_start[i], wind_start[i] + wind_growth[i]],\n [len(countries_1) + i + offset * 3 / 2, len(countries_1) + i + offset * 3 / 2],\n color=\"black\",\n s=10,\n )\n ax1.annotate(\n f\"{wind_growth[i]:.1f}GW\",\n (wind_start[i] + wind_growth[i], len(countries_1) + i + offset * 1.75),\n color=\"blue\",\n ha=\"right\",\n va=\"center\",\n )\n\n# Set y-axis limits\nax1.set_ylim(0, len(countries_1) + len(countries_2))\n\n# Set x-axis limits uniformly\nax1.set_xlim(xlim_values)\n\n# Adjust the y-axis tick positions\nax1.set_yticks([i + offset for i in range(len(countries_1) + len(countries_2))])\nax1.set_yticklabels(countries_1 + countries_2)\n\n# Offset grid lines on the y-axis\nax1.set_yticks([i for i in range(len(countries_1) + len(countries_2))], minor=True)\n\nax1.yaxis.grid(True, which=\"minor\", linewidth=0.5, alpha=0.7, color=\"black\")\n\n# Add x-axis grid lines and set gap to 1\nax1.xaxis.set_major_locator(plt.MultipleLocator(1))\n\nax1.grid(axis=\"x\", linestyle=\"--\", linewidth=0.5)\n\n# Create arrow-shaped legend entries with a line that aligns with the arrowhead\ngreen_arrow = mlines.Line2D(\n [],\n [],\n color=\"green\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=label_solar,\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\n\nblue_arrow = mlines.Line2D(\n [],\n [],\n color=\"blue\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=label_wind,\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\n\n# Set title and labels\nax1.set_xlabel(xlabel)\nax1.set_ylabel(ylabel)\nax1.set_title(title)\n\nfig.legend(handles=[green_arrow, blue_arrow], bbox_to_anchor=(0.5, -0.1), ncol=1)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout()\nplt.savefig(\"quiver_24.pdf\", bbox_inches=\"tight\")\n", "width": 7.0, "height": 5.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "misc" }, { "id": "test_95", "content": { "Categories": [ "EDUCATION", "WORKPLACE", "HEALTHCARE", "TECHNOLOGY", "ENTERTAINMENT" ], "Public Interest": [ 0.25, 0.3, 0.2, 0.15, 0.1 ], "Lower_Error": [ 0.04, 0.03, 0.05, 0.02, 0.03 ], "Upper_Error": [ 0.02, 0.03, 0.04, 0.01, 0.04 ] }, "visual_intent": "An errorbar plot about Categories and Public Interest (Fraction of Survey Responses), titled Public Interest in Various Societal Categories(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/errorpoint_35.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Data for plotting\ncategories = [\n \"EDUCATION\",\n \"WORKPLACE\",\n \"HEALTHCARE\",\n \"TECHNOLOGY\",\n \"ENTERTAINMENT\",\n]\nmeans = [0.25, 0.3, 0.2, 0.15, 0.1]\nerrors = [0.04, 0.03, 0.05, 0.02, 0.03]\ndownerrors = [0.02, 0.03, 0.04, 0.01, 0.04]\nlegendtitles = [\"Overall Mean\", \"Category Mean\"]\ntexttitle = \"Overall Mean\"\nylabel = \"Public Interest (Fraction of Survey Responses)\"\nxlabel = \"Categories\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nfig, ax = plt.subplots(figsize=(10, 7))\n\nax.errorbar(\n categories,\n means,\n yerr=[errors, downerrors],\n fmt=\"o\",\n color=\"forestgreen\",\n ecolor=\"lightcoral\",\n elinewidth=2,\n capsize=6,\n markerfacecolor='blue',\n markeredgewidth=2,\n)\n\n# Adding a legend with both \"Category Mean\" and \"Overall Mean\"\noverall_mean = 0.2\nmean_line = ax.errorbar(\n [], [], yerr=[], fmt=\"o\", color=\"forestgreen\", ecolor=\"lightcoral\", capsize=6\n)\noverall_mean_line = ax.axhline(\n y=overall_mean, color=\"indigo\", linestyle=\"--\", linewidth=1.5\n)\nax.legend(\n [overall_mean_line, mean_line],\n legendtitles,\n loc=\"upper right\",\n fancybox=True,\n framealpha=1,\n shadow=True,\n borderpad=1,\n)\n\n# Adding a horizontal line for overall mean and text annotation with a white background\nax.text(\n 0.95,\n overall_mean,\n texttitle,\n va=\"center\",\n ha=\"right\",\n backgroundcolor=\"white\",\n transform=ax.get_yaxis_transform(),\n)\n\n# Setting labels\nax.set_ylabel(ylabel)\nax.set_xlabel(xlabel)\nax.set_title(\"Public Interest in Various Societal Categories\", fontsize=14, fontweight='bold')\nplt.xticks(rotation=30, fontsize=10)\nplt.yticks(fontsize=10)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorpoint_35.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_96", "content": { "Country": [ "USA", "Germany", "China", "India" ], "Growth Rate (%)": [ 2.9, 1.6, 6.1, 5.8 ], "Inflation Rate (%)": [ 2.3, 1.5, 2.7, 3.4 ] }, "visual_intent": "A figure with 2 subplots: (1) a combined bar and line chart about countries and growth rates, titled Average Growth Rates by Country, (2) a combined bar and line chart about countries and inflation rates, titled Average Inflation Rates by Country(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/CB_80.jpg", "original_category": "CB", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data\ncountries = [\"USA\", \"Germany\", \"China\", \"India\"]\ngrowth_rates = [2.9, 1.6, 6.1, 5.8]\ninflation_rates = [2.3, 1.5, 2.7, 3.4]\n\n# Axes Limits and Labels\nax1_title = \"Average Growth Rates by Country\"\nax1_ylim = [0, 7]\nax1_ylabel = \"Growth Rate (%)\"\nax2_title = \"Average Inflation Rates by Country\"\nax2_ylim = [0, 4]\nax2_ylabel = \"Inflation Rate (%)\"\nsublabel_title = \"Economic Indicators by Country\"\nlegendlabels = [\"Growth Rate\", \"Inflation Rate\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and axes\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))\n\n# Bar chart for Average Growth Rates\nax1.bar(countries, growth_rates, color=\"#76c7c0\")\nax1.plot(countries, growth_rates, marker=\"^\", linestyle=\"--\", color=\"#005f73\", linewidth=2)\nfor i, rate in enumerate(growth_rates):\n ax1.text(i, rate, f\"{rate:.1f}%\", ha=\"center\", va=\"bottom\", color=\"#0a9396\")\nax1.set_title(ax1_title)\nax1.set_ylim(ax1_ylim)\nax1.set_ylabel(ax1_ylabel)\nax1.set_facecolor(\"#e0fbfc\")\n\n# Bar chart for Average Inflation Rates\nax2.bar(countries, inflation_rates, color=\"#98c1d9\")\nax2.plot(countries, inflation_rates, marker=\"s\", linestyle=\":\", color=\"#3d5a80\", linewidth=2)\nfor i, rate in enumerate(inflation_rates):\n ax2.text(i, rate, f\"{rate:.1f}%\", ha=\"center\", va=\"bottom\", color=\"#293241\")\nax2.set_title(ax2_title)\nax2.set_ylim(ax2_ylim)\nax2.set_ylabel(ax2_ylabel)\nax2.set_facecolor(\"#e0fbfc\")\n\n# Setting a supertitle\nfig.suptitle(sublabel_title, fontsize=14)\n\n# Adding legends\nax1.legend([legendlabels[0]], loc=\"upper left\")\nax2.legend([legendlabels[1]], loc=\"upper left\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save plot\nplt.tight_layout(rect=[0, 0.03, 1, 0.95])\nplt.savefig(\"CB_80.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_97", "content": { "Research Author": [ "Research A", "Research B", "Research C", "Research D", "Research E", "Research F", "Research G", "Research H", "Research I", "Research J" ], "MB Value": [ -20.1, -20.4, -20.5, -20.2, -20.3, -20.4, -20.5, -20.6, -20.0, -20.7 ], "Error Positive": [ 0.1, 0.2, 0.3, 0.15, 0.25, 0.18, 0.2, 0.22, 0.1, 0.3 ], "Error Negative": [ -0.1, -0.2, -0.3, -0.15, -0.25, -0.18, -0.2, -0.22, -0.1, -0.3 ], "Method": [ "Method 1", "Method 2", "Method 3", "Method 4", "Method 5", "Method 6", "Method 7", "Method 8", "Method 9", "Method 10" ] }, "visual_intent": "A horizontal dot plot with error bars about research authors and MB values, titled Comparison of Different Research Outcomes(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/errorpoint_29.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# New Data for plotting\nauthors = [\n \"Research A\",\n \"Research B\",\n \"Research C\",\n \"Research D\",\n \"Research E\",\n \"Research F\",\n \"Research G\",\n \"Research H\",\n \"Research I\",\n \"Research J\",\n]\nvalues = [\n -20.1,\n -20.4,\n -20.5,\n -20.2,\n -20.3,\n -20.4,\n -20.5,\n -20.6,\n -20.0,\n -20.7,\n]\nerrors = [\n [0.1, -0.1],\n [0.2, -0.2],\n [0.3, -0.3],\n [0.15, -0.15],\n [0.25, -0.25],\n [0.18, -0.18],\n [0.2, -0.2],\n [0.22, -0.22],\n [0.1, -0.1],\n [0.3, -0.3],\n]\nmethods = [\n \"Method 1\",\n \"Method 2\",\n \"Method 3\",\n \"Method 4\",\n \"Method 5\",\n \"Method 6\",\n \"Method 7\",\n \"Method 8\",\n \"Method 9\",\n \"Method 10\",\n]\nxticks = np.arange(-21.2, -19.5, 0.2)\nxlim = [-21.2, -19.5]\nxvline = -20.25\nxvspan = [-20.4, -20.1]\n# Labels\nxlabel = r\"$M_B$ Value\"\ntitle = \"Comparison of Different Research Outcomes\"\nsupertitle = \"Scientific Study Results\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting\nfig, ax = plt.subplots(figsize=(10, 8))\n\n# Error bars with different positive and negative values\nfor i, (author, value, error) in enumerate(zip(authors, values, errors)):\n ax.errorbar(\n value,\n i,\n xerr=[[abs(error[1])], [error[0]]],\n fmt=\"o\",\n color=\"#2E8B57\",\n ecolor=\"#8B0000\",\n capsize=3,\n )\n ax.text(\n value,\n i - 0.15,\n r\"$%.1f^{+%.1f} _{-%.1f}$\" % (value, error[0], abs(error[1])),\n va=\"center\",\n ha=\"center\",\n fontsize=9,\n color=\"#4B0082\"\n )\n\n# Highlighted region with adjusted color and alpha\nax.axvspan(xvspan[0], xvspan[1], color=\"#FFD700\", alpha=0.3)\n\n# Text for methods with adjusted font size\nfor i, method in enumerate(methods):\n ax.text(-19.45, i, method, va=\"center\", ha=\"left\", fontsize=11, color=\"#4682B4\")\n\n# Set labels and title\nax.set_yticks(range(len(authors)))\nax.set_yticklabels(authors, fontsize=12, color=\"#191970\")\nax.set_xlabel(xlabel, fontsize=12, color=\"#191970\")\nax.set_title(title, fontsize=14, fontweight='bold')\nax.set_xlim(xlim)\nax.invert_yaxis() \nax.axvline(x=xvline, linestyle=\"--\", color=\"#FF6347\")\n# Adjust x-axis ticks and labels\nax.set_xticks(xticks)\nax.set_xticklabels([f\"{x:.1f}\" for x in xticks], fontsize=10, color=\"#191970\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save/show the plot\nplt.suptitle(supertitle, fontsize=16, fontweight='bold')\nplt.tight_layout()\nplt.savefig(\"errorpoint_29.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_98", "content": { "maximum predicted probability": [ 0.0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5 ], "Known": [ 10000, 2000, 1000, 800, 600, 500, 500, 400, 300, 200, 100 ], "Unknown": [ 7000, 4000, 3000, 2000, 1000, 800, 500, 400, 300, 200, 100 ] }, "visual_intent": "A stacked bar chart about maximum predicted probability and number of examples, featuring an inset plot zooming into the tail of the distribution(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/PIP_4.jpg", "original_category": "PIP", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Generate some dummy data\ncategory1 = [\n 10000,\n 2000,\n 1000,\n 800,\n 600,\n 500,\n 500,\n 400,\n 300,\n 200,\n 100,\n] # Known category\ncategory2 = [\n 7000,\n 4000,\n 3000,\n 2000,\n 1000,\n 800,\n 500,\n 400,\n 300,\n 200,\n 100,\n] # Unknown category\nbins = [0.0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.4, 0.45, 0.5]\nlabels = [\"Known\", \"Unknown\"]\nxmainlabel = \"maximum predicted probability\"\nxmainlim = [-0.1, 0.8]\nxmainticks = [0.0, 0.2, 0.4, 0.6]\nymainlabel = \"number of examples\"\nymainlim = [0, 20000]\nymainticks = [0, 5000, 10000, 15000, 20000]\n\nxinsetlim = [0.20, 0.55]\nxinsetticks = [0.25, 0.30, 0.35, 0.40, 0.45, 0.50]\nyinsetlim = [0, 1500]\nyinsetticks = [0, 500, 1000, 1500]\n# Create inset plot with adjusted bar widths and white borders\nleft, bottom, width, height = [0.5, 0.3, 0.3, 0.4]\nmainplotline = [(0.235, 1000), (0.235, 2000)]\nmaininsetline = [(0.20, 0), (0.55, 0)]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create main plot with adjusted bar widths and white borders\nfig, ax_main = plt.subplots(figsize=(10, 6))\nbar_width = 0.05 # Slightly less than the bin width to create a gap\nax_main.bar(\n bins,\n category1,\n width=bar_width,\n color=\"#FC8D59\",\n align=\"center\",\n label=labels[0],\n edgecolor=\"white\",\n)\nax_main.bar(\n bins,\n category2,\n width=bar_width,\n color=\"#98C3DD\",\n align=\"center\",\n bottom=category1,\n label=labels[1],\n edgecolor=\"white\",\n)\nax_main.set_xlabel(xmainlabel)\nax_main.set_xlim(xmainlim)\nax_main.set_xticks(xmainticks)\nax_main.set_ylabel(ymainlabel)\nax_main.set_ylim(ymainlim)\nax_main.set_yticks(ymainticks)\nax_main.legend(loc=\"upper right\", prop={\"size\": 16})\nax_main.grid()\n\nax_inset = fig.add_axes([left, bottom, width, height])\nax_inset.bar(\n bins[5:],\n category1[5:],\n width=bar_width,\n color=\"#FC8D59\",\n align=\"center\",\n edgecolor=\"white\",\n)\nax_inset.bar(\n bins[5:],\n category2[5:],\n width=bar_width,\n color=\"#98C3DD\",\n align=\"center\",\n bottom=category1[5:],\n edgecolor=\"white\",\n)\nax_inset.set_xlim(xinsetlim) # Zoom in on the right part of the data\nax_inset.set_xticks(xinsetticks) # Zoom in on the right part of the data\nax_inset.set_ylim(yinsetlim)\nax_inset.set_yticks(yinsetticks)\nax_inset.grid()\n\n# Adding lines to connect the plots.\n# Coordinates of the main plot corners\nmain_plot_left = ax_main.transData.transform_point(mainplotline[0])\nmain_plot_right = ax_main.transData.transform_point(mainplotline[1])\n\n# Coordinates of the inset corners\ninset_left = ax_inset.transData.transform_point(maininsetline[0])\ninset_right = ax_inset.transData.transform_point(maininsetline[1])\n\n# Transform to figure coordinates for annotation\nmain_plot_left = fig.transFigure.inverted().transform(main_plot_left)\nmain_plot_right = fig.transFigure.inverted().transform(main_plot_right)\ninset_left = fig.transFigure.inverted().transform(inset_left)\ninset_right = fig.transFigure.inverted().transform(inset_right)\n\n# Draw lines connecting corners\nfig.add_artist(\n plt.Line2D(\n (main_plot_left[0], inset_left[0]),\n (main_plot_left[1], inset_left[1]),\n color=\"gray\",\n )\n)\nfig.add_artist(\n plt.Line2D(\n (main_plot_right[0], inset_right[0]),\n (main_plot_right[1], inset_right[1]),\n color=\"gray\",\n )\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"PIP_4.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_99", "content": { "Attribute": [ "Damage", "Range", "Speed", "Reliability", "Durability" ], "Sword": [ 0.8, 0.2, 0.5, 0.7, 0.9 ], "Bow": [ 0.3, 0.9, 0.7, 0.6, 0.4 ], "Axe": [ 0.7, 0.4, 0.6, 0.8, 0.5 ] }, "visual_intent": "A radar chart about weapon attributes and performance ratings, titled Medieval Weapon Performance(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/radar_55.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data values\nvalues_sword = [0.8, 0.2, 0.5, 0.7, 0.9]\nvalues_bow = [0.3, 0.9, 0.7, 0.6, 0.4]\nvalues_axe = [0.7, 0.4, 0.6, 0.8, 0.5]\ncategories = [\"Damage\", \"Range\", \"Speed\", \"Reliability\", \"Durability\"]\nlabels = [\"Sword\", \"Bow\", \"Axe\"]\n\nchart_title = \"Medieval Weapon Performance\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Initialise the radar plot\nfig, ax = plt.subplots(figsize=(8, 6), subplot_kw=dict(polar=True))\n\n# Number of variables\nN = len(categories)\n\n# What will be the angle of each axis in the plot\nangles = [n / float(N) * 2 * np.pi for n in range(N)]\nangles += angles[:1]\n\n# Draw one axe per variable and add labels\nplt.xticks(angles[:-1], categories)\n\n# Draw ylabels\nax.set_rlabel_position(0)\nplt.yticks([0.2, 0.4, 0.6, 0.8], [], color=\"grey\", size=7)\nplt.ylim(0, 1)\n\n# Plot data\nax.plot(\n angles,\n values_sword + values_sword[:1],\n color=\"#708090\", # Steel Grey\n linewidth=2,\n linestyle=\"solid\",\n label=labels[0],\n marker=\"o\",\n)\nax.fill(angles, values_sword + values_sword[:1], color=\"#708090\", alpha=0.1)\n\nax.plot(\n angles,\n values_bow + values_bow[:1],\n color=\"#228B22\", # Forest Green\n linewidth=2,\n linestyle=\"dashed\",\n label=labels[1],\n marker=\"v\",\n)\nax.fill(angles, values_bow + values_bow[:1], color=\"#228B22\", alpha=0.1)\n\nax.plot(\n angles,\n values_axe + values_axe[:1],\n color=\"#DC143C\", # Crimson\n linewidth=2,\n linestyle=\"dotted\",\n label=labels[2],\n marker=\"s\",\n)\nax.fill(angles, values_axe + values_axe[:1], color=\"#DC143C\", alpha=0.1)\n\n# Add legend\nplt.legend(loc=\"upper left\", bbox_to_anchor=(1, 1))\n\n# Title and layout adjustments\nplt.suptitle(chart_title, fontsize=14)\nplt.tight_layout(rect=[0, 0, 0.85, 0.95])\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit and save the plot\nplt.savefig(\"radar_55.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "radar" }, { "id": "test_100", "content": { "Category": [ "Programming", "Problem Solving", "Debugging", "Communication", "Teamwork", "Creativity", "Learning" ], "Developer A": [ 7.5, 8, 6.5, 7, 8.5, 7, 9.3 ], "Developer B": [ 8.2, 7.5, 5.4, 7.8, 7, 8.5, 9.0 ] }, "visual_intent": "A radar chart comparing the skill proficiency of Developer A and Developer B across various categories(size of the desired plot: width=4.0, height=4.0)", "path_to_gt_image": "images/radar_52.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\nfrom math import pi\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Define the data for the radar chart\ncategories = [\n \"Programming\",\n \"Problem Solving\",\n \"Debugging\",\n \"Communication\",\n \"Teamwork\",\n \"Creativity\",\n \"Learning\",\n]\nvalues1 = [7.5, 8, 6.5, 7, 8.5, 7, 9.3] # Values for Developer A\nvalues2 = [8.2, 7.5, 5.4, 7.8, 7, 8.5, 9.0] # Values for Developer B\n\n# Number of variables\nN = len(categories)\n\n# Compute angle for each category\nangles = [n / float(N) * 2 * pi for n in range(N)]\nvalues1 += values1[:1]\nvalues2 += values2[:1]\nangles += angles[:1]\n\n# Extracted variables\nline_label1 = \"Developer A\"\nline_label2 = \"Developer B\"\nxticks = angles[:-1]\nxtickslabel = categories\nyticks = [0, 2, 4, 6, 8]\nytickslabel = [\"0\", \"2\", \"4\", \"6\", \"8\"]\nylim = (0, 10)\nlegend_loc = \"lower center\"\nlegend_bbox_to_anchor = (0.5, 1.2)\nlegend_ncol = 2\nlegend_frameon = False\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Initialize the spider plot\nfig, ax = plt.subplots(figsize=(4, 4), subplot_kw=dict(polar=True))\n\n# Draw one axe per variable and add labels with increased padding\nplt.xticks(xticks, xtickslabel, color=\"black\", size=10)\n\n# Draw ylabels\nax.set_rlabel_position(0)\nplt.yticks(yticks, ytickslabel, color=\"black\", size=7)\nplt.ylim(ylim)\n\n# Plot data\nax.plot(\n angles, values1, linewidth=2, linestyle=\"solid\", label=line_label1, color=\"#1f77b4\"\n)\nax.fill(angles, values1, \"#1f77b4\", alpha=0.3)\n\nax.plot(\n angles, values2, linewidth=2, linestyle=\"dashed\", label=line_label2, color=\"#ff7f0e\"\n)\nax.fill(angles, values2, \"#ff7f0e\", alpha=0.3)\n\n# Add legend\nplt.legend(\n loc=legend_loc,\n bbox_to_anchor=legend_bbox_to_anchor,\n ncol=legend_ncol,\n frameon=legend_frameon,\n)\n\n# Set the background color inside the radar chart to white\nax.set_facecolor(\"white\")\n\nax.xaxis.set_tick_params(pad=20)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit\nplt.tight_layout()\n\n# Show the plot\nplt.savefig(\"radar_52.pdf\", bbox_inches=\"tight\")\n", "width": 4.0, "height": 4.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_101", "content": { "Category": [ "Air\nQuality", "Water\nQuality", "Soil\nHealth", "Biodiversity", "Noise\nPollution", "Green\nCover", "Waste\nManagement", "Renewable\nEnergy", "Climate\nResilience" ], "Region A": [ 72, 65, 80, 90, 78, 88, 75, 85, 65 ], "Region B": [ 60, 70, 68, 85, 80, 70, 82, 78, 88 ] }, "visual_intent": "A radar chart comparing various environmental indicators for Region A and Region B, titled Environmental Indicators: Region A vs Region B(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/radar_63.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(1)\n# Data\ncategories = [\n \"Air\\nQuality\",\n \"Water\\nQuality\",\n \"Soil\\nHealth\",\n \"Biodiversity\",\n \"Noise\\nPollution\",\n \"Green\\nCover\",\n \"Waste\\nManagement\",\n \"Renewable\\nEnergy\",\n \"Climate\\nResilience\",\n]\n\nvalues1 = [72, 65, 80, 90, 78, 88, 75, 85, 65] # Region A\nvalues2 = [60, 70, 68, 85, 80, 70, 82, 78, 88] # Region B\n\n# Number of variables\nnum_vars = len(categories)\n\n# Compute angle for each category\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n\n# The plot is circular, so we need to \"complete the loop\" and append the start to the end.\nvalues1 += values1[:1]\nvalues2 += values2[:1]\nangles += angles[:1]\n\n# Extracted variables\nline_label1 = \"Region A\"\nline_label2 = \"Region B\"\nxticks_labels = categories\nyticks_values = [20, 40, 60, 80]\nyticks_labels = []\nylim_values = (0, 100)\ntitle_text = \"Environmental Indicators: Region A vs Region B\"\ntitle_size = 14\ntitle_color = \"darkgreen\"\ntitle_y = 1.1\nlegend_loc = \"lower center\"\nlegend_ncol = 2\nlegend_bbox_to_anchor = (0.5, -0.2)\nlegend_fontsize = \"small\"\nlegend_frameon = False\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Size of the figure\nfig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True))\n\n# Draw one axe per variable and add labels, aligned vertically\nplt.xticks(angles[:-1], xticks_labels, color=\"darkgreen\", size=10, ha=\"center\")\n\n# Draw ylabels\nax.set_rlabel_position(0)\nplt.yticks(yticks_values, yticks_labels, color=\"grey\", size=7)\nplt.ylim(ylim_values)\n\n# Plot data with markers and new colors\nax.plot(\n angles,\n values2,\n linewidth=2,\n linestyle=\"dashed\",\n marker=\"o\",\n label=line_label2,\n color=\"#1f77b4\",\n)\nax.fill(angles, values2, \"#1f77b4\", alpha=0.2)\n\nax.plot(\n angles,\n values1,\n linewidth=2,\n linestyle=\"solid\",\n marker=\"s\",\n label=line_label1,\n color=\"#2ca02c\",\n)\nax.fill(angles, values1, \"#2ca02c\", alpha=0.2)\n\n# Add a title to the radar chart\nplt.title(title_text, size=title_size, color=title_color, y=title_y)\n\n# Add legend\nplt.legend(\n loc=legend_loc,\n ncol=legend_ncol,\n bbox_to_anchor=legend_bbox_to_anchor,\n fontsize=legend_fontsize,\n frameon=legend_frameon,\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_63.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_102", "content": { "Weeks": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], "Traditional TV": [ 20, 19, 18, 16, 15, 14, 13, 12, 11, 10 ], "Streaming Services": [ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ], "Traditional TV Std Dev": [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ], "Streaming Services Std Dev": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ] }, "visual_intent": "A line chart about Weeks and Hours per Week comparing Traditional TV and Streaming Services, titled Weekly Media Consumption Trends(size of the desired plot: width=8.0, height=5.0)", "path_to_gt_image": "images/line_141.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n\n# Sample data: Media consumption trends\nweeks = np.arange(1, 11, 1)\naverage_tv = np.array([20, 19, 18, 16, 15, 14, 13, 12, 11, 10])\naverage_streaming = np.array([5, 6, 7, 8, 9, 10, 11, 12, 13, 14])\nstd_dev_tv = np.array([2, 2, 2, 2, 2, 2, 2, 2, 2, 2])\nstd_dev_streaming = np.array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1])\n\n# Axes Limits and Labels\nxlabel_value = \"Weeks\"\nylabel_value = \"Hours per Week\"\nylim_values = [0, 25]\nyticks_values = np.arange(0, 26, 5)\n\n# Labels\nlabel_TV = \"Traditional TV\"\nlabel_Streaming = \"Streaming Services\"\ntitle=\"Weekly Media Consumption Trends\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nplt.figure(figsize=(8, 5))\n\n# Plotting TV consumption\nplt.plot(weeks, average_tv, label=label_TV, marker=\"s\", linestyle=\"--\", color=\"#ff7f0e\", linewidth=2, markersize=6)\nplt.fill_between(\n weeks,\n average_tv - std_dev_tv,\n average_tv + std_dev_tv,\n color=\"#ff7f0e\",\n alpha=0.2,\n)\n\n# Plotting Streaming consumption\nplt.plot(weeks, average_streaming, label=label_Streaming, marker=\"^\", linestyle=\"-\", color=\"#2ca02c\", linewidth=2, markersize=6)\nplt.fill_between(\n weeks,\n average_streaming - std_dev_streaming,\n average_streaming + std_dev_streaming,\n color=\"#2ca02c\",\n alpha=0.2,\n)\n\n# Adjusting y-axis range and ticks\nplt.ylim(ylim_values)\nplt.yticks(yticks_values)\n\n# Adding labels and title with enhanced font size\nplt.xlabel(xlabel_value, fontsize=12)\nplt.ylabel(ylabel_value, fontsize=12)\nplt.title(title, fontsize=14)\n\n# Adding legend\nplt.legend(frameon=True, fontsize=12)\n\n# Adding grid\nplt.grid(True, color=\"#d1d1d1\", linestyle=\":\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to add more space on the right\nplt.tight_layout()\nplt.savefig(\"line_141.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 5.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_103", "content": { "Law Domain": [ "Constitutional Law", "Corporate Law", "Criminal Law", "Environmental Law", "Family Law", "Health Law", "Immigration Law", "Intellectual Property Law", "International Law", "Labor Law", "Real Estate Law", "Tax Law" ], "BrightLaw": [ 4.0, 3.5, 4.6, 4.2, 3.9, 4.8, 4.3, 3.7, 3.4, 4.0, 4.7, 4.3 ], "DefenderLegal": [ 3.8, 4.2, 4.1, 3.6, 4.0, 3.5, 3.8, 4.5, 4.3, 3.9, 4.1, 3.6 ], "JusticePartners": [ 3.5, 3.9, 3.7, 3.2, 3.6, 3.8, 3.9, 4.0, 3.7, 3.5, 3.6, 3.8 ] }, "visual_intent": "A radar chart comparing performance ratings of three legal teams across different law domains, titled Performance Ratings of Legal Teams Across Different Law Domains(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/radar_40.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom math import pi\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# Define the data for each line\nlabels = np.array(\n [\n \"Constitutional Law\",\n \"Corporate Law\",\n \"Criminal Law\",\n \"Environmental Law\",\n \"Family Law\",\n \"Health Law\",\n \"Immigration Law\",\n \"Intellectual Property Law\",\n \"International Law\",\n \"Labor Law\",\n \"Real Estate Law\",\n \"Tax Law\",\n ]\n)\nnum_vars = len(labels)\n\n# Fictional scores for three legal teams\nvalues1 = np.array([4.0, 3.5, 4.6, 4.2, 3.9, 4.8, 4.3, 3.7, 3.4, 4.0, 4.7, 4.3])\nvalues2 = np.array([3.8, 4.2, 4.1, 3.6, 4.0, 3.5, 3.8, 4.5, 4.3, 3.9, 4.1, 3.6])\nvalues3 = np.array([3.5, 3.9, 3.7, 3.2, 3.6, 3.8, 3.9, 4.0, 3.7, 3.5, 3.6, 3.8])\n\nlabels2 = [\"BrightLaw\", \"DefenderLegal\", \"JusticePartners\"]\nyticks = [1, 2, 3, 4, 5]\nytickslabel = [\"1\", \"2\", \"3\", \"4\", \"5\"]\nylim = [0, 5]\n\ntitle = \"Performance Ratings of Legal Teams Across Different Law Domains\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot\nfig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True))\n\n# Compute angle for each axis\nangles = [n / float(num_vars) * 2 * pi for n in range(num_vars)]\nvalues1 = np.concatenate((values1, [values1[0]]))\nvalues2 = np.concatenate((values2, [values2[0]]))\nvalues3 = np.concatenate((values3, [values3[0]]))\nangles += angles[:1]\n\n# Draw one axe per variable and add labels\nplt.xticks(angles[:-1], labels, color=\"navy\", size=10)\n\n# Draw ylabels\nax.set_rlabel_position(0)\nplt.yticks(yticks, ytickslabel, color=\"grey\", size=8)\nplt.ylim(ylim)\n\n# Plot data\nax.plot(\n angles,\n values1,\n linewidth=2,\n linestyle=\"solid\",\n label=labels2[0],\n color=\"#1f77b4\",\n marker=\"o\",\n)\nax.fill(angles, values1, \"#1f77b4\", alpha=0.25)\n\nax.plot(\n angles,\n values2,\n linewidth=2,\n linestyle=\"dashed\",\n label=labels2[1],\n color=\"#ff7f0e\",\n marker=\"s\",\n)\nax.fill(angles, values2, \"#ff7f0e\", alpha=0.25)\n\nax.plot(\n angles,\n values3,\n linewidth=2,\n linestyle=\"dotted\",\n label=labels2[2],\n color=\"#2ca02c\",\n marker=\"D\",\n)\nax.fill(angles, values3, \"#2ca02c\", alpha=0.25)\n\n# Add legend\nplt.legend(loc=\"lower left\", bbox_to_anchor=(-0.15, -0.1), fontsize=\"small\")\n\n# Add title\nplt.title(title, size=15, color=\"darkblue\", y=1.1)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_40.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_104", "content": { "Voter": [ "Werewolf", "Seer", "Witch", "Hunter", "Villager" ], "Werewolf": [ 50.3, 49.2, 50.8, 76.0, 15.7 ], "Seer": [ 12.0, 11.2, 12.3, 2.1, 28.1 ], "Witch": [ 0.9, 0.6, 0.9, 0.5, 2.6 ], "Hunter": [ 7.0, 7.8, 6.2, 4.1, 14.5 ], "Villager": [ 13.4, 17.3, 15.5, 8.1, 28.6 ], "Abstain": [ 16.3, 13.9, 14.3, 9.2, 10.5 ] }, "visual_intent": "A bubble heatmap about Voter and Votee(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/heatmap_21.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom matplotlib.colors import LogNorm\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Defining the colormap from white to blue\ncmap = plt.cm.Blues\n\n# Sample data: a 5x6 grid, similar to the provided heatmap\ndata = np.array(\n [\n [50.3, 12.0, 0.9, 7.0, 13.4, 16.3],\n [49.2, 11.2, 0.6, 7.8, 17.3, 13.9],\n [50.8, 12.3, 0.9, 6.2, 15.5, 14.3],\n [76.0, 2.1, 0.5, 4.1, 8.1, 9.2],\n [15.7, 28.1, 2.6, 14.5, 28.6, 10.5],\n ]\n)\n\n# X and Y labels\nxticklabels = [\"Werewolf\", \"Seer\", \"Witch\", \"Hunter\", \"Villager\", \"Abstain\"]\nyticklabels = [\"Werewolf\", \"Seer\", \"Witch\", \"Hunter\", \"Villager\"]\nx_label = \"Votee\"\ny_label = \"Voter\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set up the figure and axis\nfig, ax = plt.subplots(figsize=(10, 8))\n\n# Set up the colormap and norm (log scale)\nnorm = LogNorm(vmin=0.1, vmax=100)\n\n# Create the scatter plot\nfor i in range(data.shape[0]):\n for j in range(data.shape[1]):\n # Calculate the color based on the original value\n color = cmap(norm(data[i, j]))\n\n # Draw the circle with a fixed size\n circle = plt.Circle((j, i), 0.4, color=color) # Fixed size\n ax.add_artist(circle)\n\n # Determine text color based on the value\n text_color = \"white\" if data[i, j] > 25 else \"black\"\n\n # Add the text inside the circle\n ax.text(j, i, f\"{data[i, j]:.1f}%\", ha=\"center\", va=\"center\", color=text_color)\n\n# Set labels for x and y axes\nax.set_xticks(range(len(xticklabels)))\nax.set_xticklabels(xticklabels, ha=\"center\")\nax.set_yticks(range(len(yticklabels)))\nax.set_yticklabels(yticklabels, va=\"center\")\n\n# Adding titles for the axes\nax.set_xlabel(x_label, fontsize=14)\nax.set_ylabel(y_label, fontsize=14)\n\n# Set the limits of the axes; they should be one more than your data range\nax.set_xlim(-0.5, data.shape[1] - 0.5)\nax.set_ylim(-0.5, data.shape[0] - 0.5)\n\n# Set the aspect of the plot to be equal and add a frame\nax.set_aspect(\"equal\")\nfor spine in ax.spines.values():\n spine.set_visible(True)\n\n# Create a colorbar\nsm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)\nsm.set_array([])\ncbar = plt.colorbar(sm, ax=ax, ticks=[0.1, 1, 10, 100], orientation=\"vertical\")\ncbar.ax.set_yticklabels([\"0.1\", \"1\", \"10\", \"100\"])\n\n# Add gridlines\nplt.grid(True, which=\"both\", color=\"gray\", linestyle=\"--\", linewidth=0.5)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout to fit the figure size\nplt.tight_layout()\n\n# Show the plot\nplt.savefig(\"heatmap_21.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_105", "content": { "Month": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ], "City A": [ 30, 32, 45, 50, 60, 70, 75, 74, 65, 55, 45, 35 ], "City B": [ 20, 22, 35, 40, 50, 60, 65, 64, 55, 45, 35, 25 ], "City C": [ 15, 18, 30, 35, 45, 55, 60, 62, 55, 45, 35, 20 ], "City D": [ 10, 15, 25, 30, 40, 50, 55, 57, 50, 40, 30, 15 ] }, "visual_intent": "A line chart about months and average temperature for different cities, titled Average Monthly Temperature for Different Cities(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/line_167.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nnp.random.seed(0)\n\n# Generate temperature data for 4 cities across 12 months\nmonths = np.arange(1, 13)\ncity_a = [30, 32, 45, 50, 60, 70, 75, 74, 65, 55, 45, 35]\ncity_b = [20, 22, 35, 40, 50, 60, 65, 64, 55, 45, 35, 25]\ncity_c = [15, 18, 30, 35, 45, 55, 60, 62, 55, 45, 35, 20]\ncity_d = [10, 15, 25, 30, 40, 50, 55, 57, 50, 40, 30, 15]\n\n# Axes Limits and Labels\nxlabel_value = \"Month\"\nxlim_values = [0.5, 12.5]\nxticks_values = np.arange(1, 13, 1)\n\nylabel_value = \"Average Temperature (°F)\"\nylim_values = [0, 80]\nyticks_values = np.arange(0, 81, 10)\n\n# Labels\nlabel_1 = \"City A\"\nlabel_2 = \"City B\"\nlabel_3 = \"City C\"\nlabel_4 = \"City D\"\ntitle=\"Average Monthly Temperature for Different Cities\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create the plot\nplt.figure(figsize=(10, 6)) # Adjust the figure size\nplt.plot(months, city_a, marker=\"o\", linestyle=\"-\", color=\"#FF5733\", label=label_1, linewidth=2)\nplt.plot(months, city_b, marker=\"s\", linestyle=\"--\", color=\"#33FF57\", label=label_2, linewidth=2)\nplt.plot(months, city_c, marker=\"^\", linestyle=\"-.\", color=\"#3357FF\", label=label_3, linewidth=2)\nplt.plot(months, city_d, marker=\"v\", linestyle=\":\", color=\"#FF33A1\", label=label_4, linewidth=2)\n\n# Set x,y-axis properties\nplt.xticks(xticks_values, fontsize=10)\nplt.xlim(xlim_values)\nplt.yticks(yticks_values, fontsize=10)\nplt.ylim(ylim_values)\n\n# Add grid for better readability\nplt.grid(True, linestyle=\"--\", alpha=0.6)\n\n# Add legend\nplt.legend(loc=\"upper left\", fontsize=12)\n\n# Add labels and title\nplt.xlabel(xlabel_value, fontsize=12)\nplt.ylabel(ylabel_value, fontsize=12)\nplt.title(title, fontsize=14)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save plot\nplt.tight_layout()\nplt.savefig(\"line_167.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "line" }, { "id": "test_106", "content": { "Health Metrics": [ "Blood Pressure", "Heart Rate", "Calorie Count", "Sleep Analysis" ], "Method1-Step1": [ 0.7, 0.75, 0.65, 0.8 ], "Method1-Step1-APE": [ 0.72, 0.77, 0.68, 0.82 ], "Method2-Step2": [ 0.78, 0.82, 0.73, 0.87 ], "Method2-Step2-APE": [ 0.8, 0.84, 0.76, 0.89 ], "Method-Best": [ 0.85, 0.88, 0.8, 0.92 ], "Iterative-APE-Best": [ 0.83, 0.86, 0.79, 0.9 ], "Sum-Best": [ 0.84, 0.87, 0.81, 0.91 ], "Overall-Trend": [ 0.75, 0.78, 0.72, 0.85 ] }, "visual_intent": "A grouped bar chart with an overlaid line plot about health metrics and scores for various monitoring methods, titled Comparison of Health Metrics Monitoring Methods(size of the desired plot: width=10.0, height=4.0)", "path_to_gt_image": "images/CB_69.jpg", "original_category": "CB", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data\ntasks = [\"Blood Pressure\", \"Heart Rate\", \"Calorie Count\", \"Sleep Analysis\"]\nscores_step1 = [0.70, 0.75, 0.65, 0.80]\nscores_step1_APE = [0.72, 0.77, 0.68, 0.82]\nscores_step2 = [0.78, 0.82, 0.73, 0.87]\nscores_step2_APE = [0.80, 0.84, 0.76, 0.89]\nscores_best = [0.85, 0.88, 0.80, 0.92]\nscores_iterative_best = [0.83, 0.86, 0.79, 0.90]\nscores_sum_best = [0.84, 0.87, 0.81, 0.91]\ntrend = [0.75, 0.78, 0.72, 0.85]\ntitle = \"Comparison of Health Metrics Monitoring Methods\"\nlabels = [\n \"Method1-Step1\", \n \"Method1-Step1-APE\", \n \"Method2-Step2\", \n \"Method2-Step2-APE\", \n \"Method-Best\", \n \"Iterative-APE-Best\", \n \"Sum-Best\", \n \"Overall-Trend\"\n]\nx_label = \"Health Metrics\"\ny_label = \"Scores\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set figure size to match the original image's dimensions\nplt.figure(figsize=(10, 4))\n\n# Bar width\nbarWidth = 0.1\n\n# Set position of bar on X axis\nr1 = np.arange(len(scores_step1))\nr2 = [x + barWidth for x in r1]\nr3 = [x + barWidth for x in r2]\nr4 = [x + barWidth for x in r3]\nr5 = [x + barWidth for x in r4]\nr6 = [x + barWidth for x in r5]\nr7 = [x + barWidth for x in r6]\n\n# Make the plot\nplt.bar(\n r1,\n scores_step1,\n color=\"#adebad\",\n width=barWidth,\n edgecolor=\"white\",\n label=labels[0],\n)\nplt.bar(\n r2,\n scores_step1_APE,\n color=\"#adebad\",\n width=barWidth,\n edgecolor=\"white\",\n label=labels[1],\n hatch=\"\\\\\",\n)\nplt.bar(\n r3,\n scores_step2,\n color=\"#66cc66\",\n width=barWidth,\n edgecolor=\"white\",\n label=labels[2],\n)\nplt.bar(\n r4,\n scores_step2_APE,\n color=\"#66cc66\",\n width=barWidth,\n edgecolor=\"white\",\n label=labels[3],\n hatch=\"\\\\\",\n)\nplt.bar(\n r5,\n scores_best,\n color=\"#339933\",\n width=barWidth,\n edgecolor=\"white\",\n label=labels[4],\n)\nplt.bar(\n r6,\n scores_iterative_best,\n color=\"#999999\",\n width=barWidth,\n edgecolor=\"white\",\n label=labels[5],\n)\nplt.bar(\n r7,\n scores_sum_best,\n color=\"#4d9900\",\n width=barWidth,\n edgecolor=\"white\",\n label=labels[6],\n)\n\n# Add trend line\nplt.plot(\n tasks,\n trend,\n color=\"#000000\",\n marker=\"s\",\n linestyle=\"--\",\n linewidth=2,\n markersize=6,\n label=labels[7],\n)\n\n# Add xticks on the middle of the group bars\nplt.xlabel(x_label)\nplt.ylabel(y_label)\nplt.xticks([r + barWidth * 3 for r in range(len(scores_step1))], tasks)\nplt.ylim(0.6, 1.0)\nplt.yticks([0.6, 0.7, 0.8, 0.9, 1.0])\n\n# Create legend & Show graphic\nplt.title(title)\nplt.legend(loc=\"upper center\", ncol=4)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"CB_69.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 4.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_107", "content": { "Year": [ 2018, 2019, 2020, 2021, 2022 ], "Brand A": [ 30, 32, 35, 37, 40 ], "Brand B": [ 25, 27, 26, 29, 31 ], "Brand C": [ 20, 18, 17, 16, 15 ] }, "visual_intent": "A line chart about years and smartphone market share for three brands, titled Smartphone Market Share Over Time(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/line_118.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Generate new data: Smartphone Market Share over Time\nyears = [2018, 2019, 2020, 2021, 2022]\nbrand_a_share = [30, 32, 35, 37, 40]\nbrand_b_share = [25, 27, 26, 29, 31]\nbrand_c_share = [20, 18, 17, 16, 15]\n\n# Extracted variables\nbrand_a_label = \"Brand A\"\nbrand_b_label = \"Brand B\"\nbrand_c_label = \"Brand C\"\n\nylim_values = [0, 50]\nyticks_values = [0, 10, 20, 30, 40, 50]\nyticks_labels = [\"$0$\", \"$10$\", \"$20$\", \"$30$\", \"$40$\", \"$50$\"]\nxlabel_value = \"Year\"\nylabel_value = \"Market Share (%)\"\nxlim_values = [2018, 2022]\nxticks_fontsize = \"12\"\nyticks_fontsize = \"12\"\nxlabel_fontsize = \"14\"\nylabel_fontsize = \"14\"\ntitle_value = \"Smartphone Market Share Over Time\"\nsupertitle_value = \"Market Trends (2018-2022)\"\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and axis\nfig, ax = plt.subplots(figsize=(10, 6))\n\nlegend_location = \"upper left\"\nlegend_ncol = 3\nlegend_bbox_to_anchor = (0, 0.95)\nlegend_frameon = False\n\n# Plot the data\nax.plot(\n years,\n brand_a_share,\n \"o-\",\n label=brand_a_label,\n clip_on=False,\n zorder=10,\n color=\"#1f77b4\", # blue\n linewidth=2.0,\n markersize=8,\n linestyle='--'\n)\nax.plot(\n years,\n brand_b_share,\n \"s-\",\n label=brand_b_label,\n clip_on=False,\n zorder=10,\n color=\"#ff7f0e\", # orange\n linewidth=2.0,\n markersize=8,\n linestyle='-.'\n)\nax.plot(\n years,\n brand_c_share,\n \"^-\",\n label=brand_c_label,\n clip_on=False,\n zorder=10,\n color=\"#9467bd\", # purple\n linewidth=2.0,\n markersize=8,\n linestyle=':'\n)\n\nplt.ylim(ylim_values)\nplt.yticks(yticks_values, yticks_labels, fontsize=yticks_fontsize)\n\n# Set x-axis to only display specific ticks and extend x-axis to leave space at right\nplt.xticks(years, fontsize=xticks_fontsize)\nplt.xlim(xlim_values)\nplt.tick_params(axis=\"both\", which=\"both\", color=\"gray\")\n\n# Add legend, labels, title and grid\nax.legend(\n loc=legend_location,\n ncol=legend_ncol,\n bbox_to_anchor=legend_bbox_to_anchor,\n frameon=legend_frameon,\n)\nax.set_xlabel(xlabel_value, fontsize=xlabel_fontsize)\nax.set_ylabel(ylabel_value, fontsize=ylabel_fontsize)\nax.grid(True)\nfig.suptitle(supertitle_value, fontsize=16)\nax.set_title(title_value, fontsize=14)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to add more space on the right\nplt.tight_layout(rect=[0, 0, 1, 0.95])\nplt.savefig(\"line_118.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "line" }, { "id": "test_108", "content": { "Time Points": [ "T=0", "T=10", "T=20" ], "Trial A Positive": [ 10.2, 15.8, 14.3 ], "Trial B Positive": [ 9.5, 16.8, 15.2 ], "Trial C Positive": [ 11.0, 17.1, 13.4 ], "Trial D Positive": [ 10.8, 15.5, 14.7 ], "Trial E Positive": [ 9.9, 16.0, 15.6 ], "Trial A Negative": [ -2, -3, -4 ], "Trial B Negative": [ -1, -2, -3 ], "Trial C Negative": [ -2, -2, -4 ], "Trial D Negative": [ -3, -3, -3 ], "Trial E Negative": [ -1, -2, -2 ] }, "visual_intent": "A grouped bar chart about Time Points and Concentration Levels across multiple Trials, titled Concentration Over Time(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/bar_230.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data\ncategories = [\"T=0\", \"T=10\", \"T=20\"]\nvalues1 = [10.2, 15.8, 14.3]\nvalues2 = [9.5, 16.8, 15.2]\nvalues3 = [11.0, 17.1, 13.4]\nvalues4 = [10.8, 15.5, 14.7]\nvalues5 = [9.9, 16.0, 15.6]\n\nvalues1minus = [-2, -3, -4]\nvalues2minus = [-1, -2, -3]\nvalues3minus = [-2, -2, -4]\nvalues4minus = [-3, -3, -3]\nvalues5minus = [-1, -2, -2]\n\n# Set up the bar width\nbarWidth = 0.15\n\n# Set position of bar on X axis\nr1 = np.arange(len(values1))\nr2 = [x + barWidth for x in r1]\nr3 = [x + barWidth for x in r2]\nr4 = [x + barWidth for x in r3]\nr5 = [x + barWidth for x in r4]\n\nlabels = [\"Trial A\", \"Trial B\", \"Trial C\", \"Trial D\", \"Trial E\"]\nxlabel = \"Time Points\"\nylabel = \"Concentration Levels\"\nyticks = np.arange(-5, 21, 5)\ntitle = \"Concentration Over Time\"\nsupertitle = \"Scientific Experiment Results\"\nlegend_labels = [\"Positive Concentrations\", \"Negative Concentrations\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set up the figure size\nplt.figure(figsize=(8, 6))\n\n# Make the plot with optimized colors and styles\nplt.bar(r1, values1, color=\"#1f77b4\", width=barWidth, edgecolor=\"black\", label=labels[0])\nplt.bar(r2, values2, color=\"#ff7f0e\", width=barWidth, edgecolor=\"black\", label=labels[1])\nplt.bar(r3, values3, color=\"#2ca02c\", width=barWidth, edgecolor=\"black\", label=labels[2])\nplt.bar(r4, values4, color=\"#d62728\", width=barWidth, edgecolor=\"black\", label=labels[3])\nplt.bar(r5, values5, color=\"#9467bd\", width=barWidth, edgecolor=\"black\", label=labels[4])\nplt.bar(r1, values1minus, color=\"#1f77b4\", width=barWidth, edgecolor=\"grey\", alpha=0.5)\nplt.bar(r2, values2minus, color=\"#ff7f0e\", width=barWidth, edgecolor=\"grey\", alpha=0.5)\nplt.bar(r3, values3minus, color=\"#2ca02c\", width=barWidth, edgecolor=\"grey\", alpha=0.5)\nplt.bar(r4, values4minus, color=\"#d62728\", width=barWidth, edgecolor=\"grey\", alpha=0.5)\nplt.bar(r5, values5minus, color=\"#9467bd\", width=barWidth, edgecolor=\"grey\", alpha=0.5)\n\n# Add text on the top of each bar\nfor i in range(len(r1)):\n plt.text(r1[i], values1[i] - 0.5, str(values1[i]), ha=\"center\", va=\"top\", rotation=90, fontsize=8)\n plt.text(r2[i], values2[i] - 0.5, str(values2[i]), ha=\"center\", va=\"top\", rotation=90, fontsize=8)\n plt.text(r3[i], values3[i] - 0.5, str(values3[i]), ha=\"center\", va=\"top\", rotation=90, fontsize=8)\n plt.text(r4[i], values4[i] - 0.5, str(values4[i]), ha=\"center\", va=\"top\", rotation=90, fontsize=8)\n plt.text(r5[i], values5[i] - 0.5, str(values5[i]), ha=\"center\", va=\"top\", rotation=90, fontsize=8)\n plt.text(r1[i], values1minus[i] + 0.5, str(-values1minus[i]), ha=\"center\", va=\"bottom\", rotation=90, fontsize=8)\n plt.text(r2[i], values2minus[i] + 0.5, str(-values2minus[i]), ha=\"center\", va=\"bottom\", rotation=90, fontsize=8)\n plt.text(r3[i], values3minus[i] + 0.5, str(-values3minus[i]), ha=\"center\", va=\"bottom\", rotation=90, fontsize=8)\n plt.text(r4[i], values4minus[i] + 0.5, str(-values4minus[i]), ha=\"center\", va=\"bottom\", rotation=90, fontsize=8)\n plt.text(r5[i], values5minus[i] - 0.5, str(-values5minus[i]), ha=\"center\", va=\"top\", rotation=90, fontsize=8)\n\n# Add xticks on the middle of the group bars\nplt.xlabel(xlabel)\nplt.xticks([r + 2 * barWidth for r in range(len(values1))], categories)\nplt.yticks(yticks)\nplt.ylabel(ylabel)\nplt.title(title)\nplt.suptitle(supertitle)\nplt.grid(True, linestyle='--', linewidth=0.5, alpha=0.7)\nplt.legend(legend_labels, loc='upper right')\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"bar_230.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" }, { "id": "test_109", "content": { "Country": [ "USA", "Canada", "UK", "Germany", "France", "Australia" ], "Urban": [ 6.8, 7.2, 6.9, 7.1, 6.5, 7.0 ], "Rural": [ 7.0, 7.5, 7.2, 6.8, 7.3, 6.9 ], "Suburban": [ 7.1, 7.3, 7.0, 6.9, 7.2, 7.1 ] }, "visual_intent": "A figure with 2 subplots: (1) a grouped bar chart showing happiness index by demographic group across countries for Survey 1, (2) a similar grouped bar chart for Survey 2, titled Happiness Index Comparison by Demographic Groups(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/bar_122.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data\nlabels = [\"USA\", \"Canada\", \"UK\", \"Germany\", \"France\", \"Australia\"]\nurban = [6.8, 7.2, 6.9, 7.1, 6.5, 7.0]\nrural = [7.0, 7.5, 7.2, 6.8, 7.3, 6.9]\nsuburban = [7.1, 7.3, 7.0, 6.9, 7.2, 7.1]\n\nx = np.arange(len(labels)) # the label locations\nwidth = 0.25 # the width of the bars\n\n# Variables for plot configuration\nylabel = \"Happiness Index\"\nxlabel_survey1 = \"Survey 1\"\nxlabel_survey2 = \"Survey 2\"\n\nlegend_label_urban = \"Urban\"\nlegend_label_rural = \"Rural\"\nlegend_label_suburban = \"Suburban\"\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nxticks = x\nxticklabels = labels\nylim_ax1 = (6.4, 7.6)\nylim_ax2 = (6.5, 7.7)\nyticks_ax1 = [6.4, 6.6, 6.8, 7.0, 7.2, 7.4, 7.6]\nyticks_ax2 = [6.5, 6.7, 6.9, 7.1, 7.3, 7.5, 7.7]\n# Setting up the figure and axes for a 2 x 1 layout\nfig, (ax1, ax2) = plt.subplots(\n 2, 1, figsize=(8, 6), gridspec_kw={\"height_ratios\": [1, 1], \"hspace\": 0.3}\n)\n\n# Upper plot\nrects1 = ax1.bar(\n x - width - 0.04,\n urban,\n width,\n label=legend_label_urban,\n color=\"#4c72b0\",\n edgecolor=\"black\",\n)\nrects2 = ax1.bar(\n x, rural, width, label=legend_label_rural, color=\"#55a868\", edgecolor=\"black\"\n)\nrects3 = ax1.bar(\n x + width + 0.04,\n suburban,\n width,\n label=legend_label_suburban,\n color=\"#c44e52\",\n edgecolor=\"black\"\n)\n# Lower plot\nrects4 = ax2.bar(\n x - width - 0.04, urban, width, color=\"#4c72b0\", edgecolor=\"black\"\n)\nrects5 = ax2.bar(x, rural, width, color=\"#55a868\", edgecolor=\"black\")\nrects6 = ax2.bar(\n x + width + 0.04, suburban, width, color=\"#c44e52\", edgecolor=\"black\"\n)\n\n# Add some text for labels, title and custom x-axis tick labels, etc.\nax1.set_ylabel(ylabel)\nax2.set_ylabel(ylabel)\nax1.set_xlabel(xlabel_survey1)\nax2.set_xlabel(xlabel_survey2)\nax1.set_xticks(xticks)\nax1.set_xticklabels(xticklabels)\nax2.set_xticks(xticks)\nax2.set_xticklabels(xticklabels)\nax1.legend(loc=\"upper center\", bbox_to_anchor=(0.5, 1.25), ncol=3, frameon=False)\n\n# Set y-axis limit to match the reference picture\nax1.set_ylim(ylim_ax1)\nax2.set_ylim(ylim_ax2)\nax1.tick_params(axis=\"x\", which=\"both\", length=0)\nax2.tick_params(axis=\"x\", which=\"both\", length=0)\nax1.set_yticks(yticks_ax1)\nax2.set_yticks(yticks_ax2)\n\n# Set grid color and style\nax1.grid(axis=\"y\", color=\"gray\", linestyle=\"--\", linewidth=0.5)\nax2.grid(axis=\"y\", color=\"gray\", linestyle=\"--\", linewidth=0.5)\nax1.tick_params(axis=\"y\", which=\"major\", color=\"gray\")\nax2.tick_params(axis=\"y\", which=\"major\", color=\"gray\")\nax1.set_axisbelow(True)\nax2.set_axisbelow(True)\n\n# Remove top and right borders\nax1.spines[\"top\"].set_visible(False)\nax1.spines[\"right\"].set_visible(False)\nax1.spines[\"bottom\"].set_visible(False)\nax1.spines[\"left\"].set_color(\"gray\")\nax2.spines[\"top\"].set_visible(False)\nax2.spines[\"right\"].set_visible(False)\nax2.spines[\"bottom\"].set_visible(False)\nax2.spines[\"left\"].set_color(\"gray\")\n\n# Set supertitle\nfig.suptitle('Happiness Index Comparison by Demographic Groups')\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"bar_122.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" }, { "id": "test_110", "content": { "Category": [ "Age Group", "Income Level", "Education Level", "Employment Status", "Total Population" ], "Region_A_2020": [ 30, 20, 35, 15, 100 ], "Region_A_2021": [ 32, 22, 33, 17, 104 ], "Region_A_2022": [ 35, 25, 30, 20, 110 ], "Region_A_2023": [ 40, 30, 25, 25, 120 ], "Region_B_2020": [ 25, 18, 40, 17, 100 ], "Region_B_2021": [ 28, 20, 37, 20, 105 ], "Region_B_2022": [ 30, 24, 34, 22, 110 ], "Region_B_2023": [ 35, 28, 30, 30, 120 ] }, "visual_intent": "A figure with 2 subplots: (1) a grouped bar chart showing population metrics across demographic categories for Region A, (2) a grouped bar chart showing population metrics across demographic categories for Region B(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/bar_105.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Data for Region A\nregion_a_categories = [\"Age Group\", \"Income Level\", \"Education Level\", \"Employment Status\", \"Total Population\"]\nregion_a_2020 = [30, 20, 35, 15, 100]\nregion_a_2021 = [32, 22, 33, 17, 104]\nregion_a_2022 = [35, 25, 30, 20, 110]\nregion_a_2023 = [40, 30, 25, 25, 120]\n\n# Data for Region B\nregion_b_categories = [\"Age Group\", \"Income Level\", \"Education Level\", \"Employment Status\", \"Total Population\"]\nregion_b_2020 = [25, 18, 40, 17, 100]\nregion_b_2021 = [28, 20, 37, 20, 105]\nregion_b_2022 = [30, 24, 34, 22, 110]\nregion_b_2023 = [35, 28, 30, 30, 120]\n\nxlabel = \"Categories\"\nylabel = \"Population Metrics (%)\"\ntitle = \"Population Data Over Years\"\ntitle_region_a = \"Region A\"\ntitle_region_b = \"Region B\"\nlabels = [\"2020\", \"2021\", \"2022\", \"2023\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nylim = [0, 150]\nyticks = np.arange(0, 151, 30)\n\n# Set up the figure and axes\nfig, axs = plt.subplots(2, 1, figsize=(10, 8)) # Width, Height in inches\n\n# Plot for Region A\nx = np.arange(len(region_a_categories))\nwidth = 0.18 # Adjust this value to change the width of the bars\nspacing = 0.2 # Adjust this value to change the spacing between the bars\n\ncustom_colors = [\"#5386E4\", \"#E4A953\", \"#53E45E\", \"#E45353\"]\n\naxs[0].bar(x - spacing * 1.5, region_a_2020, width, label=labels[0], color=custom_colors[0])\naxs[0].bar(x - spacing / 2, region_a_2021, width, label=labels[1], color=custom_colors[1])\naxs[0].bar(x + spacing / 2, region_a_2022, width, label=labels[2], color=custom_colors[2])\naxs[0].bar(x + spacing * 1.5, region_a_2023, width, label=labels[3], color=custom_colors[3])\naxs[0].set_title(title_region_a)\naxs[0].set_xticks(x)\naxs[0].set_xticklabels(region_a_categories)\naxs[0].set_ylim(ylim)\naxs[0].set_yticks(yticks)\naxs[0].legend(loc=\"upper left\")\n\n# Plot for Region B\nx = np.arange(len(region_b_categories))\naxs[1].bar(x - spacing * 1.5, region_b_2020, width, color=custom_colors[0])\naxs[1].bar(x - spacing / 2, region_b_2021, width, color=custom_colors[1])\naxs[1].bar(x + spacing / 2, region_b_2022, width, color=custom_colors[2])\naxs[1].bar(x + spacing * 1.5, region_b_2023, width, color=custom_colors[3])\naxs[1].set_title(title_region_b)\naxs[1].set_xticks(x)\naxs[1].set_xticklabels(region_b_categories)\naxs[1].set_ylim(ylim)\naxs[1].set_yticks(yticks)\n\n# Add common labels\nfig.text(0.5, -0.01, xlabel, ha='center', fontsize=12)\nfig.text(-0.01, 0.5, ylabel, va='center', rotation='vertical', fontsize=12)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the figure\nplt.tight_layout()\nplt.savefig(\"bar_105.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "bar" }, { "id": "test_111", "content": { "Device Name": [ "Device A", "Device B", "Device C", "Device D", "Device E", "Device F" ], "Battery Life (hours)": [ 5, 10, 15, 20, 25, 30 ], "Accuracy Rate (%)": [ 90, 85, 80, 75, 70, 65 ], "Number of Devices Sold": [ 500, 1000, 1500, 2000, 2500, 3000 ] }, "visual_intent": "A bubble chart about battery life, accuracy rate, and number of devices sold for various health monitoring devices, titled Health Monitoring Devices Performance(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/scatter_56.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\nimport matplotlib.ticker as ticker\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data for plotting\nnames = [\"Device A\", \"Device B\", \"Device C\", \"Device D\", \"Device E\", \"Device F\"]\nx = [5, 10, 15, 20, 25, 30] # Battery Life (hours)\ny = [90, 85, 80, 75, 70, 65] # Accuracy Rate (%)\nsizes = [500, 1000, 1500, 2000, 2500, 3000] # Number of Devices Sold\n\n# Plot and legend labels\nscatter_label = \"Bubble Size: Number of Devices Sold\"\n\n# Axis limits\nxlim_values = (1, 35)\nylim_values = (60, 95)\n\n# Axis labels\nxlabel_value = \"Battery Life (hours)\"\nylabel_value = \"Accuracy Rate (%)\"\n\n# Axis ticks\nxticks_values = [5, 10, 15, 20, 25, 30]\nyticks_values = None # Using default y-ticks\n\n# Axis ticks labels\nxtickslabel_values = None # Using default labels\nytickslabel_values = None # Using default labels\n\n# Title\ntitle_value = \"Health Monitoring Devices Performance\"\n\n# Horizontal and vertical lines\naxhline_values = None\naxvline_values = None\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a scatter plot\nfig, ax = plt.subplots(figsize=(8, 6))\ncolors = [\"#2E8B57\", \"#3CB371\", \"#66CDAA\", \"#8FBC8F\", \"#20B2AA\", \"#5F9EA0\"]\nscatter = ax.scatter(\n x, y, s=sizes, c=colors, alpha=0.6, edgecolors=\"black\", label=scatter_label\n)\n\n# Add labels for each bubble\nfor i, txt in enumerate(names):\n ax.annotate(txt, (x[i], y[i]), ha=\"center\", va=\"center\", fontsize=8, color=\"black\")\n\n# Set the x-axis to a logarithmic scale\nax.set_xscale(\"log\")\nax.xaxis.set_major_formatter(ticker.FuncFormatter(lambda x, _: f\"{int(x):d}\"))\nax.xaxis.set_major_locator(ticker.FixedLocator(xticks_values))\n\n# Set axis labels\nax.set_xlabel(xlabel_value, fontsize=12)\nax.set_ylabel(ylabel_value, fontsize=12)\nax.set_xlim(xlim_values)\nax.set_ylim(ylim_values)\n\n# Set plot title\nax.set_title(title_value, fontsize=14, fontweight=\"bold\")\n\n# Add grid\nax.grid(True, which=\"both\", linestyle=\"--\", linewidth=0.5)\n\n# Set background color to white\nfig.patch.set_facecolor(\"white\")\nax.set_facecolor(\"white\")\n\n# Add legend\nlegend = ax.legend()\n\nfor legend_handle in legend.legendHandles:\n legend_handle._sizes = [60]\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"scatter_56.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_112", "content": { "Media Category": [ "Streaming", "Cable TV", "Social Media", "Newspapers", "Podcasts", "Blogs" ], "Average Viewer Statistics (%)": [ 65, 45, 85, 20, 30, 25 ], "Viewer Statistics Change (%)": [ 8, 3, 12, 2, 7, 4 ], "Engagement Rate (%)": [ 55, 35, 70, 15, 45, 30 ], "Engagement Rate Change (%)": [ 10, 5, 15, 3, 10, 6 ] }, "visual_intent": "A figure with 2 subplots: (1) an arrow chart illustrating changes in viewer statistics and engagement rates for digital media formats like Streaming and Social Media, (2) a similar arrow chart for formats like Newspapers and Blogs, titled Media Consumption and Engagement Trends(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/quiver_46.jpg", "original_category": "quiver", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.lines as mlines\nimport numpy as np\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for the plot (Media Domain)\nregions_1 = [\"Streaming\", \"Cable TV\", \"Social Media\"]\nviewer_statistics_1 = [65, 45, 85] # Average viewer statistics in percentage\nviewer_statistics_change_1 = [8, 3, 12] # Change in viewer statistics in percentage\nengagement_rate_1 = [55, 35, 70] # Viewer engagement rate in percentage\nengagement_rate_change_1 = [10, 5, 15] # Change in engagement rate in percentage\nax1_labels = [\"Viewer Stats Change (%)\", \"Engagement Rate Change (%)\"]\n\nregions_2 = [\"Newspapers\", \"Podcasts\", \"Blogs\"]\nviewer_statistics_2 = [20, 30, 25] # Average viewer statistics in percentage\nviewer_statistics_change_2 = [2, 7, 4] # Change in viewer statistics in percentage\nengagement_rate_2 = [15, 45, 30] # Viewer engagement rate in percentage\nengagement_rate_change_2 = [3, 10, 6] # Change in engagement rate in percentage\nax2_labels = [\"Viewer Stats Change (%)\", \"Engagement Rate Change (%)\"]\n\n# Text labels\nxlabel = \"Percentage\"\nylabel = \"Media Categories\"\ntitle1 = \"Media Consumption Trends (Group 1)\"\ntitle2 = \"Media Consumption Trends (Group 2)\"\nsupertitle = \"Media Consumption and Engagement Trends\"\nlegendlabels = [\"Viewer Stats Change (%)\", \"Engagement Rate Change (%)\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure with two subplots\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))\n\n# Set the y-axis offsets to be in the middle of each grid\noffset = 0.5\n\n# First subplot (regions_1)\nfor i, region in enumerate(regions_1):\n # Viewer Statistics change line with arrow and black dots at start and end\n ax1.annotate(\n \"\",\n xy=(viewer_statistics_1[i], i + offset * 3 / 2),\n xytext=(\n viewer_statistics_1[i] + viewer_statistics_change_1[i],\n i + offset * 3 / 2,\n ),\n arrowprops=dict(arrowstyle=\"<-\", color=\"#FF5733\"), # Bright Orange\n )\n ax1.scatter(\n [\n viewer_statistics_1[i],\n viewer_statistics_1[i] + viewer_statistics_change_1[i],\n ],\n [i + offset * 3 / 2, i + offset * 3 / 2],\n color=\"black\",\n s=25,\n )\n ax1.annotate(\n f\"{viewer_statistics_change_1[i]:.2f}\",\n (viewer_statistics_1[i] + viewer_statistics_change_1[i], i + offset * 1.75),\n color=\"#FF5733\",\n ha=\"right\",\n va=\"center\",\n )\n\n # Engagement Rate change line with arrow and black dots at start and end\n ax1.annotate(\n \"\",\n xy=(engagement_rate_1[i], i + offset / 2),\n xytext=(engagement_rate_1[i] + engagement_rate_change_1[i], i + offset / 2),\n arrowprops=dict(arrowstyle=\"<-\", color=\"#33C3F0\"), # Bright Blue\n )\n ax1.scatter(\n [engagement_rate_1[i], engagement_rate_1[i] + engagement_rate_change_1[i]],\n [i + offset / 2, i + offset / 2],\n color=\"black\",\n s=25,\n )\n ax1.annotate(\n f\"{engagement_rate_change_1[i]:.2f}\",\n (engagement_rate_1[i] + engagement_rate_change_1[i], i + offset * 0.75),\n color=\"#33C3F0\",\n ha=\"left\",\n va=\"center\",\n )\n\n# Second subplot (regions_2)\nfor i, region in enumerate(regions_2):\n ax2.annotate(\n \"\",\n xy=(viewer_statistics_2[i], i + offset * 3 / 2),\n xytext=(\n viewer_statistics_2[i] + viewer_statistics_change_2[i],\n i + offset * 3 / 2,\n ),\n arrowprops=dict(arrowstyle=\"<-\", color=\"#FF5733\"), # Bright Orange\n )\n ax2.scatter(\n [\n viewer_statistics_2[i],\n viewer_statistics_2[i] + viewer_statistics_change_2[i],\n ],\n [i + offset * 3 / 2, i + offset * 3 / 2],\n color=\"black\",\n s=25,\n )\n ax2.annotate(\n f\"{viewer_statistics_change_2[i]:.2f}\",\n (viewer_statistics_2[i] + viewer_statistics_change_2[i], i + offset * 1.75),\n color=\"#FF5733\",\n ha=\"right\",\n va=\"center\",\n )\n\n ax2.annotate(\n \"\",\n xy=(engagement_rate_2[i], i + offset / 2),\n xytext=(engagement_rate_2[i] + engagement_rate_change_2[i], i + offset / 2),\n arrowprops=dict(arrowstyle=\"<-\", color=\"#33C3F0\"), # Bright Blue\n )\n ax2.scatter(\n [engagement_rate_2[i], engagement_rate_2[i] + engagement_rate_change_2[i]],\n [i + offset / 2, i + offset / 2],\n color=\"black\",\n s=25,\n )\n ax2.annotate(\n f\"{engagement_rate_change_2[i]:.2f}\",\n (engagement_rate_2[i] + engagement_rate_change_2[i], i + offset * 0.75),\n color=\"#33C3F0\",\n ha=\"left\",\n va=\"center\",\n )\n\n# set y-axis limits\nax1.set_ylim(0, len(regions_1))\nax2.set_ylim(0, len(regions_2))\n\n# Set x-axis limits uniformly\nax1.set_xlim(0, 100)\nax2.set_xlim(0, 100)\n\n# Adjust the y-axis tick positions\nax1.set_yticks([i + offset for i in range(len(regions_1))])\nax1.set_yticklabels(regions_1)\nax2.set_yticks([i + offset for i in range(len(regions_2))])\nax2.set_yticklabels(regions_2)\nax2.yaxis.tick_right()\nax2.yaxis.set_label_position(\"right\")\n\n# Offset grid lines on the y-axis\nax1.set_yticks([i for i in range(len(regions_1))], minor=True)\nax2.set_yticks([i for i in range(len(regions_2))], minor=True)\nax1.yaxis.grid(True, which=\"minor\", linewidth=0.5, alpha=0.7, color=\"grey\")\nax2.yaxis.grid(True, which=\"minor\", linewidth=0.5, alpha=0.7, color=\"grey\")\n\n# add x-axis grid lines and set gap is 10\nax1.xaxis.set_major_locator(plt.MultipleLocator(10))\nax2.xaxis.set_major_locator(plt.MultipleLocator(10))\nax1.grid(axis=\"x\", linestyle=\"--\", linewidth=0.5)\nax2.grid(axis=\"x\", linestyle=\"--\", linewidth=0.5)\n\n# Create arrow-shaped legend entries with a line that aligns with the arrowhead\norange_arrow = mlines.Line2D(\n [],\n [],\n color=\"#FF5733\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax1_labels[0],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nblue_arrow = mlines.Line2D(\n [],\n [],\n color=\"#33C3F0\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax1_labels[1],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nfig.legend(handles=[orange_arrow, blue_arrow], bbox_to_anchor=(0.45, 0), ncol=2)\n\norange_arrow = mlines.Line2D(\n [],\n [],\n color=\"#FF5733\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax2_labels[0],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nblue_arrow = mlines.Line2D(\n [],\n [],\n color=\"#33C3F0\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=ax2_labels[1],\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nfig.legend(handles=[orange_arrow, blue_arrow], bbox_to_anchor=(0.95, 0), ncol=2)\n\n# Update plot titles and labels\nax1.set_title(title1)\nax2.set_title(title2)\nfig.suptitle(supertitle, y=1.02)\nfig.supxlabel(xlabel)\nfig.supylabel(ylabel)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout()\nplt.savefig(\"quiver_46.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_113", "content": { "Vegetable": [ "cucumber", "tomato", "lettuce", "asparagus", "potato", "wheat", "barley" ], "Farmer Joe": [ 0.8, 2.4, 1.1, 0.6, 0.7, 1.3, 0.1 ], "Upland Bros.": [ 2.4, 0.0, 2.4, 0.0, 1.7, 1.2, 2.0 ], "Smith Gardening": [ 2.5, 4.0, 0.8, 0.3, 0.6, 0.0, 0.0 ], "Agrifun": [ 3.9, 1.0, 4.3, 0.0, 2.6, 0.0, 1.4 ], "Organiculture": [ 0.0, 2.7, 1.9, 3.1, 2.2, 0.0, 0.0 ], "BioGoods Ltd.": [ 4.0, 0.0, 4.4, 0.0, 6.2, 3.2, 1.9 ], "Cornylee Corp.": [ 0.0, 0.0, 0.0, 0.0, 0.0, 5.1, 6.3 ] }, "visual_intent": "A heatmap about vegetables and farmers showing harvest yields(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/heatmap_24.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib\nimport matplotlib as mpl\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n\nvegetables = [\"cucumber\", \"tomato\", \"lettuce\", \"asparagus\", \"potato\", \"wheat\", \"barley\"]\nfarmers = [\n \"Farmer Joe\",\n \"Upland Bros.\",\n \"Smith Gardening\",\n \"Agrifun\",\n \"Organiculture\",\n \"BioGoods Ltd.\",\n \"Cornylee Corp.\",\n]\n\nharvest = np.array(\n [\n [0.8, 2.4, 2.5, 3.9, 0.0, 4.0, 0.0],\n [2.4, 0.0, 4.0, 1.0, 2.7, 0.0, 0.0],\n [1.1, 2.4, 0.8, 4.3, 1.9, 4.4, 0.0],\n [0.6, 0.0, 0.3, 0.0, 3.1, 0.0, 0.0],\n [0.7, 1.7, 0.6, 2.6, 2.2, 6.2, 0.0],\n [1.3, 1.2, 0.0, 0.0, 0.0, 3.2, 5.1],\n [0.1, 2.0, 0.0, 1.4, 0.0, 1.9, 6.3],\n ]\n)\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n\n\ndef heatmap(\n data, row_labels, col_labels, ax=None, cbar_kw=None, cbarlabel=\"\", **kwargs\n):\n if ax is None:\n ax = plt.gca()\n\n if cbar_kw is None:\n cbar_kw = {}\n\n # Plot the heatmap\n im = ax.imshow(data, **kwargs)\n\n # Create colorbar\n cbar = ax.figure.colorbar(im, ax=ax, **cbar_kw)\n cbar.ax.set_ylabel(cbarlabel, rotation=-90, va=\"bottom\")\n\n # Show all ticks and label them with the respective list entries.\n ax.set_xticks(np.arange(data.shape[1]), labels=col_labels)\n ax.set_yticks(np.arange(data.shape[0]), labels=row_labels)\n\n # Let the horizontal axes labeling appear on top.\n ax.tick_params(top=True, bottom=False, labeltop=True, labelbottom=False)\n\n # Rotate the tick labels and set their alignment.\n plt.setp(ax.get_xticklabels(), rotation=-30, ha=\"right\", rotation_mode=\"anchor\")\n\n # Turn spines off and create white grid.\n ax.spines[:].set_visible(False)\n\n ax.set_xticks(np.arange(data.shape[1] + 1) - 0.5, minor=True)\n ax.set_yticks(np.arange(data.shape[0] + 1) - 0.5, minor=True)\n ax.grid(which=\"minor\", color=\"w\", linestyle=\"-\", linewidth=3)\n ax.tick_params(which=\"minor\", bottom=False, left=False)\n\n return im, cbar\n\n\ndef annotate_heatmap(\n im,\n data=None,\n valfmt=\"{x:.2f}\",\n textcolors=(\"black\", \"white\"),\n threshold=None,\n **textkw\n):\n if not isinstance(data, (list, np.ndarray)):\n data = im.get_array()\n\n # Normalize the threshold to the images color range.\n if threshold is not None:\n threshold = im.norm(threshold)\n else:\n threshold = im.norm(data.max()) / 2.0\n\n # Set default alignment to center, but allow it to be\n # overwritten by textkw.\n kw = dict(horizontalalignment=\"center\", verticalalignment=\"center\")\n kw.update(textkw)\n\n # Get the formatter in case a string is supplied\n if isinstance(valfmt, str):\n valfmt = matplotlib.ticker.StrMethodFormatter(valfmt)\n\n # Loop over the data and create a `Text` for each \"pixel\".\n # Change the text's color depending on the data.\n texts = []\n for i in range(data.shape[0]):\n for j in range(data.shape[1]):\n kw.update(color=textcolors[int(im.norm(data[i, j]) > threshold)])\n text = im.axes.text(j, i, valfmt(data[i, j], None), **kw)\n texts.append(text)\n\n return texts\n\n\nfig, ax = plt.subplots(figsize=(8, 8))\nim, cbar = heatmap(\n harvest, vegetables, farmers, ax=ax, cmap=\"YlGn\", cbarlabel=\"harvest [t/year]\"\n)\ntexts = annotate_heatmap(im, valfmt=\"{x:.1f} t\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\nfig.tight_layout()\nplt.savefig(\"heatmap_24.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_114", "content": { "Model": [ "GPT-2", "Llama 2 7B", "Llama 2 70B", "Mixtral 8x7B", "GPT-3.5", "GPT-4" ], "Simple": [ 0, 6, 8, 12, 12, 56 ], "Complex": [ 0, 16, 4, 18, 10, 4 ], "Code": [ 0, 12, 20, 26, 20, 22 ], "Simple Trend": [ 0, 6, 8, 12, 12, 56 ] }, "visual_intent": "A mixed chart consisting of grouped bars and a trend line showing success rates for different task types across various AI models, titled Encoding/Decoding Schelling Points by Model(size of the desired plot: width=8.0, height=5.0)", "path_to_gt_image": "images/CB_2.jpg", "original_category": "CB", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data\nmodels = [\"GPT-2\", \"Llama 2 7B\", \"Llama 2 70B\", \"Mixtral 8x7B\", \"GPT-3.5\", \"GPT-4\"]\nsimple = [0, 6, 8, 12, 12, 56]\ncomplex = [0, 16, 4, 18, 10, 4]\ncode = [0, 12, 20, 26, 20, 22]\nsimple_trend = [0, 6, 8, 12, 12, 56]\nlabels = [\"Simple\", \"Complex\", \"Code\", \"Simple Trend\"]\n\nxlabel = \"Model\"\nylabel = \"Success Rate (%)\"\ntitle = \"Encoding/Decoding Schelling Points by Model\"\nyticks = np.arange(0, 61, 10)\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting\nfig, ax = plt.subplots(\n figsize=(8, 5)\n) # Adjusting figure size to match the original image's dimensions\n\nbar_width = 0.25\nindex = np.arange(len(models))\n\nbar1 = ax.bar(\n index, simple, bar_width, label=labels[0], color=\"#db7a6e\", edgecolor=\"grey\"\n)\nbar2 = ax.bar(\n index + bar_width,\n complex,\n bar_width,\n label=labels[1],\n color=\"#e5a893\",\n edgecolor=\"grey\",\n)\nbar3 = ax.bar(\n index + 2 * bar_width,\n code,\n bar_width,\n label=labels[2],\n color=\"#f9ebe7\",\n edgecolor=\"grey\",\n)\n\n# Trend line for 'Simple Trend'\nax.plot(\n index,\n simple_trend,\n color=\"#cb56ae\",\n marker=\"o\",\n linestyle=\"dashed\",\n label=labels[3],\n)\n\n# Adding percentages on top of the bars\nfor i, rect in enumerate(bar1 + bar2 + bar3):\n height = rect.get_height()\n ax.text(\n rect.get_x() + rect.get_width() / 2.0,\n height,\n f\"{height}%\",\n ha=\"center\",\n va=\"bottom\",\n )\n\n# Labels, title and custom x-axis tick labels\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\nax.set_yticks(yticks)\nax.set_title(title)\nax.set_xticks(index + bar_width)\nax.set_xticklabels(models, rotation=30)\nax.legend()\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"CB_2.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 5.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "misc" }, { "id": "test_115", "content": { "Months": [ 1, 2, 3, 4, 5 ], "Classic Monitoring Devices": [ 75, 78, 80, 85, 87 ], "Satellite-based Monitoring": [ 70, 74, 77, 82, 85 ], "Drone Surveillance": [ 65, 70, 74, 79, 83 ], "Ground Sensor Networks": [ 80, 83, 86, 89, 91 ] }, "visual_intent": "A line chart about months and monitoring accuracy (%), titled Accuracy of Different Air Quality Monitoring Methods Over Time(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/line_72.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for air quality monitoring accuracy over months\nmonths = [1, 2, 3, 4, 5]\nmethod_a = [75, 78, 80, 85, 87]\nmethod_b = [70, 74, 77, 82, 85]\nmethod_c = [65, 70, 74, 79, 83]\nmethod_d = [80, 83, 86, 89, 91]\n\n# Labels and Plot Types\nlabel_method_a = \"Classic Monitoring Devices\"\nlabel_method_b = \"Satellite-based Monitoring\"\nlabel_method_c = \"Drone Surveillance\"\nlabel_method_d = \"Ground Sensor Networks\"\nxlabel_value = \"Months\"\nylabel_value = \"Monitoring Accuracy (%)\"\n\n# Axes Limits and Labels\nxlim_values = [1, 5]\nylim_values = [60, 100]\nxticks_values = np.arange(1, 6, 1)\nyticks_values = np.arange(60, 101, 10)\ntitle=\"Accuracy of Different Air Quality Monitoring Methods Over Time\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting\nplt.figure(figsize=(10, 6)) # Adjusting figure size for better readability\n\nplt.plot(\n months,\n method_a,\n \"-D\",\n label=label_method_a,\n color=\"#2E8B57\", # Sea Green\n clip_on=False,\n zorder=10,\n linewidth=2,\n markersize=8,\n)\n\nplt.plot(\n months,\n method_b,\n \"-v\",\n label=label_method_b,\n color=\"#4682B4\", # Steel Blue\n clip_on=False,\n zorder=10,\n linewidth=2,\n markersize=8,\n)\n\nplt.plot(\n months,\n method_c,\n \"-s\",\n label=label_method_c,\n color=\"#8B4513\", # Saddle Brown\n clip_on=False,\n zorder=10,\n linewidth=2,\n markersize=8,\n)\n\nplt.plot(\n months,\n method_d,\n \"-o\",\n label=label_method_d,\n color=\"#32CD32\", # Lime Green\n clip_on=False,\n zorder=10,\n linewidth=2,\n markersize=8,\n)\n\n# Set y-axis to only display specific ticks and extend y-axis to leave space at top\nplt.yticks(yticks_values)\nplt.ylim(ylim_values) # Adjusted y-axis limit\nplt.xticks(xticks_values)\nplt.xlim(xlim_values)\n\n# Adding grid, legend, and labels\nplt.grid(True, linestyle='--', alpha=0.7)\nplt.legend(loc=\"upper left\", bbox_to_anchor=(1.05, 1), ncol=1, frameon=False)\nplt.xlabel(xlabel_value)\nplt.ylabel(ylabel_value)\nplt.title(title, pad=20)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to reduce white space\nplt.tight_layout()\nplt.savefig(\"line_72.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "line" }, { "id": "test_116", "content": { "Religion": [ "Christianity", "Christianity", "Islam", "Islam", "Hinduism", "Hinduism", "Buddhism", "Buddhism", "Judaism", "Judaism", "Other", "Other" ], "Affiliation Rate": [ 0.7, 0.75, 0.6, 0.65, 0.5, 0.55, 0.4, 0.45, 0.3, 0.35, 0.2, 0.25 ], "Community Engagement Score": [ 85, 90, 88, 85, 80, 78, 75, 74, 70, 72, 65, 68 ] }, "visual_intent": "A scatter plot about Affiliation Rate and Community Engagement Score categorized by religious group, titled Scatter Plot of Community Engagement Score vs Affiliation Rate(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/scatter_38.jpg", "original_category": "scatter", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data points for each religious group with (Affiliation Rate, Community Engagement Score)\nchristianity = [(0.70, 85), (0.75, 90)]\nislam = [(0.60, 88), (0.65, 85)]\nhinduism = [(0.50, 80), (0.55, 78)]\nbuddhism = [(0.40, 75), (0.45, 74)]\njudaism = [(0.30, 70), (0.35, 72)]\nother = [(0.20, 65), (0.25, 68)]\nlabels = [\"Christianity\", \"Islam\", \"Hinduism\", \"Buddhism\", \"Judaism\", \"Other\"]\nxlabel = \"Affiliation Rate\"\nylabel = \"Community Engagement Score\"\ntitle = \"Scatter Plot of Community Engagement Score vs Affiliation Rate\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a scatter plot\nfig, ax = plt.subplots(figsize=(10, 6))\n\n# Plot each group with different color and marker\nax.scatter(*zip(*christianity), color=\"#2E8B57\", label=labels[0], s=100, marker=\"o\") # SeaGreen\nax.scatter(*zip(*islam), color=\"#4682B4\", label=labels[1], s=100, marker=\"^\") # SteelBlue\nax.scatter(*zip(*hinduism), color=\"#6A5ACD\", label=labels[2], s=100, marker=\"s\") # SlateBlue\nax.scatter(*zip(*buddhism), color=\"#FF8C00\", label=labels[3], s=100, marker=\"D\") # DarkOrange\nax.scatter(*zip(*judaism), color=\"#8A2BE2\", label=labels[4], s=100, marker=\"P\") # BlueViolet\nax.scatter(*zip(*other), color=\"#20B2AA\", label=labels[5], s=100, marker=\"*\") # LightSeaGreen\n\n# Add legend\nax.legend(loc=\"upper left\")\n\n# Add labels and title\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\nax.set_title(title)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nfig.tight_layout()\nplt.savefig(\"scatter_38.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_117", "content": { "Subjects": [ "Math", "Science", "History" ], "Benchmark Scores": [ -10.35, -10.53, -3.53 ], "Actual Scores": [ -23.53, -27.98, -6.07 ], "Improvement Index": [ 0.83, 0.6, 0.11 ] }, "visual_intent": "A dual-axis grouped bar chart about subjects, benchmark scores, actual scores, and improvement index(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/bar_99.jpg", "original_category": "bar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nnp.random.seed(0)\n\n# Data\ncategories = [\"Math\", \"Science\", \"History\"]\nprobing_fgt = [-10.35, -10.53, -3.53]\nobserved_fgt = [-23.53, -27.98, -6.07]\nfeature_embedding_distance = [0.83, 0.60, 0.11]\n\nlabels = [\"Benchmark Scores\", \"Actual Scores\", \"Improvement Index\"]\nxlabel = \"Subjects\"\nylabel = \"Scores (%)\"\nylabel2 = \"Improvement Index\"\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nxticks = np.arange(len(categories))\nylim = [-100, 100]\nylim2 = [-1, 1]\nnum_yticks = 5\nyticks = np.linspace(-100, 0, num_yticks)\nyticks2 = np.linspace(0, 1, num_yticks)\n\n# Create figure and axes\nfig, ax1 = plt.subplots(figsize=(8, 6))\nax2 = ax1.twinx()\n\n# Bar plots\nbar_width = 0.2\nindex = np.arange(len(categories))\n\nbar1 = ax1.bar(\n index - bar_width,\n probing_fgt,\n bar_width,\n label=labels[0],\n color=\"#2E8B57\",\n edgecolor=\"black\",\n zorder=3,\n)\nbar2 = ax1.bar(\n index,\n observed_fgt,\n bar_width,\n label=labels[1],\n color=\"#FF6347\",\n edgecolor=\"black\",\n zorder=3,\n)\nbar3 = ax2.bar(\n index + bar_width,\n feature_embedding_distance,\n bar_width,\n label=labels[2],\n color=\"#4682B4\",\n edgecolor=\"black\",\n zorder=3,\n)\n\n# Add values on top of the bars\nfor bars in [bar1, bar2]:\n for bar in bars:\n height = bar.get_height()\n ax1.annotate(\n f\"{height}\",\n xy=(bar.get_x() + bar.get_width() / 2, height - 4),\n xytext=(0, 3),\n textcoords=\"offset points\",\n ha=\"center\",\n va=\"top\",\n fontsize=8,\n )\nfor bars in [bar3]:\n for bar in bars:\n height = bar.get_height()\n ax2.annotate(\n f\"{height}\",\n xy=(bar.get_x() + bar.get_width() / 2, height),\n xytext=(0, 3),\n textcoords=\"offset points\",\n ha=\"center\",\n va=\"bottom\",\n fontsize=8,\n )\n\n# Set the axes background color and add grid lines\nfor ax in [ax1, ax2]:\n ax.set_facecolor(\"#f5f5f5\")\n ax.grid(True, color=\"#d9d9d9\", linestyle='--', zorder=1)\n\n# Axes labels\nax1.set_xlabel(xlabel)\nax1.set_ylabel(ylabel)\nax2.set_ylabel(ylabel2)\n\nax1.set_ylim(ylim)\nax2.set_ylim(ylim2)\nax1.set_xticks(index)\nax1.set_xticklabels(categories)\n\nax1.set_yticks(yticks)\nax2.set_yticks(yticks2)\n\n# Create legend & Show plot\nhandles, labels = ax1.get_legend_handles_labels()\nhandles2, labels2 = ax2.get_legend_handles_labels()\nfig.legend(\n handles + handles2,\n labels + labels2,\n loc=\"lower right\",\n bbox_to_anchor=(0.9, 0.1),\n frameon=False,\n framealpha=0,\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"bar_99.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" }, { "id": "test_118", "content": { "City": [ "New York", "Los Angeles", "Chicago", "Houston" ], "Sunny": [ 60, 70, 50, 80 ], "Cloudy": [ 20, 15, 30, 10 ], "Rainy": [ 20, 15, 20, 10 ] }, "visual_intent": "A figure with 4 subplots showing horizontal stacked bar charts about weather statistics (Sunny, Cloudy, Rainy) across different cities, with titles indicating specific cities but displaying the same dataset in each subplot(size of the desired plot: width=13.0, height=6.0)", "path_to_gt_image": "images/bar_220.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for the bar charts\ncategories = [\"New York\", \"Los Angeles\", \"Chicago\", \"Houston\"]\nsunny = [60, 70, 50, 80]\ncloudy = [20, 15, 30, 10]\nrainy = [20, 15, 20, 10]\n\nlabels = [\"Sunny\", \"Cloudy\", \"Rainy\"]\ntitles = [\n \"Weather Stats for New York\",\n \"Weather Stats for Los Angeles\",\n \"Weather Stats for Chicago\",\n \"Weather Stats for Houston\",\n]\nxlabel = \"Percentage of Days\"\nylabel = \"City\"\nlegendlabels = labels\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with custom size\nfig, axes = plt.subplots(2, 2, figsize=(13, 6))\n\n# Function to create a bar chart\ndef create_bar_chart(ax, sunny, cloudy, rainy, title):\n bar_width = 0.5\n indices = np.arange(len(categories))\n\n ax.barh(indices, sunny, bar_width, color=\"#f1c40f\", label=labels[0])\n ax.barh(indices, cloudy, bar_width, left=sunny, color=\"#95a5a6\", label=labels[1])\n ax.barh(indices, rainy, bar_width, left=np.add(sunny, cloudy), color=\"#3498db\", label=labels[2])\n\n ax.set_yticks(indices)\n ax.set_yticklabels(categories)\n ax.invert_yaxis() # labels read top-to-bottom\n ax.set_title(title)\n ax.set_xlim(0, 100)\n ax.set_xlabel(xlabel)\n ax.set_ylabel(ylabel)\n ax.grid(True, which=\"both\", linestyle='--', linewidth=0.5)\n\n for i, (s, c, r) in enumerate(zip(sunny, cloudy, rainy)):\n ax.text(s / 2, i, f\"{s}%\", ha=\"center\", va=\"center\", color=\"black\")\n ax.text(s + c / 2, i, f\"{c}%\", ha=\"center\", va=\"center\", color=\"black\")\n ax.text(s + c + r / 2, i, f\"{r}%\", ha=\"center\", va=\"center\", color=\"black\")\n\n for spine in ax.spines.values():\n spine.set_visible(False)\n ax.set_yticklabels(categories, rotation=0)\n\n# Create each bar chart\ncreate_bar_chart(axes[0, 0], sunny, cloudy, rainy, titles[0])\ncreate_bar_chart(axes[1, 0], sunny, cloudy, rainy, titles[1])\ncreate_bar_chart(axes[0, 1], sunny, cloudy, rainy, titles[2])\ncreate_bar_chart(axes[1, 1], sunny, cloudy, rainy, titles[3])\n\n# Add a legend\nhandles, labels = axes[0, 0].get_legend_handles_labels()\nfig.legend(handles, labels, loc=\"lower center\", ncol=3)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the figure\nplt.tight_layout(rect=[0, 0.05, 1, 1])\nplt.savefig(\"bar_220.pdf\", bbox_inches=\"tight\")\n\n", "width": 13.0, "height": 6.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_119", "content": { "Region": [ "Region A", "Region B", "Region C", "Region D" ], "Religion 1": [ 30, 45, 50, 55 ], "Religion 2": [ 40, 35, 30, 25 ], "Religion 3": [ 30, 20, 20, 20 ] }, "visual_intent": "A line chart about regions and percentage of followers, titled Distribution of Religious Followers by Region(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/line_105.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Data for plotting\nregions = [\"Region A\", \"Region B\", \"Region C\", \"Region D\"]\nfollowers_religion1 = [30, 45, 50, 55]\nfollowers_religion2 = [40, 35, 30, 25]\nfollowers_religion3 = [30, 20, 20, 20]\n\n# Extracted variables\nline_label_religion1 = \"Religion 1\"\nline_label_religion2 = \"Religion 2\"\nline_label_religion3 = \"Religion 3\"\nxlim_values = (0.25, 1)\nylim_values = (0, 60)\nxlabel_value = \"Region\"\nylabel_value = \"Percentage of Followers\"\nxticks_values = np.arange(len(regions))\n\n# Label texts\nchart_title = \"Distribution of Religious Followers by Region\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nxtickslabel_fontsize = 14\nytickslabel_fontsize = 14\n\n# Plotting the lines with specific styles\nplt.figure(figsize=(10, 6))\nplt.plot(\n xticks_values,\n followers_religion1,\n marker=\"o\",\n markersize=8,\n linewidth=2,\n linestyle=\"-\",\n color=\"#1f77b4\",\n label=line_label_religion1\n)\nplt.plot(\n xticks_values,\n followers_religion2,\n marker=\"s\",\n markersize=8,\n linewidth=2,\n linestyle=\"--\",\n color=\"#ff7f0e\",\n label=line_label_religion2\n)\nplt.plot(\n xticks_values,\n followers_religion3,\n marker=\"+\",\n markersize=12,\n linewidth=2,\n linestyle=\":\",\n color=\"#2ca02c\",\n label=line_label_religion3\n)\n\n# Setting the x-axis and y-axis limits\nplt.ylim(ylim_values)\nplt.yticks(fontsize=ytickslabel_fontsize)\nplt.xlim((0, len(regions)-1))\nplt.xticks(xticks_values, regions, fontsize=xtickslabel_fontsize)\n\n# Adding labels and title\nplt.xlabel(xlabel_value, fontsize=18)\nplt.ylabel(ylabel_value, fontsize=18)\nplt.title(chart_title, fontsize=20)\n\n# Adding legend with increased font size\nplt.legend(\n fontsize=\"large\",\n loc=\"upper center\",\n ncol=3,\n frameon=False,\n bbox_to_anchor=(0.5, 1.15),\n)\n\n# Adding grid\nplt.grid(True, alpha=0.6)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to reduce white space\nplt.tight_layout()\nplt.savefig(\"line_105.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "line" }, { "id": "test_120", "content": { "Years": [ 1, 2, 3, 4, 5, 6 ], "Strategy A": [ 0.1, 0.2, 0.35, 0.55, 0.75, 1.0 ], "Strategy B": [ 0.05, 0.1, 0.18, 0.27, 0.4, 0.55 ] }, "visual_intent": "A log-log line chart about Years and Return on Investment (ROI), titled Comparison of Investment Strategies Over Time(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/line_86.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for plotting\nyears = np.array([1, 2, 3, 4, 5, 6])\nstrategy_A = np.array([0.1, 0.2, 0.35, 0.55, 0.75, 1.0])\nstrategy_B = np.array([0.05, 0.1, 0.18, 0.27, 0.4, 0.55])\n\n# Axes Limits and Labels\nxlabel_value = \"Years\"\nylabel_value = \"Return on Investment (ROI)\"\n\nylim_values = [1e-2, 1e0]\nyticks_values = [10**-2, 10**-1, 10**0]\nyticks_labels = [\"$10^{-2}$\", \"$10^{-1}$\", \"$10^0$\"]\n\n# Labels\nlabel_Strategy_A = \"Strategy A\"\nlabel_Strategy_B = \"Strategy B\"\n\n# Title\ntitle_value = \"Comparison of Investment Strategies Over Time\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the figure size\nplt.figure(figsize=(10, 6))\n\n# Plot the data\nplt.loglog(\n years,\n strategy_A,\n \"o-\",\n color=\"#2ca02c\",\n label=label_Strategy_A,\n markerfacecolor=\"#2ca02c\",\n markersize=6,\n linestyle='--'\n) # Dashed line for Strategy A\nplt.loglog(\n years, \n strategy_B, \n \"x-\", \n color=\"#d62728\", \n label=label_Strategy_B, \n markersize=6,\n linestyle='-'\n) # Solid line for Strategy B\n\n# Add labels with increased font size\nplt.xlabel(xlabel_value, fontsize=14)\nplt.ylabel(ylabel_value, fontsize=14)\nplt.title(title_value, fontsize=16)\n\n# Set y-axis to only display specific ticks and extend y-axis to leave space at top\nplt.yticks(\n yticks_values,\n yticks_labels,\n)\nplt.ylim(ylim_values) # Extend y-axis to leave some space above 10^0\n\n# Explicitly set the tick params for the x-axis\nplt.tick_params(axis=\"x\", labelsize=14) # Ensure x-axis tick labels are of font size 14\n\n# Add legend with transparent background\nplt.legend(frameon=True, fontsize=12)\n\n# Add a vertical line at x=1 and enable horizontal grid lines for structure\nplt.axvline(x=1, color=\"grey\", linestyle=\"--\", linewidth=1)\nplt.grid(\n True, which=\"both\", ls=\"--\", color=\"grey\", linewidth=1, axis=\"y\"\n) # Horizontal grid lines\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust the layout and display the plot\nplt.tight_layout()\nplt.savefig(\"line_86.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "line" }, { "id": "test_121", "content": { "Year": [ 2000, 2005, 2010, 2015, 2020, 2025 ], "Urbanization": [ 0.1, 0.15848931924611134, 0.251188643150958, 0.3981071705534972, 0.6309573444801932, 1.0 ], "Education Level": [ 50.0, 58.0, 66.0, 74.0, 82.0, 90.0 ], "Healthcare Access": [ 0.6, 0.7, 0.75, 0.8, 0.85, 0.9 ], "Internet Penetration": [ 0.2, 0.4, 0.6, 0.8, 0.9, 0.95 ] }, "visual_intent": "A figure with 4 subplots comparing societal trends over years: (1) Urbanization, (2) Education Level, (3) Healthcare Access, and (4) Internet Penetration, titled Societal Trends Over Years(size of the desired plot: width=14.0, height=10.0)", "path_to_gt_image": "images/line_205.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Generate distinct data sets for each subplot related to societal trends\nyears = np.array([2000, 2005, 2010, 2015, 2020, 2025])\ndatasets = {\n \"Urbanization\": np.logspace(2, 3, len(years)) / 1000, # Exponential trend\n \"Education Level\": np.linspace(50, 90, len(years)), # Linear increase\n \"Healthcare Access\": np.array([60, 70, 75, 80, 85, 90]) / 100, # Increasing trend\n \"Internet Penetration\": np.array([20, 40, 60, 80, 90, 95]) / 100, # S-curve\n}\n\n# Assign each dataset to a subplot\nplot_order = [\"Urbanization\", \"Education Level\", \"Healthcare Access\", \"Internet Penetration\"]\n\n# Axes Limits and Labels\nxlabel_value = \"Year\"\n\nylabel_values = {\n \"Urbanization\": \"Percentage (%)\",\n \"Education Level\": \"Percentage (%)\",\n \"Healthcare Access\": \"Percentage (%)\",\n \"Internet Penetration\": \"Percentage (%)\",\n}\nylim_values = [0, 1]\n\n# Text\nannotations = {\n \"Urbanization\": \"Rapid Growth\",\n \"Education Level\": \"Steady Increase\",\n \"Healthcare Access\": \"Improving Access\",\n \"Internet Penetration\": \"Digital Revolution\",\n}\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the figure size and define colors, markers, and linestyles\nfig, axs = plt.subplots(2, 2, figsize=(14, 10)) # Use a 2x2 subplot grid\ncolors = [\"royalblue\", \"goldenrod\", \"seagreen\", \"darkorchid\"]\nmarkers = [\"o\", \"s\", \"^\", \"d\"]\nlinestyles = [\"-\", \"--\", \":\", \"-.\"]\n\n# Plot data in each subplot\nfor i, (ax, key) in enumerate(zip(axs.flat, plot_order)):\n for j, data_key in enumerate(plot_order):\n if key == data_key:\n ax.plot(\n years,\n datasets[data_key],\n linestyle=linestyles[j],\n marker=markers[j],\n color=colors[j],\n label=data_key,\n markersize=8,\n )\n else:\n ax.plot(\n years,\n datasets[data_key],\n linestyle=linestyles[j],\n marker=markers[j],\n color=colors[j],\n label=data_key,\n markersize=8,\n alpha=0.8,\n ) # Faded other lines\n\n ax.set_xlabel(xlabel_value)\n ax.set_ylabel(ylabel_values[key])\n ax.set_ylim(ylim_values) # Ensure y-axis ranges don't clip data\n ax.set_title(f\"{key} Over Years\")\n ax.legend()\n\n # Annotations to explain features, only on primary dataset for clarity\n annotation_text = annotations[key]\n ax.annotate(\n annotation_text,\n xy=(years[-1], datasets[key][-1]),\n xytext=(years[3], datasets[key][-1] * 0.6),\n arrowprops=dict(arrowstyle=\"->\", color=\"navy\"),\n textcoords=\"data\",\n )\n\n# Adjust layout to prevent overlap and ensure clarity\nplt.suptitle(\"Societal Trends Over Years\", fontsize=16)\nplt.tight_layout(rect=[0, 0, 1, 0.96])\nplt.savefig(\"line_205.pdf\", bbox_inches=\"tight\")\n\n", "width": 14.0, "height": 10.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "line" }, { "id": "test_122", "content": { "City": [ "City A", "City A", "City A", "City A", "City A", "City A", "City B", "City B", "City B", "City B", "City B", "City B", "City C", "City C", "City C", "City C", "City C", "City C", "City D", "City D", "City D", "City D", "City D", "City D", "City E", "City E", "City E", "City E", "City E", "City E" ], "Month": [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jan", "Feb", "Mar", "Apr", "May", "Jun" ], "Temperature": [ 15.3, 18.0, 20.9, 25.0, 30.4, 35.3, 10.2, 12.2, 15.6, 20.8, 25.3, 28.9, 5.8, 7.3, 12.9, 18.2, 22.5, 29.3, 2.0, 5.1, 10.5, 15.1, 22.1, 25.2, 0.0, 2.1, 5.6, 10.5, 15.6, 20.5 ] }, "visual_intent": "A styled bubble chart heatmap about months and cities showing temperature readings(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/heatmap_93.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom matplotlib.colors import LogNorm\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Defining the colormap from blue (cold) to red (hot)\ncmap = plt.cm.coolwarm\n\n# Sample data: a 5x6 grid representing temperature readings (in °C)\ndata = np.array(\n [\n [15.3, 18.0, 20.9, 25.0, 30.4, 35.3],\n [10.2, 12.2, 15.6, 20.8, 25.3, 28.9],\n [5.8, 7.3, 12.9, 18.2, 22.5, 29.3],\n [2.0, 5.1, 10.5, 15.1, 22.1, 25.2],\n [0.0, 2.1, 5.6, 10.5, 15.6, 20.5],\n ]\n)\n\n# X and Y labels\nxticklabels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\"]\nyticklabels = [\"City A\", \"City B\", \"City C\", \"City D\", \"City E\"]\nx_label = \"Month\"\ny_label = \"City\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set up the figure and axis\nfig, ax = plt.subplots(figsize=(10, 8))\n\n# Set up the colormap and norm (log scale)\nnorm = LogNorm(vmin=1, vmax=40)\n\n# Create the scatter plot\nfor i in range(data.shape[0]):\n for j in range(data.shape[1]):\n # Calculate the color based on the original value\n color = cmap(norm(data[i, j]))\n\n # Draw the circle with a fixed size\n circle = plt.Circle((j, i), 0.4, color=color) # Fixed size\n ax.add_artist(circle)\n\n # Determine text color based on the value\n text_color = \"white\" if data[i, j] > 20 else \"black\"\n\n # Add the text inside the circle\n ax.text(j, i, f\"{data[i, j]:.1f}°C\", ha=\"center\", va=\"center\", color=text_color)\n\n# Set labels for x and y axes\nax.set_xticks(range(len(xticklabels)))\nax.set_xticklabels(xticklabels, ha=\"center\")\nax.set_yticks(range(len(yticklabels)))\nax.set_yticklabels(yticklabels, va=\"center\")\n\n# Adding titles for the axes\nax.set_xlabel(x_label, fontsize=14)\nax.set_ylabel(y_label, fontsize=14)\n\n# Set the limits of the axes; they should be one more than your data range\nax.set_xlim(-0.5, data.shape[1] - 0.5)\nax.set_ylim(-0.5, data.shape[0] - 0.5)\n\n# Set the aspect of the plot to be equal and add a frame\nax.set_aspect(\"equal\")\nfor spine in ax.spines.values():\n spine.set_visible(True)\n\n# Create a colorbar\nsm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)\nsm.set_array([])\ncbar = plt.colorbar(sm, ax=ax, ticks=[1, 5, 10, 20, 30, 40], orientation=\"vertical\")\ncbar.ax.set_yticklabels([\"1\", \"5\", \"10\", \"20\", \"30\", \"40\"])\n\n# Add gridlines\nplt.grid(True, which=\"both\", color=\"gray\", linestyle=\"--\", linewidth=0.5)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout to fit the figure size\nplt.tight_layout()\n\n# Show the plot\nplt.savefig(\"heatmap_93.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_123", "content": { "Attribute": [ "Scenic Beauty", "Accessibility", "Accommodation Quality", "Local Culture", "Safety" ], "Destination A": [ 4, 3, 5, 4, 5 ], "Destination B": [ 3, 4, 4, 3, 4 ], "Destination C": [ 5, 2, 3, 5, 3 ] }, "visual_intent": "A figure with 3 subplots displaying radar charts for Destination A, Destination B, and Destination C, evaluating attributes such as Scenic Beauty and Safety(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/radar_31.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Define the data for each destination\nlabels = np.array(\n [\n \"Scenic Beauty\",\n \"Accessibility\",\n \"Accommodation Quality\",\n \"Local Culture\",\n \"Safety\",\n ]\n)\nstats = np.array([[4, 3, 5, 4, 5], [3, 4, 4, 3, 4], [5, 2, 3, 5, 3]])\ntitles = [\"Destination A\", \"Destination B\", \"Destination C\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the figure size\nfig, ax = plt.subplots(figsize=(10, 6), nrows=1, ncols=3, subplot_kw=dict(polar=True))\n\n# Define the number of variables\nnum_vars = len(labels)\n# Compute angle for each axis\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n# The plot is made circular\nstats = np.concatenate((stats, stats[:, [0]]), axis=1)\nangles += angles[:1]\n\ncolors = [\"#2E8B57\", \"#1E90FF\", \"#FF8C00\"] # Green, Blue, Orange\n\n# Draw one radar chart for each destination\nfor idx, (title, case_data) in enumerate(zip(titles, stats)):\n thisColor = colors[idx]\n ax[idx].fill(\n angles, case_data, color=thisColor, alpha=0.25\n ) # Fill with transparency\n ax[idx].plot(\n angles, case_data, color=thisColor, linewidth=2, linestyle=\"solid\", marker=\"o\"\n )\n ax[idx].set_yticks([1, 2, 3, 4, 5])\n ax[idx].set_xticks(angles[:-1])\n ax[idx].set_xticklabels(labels)\n ax[idx].set_title(title, size=14, color=\"black\", position=(0.5, -0.1))\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit\nplt.tight_layout()\n\n# Show the plot\nplt.savefig(\"radar_31.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "radar" }, { "id": "test_124", "content": { "Programming Languages": [ "Python", "JavaScript", "Java", "C++", "C#", "Ruby", "Go", "Swift", "Kotlin" ], "Popularity": [ 9.5, 8.8, 8.2, 7.0, 7.5, 6.0, 6.8, 7.1, 6.7 ], "Ease of Learning": [ 9.0, 8.5, 7.5, 6.0, 7.0, 7.8, 7.2, 7.5, 7.3 ], "Performance": [ 7.0, 6.5, 8.0, 9.0, 7.4, 6.2, 8.5, 7.0, 7.2 ], "Community Support": [ 9.5, 8.9, 8.0, 7.5, 8.0, 7.0, 7.8, 7.5, 7.6 ] }, "visual_intent": "A figure with 2 subplots: (1) a scatter plot comparing Popularity and Ease of Learning scores for various programming languages, titled Programming Languages Comparison, (2) a scatter plot comparing Performance and Community Support scores for the same languages, titled Technical Metrics(size of the desired plot: width=14.0, height=7.0)", "path_to_gt_image": "images/scatter_90.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\nlanguages = [\n \"Python\",\n \"JavaScript\",\n \"Java\",\n \"C++\",\n \"C#\",\n \"Ruby\",\n \"Go\",\n \"Swift\",\n \"Kotlin\",\n]\nvalues = {\n \"Popularity\": [9.5, 8.8, 8.2, 7.0, 7.5, 6.0, 6.8, 7.1, 6.7],\n \"Ease of Learning\": [9.0, 8.5, 7.5, 6.0, 7.0, 7.8, 7.2, 7.5, 7.3],\n \"Performance\": [7.0, 6.5, 8.0, 9.0, 7.4, 6.2, 8.5, 7.0, 7.2],\n \"Community Support\": [9.5, 8.9, 8.0, 7.5, 8.0, 7.0, 7.8, 7.5, 7.6],\n \"Versatility\": [9.0, 8.0, 8.2, 7.5, 8.0, 6.5, 7.5, 7.8, 7.4],\n \"Libraries & Tools\": [9.5, 8.6, 8.3, 7.2, 7.8, 6.9, 7.7, 7.4, 7.3],\n}\ncategorys1 = [\"Popularity\", \"Ease of Learning\"]\ncategorys2 = [\"Performance\", \"Community Support\"]\ntitles = [\"Programming Languages Comparison\", \"Technical Metrics\"]\nxlabel = \"Score\"\nylabel = \"Programming Languages\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create subplots\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 7), sharey=True)\ncolors1 = [\"#1f77b4\", \"#ff7f0e\"] # Muted Blue and Orange\ncolors2 = [\"#2ca02c\", \"#d62728\"] # Muted Green and Red\nmarkers1 = [\"o\", \"s\"] # Circle and Square\nmarkers2 = [\"^\", \"D\"] # Triangle Up and Diamond\n\n# Plotting for ax1 - first two categories\nfor category, color, marker in zip(categorys1, colors1, markers1):\n ax1.scatter(\n values[category], languages, color=color, label=category, marker=marker, s=100\n )\nax1.set_title(titles[0], fontsize=14)\nax1.set_xlabel(xlabel, fontsize=12)\nax1.set_ylabel(ylabel, fontsize=12)\nax1.legend(fontsize=10)\n\n# Plotting for ax2 - next two categories\nfor category, color, marker in zip(categorys2, colors2, markers2):\n ax2.scatter(\n values[category], languages, color=color, label=category, marker=marker, s=100\n )\nax2.set_title(titles[1], fontsize=14)\nax2.set_xlabel(xlabel, fontsize=12)\nax2.legend(fontsize=10)\n\n# Common settings\nfor ax in [ax1, ax2]:\n ax.set_yticks(range(len(languages)))\n ax.set_yticklabels(languages, fontsize=10)\n ax.grid(True, linestyle=\"--\", alpha=0.7)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and show plot\nplt.tight_layout()\nplt.savefig(\"scatter_90.pdf\", bbox_inches=\"tight\")\n", "width": 14.0, "height": 7.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_125", "content": { "Time Period (Months)": [ 1, 2, 3, 4, 5, 6, 7 ], "S&P 500": [ 100, 102, 104, 108, 110, 115, 120 ], "Dow Jones": [ 100, 101, 103, 107, 109, 113, 116 ], "NASDAQ": [ 100, 105, 110, 112, 115, 120, 125 ], "Russell 2000": [ 100, 99, 98, 100, 102, 105, 110 ] }, "visual_intent": "A line chart about time periods and stock index values (S&P 500, Dow Jones, NASDAQ, Russell 2000) using dual y-axes, titled Performance of Major Stock Indexes Over Time(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/line_170.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom matplotlib.lines import Line2D # Importing Line2D for creating custom legend items\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Data (Finance Domain)\ntime_periods = [1, 2, 3, 4, 5, 6, 7]\nsnp_500 = [100, 102, 104, 108, 110, 115, 120]\nnasdaq = [100, 105, 110, 112, 115, 120, 125]\ndow_jones = [100, 101, 103, 107, 109, 113, 116]\nrussell_2000 = [100, 99, 98, 100, 102, 105, 110]\n\n# Axes Limits and Labels\nxlabel_value = \"Time Period (Months)\"\nylabel_value_1 = \"S&P 500 / Dow Jones\"\nylabel_value_2 = \"NASDAQ / Russell 2000\"\nylim_values_1 = [90, 130]\nylim_values_2 = [90, 130]\nyticks_values_1 = range(90, 131, 10)\nyticks_values_2 = range(90, 131, 10)\n\n# Labels\nlabel_snp = \"S&P 500\"\nlabel_nasdaq = \"NASDAQ\"\nlabel_dow = \"Dow Jones\"\nlabel_russell = \"Russell 2000\"\ntitle_text = \"Performance of Major Stock Indexes Over Time\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot\nfig, ax1 = plt.subplots(figsize=(10, 8))\n\n# S&P 500 and Dow Jones plots\n(snp_line,) = ax1.plot(\n time_periods,\n snp_500,\n \"o-\",\n color=\"#1f77b4\",\n label=label_snp,\n markersize=8,\n linewidth=2.5,\n)\n(dow_line,) = ax1.plot(\n time_periods,\n dow_jones,\n \"s--\",\n color=\"#ff7f0e\",\n label=label_dow,\n markersize=8,\n linewidth=2.5,\n)\nax1.set_xlabel(xlabel_value, fontsize=14)\nax1.set_ylabel(ylabel_value_1, fontsize=14, color=\"#1f77b4\")\nax1.tick_params(axis=\"y\", labelcolor=\"#1f77b4\", direction=\"in\", labelsize=12)\nax1.tick_params(axis=\"x\", direction=\"in\", labelsize=12)\nax1.set_yticks(yticks_values_1)\nax1.set_ylim(ylim_values_1)\nax1.grid(which='major', linestyle='--', linewidth='0.5', color='gray')\n\n# Adding values to the plot for S&P 500 and Dow Jones\nfor i, txt in enumerate(snp_500):\n ax1.annotate(\n f\"{txt}\",\n (time_periods[i], txt),\n textcoords=\"offset points\",\n xytext=(0, 10),\n ha=\"center\",\n fontsize=10,\n )\nfor i, txt in enumerate(dow_jones):\n ax1.annotate(\n f\"{txt}\",\n (time_periods[i], txt),\n textcoords=\"offset points\",\n xytext=(0, -15),\n ha=\"center\",\n fontsize=10,\n )\n\n# NASDAQ and Russell 2000 plots with a secondary y-axis\nax2 = ax1.twinx()\n(nasdaq_line,) = ax2.plot(\n time_periods,\n nasdaq,\n \"^-\",\n color=\"#2ca02c\",\n label=label_nasdaq,\n markersize=8,\n linewidth=2.5,\n)\n(russell_line,) = ax2.plot(\n time_periods,\n russell_2000,\n \"d-.\",\n color=\"#d62728\",\n label=label_russell,\n markersize=8,\n linewidth=2.5,\n)\nax2.set_ylabel(ylabel_value_2, color=\"#2ca02c\", fontsize=14)\nax2.tick_params(axis=\"y\", labelcolor=\"#2ca02c\", direction=\"in\", labelsize=12)\nax2.set_yticks(yticks_values_2)\nax2.set_ylim(ylim_values_2)\n\n# Adding values to the plot for NASDAQ and Russell 2000\nfor i, txt in enumerate(nasdaq):\n ax2.annotate(\n f\"{txt}\",\n (time_periods[i], txt),\n textcoords=\"offset points\",\n xytext=(0, 10),\n ha=\"center\",\n fontsize=10,\n )\nfor i, txt in enumerate(russell_2000):\n ax2.annotate(\n f\"{txt}\",\n (time_periods[i], txt),\n textcoords=\"offset points\",\n xytext=(0, -15),\n ha=\"center\",\n fontsize=10,\n )\n\n# Creating custom legend items for line styles\nsnp_legend = Line2D([0], [0], color=\"#1f77b4\", linestyle=\"-\", linewidth=2.5, label=\"S&P 500\")\ndow_legend = Line2D([0], [0], color=\"#ff7f0e\", linestyle=\"--\", linewidth=2.5, label=\"Dow Jones\")\nnasdaq_legend = Line2D([0], [0], color=\"#2ca02c\", linestyle=\"-\", linewidth=2.5, label=\"NASDAQ\")\nrussell_legend = Line2D([0], [0], color=\"#d62728\", linestyle=\"-.\", linewidth=2.5, label=\"Russell 2000\")\n\n# Adding legends\nfirst_legend = ax1.legend(\n handles=[snp_legend, dow_legend],\n loc=\"upper left\",\n fontsize=12,\n edgecolor=\"black\",\n)\nax1.add_artist(first_legend) # Add the first legend manually\nsecond_legend = ax1.legend(\n handles=[nasdaq_line, russell_line],\n loc=\"upper right\",\n fontsize=12,\n edgecolor=\"black\"\n) # Add the second legend\n\n# Adding title\nplt.title(title_text, fontsize=16, fontweight='bold')\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"line_170.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "line" }, { "id": "test_126", "content": { "City": [ "New York", "New York", "New York", "Los Angeles", "Los Angeles", "Los Angeles", "Chicago", "Chicago", "Chicago" ], "Metric": [ "Air Quality Index (AQI)", "Hospital Capacity", "Vaccine Coverage", "Air Quality Index (AQI)", "Hospital Capacity", "Vaccine Coverage", "Air Quality Index (AQI)", "Hospital Capacity", "Vaccine Coverage" ], "Value": [ 50, 80, 95, 60, 85, 90, 55, 75, 85 ], "Error_Lower": [ 5, 7, 3, 6, 5, 4, 7, 6, 5 ], "Error_Upper": [ 8, 5, 4, 7, 6, 3, 6, 5, 4 ] }, "visual_intent": "A figure with 3 subplots: (1) a bar chart about public health metrics in New York, (2) a bar chart about public health metrics in Los Angeles, (3) a bar chart about public health metrics in Chicago, titled Public Health Metrics in Major Cities(size of the desired plot: width=12.0, height=5.0)", "path_to_gt_image": "images/errorbar_115.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Public Health Metrics Data for three major cities\nmetrics = [\"Air Quality Index (AQI)\", \"Hospital Capacity\", \"Vaccine Coverage\"]\nvalues = np.array(\n [\n [50, 80, 95], # New York\n [60, 85, 90], # Los Angeles\n [55, 75, 85], # Chicago\n ]\n)\n\n# Asymmetric error values, proportionate to the data scale\nerrors = np.array(\n [\n [[5, 8], [7, 5], [3, 4]], # Errors for New York (lower, upper)\n [[6, 7], [5, 6], [4, 3]], # Errors for Los Angeles\n [[7, 6], [6, 5], [5, 4]], # Errors for Chicago\n ]\n)\n\n# Creating subplots for each city\ncities = [\"New York\", \"Los Angeles\", \"Chicago\"]\n\nylabel = \"Metric Values\"\nylim = [40, 110]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, axs = plt.subplots(1, 3, figsize=(12, 5)) # Slightly larger layout\n\n# Function to plot each city's data\ndef plot_city_data(ax, errors, city_index, city_name):\n x = np.arange(len(metrics)) # the label locations\n bar_colors = [\"#ff9999\", \"#66b3ff\", \"#99ff99\"]\n barerrors = np.array(errors).T[:, :, city_index]\n bars = ax.bar(x, values[city_index], yerr=barerrors, color=bar_colors, capsize=5)\n for bar, lower_error, upper_error in zip(bars, barerrors[0], barerrors[1]):\n # Position for lower error text\n ax.text(\n bar.get_x() + bar.get_width() / 2,\n bar.get_height() - lower_error - 2,\n f\"-{lower_error}\",\n va=\"bottom\",\n ha=\"center\",\n color=\"black\",\n fontsize=8,\n )\n # Position for upper error text\n ax.text(\n bar.get_x() + bar.get_width() / 2,\n bar.get_height() + upper_error + 1,\n f\"+{upper_error}\",\n ha=\"center\",\n color=\"black\",\n fontsize=8,\n )\n\n ax.set_title(city_name)\n ax.set_xticks(x)\n ax.set_xticklabels(metrics, rotation=45, ha='right')\n ax.set_ylabel(ylabel)\n ax.set_ylim(ylim) # Uniform scale for all charts\n\n# Plotting the data for each city\nfor i, city in enumerate(cities):\n plot_city_data(axs[i], errors, i, city)\n\n# Adding a super title\nplt.suptitle(\"Public Health Metrics in Major Cities\", fontsize=16)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout(rect=[0, 0.03, 1, 0.95]) # Adjust tight_layout to make space for supertitle\nplt.savefig(\"errorbar_115.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 5.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_127", "content": { "Seasons": [ "Spring", "Summer", "Autumn", "Winter" ], "Country A Tourists (in thousands)": [ 120, 150, 180, 110 ], "Country B Tourists (in thousands)": [ 80, 100, 130, 90 ] }, "visual_intent": "A dual-axis bar chart about seasons and tourist visits for Country A and Country B, titled Seasonal Tourist Visits to Countries A and B(size of the desired plot: width=8.0, height=5.0)", "path_to_gt_image": "images/bar_303.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for the bar charts\ncountry_a_tourists = [120, 150, 180, 110]\ncountry_b_tourists = [80, 100, 130, 90]\nx = np.arange(len(country_a_tourists)) # x-coordinates for the bars\n\n# Labels and Titles\nlabels = [\"Country A Tourists\", \"Country B Tourists\"]\ntitle = \"Seasonal Tourist Visits to Countries A and B\"\nxlabel = \"Seasons\"\nylabel1 = \"Country A Tourists (in thousands)\"\nylabel2 = \"Country B Tourists (in thousands)\"\nlegend_labels = [\"Country A\", \"Country B\"]\nseason_labels = [\"Spring\", \"Summer\", \"Autumn\", \"Winter\"]\n\n# Plot configuration\nylim1 = [0, 200] # y-axis limits for the first subplot\nylim2 = [0, 150] # y-axis limits for the second subplot\nyticks1 = [0, 50, 100, 150, 200] # y-ticks for the first subplot\nyticks2 = [0, 50, 100, 150] # y-ticks for the second subplot\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the figure size to match the original image's dimensions\nfig, ax1 = plt.subplots(figsize=(8, 5))\n\n# Colors\ncolor_country_a = \"#1f77b4\"\ncolor_country_b = \"#ff7f0e\"\n\n# Create the first subplot for 'country_a_tourists' using the left y-axis\nax1.bar(\n x,\n country_a_tourists,\n width=0.4,\n label=legend_labels[0],\n color=color_country_a,\n align=\"center\",\n)\nax1.set_ylabel(ylabel1, color=color_country_a)\nax1.tick_params(axis=\"y\", labelcolor=color_country_a)\n\n# Create the second y-axis for 'country_b_tourists'\nax2 = ax1.twinx()\nax2.bar(\n x + 0.4,\n country_b_tourists,\n width=0.4,\n label=legend_labels[1],\n color=color_country_b,\n align=\"center\",\n)\nax2.set_ylabel(ylabel2, color=color_country_b)\nax2.tick_params(axis=\"y\", labelcolor=color_country_b)\n\n# Title and x-axis labels\nax1.set_title(title)\nax1.set_xlabel(xlabel)\nax1.set_xticks(x + 0.2)\nax1.set_xticklabels(season_labels)\n\n# Drawing a horizontal line at y=0 (if needed)\n# ax1.axhline(0, color=\"black\", linewidth=0.8)\n\n# Annotate bars with their values\nfor i in range(4):\n ax1.text(\n x[i],\n country_a_tourists[i] + 5,\n f\"{country_a_tourists[i]}k\",\n ha=\"center\",\n color=\"black\",\n )\n ax2.text(\n x[i] + 0.4,\n country_b_tourists[i] + 5,\n f\"{country_b_tourists[i]}k\",\n ha=\"center\",\n color=\"black\",\n )\n\nax1.set_ylim(ylim1)\nax1.set_yticks(yticks1)\n\nax2.set_ylim(ylim2)\nax2.set_yticks(yticks2)\nax2.set_yticklabels(yticks2)\n\n# Add legends to the subplot\nax1.legend(loc=\"upper left\", bbox_to_anchor=(0.0, 1.2))\nax1.grid(axis=\"y\", linestyle=\"--\")\nax1.set_axisbelow(True)\nax2.legend(loc=\"upper right\", bbox_to_anchor=(1, 1.2))\nax2.grid(axis=\"y\", linestyle=\"--\")\nax2.set_axisbelow(True)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout\nplt.tight_layout()\nplt.savefig(\"bar_303.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 5.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" }, { "id": "test_128", "content": { "Scenario": [ "Original", "Adjusted" ], "angry": [ 0.1, 0.12 ], "sad": [ 0.0, 0.0 ], "disgust": [ 0.3, 0.44 ], "contempt": [ 0.0, 0.0 ], "fear": [ 0.0, 0.0 ], "neutral": [ 0.5, 0.44 ], "surprise": [ 0.0, 0.0 ], "happy": [ 0.1, 0.0 ] }, "visual_intent": "A figure with 2 subplots: (1) a heatmap showing original emotion probabilities, titled Original, (2) a heatmap showing adjusted emotion probabilities, titled Adjusted(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/heatmap_20.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport pandas as pd\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Define the emotion labels\nemotions = [\n \"angry\",\n \"sad\",\n \"disgust\",\n \"contempt\",\n \"fear\",\n \"neutral\",\n \"surprise\",\n \"happy\",\n]\n\n# Define the data for the original and adjusted values\noriginal_values = [0.10, 0.00, 0.30, 0.00, 0.00, 0.50, 0.00, 0.10]\nadjusted_values = [0.12, 0.00, 0.44, 0.00, 0.00, 0.44, 0.00, 0.00]\ntitles = [\"Original\", \"Adjusted\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with two subplots (one for original and one for adjusted values)\nfig, (ax1, ax2) = plt.subplots(2, 1, figsize=(10, 8))\n\n# Define the color palette\ncmap = plt.get_cmap(\"coolwarm\")\n\n# Plot heatmap for original values\nim1 = ax1.imshow(pd.DataFrame([original_values], columns=emotions), cmap=cmap)\nax1.set_title(titles[0])\nax1.set_xticks(range(len(emotions)))\nax1.set_xticklabels(emotions, rotation=45, ha=\"center\")\nax1.set_yticks(range(1))\nax1.set_yticklabels([\"\"], rotation=0)\n\n# Add annotations for original values\nfor i in range(1):\n for j in range(len(emotions)):\n ax1.text(\n j, i, f\"{original_values[j]:.2f}\", ha=\"center\", va=\"center\", color=\"black\"\n )\n\n# Plot heatmap for adjusted values\nim2 = ax2.imshow(pd.DataFrame([adjusted_values], columns=emotions), cmap=cmap)\nax2.set_title(titles[1])\nax2.set_xticks(range(len(emotions)))\nax2.set_xticklabels(emotions, rotation=45, ha=\"center\")\nax2.set_yticks(range(1))\nax2.set_yticklabels([\"\"], rotation=0)\n\n# Add annotations for adjusted values\nfor i in range(1):\n for j in range(len(emotions)):\n ax2.text(\n j, i, f\"{adjusted_values[j]:.2f}\", ha=\"center\", va=\"center\", color=\"black\"\n )\n\n# Display the figure\nplt.subplots_adjust(hspace=-0.5)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"heatmap_20.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_129", "content": { "Training Session Duration": [ 1, 2, 3, 4 ], "Average Speed (Moderate Training)": [ 10, 12, 15, 18 ], "Average Speed (Intense Training)": [ 12, 15, 18, 22 ], "Endurance (Moderate Training)": [ 30, 45, 60, 75 ], "Endurance (Intense Training)": [ 35, 50, 70, 90 ] }, "visual_intent": "A figure with 4 subplots: (1) a line chart comparing average speed of moderate vs. intense training over duration, titled Speed vs. Training Duration, (2) a line chart comparing endurance of moderate vs. intense training over duration, titled Endurance vs. Training Duration, (3) a repeat of the speed chart with swapped layer order and markers, and (4) a repeat of the endurance chart with swapped layer order and markers(size of the desired plot: width=12.0, height=9.0)", "path_to_gt_image": "images/line_241.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(1)\n\n# Simulated sports training data\ntraining_duration = [1, 2, 3, 4] # Training session duration in hours\navg_speed_moderate = np.array([10, 12, 15, 18]) # Average speed in km/h for moderate training\navg_speed_intense = np.array([12, 15, 18, 22]) # Average speed in km/h for intense training\nendurance_moderate = np.array([30, 45, 60, 75]) # Endurance in minutes for moderate training\nendurance_intense = np.array([35, 50, 70, 90]) # Endurance in minutes for intense training\n\n# Axes Limits and Labels\nxlabel_value = \"Training Session Duration (hours)\"\nylabel_value_speed = \"Average Speed (km/h)\"\nylabel_value_endurance = \"Endurance (minutes)\"\n\n# Labels\nlabel_speed = \"Average Speed\"\nlabel_endurance = \"Endurance\"\nlabel_moderate = \" (Moderate Training)\"\nlabel_intense = \" (Intense Training)\"\ntitle_speed_vs_duration = \"Speed vs. Training Duration\"\ntitle_endurance_vs_duration = \"Endurance vs. Training Duration\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with a 2x2 grid\nfig, axs = plt.subplots(2, 2, figsize=(12, 9))\n\n# Custom colors for the sports theme\ncolors = [\"#1f77b4\", \"#ff7f0e\", \"#2ca02c\", \"#d62728\"]\n\n# Function to plot the data\ndef plot_data(ax, x, y1, y2, title, ylabel, marker1, marker2, color1, color2, label1, label2):\n ax.plot(\n x,\n y1,\n marker=marker1,\n markersize=8,\n linewidth=2,\n linestyle='--',\n color=color1,\n label=label1,\n )\n ax.plot(\n x,\n y2,\n marker=marker2,\n markersize=8,\n linewidth=2,\n linestyle='-',\n color=color2,\n label=label2,\n )\n ax.set_title(title, fontsize=14)\n ax.set_xlabel(xlabel_value, fontsize=12)\n ax.set_ylabel(ylabel, fontsize=12)\n ax.legend(loc=\"best\", fontsize=10, frameon=True, shadow=True)\n ax.grid(True, linestyle=\"--\", alpha=0.5)\n\n# Assigning data to each subplot\nplot_data(\n axs[0, 0],\n training_duration,\n avg_speed_moderate,\n avg_speed_intense,\n title_speed_vs_duration,\n ylabel_value_speed,\n \"o\",\n \"s\",\n colors[0],\n colors[1],\n f\"{label_speed}{label_moderate}\",\n f\"{label_speed}{label_intense}\",\n)\nplot_data(\n axs[0, 1],\n training_duration,\n endurance_moderate,\n endurance_intense,\n title_endurance_vs_duration,\n ylabel_value_endurance,\n \"^\",\n \"d\",\n colors[2],\n colors[3],\n f\"{label_endurance}{label_moderate}\",\n f\"{label_endurance}{label_intense}\",\n)\nplot_data(\n axs[1, 0],\n training_duration,\n avg_speed_intense,\n avg_speed_moderate,\n title_speed_vs_duration,\n ylabel_value_speed,\n \"p\",\n \"*\",\n colors[1],\n colors[0],\n f\"{label_speed}{label_intense}\",\n f\"{label_speed}{label_moderate}\",\n)\nplot_data(\n axs[1, 1],\n training_duration,\n endurance_intense,\n endurance_moderate,\n title_endurance_vs_duration,\n ylabel_value_endurance,\n \"H\",\n \"X\",\n colors[3],\n colors[2],\n f\"{label_endurance}{label_intense}\",\n f\"{label_endurance}{label_moderate}\",\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and display the plots\nplt.tight_layout()\nplt.savefig(\"line_241.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 9.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "line" }, { "id": "test_130", "content": { "Brand Label": [ "Twinings\n30%", "Lipton\n25%", "Dilmah\n20%", "Tazo\n15%", "Tetley\n10%" ], "Market Share": [ 30, 25, 20, 15, 10 ] }, "visual_intent": "A treemap about brands and market share, titled Market Share of Global Black Tea Brands(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/tree_18.jpg", "original_category": "tree", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data\nsizes = [30, 25, 20, 15, 10]\nlabels = [\n \"Twinings\\n30%\",\n \"Lipton\\n25%\",\n \"Dilmah\\n20%\",\n \"Tazo\\n15%\",\n \"Tetley\\n10%\"\n]\ntitle = \"Market Share of Global Black Tea Brands\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#8FBC8F\", \"#FFD700\", \"#D2B48C\", \"#6B8E23\", \"#CD853F\"]\n# Create a figure with the specified size\nfig = plt.figure(figsize=(8, 8))\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes,\n label=labels,\n color=colors,\n alpha=0.8,\n text_kwargs={\"fontsize\": 14, \"color\": \"black\"},\n pad=True,\n ec=\"black\",\n)\n\n# Set title\nplt.title(title, fontsize=16)\n\n# Remove axes\nplt.axis(\"off\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout and save to file\nplt.tight_layout()\nplt.savefig(\"tree_18.pdf\", bbox_inches=\"tight\")\n\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_131", "content": { "Attraction Type": [ "Museums", "Parks", "Beaches", "Historical Sites", "Amusement Parks", "Shopping Centers", "Zoos" ], "Visitor Numbers (millions)": [ 10, 25, 40, 20, 15, 30, 12 ], "Average Satisfaction (out of 100)": [ 85, 90, 88, 80, 75, 70, 65 ], "Investment Cost ($)": [ 50000000.0, 25000000.0, 40000000.0, 30000000.0, 20000000.0, 45000000.0, 35000000.0 ] }, "visual_intent": "A figure with 2 subplots: (1) a scatter plot about visitor numbers and average satisfaction, titled Tourist Attractions (Satisfaction vs Visitor Numbers), (2) a scatter plot about investment cost and average satisfaction, titled Tourist Attractions (Satisfaction vs Investment Cost)(size of the desired plot: width=14.0, height=6.0)", "path_to_gt_image": "images/scatter_70.jpg", "original_category": "scatter", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data for the plots\nattraction_types = [\"Museums\", \"Parks\", \"Beaches\", \"Historical Sites\", \"Amusement Parks\", \"Shopping Centers\", \"Zoos\"]\nvisitor_numbers = [10, 25, 40, 20, 15, 30, 12] # in millions\nsatisfaction_ratings = [85, 90, 88, 80, 75, 70, 65] # out of 100\n\ninvestment_cost = [5e7, 2.5e7, 4e7, 3e7, 2e7, 4.5e7, 3.5e7] # in dollars\nannual_visits = [10, 25, 40, 20, 15, 30, 12] # in millions\n\ntitles = [\n \"Tourist Attractions (Satisfaction vs Visitor Numbers)\",\n \"Tourist Attractions (Satisfaction vs Investment Cost)\",\n]\nxlabels = [\"Visitor Numbers (millions)\", \"Investment Cost (millions $)\"]\nylabels = [\"Average Satisfaction (out of 100)\", \"Average Satisfaction (out of 100)\"]\nlegendlabels = [\"Types of Attractions\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and axes\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 6))\n\ncolors = [\"#4e79a7\", \"#f28e2c\", \"#e15759\", \"#76b7b2\", \"#59a14f\", \"#edc949\", \"#af7aa1\"]\nmarkers = [\"o\", \"s\", \"D\", \"^\", \"v\", \"<\", \">\"]\n\n# First subplot\nfor i, txt in enumerate(attraction_types):\n ax1.scatter(visitor_numbers[i], satisfaction_ratings[i], color=colors[i], marker=markers[i], s=100, label=txt)\nax1.set_title(titles[0])\nax1.set_xlabel(xlabels[0])\nax1.set_ylabel(ylabels[0])\nax1.set_xlim([0, 50])\nax1.set_ylim([60, 100])\nax1.grid(True)\nax1.legend(loc='best')\n\n# Second subplot\nfor i, txt in enumerate(attraction_types):\n ax2.scatter(investment_cost[i], satisfaction_ratings[i], color=colors[i], marker=markers[i], s=100, label=txt)\nax2.set_title(titles[1])\nax2.set_xlabel(xlabels[1])\nax2.set_ylabel(ylabels[1])\nax2.ticklabel_format(style=\"sci\", axis=\"x\", scilimits=(0, 0)) # Use scientific notation\nax2.set_xlim([0, 5.5e7])\nax2.set_ylim([60, 100])\nax2.grid(True)\nax2.legend(loc='best')\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save plot\nplt.tight_layout()\nplt.savefig(\"scatter_70.pdf\", bbox_inches=\"tight\")\n", "width": 14.0, "height": 6.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_132", "content": { "Civilization": [ "Ancient Egypt", "Ancient Egypt", "Ancient Egypt", "Ancient Rome", "Ancient Rome", "Ancient Rome", "Ancient China", "Ancient China", "Ancient China" ], "Year (BC)": [ 1000, 1500, 2000, 800, 1200, 1800, 900, 1400, 1900 ], "Population (Millions)": [ 2.0, 3.5, 5.0, 1.5, 2.5, 4.5, 2.2, 3.8, 6.0 ], "Size": [ 300, 400, 500, 300, 400, 500, 300, 400, 500 ] }, "visual_intent": "A connected scatter plot about Year (BC) and Population (Millions) for Ancient Egypt, Ancient Rome, and Ancient China(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/scatter_29.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data for plotting\nx_egypt = [1000, 1500, 2000]\ny_egypt = [2, 3.5, 5]\nsizes_egypt = [300, 400, 500]\n\nx_rome = [800, 1200, 1800]\ny_rome = [1.5, 2.5, 4.5]\nsizes_rome = [300, 400, 500]\n\nx_china = [900, 1400, 1900]\ny_china = [2.2, 3.8, 6]\nsizes_china = [300, 400, 500]\n\nlegend_labels = [\"Ancient Egypt\", \"Ancient Rome\", \"Ancient China\"]\ntitle = \"Growth of Ancient Civilizations\"\nxlabel = \"Year (BC)\"\nylabel = \"Population (Millions)\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create the plot\nfig, ax = plt.subplots(figsize=(10, 6)) # Make the plot wider to fit the data better\n\n# Scatter points\negypt_scatter = ax.scatter(\n x_egypt, y_egypt, s=sizes_egypt, alpha=0.8, color=\"#8B4513\", marker=\"o\"\n)\nrome_scatter = ax.scatter(\n x_rome, y_rome, s=sizes_rome, alpha=0.8, color=\"#CD5C5C\", marker=\"s\"\n)\nchina_scatter = ax.scatter(\n x_china, y_china, s=sizes_china, alpha=0.8, color=\"#4682B4\", marker=\"^\"\n)\n\n# Connect points with lines\nax.plot(x_egypt, y_egypt, linestyle=\"--\", color=\"#8B4513\", alpha=0.8, linewidth=2)\nax.plot(x_rome, y_rome, linestyle=\"-.\", color=\"#CD5C5C\", alpha=0.8, linewidth=2)\nax.plot(x_china, y_china, linestyle=\":\", color=\"#4682B4\", alpha=0.8, linewidth=2)\n\n# Legend\nlegend = ax.legend(\n [egypt_scatter, rome_scatter, china_scatter],\n legend_labels,\n title=title,\n loc=\"upper left\",\n)\n\nfor legend_handle in legend.legendHandles:\n legend_handle._sizes = [50] # 设置图例标记的大小\n\nlegend.get_frame().set_alpha(1) # Make legend background opaque\n\n# Axes labels\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show the plot with tight layout\nplt.tight_layout()\nplt.savefig(\"scatter_29.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_133", "content": { "Historical Period": [ "Ancient Egypt\n25%", "Classical Greece\n18%", "Roman Empire\n15%", "Middle Ages\n12%", "Renaissance\n10%", "Industrial Revolution\n8%", "World War I\n7%", "Space Age\n5%" ], "Impact Score": [ 25, 18, 15, 12, 10, 8, 7, 5 ] }, "visual_intent": "A treemap about historical periods and their impact sizes, titled Significant Historical Periods by Impact(size of the desired plot: width=12.0, height=8.0)", "path_to_gt_image": "images/tree_23.jpg", "original_category": "tree", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\nimport numpy as np # New import as required\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for historical periods/events\nsizes = [25, 18, 15, 12, 10, 8, 7, 5]\nlabels = [\n \"Ancient Egypt\\n25%\",\n \"Classical Greece\\n18%\",\n \"Roman Empire\\n15%\",\n \"Middle Ages\\n12%\",\n \"Renaissance\\n10%\",\n \"Industrial Revolution\\n8%\",\n \"World War I\\n7%\",\n \"Space Age\\n5%\"\n]\n\n# Text and labels\ntitle = \"Significant Historical Periods by Impact\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with the specified size\nfig = plt.figure(figsize=(12, 8))\n\n# Colors reflecting an antiquity theme\ncolors = [\n \"#d4b483\", # Parchment\n \"#8a7c54\", # Olive\n \"#c9b6a3\", # Tan\n \"#735b32\", # Brown\n \"#d7c29e\", # Light Wheat\n \"#907a5e\", # Taupe\n \"#c8ad8e\", # Pale Copper\n \"#5f4b32\", # Dark Chestnut\n]\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes, label=labels, color=colors, alpha=0.8, text_kwargs={\"fontsize\": 20, \"fontname\": \"serif\"}\n)\n\n# Remove axes\nplt.axis(\"off\")\n\n# Add title\nplt.title(title, fontsize=24, fontname=\"serif\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout and save to file\nplt.tight_layout()\nplt.savefig(\"tree_23.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 8.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_134", "content": { "Department": [ "Market", "Sales", "R&D", "Finance", "Support", "HR", "IT", "Operations" ], "Q1 Performance": [ 4.5, 3.8, 4.2, 4.7, 3.9, 4.0, 4.1, 4.3 ], "Q2 Performance": [ 3.7, 4.1, 3.5, 3.8, 4.2, 3.9, 3.6, 4.0 ], "Q3 Performance": [ 3.2, 3.4, 3.1, 3.5, 2.9, 3.3, 3.0, 3.2 ] }, "visual_intent": "A radar chart comparing Q1, Q2, and Q3 performance across different departments, titled Department Performance Comparison by Quarter(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/radar_39.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\nfrom math import pi\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# Define the data for each line\nlabels = np.array(\n [\n \"Market\",\n \"Sales\",\n \"R&D\",\n \"Finance\",\n \"Support\",\n \"HR\",\n \"IT\",\n \"Operations\",\n ]\n)\nnum_vars = len(labels)\n\nvalues1 = np.array([4.5, 3.8, 4.2, 4.7, 3.9, 4.0, 4.1, 4.3])\nvalues2 = np.array([3.7, 4.1, 3.5, 3.8, 4.2, 3.9, 3.6, 4.0])\nvalues3 = np.array([3.2, 3.4, 3.1, 3.5, 2.9, 3.3, 3.0, 3.2])\nlabels2 = [\"Q1 Performance\", \"Q2 Performance\", \"Q3 Performance\"]\nyticks = [1, 2, 3, 4, 5]\nytickslabel = [\"1\", \"2\", \"3\", \"4\", \"5\"]\nylim = [0, 5]\n\ntitle = \"Department Performance Comparison by Quarter\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot\nfig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True))\n\n# Compute angle for each axis\nangles = [n / float(num_vars) * 2 * pi for n in range(num_vars)]\nvalues1 = np.concatenate((values1, [values1[0]]))\nvalues2 = np.concatenate((values2, [values2[0]]))\nvalues3 = np.concatenate((values3, [values3[0]]))\nangles += angles[:1]\n\n# Draw one axe per variable and add labels\nplt.xticks(angles[:-1], labels, fontsize=12, color=\"darkblue\")\n\n# Draw ylabels\nax.set_rlabel_position(0)\nplt.yticks(yticks, ytickslabel, color=\"black\", size=10)\nplt.ylim(ylim)\n\n# Plot data\nax.plot(\n angles,\n values1,\n linewidth=2,\n linestyle=\"solid\",\n label=labels2[0],\n color=\"#1f77b4\",\n marker=\"o\",\n)\nax.fill(angles, values1, \"#1f77b4\", alpha=0.25)\n\nax.plot(\n angles,\n values2,\n linewidth=2,\n linestyle=\"dashed\",\n label=labels2[1],\n color=\"#ff7f0e\",\n marker=\"s\",\n)\nax.fill(angles, values2, \"#ff7f0e\", alpha=0.25)\n\nax.plot(\n angles,\n values3,\n linewidth=2,\n linestyle=\"dotted\",\n label=labels2[2],\n color=\"#2ca02c\",\n marker=\"D\",\n)\nax.fill(angles, values3, \"#2ca02c\", alpha=0.25)\n\n# Add legend\nplt.legend(loc=\"lower left\", bbox_to_anchor=(-0.15, -0.1), fontsize=12)\n\n# Title\nplt.title(title, size=16, color=\"darkred\", y=1.1)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_39.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_135", "content": { "Countries": [ "USA", "China", "India", "Germany", "UK", "France", "Brazil", "Japan" ], "Energy_Consumption_2022": [ 2000, 3000, 1500, 500, 450, 400, 100, 800 ], "Error_2022": [ 100, 150, 50, 20, 25, 30, 10, 40 ], "Energy_Consumption_2023": [ 2100, 3100, 1600, 520, 460, 410, 110, 820 ], "Error_2023": [ 110, 160, 60, 25, 30, 35, 15, 45 ] }, "visual_intent": "A figure with 2 subplots: (1) a line chart with error bars about countries and energy consumption in 2022, titled Energy Consumption in 2022, (2) a line chart with error bars about countries and energy consumption in 2023, titled Energy Consumption in 2023. The figure is titled Energy Consumption in Different Countries Over the Years(size of the desired plot: width=14.0, height=6.0)", "path_to_gt_image": "images/line_199.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Simulated data for energy consumption (in terawatt-hours)\ncountries_x = np.array(\n [\"USA\", \"China\", \"India\", \"Germany\", \"UK\", \"France\", \"Brazil\", \"Japan\"]\n)\nenergy_2022 = np.array([2000, 3000, 1500, 500, 450, 400, 100, 800])\nerror_2022 = np.array([100, 150, 50, 20, 25, 30, 10, 40])\nenergy_2023 = np.array([2100, 3100, 1600, 520, 460, 410, 110, 820])\nerror_2023 = np.array([110, 160, 60, 25, 30, 35, 15, 45])\n\nylabel_value = \"Energy Consumption (TWh)\"\nxlabel_value = \"Countries\"\nylim_values = [0, 3500]\nyticks_values = np.arange(0, 3501, 500)\n\n# Labels\nlabel_1 = \"Energy Consumption 2022\"\nlabel_2 = \"Energy Consumption 2023\"\n\n# Titles\ntitle_1 = \"Energy Consumption in 2022\"\ntitle_2 = \"Energy Consumption in 2023\"\nsuptitle = \"Energy Consumption in Different Countries Over the Years\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a subplot layout of 1x2\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 6), sharey=True)\n\n# First subplot for 2022\nax1.errorbar(\n countries_x,\n energy_2022,\n yerr=error_2022,\n fmt=\"o-\",\n label=label_1,\n color=\"#1f77b4\", # Blue color\n capsize=5,\n linewidth=2,\n markersize=8,\n)\nax1.set_title(title_1)\nax1.set_xticks(countries_x)\nax1.set_xticklabels(countries_x, rotation=45, ha=\"right\", fontsize=12)\nax1.set_yticks(yticks_values)\nax1.set_ylim(ylim_values)\nax1.grid(True, which=\"both\", linestyle=\"--\", linewidth=0.5, alpha=0.5)\nax1.set_ylabel(ylabel_value, fontsize=16)\nax1.legend(loc=\"upper left\", fontsize=12)\n\n# Second subplot for 2023\nax2.errorbar(\n countries_x,\n energy_2023,\n yerr=error_2023,\n fmt=\"s-\",\n label=label_2,\n color=\"#ff7f0e\", # Orange color\n capsize=5,\n linewidth=2,\n markersize=8,\n)\nax2.set_title(title_2)\nax2.set_xticks(countries_x)\nax2.set_xticklabels(countries_x, rotation=45, ha=\"right\", fontsize=12)\nax2.grid(True, which=\"both\", linestyle=\"--\", linewidth=0.5, alpha=0.5)\nax2.legend(loc=\"upper left\", fontsize=12)\n\n# Set supertitle for the entire figure\nplt.suptitle(suptitle, fontsize=18)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Enhance overall layout\nplt.tight_layout(rect=[0, 0, 1, 0.95])\nplt.savefig(\"line_199.pdf\", bbox_inches=\"tight\")\n", "width": 14.0, "height": 6.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "line" }, { "id": "test_136", "content": { "Model": [ "All", "MLP", "GCN", "NCN", "NCNC", "NeoGNN-BUDDY", "SEAL", "Node2Vec" ], "ogbl-collab 2022 Hits@50": [ 75, 73, 72, 70, 69, 71, 73, 74 ], "ogbl-collab 2022 Error": [ 2, 3, 1, 1, 2, 2, 3, 2 ], "ogbl-collab 2023 Hits@50": [ 67, 65, 64, 62, 61, 63, 65, 66 ], "ogbl-collab 2023 Error": [ 3, 3, 1, 2, 2, 3, 3, 4 ], "ogbl-ppa 2022 Hits@50": [ 65, 63, 62, 60, 59, 61, 63, 64 ], "ogbl-ppa 2022 Error": [ 3, 2, 1, 2, 3, 2, 2, 1 ], "ogbl-ppa 2023 Hits@50": [ 70, 69, 69, 68, 67, 69, 70, 68 ], "ogbl-ppa 2023 Error": [ 2, 3, 1, 1, 2, 2, 3, 2 ] }, "visual_intent": "A figure with 2 subplots: (1) a line chart with error bars comparing ogbl-collab 2022 and 2023 Hits@50 scores across different models, titled ogbl-collab Results, (2) a line chart with error bars comparing ogbl-ppa 2022 and 2023 Hits@50 scores across different models, titled ogbl-ppa Results(size of the desired plot: width=12.0, height=5.0)", "path_to_gt_image": "images/line_43.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Simulated data\ncollab_x = np.array(\n [\"All\", \"MLP\", \"GCN\", \"NCN\", \"NCNC\", \"NeoGNN-BUDDY\", \"SEAL\", \"Node2Vec\"]\n)\ncollab_y = np.array([75, 73, 72, 70, 69, 71, 73, 74])\ncollab_err = np.array([2, 3, 1, 1, 2, 2, 3, 2])\ncollab_y2 = np.array(\n [67, 65, 64, 62, 61, 63, 65, 66]\n) # Adjusted data for clear spacing\ncollab_err2 = np.array([3, 3, 1, 2, 2, 3, 3, 4])\n\nppa_x = np.array(\n [\"All\", \"MLP\", \"GCN\", \"NCN\", \"NCNC\", \"NeoGNN-BUDDY\", \"SEAL\", \"Node2Vec\"]\n)\nppa_y = np.array([65, 63, 62, 60, 59, 61, 63, 64])\nppa_err = np.array([3, 2, 1, 2, 3, 2, 2, 1])\nppa_y2 = np.array([70, 69, 69, 68, 67, 69, 70, 68]) # Adjusted data for clear spacing\nppa_err2 = np.array([2, 3, 1, 1, 2, 2, 3, 2])\n\n# Axes Limits and Labels\nylabel_value = \"Hits@50\"\nylim_values = [55, 80]\nyticks_values = np.arange(55, 81, 5)\n\n# Labels\nlabel_1 = \"ogbl-collab 2022\"\nlabel_2 = \"ogbl-collab 2023\"\nlabel_3 = \"ogbl-ppa 2022\"\nlabel_4 = \"ogbl-ppa 2023\"\n\n# Titles\ntitle_1 = \"ogbl-collab Results\"\ntitle_2 = \"ogbl-ppa Results\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a subplot layout of 1x2\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5), sharey=True)\n\n# First subplot for ogbl-collab\nax1.errorbar(\n collab_x,\n collab_y,\n yerr=collab_err,\n fmt=\"o-\",\n label=label_1,\n color=\"#3d89be\",\n capsize=5,\n)\nax1.errorbar(\n collab_x,\n collab_y2,\n yerr=collab_err2,\n fmt=\"^-\",\n label=label_2,\n color=\"#00BFFF\",\n capsize=5,\n)\nax1.set_title(title_1)\nax1.set_xticks(collab_x)\nax1.set_xticklabels(collab_x, rotation=45, ha=\"right\", fontsize=12)\nax1.set_yticks(yticks_values)\nax1.set_ylim(ylim_values)\nax1.grid(True, which=\"both\", linestyle=\"--\", linewidth=0.5, alpha=0.5)\nax1.set_ylabel(ylabel_value, fontsize=16)\nax1.legend(loc=\"lower left\", fontsize=12)\n\n# Second subplot for ogbl-ppa\nax2.errorbar(\n ppa_x,\n ppa_y,\n yerr=ppa_err,\n fmt=\"s--\",\n label=label_3,\n color=\"#ff7f0e\",\n capsize=5,\n)\nax2.errorbar(\n ppa_x,\n ppa_y2,\n yerr=ppa_err2,\n fmt=\"o-.\",\n label=label_4,\n color=\"#FFA500\",\n capsize=5,\n)\nax2.set_title(title_2)\nax2.set_xticks(ppa_x)\nax2.set_xticklabels(ppa_x, rotation=45, ha=\"right\", fontsize=12)\nax2.grid(True, which=\"both\", linestyle=\"--\", linewidth=0.5, alpha=0.5)\nax2.legend(loc=\"upper left\", fontsize=12)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Enhance overall layout\nplt.tight_layout()\nplt.savefig(\"line_43.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 5.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "line" }, { "id": "test_137", "content": { "Investment Strategy": [ "Conservative", "Balanced", "Aggressive", "Speculative" ], "Bull Market Return (%)": [ 5.8, 7.4, 9.1, 12.5 ], "Bear Market Return (%)": [ -3.2, -1.1, 0.5, 4.8 ], "Error Margin": [ 0.9, 0.7, 0.4, 0.8 ] }, "visual_intent": "A line chart with error bars displaying return percentages for various investment strategies under Bull and Bear market conditions(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/line_94.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data\ninvestment_strategies = [\"Conservative\", \"Balanced\", \"Aggressive\", \"Speculative\"]\nreturns_bull = [5.8, 7.4, 9.1, 12.5]\nreturns_bear = [-3.2, -1.1, 0.5, 4.8]\nerror = [0.9, 0.7, 0.4, 0.8]\n\n# Axes Limits and Labels\nxlabel_value = \"Investment Strategy\"\nylabel_value = \"Return Percentage (%)\"\nylim_values = [-5, 15]\n\n# Labels\nlabel_Bull_Market = \"Bull Market\"\nlabel_Bear_Market = \"Bear Market\"\n\n# Titles\ntitle = \"Economic Condition\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot\nfig, ax = plt.subplots(figsize=(8, 6))\nax.errorbar(\n investment_strategies,\n returns_bull,\n yerr=error,\n fmt=\"h-\",\n color=\"navy\",\n ecolor=\"skyblue\",\n elinewidth=2,\n capsize=5,\n capthick=2,\n label=label_Bull_Market,\n)\nax.errorbar(\n investment_strategies,\n returns_bear,\n yerr=error,\n fmt=\"d--\",\n color=\"green\",\n ecolor=\"lightgreen\",\n elinewidth=2,\n capsize=5,\n capthick=2,\n label=label_Bear_Market,\n)\n\n# Customization\nax.set_xlabel(xlabel_value)\nax.set_ylabel(ylabel_value)\n\nax.tick_params(\n axis=\"both\", which=\"major\", length=5, direction=\"in\", top=True, right=True\n)\nax.legend(title=title, loc=\"upper left\", frameon=False)\nax.set_ylim(ylim_values)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot\nplt.tight_layout()\nplt.savefig(\"line_94.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_138", "content": { "2020_State_A": [ 70, 75, 80, 85 ], "2020_State_B": [ 60, 67, 72, 78 ], "2020_State_C": [ 55, 60, 65, 70 ], "2016_State_A": [ 65, 70, 75, 80 ], "2016_State_B": [ 55, 60, 67, 73 ], "2016_State_C": [ 50, 55, 60, 65 ] }, "visual_intent": "A figure with 2 subplots: (1) a heatmap about voter turnout percentages in 2020 across three states, titled Voter Turnout 2020, (2) a heatmap about voter turnout percentages in 2016 across three states, titled Voter Turnout 2016(size of the desired plot: width=6.0, height=3.0)", "path_to_gt_image": "images/heatmap_94.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport pandas as pd\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Creating a dataset reflecting voter turnout in different states over several election cycles\ndata_2020 = pd.DataFrame(\n {\n \"State A\": [\"#70\", \"#75\", \"#80\", \"#85\"],\n \"State B\": [\"#60\", \"#67\", \"#72\", \"#78\"],\n \"State C\": [\"#55\", \"#60\", \"#65\", \"#70\"],\n }\n)\n\ndata_2016 = pd.DataFrame(\n {\n \"State A\": [\"#65\", \"#70\", \"#75\", \"#80\"],\n \"State B\": [\"#55\", \"#60\", \"#67\", \"#73\"],\n \"State C\": [\"#50\", \"#55\", \"#60\", \"#65\"],\n }\n)\n\n# Creating a function to convert the string indices to numeric values for plotting\ndef convert_to_numeric(cell):\n return int(cell.replace(\"#\", \"\"))\n\n# Convert the dataframes\ndata_2020_numeric = data_2020.applymap(convert_to_numeric)\ndata_2016_numeric = data_2016.applymap(convert_to_numeric)\n\n# Axes Limits and Labels\nax1_title = \"Voter Turnout 2020\"\nax1_ylabel = \"Voter Turnout %\"\nax2_title = \"Voter Turnout 2016\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Creating the heatmap using matplotlib with increased linewidths for separation\nfig, (ax1, ax2) = plt.subplots(\n ncols=2, figsize=(6, 3), gridspec_kw={\"width_ratios\": [1, 1], \"wspace\": 0.1}\n)\n\n# Setting the color map to a new color scheme: Reds for 2020, Blues for 2016\ncmap_2020 = plt.get_cmap(\"Reds\")\ncmap_2016 = plt.get_cmap(\"Blues\")\n\n# Heatmap for 2020 with increased cell borders\nim1 = ax1.imshow(data_2020_numeric, cmap=cmap_2020)\nax1.set_title(ax1_title)\nax1.set_ylabel(ax1_ylabel)\nax1.set_xticks(range(len(data_2020.columns)))\nax1.set_xticklabels(data_2020.columns, rotation=45)\nax1.set_yticks(range(len(data_2020.index)))\nax1.set_yticklabels(data_2020.index, rotation=0)\n\n# Add annotations for 2020\nfor i in range(len(data_2020.index)):\n for j in range(len(data_2020.columns)):\n ax1.text(j, i, data_2020.iloc[i, j], ha=\"center\", va=\"center\", color=\"black\")\n\n# Heatmap for 2016 with increased cell borders\nim2 = ax2.imshow(data_2016_numeric, cmap=cmap_2016)\nax2.set_title(ax2_title)\nax2.set_xticks(range(len(data_2016.columns)))\nax2.set_xticklabels(data_2016.columns, rotation=45)\nax2.set_yticks(range(len(data_2016.index)))\nax2.set_yticklabels(data_2016.index, rotation=0)\n\n# Add annotations for 2016\nfor i in range(len(data_2016.index)):\n for j in range(len(data_2016.columns)):\n ax2.text(j, i, data_2016.iloc[i, j], ha=\"center\", va=\"center\", color=\"black\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"heatmap_94.pdf\", bbox_inches=\"tight\")\n\n", "width": 6.0, "height": 3.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_139", "content": { "Metric": [ "Solar Efficiency", "Wind Efficiency", "Hydro Potential", "Geothermal Potential", "Carbon Footprint", "Energy Cost", "Infrastructure Readiness", "Policy Support", "Public Acceptance", "Technological Advancement" ], "Solar Energy": [ 0.85, 0.4, 0.75, 0.6, 0.9, 0.7, 0.8, 0.6, 0.7, 0.65 ], "Wind Energy": [ 0.4, 0.85, 0.5, 0.55, 0.45, 0.6, 0.7, 0.75, 0.55, 0.8 ] }, "visual_intent": "A radar chart comparing Solar Energy and Wind Energy across various metrics like efficiency, potential, and cost, titled Energy Source Comparison: Solar vs Wind(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/radar_72.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom matplotlib.lines import Line2D\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data for Solar and Wind Energy\nvalues_solar = [0.85, 0.4, 0.75, 0.6, 0.9, 0.7, 0.8, 0.6, 0.7, 0.65]\nvalues_wind = [0.4, 0.85, 0.5, 0.55, 0.45, 0.6, 0.7, 0.75, 0.55, 0.8]\nlabels = [\n \"Solar\\nEfficiency\",\n \"Wind\\nEfficiency\",\n \"Hydro\\nPotential\",\n \"Geothermal\\nPotential\",\n \"Carbon\\nFootprint\",\n \"Energy\\nCost\",\n \"Infrastructure\\nReadiness\",\n \"Policy\\nSupport\",\n \"Public\\nAcceptance\",\n \"Technological\\nAdvancement\",\n]\nnum_vars = len(labels)\n\n# Compute angle for each axis\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n\n# The plot is circular, so we need to \"complete the loop\" and append the start to the end.\nvalues_solar += values_solar[:1]\nvalues_wind += values_wind[:1]\nangles += angles[:1]\n\n# Extracted variables\nsolar_label = \"Solar Energy\"\nwind_label = \"Wind Energy\"\nxticks = angles[:-1]\nxticklabels = labels\nyticklabels = []\nrgrids = [0.2, 0.4, 0.6, 0.8, 1.0]\nrgrid_labels = [\"0.2\", \"0.4\", \"0.6\", \"0.8\", \"1.0\"]\ntitle_text = \"Energy Source Comparison: Solar vs Wind\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Draw the radar chart\nfig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True))\n\ntitle_size = 18\ntitle_color = \"darkgreen\"\ntitle_y = 1.1\n\nax.fill(angles, values_solar, color=\"seagreen\", alpha=0.7)\nax.plot(angles, values_solar, color=\"seagreen\", linewidth=2, label=solar_label)\nax.scatter(angles[:-1], values_solar[:-1], color=\"seagreen\", s=75, zorder=5, marker=\"^\")\n\nax.fill(angles, values_wind, color=\"royalblue\", alpha=0.7)\nax.plot(angles, values_wind, color=\"royalblue\", linewidth=2, label=wind_label)\nax.scatter(angles[:-1], values_wind[:-1], color=\"royalblue\", s=75, zorder=5, marker=\"o\")\n\n# Add labels to the plot\nax.set_xticks(xticks)\nax.set_xticklabels(xticklabels, size=13)\n\n# Add grid lines and labels for the concentric circles\nax.set_yticklabels(yticklabels)\nax.set_rgrids(rgrids, labels=rgrid_labels, angle=225, color=\"gray\", size=12)\n\n# Create legend handles manually\nlegend_elements = [\n Line2D(\n [0],\n [0],\n color=\"seagreen\",\n linewidth=2,\n marker=\"^\",\n markersize=10,\n label=solar_label,\n ),\n Line2D(\n [0],\n [0],\n color=\"royalblue\",\n linewidth=2,\n marker=\"o\",\n markersize=10,\n label=wind_label,\n ),\n]\n\n# Add legend and title\nax.set_title(title_text, size=title_size, color=title_color, y=title_y)\nax.legend(\n handles=legend_elements,\n loc=\"lower center\",\n bbox_to_anchor=(0.5, -0.2),\n frameon=False,\n ncol=2,\n)\n\nax.xaxis.set_tick_params(pad=20)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_72.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_140", "content": { "Exercise Type": [ "Running", "Cycling", "Walking", "Yoga", "Swimming" ], "Average Calories": [ 600, 500, 250, 200, 700 ], "Calorie Variance": [ 50, 40, 30, 20, 60 ] }, "visual_intent": "A horizontal error bar plot about Exercise Type and Average Calories, titled Average Calorie Burn by Exercise Type(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/errorpoint_54.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Data for plotting\ncategories = [\"Running\", \"Cycling\", \"Walking\", \"Yoga\", \"Swimming\"]\naverage_calories = [600, 500, 250, 200, 700] # Average calories burned per hour\nerrors = [50, 40, 30, 20, 60] # Calorie variance\nworld_mean = [450] # Global average calories burned per hour\nxlabel = \"Average Calories Burned per Hour\"\nlabel = \"Global Average Calories Burned\"\nplot_title = 'Average Calorie Burn by Exercise Type'\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nplt.figure(figsize=(10, 7)) # Adjusting figure size for better readability\nplt.errorbar(\n average_calories,\n categories,\n xerr=errors,\n fmt=\"o\",\n color=\"#0077b6\",\n ecolor=\"#48cae4\",\n capsize=5,\n elinewidth=2,\n markeredgewidth=2,\n label=\"Exercise Type Mean\",\n)\nplt.axvline(world_mean[0], color=\"#f77f00\", linestyle=\"--\", linewidth=3, label=label)\n\n# Customizing the plot\nplt.xlabel(xlabel)\nplt.title(plot_title)\nplt.legend(loc='upper right')\nplt.grid(True, linestyle=':', linewidth=0.5, alpha=0.7)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting the layout and saving the figure\nplt.tight_layout()\nplt.savefig(\"errorpoint_54.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_141", "content": { "Sector": [ "Energy Production", "Transportation", "Industry", "Residential", "Agriculture", "Commercial", "Forestry", "Waste Management", "Public Services", "Miscellaneous" ], "Carbon Footprint (Gigatonnes of CO2)": [ 10.5, 8.4, 7.9, 5.6, 3.4, 4.2, 2.7, 1.8, 2.3, 1.5 ], "Error Margin Upper": [ 0.8, 0.9, 1.0, 0.6, 0.4, 0.5, 0.3, 0.2, 0.3, 0.2 ], "Error Margin Lower": [ -0.6, -0.7, -0.8, -0.5, -0.3, -0.4, -0.2, -0.15, -0.2, -0.15 ], "Method": [ "Energy Calculations", "Transport Analysis", "Industrial Survey", "Residential Study", "Agricultural Data", "Commercial Estimation", "Forestry Reports", "Waste Data Models", "Public Services Review", "Miscellaneous Sources" ] }, "visual_intent": "A horizontal error bar plot about sectors and carbon footprints, titled Carbon Footprints of Different Sectors(size of the desired plot: width=12.0, height=8.0)", "path_to_gt_image": "images/errorpoint_57.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\nimport numpy as np\n\nnp.random.seed(2)\nsectors = [\n \"Energy Production\",\n \"Transportation\",\n \"Industry\",\n \"Residential\",\n \"Agriculture\",\n \"Commercial\",\n \"Forestry\",\n \"Waste Management\",\n \"Public Services\",\n \"Miscellaneous\",\n]\ncarbon_footprints = [\n 10.5, # Gigatonnes of CO2\n 8.4,\n 7.9,\n 5.6,\n 3.4,\n 4.2,\n 2.7,\n 1.8,\n 2.3,\n 1.5,\n]\nerrors = [\n [0.8, -0.6], # Error margins in Gigatonnes of CO2\n [0.9, -0.7],\n [1.0, -0.8],\n [0.6, -0.5],\n [0.4, -0.3],\n [0.5, -0.4],\n [0.3, -0.2],\n [0.2, -0.15],\n [0.3, -0.2],\n [0.2, -0.15],\n]\nmethods = [\n \"Energy Calculations\",\n \"Transport Analysis\",\n \"Industrial Survey\",\n \"Residential Study\",\n \"Agricultural Data\",\n \"Commercial Estimation\",\n \"Forestry Reports\",\n \"Waste Data Models\",\n \"Public Services Review\",\n \"Miscellaneous Sources\",\n]\nxticks = np.arange(0.0, 12.0, 2.0) # Scale for carbon footprints\nxlim = [0.0, 12.0]\nxvline = 5.0 # Average carbon footprint in Gigatonnes of CO2\nxvspan = [4.5, 5.5] # Range near average\nxlabel = \"Carbon Footprint (Gigatonnes of CO2)\"\nylabel = \"Sectors\"\ntitle = \"Carbon Footprints of Different Sectors\"\nsupertitle = \"An Overview of Global Carbon Emissions by Sector\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting\nfig, ax = plt.subplots(figsize=(12, 8))\n\n# Color palette for the sectors\ncolors = plt.cm.viridis(np.linspace(0, 1, len(sectors)))\n\n# Error bars with different positive and negative values\nfor i, (sector, value, error, color) in enumerate(zip(sectors, carbon_footprints, errors, colors)):\n ax.errorbar(\n value,\n i,\n xerr=[[abs(error[1])], [error[0]]],\n fmt=\"o\",\n color=color,\n ecolor='black',\n capsize=3,\n )\n ax.text(\n value,\n i - 0.15,\n r\"$%.1f^{+%.2f} _{-%.2f}$\" % (value, error[0], abs(error[1])),\n va=\"center\",\n ha=\"center\",\n fontsize=9,\n color='black'\n )\n\n# Highlighted region with adjusted color and alpha\nax.axvspan(xvspan[0], xvspan[1], color=\"yellow\", alpha=0.3)\n\n# Text for methods with adjusted font size\nfor i, method in enumerate(methods):\n ax.text(12.5, i, method, va=\"center\", ha=\"left\", fontsize=11)\n\n# Set labels and title\nax.set_yticks(range(len(sectors)))\nax.set_yticklabels(sectors, fontsize=11)\nax.set_xlabel(xlabel, fontsize=12)\nax.set_xlim(xlim)\nax.set_ylim(-0.5, len(sectors) - 0.5)\nax.invert_yaxis() # Invert y-axis to match the original image\nax.axvline(x=xvline, linestyle=\"--\", color=\"red\", linewidth=1)\n# Adjust x-axis ticks and labels\nax.set_xticks(xticks)\nax.set_xticklabels([f\"{x:.1f}\" for x in xticks], fontsize=11)\n\n# Set the super title and title\nplt.suptitle(supertitle, fontsize=14, fontweight='bold')\nplt.title(title, fontsize=12)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save/show the plot\nplt.tight_layout(rect=[0, 0.03, 1, 0.95])\nplt.savefig(\"errorpoint_57.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 8.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_142", "content": { "Rating Interval": [ 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0 ], "Known Authors": [ 1500, 2300, 2700, 3200, 2800, 2500, 2200, 1900, 1600, 1300, 1100 ], "New Authors": [ 800, 1100, 1400, 1600, 1500, 1400, 1100, 900, 700, 600, 400 ] }, "visual_intent": "A stacked bar chart about rating intervals and number of reviews for known and new authors, featuring an inset plot zooming into the 2.5 to 3.0 rating range(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/PIP_31.jpg", "original_category": "PIP", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Generate some dummy data for \"Book Review Ratings\" domain\ncategory1 = [\n 1500, 2300, 2700, 3200, 2800, 2500, 2200, 1900, 1600, 1300, 1100\n] # Ratings for Known Authors\ncategory2 = [\n 800, 1100, 1400, 1600, 1500, 1400, 1100, 900, 700, 600, 400\n] # Ratings for New Authors\nbins = [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0]\nlabels = [\"Known Authors\", \"New Authors\"]\nxmainlabel = \"Rating Interval\"\nxmainlim = [-0.1, 5.5]\nxmainticks = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]\nymainlabel = \"Number of Reviews\"\nymainlim = [0, 6000]\nymainticks = [0, 1000, 2000, 3000, 4000, 5000, 6000]\n\nxinsetlim = [2.25, 3.25]\nxinsetticks = [ 2.5, 3.0]\nyinsetlim = [0, 6000]\nyinsetticks = [0, 2000, 4000, 6000]\n\nleft, bottom, width, height = [0.5, 0.6, 0.3, 0.3]\nmainplotline = [(1.75, 1000), (3.5, 1000)]\nmaininsetline = [(2.25, 0), (3.25, 0)]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create main plot with adjusted bar widths and white borders\nfig, ax_main = plt.subplots(figsize=(10, 6))\nbar_width = 0.45 # Adjust bar width for better visual separation\nax_main.bar(\n bins,\n category1,\n width=bar_width,\n color=\"#81C784\", # Greenish color\n align=\"center\",\n label=labels[0],\n edgecolor=\"white\",\n)\nax_main.bar(\n bins,\n category2,\n width=bar_width,\n color=\"#FFB74D\", # Orange color\n align=\"center\",\n bottom=category1,\n label=labels[1],\n edgecolor=\"white\",\n)\nax_main.set_xlabel(xmainlabel)\nax_main.set_xlim(xmainlim)\nax_main.set_xticks(xmainticks)\nax_main.set_ylabel(ymainlabel)\nax_main.set_ylim(ymainlim)\nax_main.set_yticks(ymainticks)\nax_main.legend(loc=\"upper right\", prop={\"size\": 12})\nax_main.grid()\n\nax_inset = fig.add_axes([left, bottom, width, height])\nax_inset.bar(\n bins[4:], # Only include bins from 2.0 onwards\n category1[4:],\n width=bar_width,\n color=\"#81C784\",\n align=\"center\",\n edgecolor=\"white\",\n)\nax_inset.bar(\n bins[4:], # Only include bins from 2.0 onwards\n category2[4:],\n width=bar_width,\n color=\"#FFB74D\",\n align=\"center\",\n bottom=category1[4:],\n edgecolor=\"white\",\n)\nax_inset.set_xlim(xinsetlim) # Zoom in on higher ratings\nax_inset.set_xticks(xinsetticks)\nax_inset.set_ylim(yinsetlim)\nax_inset.set_yticks(yinsetticks)\nax_inset.grid()\n\n# Adding lines to connect the plots.\n# Coordinates of the main plot corners\nmain_plot_left = ax_main.transData.transform_point(mainplotline[0])\nmain_plot_right = ax_main.transData.transform_point(mainplotline[1])\n\n# Coordinates of the inset corners\ninset_left = ax_inset.transData.transform_point(maininsetline[0])\ninset_right = ax_inset.transData.transform_point(maininsetline[1])\n\n# Transform to figure coordinates for annotation\nmain_plot_left = fig.transFigure.inverted().transform(main_plot_left)\nmain_plot_right = fig.transFigure.inverted().transform(main_plot_right)\ninset_left = fig.transFigure.inverted().transform(inset_left)\ninset_right = fig.transFigure.inverted().transform(inset_right)\n\n# Draw lines connecting corners\nfig.add_artist(\n plt.Line2D(\n (main_plot_left[0], inset_left[0]),\n (main_plot_left[1], inset_left[1]),\n color=\"gray\",\n )\n)\nfig.add_artist(\n plt.Line2D(\n (main_plot_right[0], inset_right[0]),\n (main_plot_right[1], inset_right[1]),\n color=\"gray\",\n )\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"PIP_31.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_143", "content": { "Source": [ "Data Center", "Cloud Provider", "Cloud Provider", "Data Center", "Regulatory Authority", "Regulatory Authority" ], "Target": [ "Cloud Provider", "Enterprise User", "Individual User", "Regulatory Authority", "Enterprise User", "Individual User" ], "Source_Type": [ "Infrastructure", "Service Provider", "Service Provider", "Infrastructure", "Government", "Government" ], "Target_Type": [ "Service Provider", "User", "User", "Government", "User", "User" ] }, "visual_intent": "A network graph illustrating the interactions between legal entities and cloud components, titled Hypothetical Legal Network(size of the desired plot: width=12.0, height=10.0)", "path_to_gt_image": "images/graph_11.jpg", "original_category": "graph", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport networkx as nx\n\n# Create a new graph representing a hypothetical legal network\nG = nx.Graph()\n\n# Add nodes representing different legal entities\n# Add nodes representing different components in a cloud computing system\nnodes = [\n (\"Data Center\", {\"type\": \"Infrastructure\"}),\n (\"Cloud Provider\", {\"type\": \"Service Provider\"}),\n (\"Enterprise User\", {\"type\": \"User\"}),\n (\"Individual User\", {\"type\": \"User\"}),\n (\"Regulatory Authority\", {\"type\": \"Government\"}),\n]\nG.add_nodes_from(nodes)\n\n# Add edges representing interactions\nedges = [\n (\"Data Center\", \"Cloud Provider\"),\n (\"Cloud Provider\", \"Enterprise User\"),\n (\"Cloud Provider\", \"Individual User\"),\n (\"Data Center\", \"Regulatory Authority\"),\n (\"Regulatory Authority\", \"Enterprise User\"),\n (\"Regulatory Authority\", \"Individual User\"),\n]\nG.add_edges_from(edges)\n\n# Define positions for nodes explicitly\npos = {\n \"Data Center\": (1, 2),\n \"Cloud Provider\": (1, 1),\n \"Enterprise User\": (0, 0),\n \"Individual User\": (2, 0),\n \"Regulatory Authority\": (1, 3),\n}\ntitle = \"Hypothetical Legal Network\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nplt.figure(figsize=(12, 10))\n\n# Node color mapping based on entity type\ncolor_map = {\n \"Infrastructure\": \"rosybrown\",\n \"Service Provider\": \"lemonchiffon\",\n \"User\": \"gold\",\n \"Government\": \"aqua\",\n}\n# Draw nodes with colors based on their type\nnode_colors = [color_map[G.nodes[node][\"type\"]] for node in G.nodes]\nnx.draw_networkx_nodes(\n G, pos, node_color=node_colors, node_size=4000, edgecolors=\"black\"\n)\n\n# Draw edges with alpha for transparency and consistent width\nnx.draw_networkx_edges(G, pos, edge_color=\"gray\", alpha=0.7, width=2.5)\n\n# Add labels to nodes\nlabels = {node: node for node in G.nodes}\nnx.draw_networkx_labels(G, pos, labels=labels, font_size=14, font_color=\"black\")\n\n# Create legend for node colors\nimport matplotlib.patches as mpatches\n\nlegend_elements = [\n mpatches.Patch(color=color, label=label) for label, color in color_map.items()\n]\nplt.legend(handles=legend_elements, loc=\"upper left\", frameon=False, fontsize=12)\n\n# Title and axis settings\nplt.title(title, fontsize=20, fontweight=\"bold\")\nplt.axis(\"off\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"graph_11.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 10.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "misc" }, { "id": "test_144", "content": { "Time (Months)": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ], "Tourist Arrivals (in thousands)": [ 1200, 1500, 1300, 900, 800, 1100, 1400, 1700, 1600, 1300, 900, 1000 ], "Symmetric Error": [ 100, 120, 90, 110, 80, 100, 130, 140, 150, 90, 80, 70 ], "Lower Error (Asymmetric)": [ 70.0, 84.0, 63.0, 77.0, 56.0, 70.0, 91.0, 98.0, 105.0, 63.0, 56.0, 49.0 ], "Upper Error (Asymmetric)": [ 100, 120, 90, 110, 80, 100, 130, 140, 150, 90, 80, 70 ] }, "visual_intent": "A figure with 2 subplots: (1) an error bar chart about monthly tourist arrivals with symmetric error margins, titled Monthly Tourist Arrivals with Symmetric Error Margins, (2) an error bar chart about monthly tourist arrivals with asymmetric error margins, titled Monthly Tourist Arrivals with Asymmetric Error Margins(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/errorpoint_74.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# example tourism data\nx = np.arange(1, 13, 1)\ny = [\n 1200, 1500, 1300, 900, 800, 1100, 1400, 1700, 1600, 1300, 900, 1000\n] # average monthly tourist arrivals (in thousands)\nerror = np.array([100, 120, 90, 110, 80, 100, 130, 140, 150, 90, 80, 70]) # symmetric error\nlower_error = 0.7 * error # Adjusted asymmetric error\nupper_error = error\nasymmetric_error = [lower_error, upper_error]\n\ntitle1 = \"Monthly Tourist Arrivals with Symmetric Error Margins\"\ntitle2 = \"Monthly Tourist Arrivals with Asymmetric Error Margins\"\nxlabel = \"Time (Months)\"\nylabel = \"Tourist Arrivals (in thousands)\"\nlegend_label = \"Tourist Data\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, (ax0, ax1) = plt.subplots(figsize=(12, 6), ncols=2, sharex=True)\n\n# Plot with symmetric error\nax0.errorbar(\n x,\n y,\n yerr=error,\n fmt=\"o\",\n color=\"mediumseagreen\",\n ecolor=\"lightgray\",\n elinewidth=2,\n capsize=5,\n label=legend_label,\n)\nax0.set_title(title1, fontsize=14)\nax0.set_xlabel(xlabel, fontsize=12)\nax0.set_ylabel(ylabel, fontsize=12)\nax0.legend()\n\n# Plot with asymmetric error\nax1.errorbar(\n x,\n y,\n yerr=asymmetric_error,\n fmt=\"v\",\n color=\"royalblue\",\n ecolor=\"darkorange\",\n elinewidth=2,\n capsize=5,\n label=legend_label,\n)\nax1.set_title(title2, fontsize=14)\nax1.set_xlabel(xlabel, fontsize=12)\nax1.set_ylabel(ylabel, fontsize=12)\nax1.legend()\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorpoint_74.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_145", "content": { "Tools": [ "Tool A", "Tool B", "Tool C", "Tool D" ], "Ease of Use": [ 0.87, 0.82, 0.9, 0.85 ], "Engagement": [ 0.75, 0.78, 0.74, 0.8 ], "Overall Score": [ 1.62, 1.6, 1.64, 1.65 ] }, "visual_intent": "A combination chart displaying grouped bars for ease of use and engagement alongside a line plot for overall score across different tools, titled Performance Metrics for Educational Tools(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/CB_56.jpg", "original_category": "CB", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nnp.random.seed(0)\n\n# Data\nmodes = [\"Tool A\", \"Tool B\", \"Tool C\", \"Tool D\"]\nease_of_use_values = [0.87, 0.82, 0.90, 0.85]\nengagement_values = [0.75, 0.78, 0.74, 0.80]\noverall_values = [1.62, 1.60, 1.64, 1.65]\nlabels = [\"Ease of Use\", \"Engagement\", \"Overall Score\"]\nxlabel = \"Tools\"\nylabel = \"Values\"\ntitle = \"Performance Metrics for Educational Tools\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Bar plot\nfig, ax1 = plt.subplots(\n figsize=(10, 6)\n)\n\nbar_width = 0.35\nindex = np.arange(len(modes))\n\n# Optimized Colors\nbar1 = ax1.bar(index, ease_of_use_values, bar_width, label=labels[0], color=\"#4C72B0\")\nbar2 = ax1.bar(\n index + bar_width, engagement_values, bar_width, label=labels[1], color=\"#55A868\"\n)\n\n# Line plot\nax2 = ax1.twinx()\n(line,) = ax2.plot(index + bar_width / 2, overall_values, color=\"#DD8452\", marker=\"s\", linestyle='--', linewidth=2, label=labels[2])\n\n# Annotate bars with values\nfor rect, value in zip(bar1, ease_of_use_values):\n height = rect.get_height()\n ax1.text(\n rect.get_x() + rect.get_width() / 2,\n height + 0.02,\n f\"{value:.2f}\",\n ha=\"center\",\n va=\"bottom\",\n )\n\nfor rect, value in zip(bar2, engagement_values):\n height = rect.get_height()\n ax1.text(\n rect.get_x() + rect.get_width() / 2,\n height + 0.02,\n f\"{value:.2f}\",\n ha=\"center\",\n va=\"bottom\",\n )\n\n# Labels, title and legend\nax1.set_xlabel(xlabel)\nax1.set_ylabel(ylabel)\nax1.set_title(title)\nax1.set_xticks(index + bar_width / 2)\nax1.set_xticklabels(modes)\nax1.set_ylim(0.7, 1.0)\nax1.set_yticks([0.7, 0.75, 0.8, 0.85, 0.9, 0.95])\nax2.set_ylim(1.55, 1.70)\nax2.set_yticks([1.55, 1.60, 1.65, 1.70])\nax1.legend(loc=\"upper left\")\nax2.legend(loc=\"upper right\")\n\nax1.yaxis.grid(True)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust figure size to match original image's dimensions\nfig.set_size_inches(10, 6)\n\n# Show plot\nplt.tight_layout()\nplt.savefig(\"CB_56.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_146", "content": { "Category": [ "λ=0.06", "λ=0.08", "λ=0.1" ], "E16.6_Positive": [ 39.4, 35.18, 34.06 ], "E16.6_Negative": [ -17, -19, -16 ], "L26.8_Positive": [ 32.84, 20.84, 30.84 ], "L26.8_Negative": [ -9, -12, -14 ], "D19.7_Positive": [ 19.66, 28.0, 24.27 ], "D19.7_Negative": [ -11, -14, -20 ], "L22.2_Type1_Positive": [ 26.82, 30, 34.06 ], "L22.2_Type1_Negative": [ -20, -30, -35 ], "L22.2_Type2_Positive": [ 22, 22, 22 ], "L22.2_Type2_Negative": [ 0, 0, 0 ] }, "visual_intent": "A grouped bar chart about Categories and Reward Values, showing bidirectional (positive and negative) bars for five distinct groups (E16.6, L26.8, D19.7, and two variants of L22.2).(size of the desired plot: width=6.0, height=5.0)", "path_to_gt_image": "images/bar_50.jpg", "original_category": "bar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data\ncategories = [\"λ=0.06\", \"λ=0.08\", \"λ=0.1\"]\nvalues1 = [39.4, 35.18, 34.06]\nvalues2 = [32.84, 20.84, 30.84]\nvalues3 = [19.66, 28.0, 24.27]\nvalues4 = [26.82, 30, 34.06]\nvalues5 = [22, 22, 22]\n\nvalues1minus = [-17, -19, -16]\nvalues2minus = [-9, -12, -14]\nvalues3minus = [-11, -14, -20]\nvalues4minus = [-20, -30, -35]\nvalues5minus = [0, 0, 0]\n\n# Set up the bar width\nbarWidth = 0.15\n\n# Set position of bar on X axis\nr1 = np.arange(len(values1))\nr2 = [x + barWidth for x in r1]\nr3 = [x + barWidth for x in r2]\nr4 = [x + barWidth for x in r3]\nr5 = [x + barWidth for x in r4]\n\nlabels = [\"E16.6\", \"L26.8\", \"D19.7\", \"L22.2\", \"L22.2\"]\nxlabel = \"Categories\"\nylabel = \"Reward Values\"\nyticks = np.arange(-40, 41, 10)\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set up the figure size\nplt.figure(figsize=(6, 5))\n\n# Make the plot\nplt.bar(\n r1, values1, color=\"#f6c3cb\", width=barWidth, edgecolor=\"black\", label=labels[0]\n)\nplt.bar(\n r2, values2, color=\"#fbe5c8\", width=barWidth, edgecolor=\"black\", label=labels[1]\n)\nplt.bar(\n r3, values3, color=\"#55b0aa\", width=barWidth, edgecolor=\"black\", label=labels[2]\n)\nplt.bar(\n r4, values4, color=\"#6f94e7\", width=barWidth, edgecolor=\"black\", label=labels[3]\n)\nplt.bar(\n r5, values5, color=\"#e6e6f9\", width=barWidth, edgecolor=\"black\", label=labels[4]\n)\nplt.bar(\n r1,\n values1minus,\n color=\"#f6c3cb\",\n width=barWidth,\n edgecolor=\"grey\",\n label=labels[0],\n alpha=0.5,\n)\nplt.bar(\n r2,\n values2minus,\n color=\"#fbe5c8\",\n width=barWidth,\n edgecolor=\"grey\",\n label=labels[1],\n alpha=0.5,\n)\nplt.bar(\n r3,\n values3minus,\n color=\"#55b0aa\",\n width=barWidth,\n edgecolor=\"grey\",\n label=labels[2],\n alpha=0.5,\n)\nplt.bar(\n r4,\n values4minus,\n color=\"#6f94e7\",\n width=barWidth,\n edgecolor=\"grey\",\n label=labels[3],\n alpha=0.5,\n)\nplt.bar(\n r5,\n values5minus,\n color=\"#e6e6f9\",\n width=barWidth,\n edgecolor=\"grey\",\n label=labels[4],\n alpha=0.5,\n)\n\n# Add text on the top of each bar\nfor i in range(len(r1)):\n plt.text(\n r1[i], values1[i] - 1, str(values1[i]), ha=\"center\", va=\"top\", rotation=-90\n )\n plt.text(\n r2[i], values2[i] - 1, str(values2[i]), ha=\"center\", va=\"top\", rotation=-90\n )\n plt.text(\n r3[i], values3[i] - 1, str(values3[i]), ha=\"center\", va=\"top\", rotation=-90\n )\n plt.text(\n r4[i], values4[i] - 1, str(values4[i]), ha=\"center\", va=\"top\", rotation=-90\n )\n plt.text(\n r5[i], values5[i] - 1, str(values5[i]), ha=\"center\", va=\"top\", rotation=-90\n )\n plt.text(\n r1[i],\n values1minus[i] + 1,\n str(-values1minus[i]),\n ha=\"center\",\n va=\"bottom\",\n rotation=-90,\n )\n plt.text(\n r2[i],\n values2minus[i] + 1,\n str(-values2minus[i]),\n ha=\"center\",\n va=\"bottom\",\n rotation=-90,\n )\n plt.text(\n r3[i],\n values3minus[i] + 1,\n str(-values3minus[i]),\n ha=\"center\",\n va=\"bottom\",\n rotation=-90,\n )\n plt.text(\n r4[i],\n values4minus[i] + 1,\n str(-values4minus[i]),\n ha=\"center\",\n va=\"bottom\",\n rotation=-90,\n )\n plt.text(\n r5[i],\n values5minus[i] - 1,\n str(-values5minus[i]),\n ha=\"center\",\n va=\"top\",\n rotation=-90,\n )\n\n# Add xticks on the middle of the group bars\nplt.xlabel(xlabel)\nplt.xticks([r + 2 * barWidth for r in range(len(values1))], categories)\nplt.yticks(yticks)\n# Create legend & Show graphic\nplt.ylabel(ylabel)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"bar_50.pdf\", bbox_inches=\"tight\")\n", "width": 6.0, "height": 5.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "bar" }, { "id": "test_147", "content": { "Activity": [ "Sightseeing", "Dining Out", "Shopping", "Cultural Experiences", "Relaxing" ], "Percentage": [ 35, 25, 15, 10, 15 ] }, "visual_intent": "A donut chart about tourism activities and percentages, titled Tourism Activity Breakdown(size of the desired plot: width=10.0, height=10.0)", "path_to_gt_image": "images/pie_76.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Data for new pie chart\ncategories = [\"Sightseeing\", \"Dining Out\", \"Shopping\", \"Cultural Experiences\", \"Relaxing\"]\npercentages = [35, 25, 15, 10, 15]\n\n# Extracted text variables\nchart_title = \"Tourism Activity Breakdown\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Define a tourism-themed color palette\ncolors = [\"#FF6F61\", \"#6B5B95\", \"#88B04B\", \"#F7CAC9\", \"#92A8D1\"]\n\n# Subtle explosion for visual separation\nexplode = (0.05, 0.05, 0.05, 0.05, 0.05)\n\n# Format for displaying percentages on the chart\nautopct_format = \"%1.1f%%\"\n\n# Legend configuration\nlegend_location = \"best\"\nlegend_bbox_to_anchor = (0, 0.8)\n\n# Create the pie chart\nfig, ax = plt.subplots(figsize=(10, 10)) # Adjust figure size for better visualization\npatches, texts, autotexts = ax.pie(\n percentages,\n colors=colors,\n autopct=autopct_format,\n startangle=90,\n wedgeprops=dict(edgecolor=\"black\"),\n explode=explode,\n pctdistance=0.75, # Adjust percentage labels position for better clarity\n)\n\n# Optional: creating a donut chart by adding a center circle\ndonut_circle = plt.Circle((0, 0), 0.60, fc=\"white\")\nfig.gca().add_artist(donut_circle)\n\n# Ensure pie is drawn as a circle\nax.axis(\"equal\")\n\nplt.title(chart_title, fontsize=22)\nplt.legend(\n patches, categories, loc=legend_location, bbox_to_anchor=legend_bbox_to_anchor\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Display the plot and save with an updated filename\nplt.tight_layout()\nplt.savefig(\"pie_76.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 10.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_148", "content": { "Sector": [ "IT\n35%", "Healthcare\n25%", "Education\n18%", "Manufacturing\n12%", "Retail\n10%" ], "Value": [ 35, 25, 18, 12, 10 ] }, "visual_intent": "A treemap about employment sectors and their distribution percentages, titled Employment Distribution by Sector(size of the desired plot: width=10.0, height=10.0)", "path_to_gt_image": "images/tree_73.jpg", "original_category": "tree", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n\n# Data\nsizes = [35, 25, 18, 12, 10]\nlabels = [\n \"IT\\n35%\",\n \"Healthcare\\n25%\",\n \"Education\\n18%\",\n \"Manufacturing\\n12%\",\n \"Retail\\n10%\",\n]\ntitle = \"Employment Distribution by Sector\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#5DADE2\", \"#48C9B0\", \"#F4D03F\", \"#EC7063\", \"#AF7AC5\"]\n# Create a figure with the specified size\nfig = plt.figure(figsize=(10, 10))\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes,\n label=labels,\n color=colors,\n alpha=0.8,\n text_kwargs={\"fontsize\": 14, \"color\": \"black\"},\n pad=True,\n ec=\"black\",\n)\n\n# Set title\nplt.title(title, fontsize=20)\n\n# Remove axes\nplt.axis(\"off\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout and save to file\nplt.tight_layout()\nplt.savefig(\"tree_73.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 10.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_149", "content": { "SNR (dB)": [ 5, 10, 15, 20, 25 ], "Approach A": [ 12, 35, 55, 75, 95 ], "Approach B": [ 10, 28, 50, 70, 90 ], "Approach C": [ 8, 25, 45, 65, 85 ], "Our Approach": [ 15, 40, 60, 80, 98 ] }, "visual_intent": "A line chart about SNR (dB) and Classification Accuracy (%), titled Classification Accuracy vs SNR for Different Approaches(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/line_73.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data\nsnr_values = [5, 10, 15, 20, 25]\napproach_a = [12, 35, 55, 75, 95]\napproach_b = [10, 28, 50, 70, 90]\napproach_c = [8, 25, 45, 65, 85]\nour_approach = [15, 40, 60, 80, 98]\n\n# Labels and Plot Types\nlabel_approach_a = \"Approach A\"\nlabel_approach_b = \"Approach B\"\nlabel_approach_c = \"Approach C\"\nlabel_our_approach = \"Our Approach\"\n\n# Axes Limits and Labels\nxlim_values = [5, 25]\nylim_values = [0, 100]\nxlabel_value = \"SNR (dB)\"\nylabel_value = \"Classification Accuracy (%)\"\nxticks_values = np.arange(5, 30, 5)\nyticks_values = np.arange(0, 101, 20)\ntitle_value = \"Classification Accuracy vs SNR for Different Approaches\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting\nplt.figure(figsize=(10, 7)) # Adjusting figure size for better readability\nplt.plot(\n snr_values,\n approach_a,\n linestyle='--',\n marker='o',\n label=label_approach_a,\n color=\"tomato\",\n clip_on=False,\n zorder=10,\n)\nplt.plot(\n snr_values,\n approach_b,\n linestyle='-.',\n marker='^',\n label=label_approach_b,\n color=\"royalblue\",\n clip_on=False,\n zorder=10,\n)\nplt.plot(\n snr_values,\n approach_c,\n linestyle=':',\n marker='s',\n label=label_approach_c,\n color=\"green\",\n clip_on=False,\n zorder=10,\n)\nplt.plot(\n snr_values,\n our_approach,\n linestyle='-',\n marker='x',\n label=label_our_approach,\n color=\"purple\",\n clip_on=False,\n zorder=10,\n)\n\n# Set y-axis to only display specific ticks and extend y-axis to leave space at top\nplt.yticks(yticks_values)\nplt.ylim(ylim_values)\nplt.xticks(xticks_values)\nplt.xlim(xlim_values)\n\n# Adding grid, legend, and labels\nplt.grid(True)\nplt.legend(loc=\"upper center\", bbox_to_anchor=(0.5, 1.15), ncol=2, frameon=False)\nplt.xlabel(xlabel_value)\nplt.ylabel(ylabel_value)\nplt.title(title_value)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to reduce white space\nplt.tight_layout()\nplt.savefig(\"line_73.pdf\", bbox_inches=\"tight\")\n\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_150", "content": { "Metric": [ "SQA-I", "GQA", "VQAv2", "POPE", "MM-Vet", "TextVQA" ], "TinyLLaVA-3.1B": [ 62.8, 42.9, 72.9, 56.9, 65.0, 49.5 ], "TinyLLaVA-3.1A": [ 43.1, 67.2, 66.3, 75.4, 49.3, 55.6 ] }, "visual_intent": "A radar chart comparing the performance metrics of two models, TinyLLaVA-3.1B and TinyLLaVA-3.1A, across six different benchmarks(size of the desired plot: width=8.0, height=7.0)", "path_to_gt_image": "images/radar_9.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data\ncategories = [\"SQA-I\", \"GQA\", \"VQAv2\", \"POPE\", \"MM-Vet\", \"TextVQA\"]\nvalues1 = [62.8, 42.9, 72.9, 56.9, 65.0, 49.5]\nvalues2 = [43.1, 67.2, 66.3, 75.4, 49.3, 55.6]\nlabels = [\"TinyLLaVA-3.1B\", \"TinyLLaVA-3.1A\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Number of variables\nnum_vars = len(categories)\n\n# Compute angle for each category\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n\n# The plot is circular, so we need to \"complete the loop\" and append the start to the end.\nvalues1 += values1[:1]\nvalues2 += values2[:1]\nangles += angles[:1]\n# Plot\nfig, ax = plt.subplots(figsize=(8, 7), subplot_kw=dict(polar=True))\nax.fill(angles, values1, color=\"#d1553e\", alpha=0.25)\nax.fill(angles, values2, color=\"#4d88b9\", alpha=0.25)\nax.plot(angles, values1, color=\"#d1553e\", linewidth=2, label=labels[0])\nax.plot(angles, values2, color=\"#4d88b9\", linewidth=2, label=labels[1])\n\n# Labels and annotations for each point\nfor angle, value1, value2 in zip(angles[:-1], values1[:-1], values2[:-1]):\n ax.annotate(\n f\"{value1}\", xy=(angle, value1), xytext=(5, 5), textcoords=\"offset points\"\n )\n ax.annotate(\n f\"{value2}\", xy=(angle, value2), xytext=(5, -10), textcoords=\"offset points\"\n )\n\n# Labels for each point\nax.set_xticks(angles[:-1])\nax.set_xticklabels(categories)\n\n# remove ylabels\nax.set_yticklabels([])\n\n# Legend\nax.legend(\n loc=\"lower center\",\n bbox_to_anchor=(0.5, -0.1),\n ncol=2,\n frameon=True,\n facecolor=\"#f2f2f2\",\n edgecolor=\"#f2f2f2\",\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_9.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 7.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_151", "content": { "Legal Categories": [ "Contracts", "Torts", "Property" ], "Predicted Suitability": [ -23.35, -8.53, -21.53 ], "Actual Suitability": [ -30.53, -22.98, -21.07 ], "Complexity Index": [ 0.13, 0.9, 0.82 ] }, "visual_intent": "A dual-axis grouped bar chart about legal categories, suitability, and complexity index(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/bar_101.jpg", "original_category": "bar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nnp.random.seed(0)\n# Data\ncategories = [\"Contracts\", \"Torts\", \"Property\"]\nprobing_fgt = [-23.35, -8.53, -21.53]\nobserved_fgt = [-30.53, -22.98, -21.07]\nfeature_embedding_distance = [0.13, 0.90, 0.82]\n\nlabels = [\"Predicted Suitability\", \"Actual Suitability\", \"Complexity Index\"]\nxlabel = \"Legal Categories\"\nylabel = \"Suitability (%)\"\nylabel2 = \"Complexity Index\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nxticks = np.arange(len(categories))\nylim = [-100, 100]\nylim2 = [-1, 1]\nnum_yticks = 5\nyticks = np.linspace(-100, 0, num_yticks)\nyticks2 = np.linspace(0, 1, num_yticks)\n\n# Create figure and axes\nfig, ax1 = plt.subplots(figsize=(8, 6))\nax2 = ax1.twinx()\n\n# Bar plots with updated color scheme\nbar_width = 0.2\nindex = np.arange(len(categories))\n\nbar1 = ax1.bar(\n index,\n probing_fgt,\n bar_width,\n label=labels[0],\n color=\"#ff7f00\", # Orange\n edgecolor=\"black\",\n zorder=3,\n)\nbar2 = ax1.bar(\n index + bar_width,\n observed_fgt,\n bar_width,\n label=labels[1],\n color=\"#984ea3\", # Purple\n edgecolor=\"black\",\n zorder=3,\n)\nbar3 = ax2.bar(\n index + 2 * bar_width,\n feature_embedding_distance,\n bar_width,\n label=labels[2],\n color=\"#ffff33\", # Yellow\n edgecolor=\"black\",\n zorder=3,\n)\n\n# Add values on top of the bars\nfor bars in [bar1, bar2]:\n for bar in bars:\n height = bar.get_height()\n ax1.annotate(\n f\"{height}\",\n xy=(bar.get_x() + bar.get_width() / 2, height - 4),\n xytext=(0, 3),\n textcoords=\"offset points\",\n ha=\"center\",\n va=\"top\",\n fontsize=8,\n )\nfor bars in [bar3]:\n for bar in bars:\n height = bar.get_height()\n ax2.annotate(\n f\"{height}\",\n xy=(bar.get_x() + bar.get_width() / 2, height),\n xytext=(0, 3),\n textcoords=\"offset points\",\n ha=\"center\",\n va=\"bottom\",\n fontsize=8,\n )\n\n# Set the axes background color and add grid lines\nfor ax in [ax1, ax2]:\n ax.set_facecolor(\"#f5f5f5\")\n ax.grid(True, color=\"#d9d9d9\", linestyle='--', zorder=1)\n\n# Axes labels\nax1.set_xlabel(xlabel)\nax1.set_ylabel(ylabel)\nax2.set_ylabel(ylabel2)\n\nax1.set_ylim(ylim)\nax2.set_ylim(ylim2)\nax1.set_xticks(index)\nax1.set_xticklabels(categories)\n\nax1.set_yticks(yticks)\nax2.set_yticks(yticks2)\n\n# Create legend & Show plot\nhandles, labels = ax1.get_legend_handles_labels()\nhandles2, labels2 = ax2.get_legend_handles_labels()\nfig.legend(\n handles + handles2,\n labels + labels2,\n loc=\"lower right\",\n bbox_to_anchor=(0.9, 0.1),\n frameon=False,\n framealpha=0,\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"bar_101.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" }, { "id": "test_152", "content": { "Attribute": [ "Extrusion", "Injection", "Blow Molding", "Compression", "Rotational" ], "Extrusion": [ 4, 3, 2, 5, 4 ], "Injection Molding": [ 3, 5, 3, 4, 3 ], "Blow Molding": [ 4, 4, 4, 3, 5 ] }, "visual_intent": "A figure with 3 subplots: (1) a radar chart about Extrusion attributes and scores, titled Extrusion, (2) a radar chart about Injection Molding attributes and scores, titled Injection Molding, (3) a radar chart about Blow Molding attributes and scores, titled Blow Molding(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/radar_17.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Define the new data for each method (plastic processing techniques)\nlabels = np.array(\n [\"Extrusion\", \"Injection\", \"Blow Molding\", \"Compression\", \"Rotational\"]\n)\nstats = np.array(\n [\n [4, 3, 2, 5, 4], # Extrusion\n [3, 5, 3, 4, 3], # Injection Molding\n [4, 4, 4, 3, 5], # Blow Molding\n ]\n)\ntitles = [\"Extrusion\", \"Injection Molding\", \"Blow Molding\"]\nrticks = [1, 2, 3, 4, 5]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the figure size\nfig, ax = plt.subplots(figsize=(10, 8), nrows=1, ncols=3, subplot_kw=dict(polar=True))\n# Define the number of variables\nnum_vars = len(labels)\n\n# Compute angle for each axis\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n\n# The plot is made circular\nstats = np.concatenate((stats, stats[:, [0]]), axis=1)\nangles += angles[:1]\n# Define colors\ncolors = [\"red\", \"green\", \"blue\"]\n\n# Draw one radar chart for each plastic processing technique\nfor idx, (title, case_data) in enumerate(zip(titles, stats)):\n ax[idx].fill(angles, case_data, color=colors[idx], alpha=0.25)\n ax[idx].plot(angles, case_data, color=colors[idx])\n ax[idx].set_rticks(rticks)\n ax[idx].set_xticks(angles[:-1])\n ax[idx].set_xticklabels(labels)\n ax[idx].set_title(title, color=colors[idx])\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit\nplt.tight_layout(rect=[0, 0.03, 1, 0.95])\n\nplt.savefig(\"radar_17.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_153", "content": { "Sector": [ "Streaming Services", "Gaming", "Music", "Movies" ], "External Market Share": [ 300, 180, 220, 300 ], "Internal Market Share": [ 250, 130, 200, 270 ] }, "visual_intent": "A double layer donut chart about entertainment sectors, external market share, and internal market share, titled Market Share by Sector - External vs. Internal (Entertainment Industry)(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/pie_64.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# New example data for the double layer donut chart in the entertainment domain\nvals1 = [300, 180, 220, 300] # External market share\nvals2 = [250, 130, 200, 270] # Internal market share\nvals3 = [700] # This will be the white center\n\n# Define labels and colors\nlabels = [\"Streaming Services\", \"Gaming\", \"Music\", \"Movies\"]\n\n# Variables for plot configuration\ntitle_text = \"Market Share by Sector - External vs. Internal (Entertainment Industry)\"\nlegend_labels = labels\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, ax = plt.subplots(figsize=(10, 8))\n\ncolors1 = [\"#FF6F61\", \"#6B5B95\", \"#88B04B\", \"#F7CAC9\"]\ncolors2 = [\"#FFB3A7\", \"#B39EB5\", \"#BFD641\", \"#F3E5AB\"]\n\nlegend_bbox_to_anchor = (1.2, 1)\nlegend_frameon = False\n\n# Outer donut chart\nwedges1, texts1, autotexts1 = ax.pie(\n vals1,\n labels=labels,\n radius=1.2,\n colors=colors1,\n autopct=\"%1.1f%%\",\n pctdistance=0.9,\n wedgeprops=dict(width=0.3, edgecolor=\"w\"),\n)\n\n# Inner donut chart\nwedges2, texts2, autotexts2 = ax.pie(\n vals2,\n radius=0.9,\n colors=colors2,\n autopct=\"%1.1f%%\",\n pctdistance=0.75,\n wedgeprops=dict(width=0.3, edgecolor=\"w\"),\n)\n\n# White center circle for the 'hole'\nax.pie(vals3, radius=0.6, colors=\"w\", wedgeprops=dict(width=0.3, edgecolor=\"w\"))\n\n# Equal aspect ratio ensures that pie chart is drawn as a circle\nax.axis(\"equal\")\n\n# Title for the donut chart\nax.set_title(title_text, fontsize=14, fontweight='bold')\n\n# Show the plot with a legend\nplt.legend(legend_labels, bbox_to_anchor=legend_bbox_to_anchor, frameon=legend_frameon)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"pie_64.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_154", "content": { "Country": [ "United States", "Germany", "India", "Brazil", "Japan" ], "Higher Education Enrollment Rate": [ 0.88, 0.65, 0.25, 0.36, 0.62 ], "Enrollment Error": [ 0.03, 0.02, 0.05, 0.04, 0.03 ], "Student-Teacher Ratio": [ 16, 15, 35, 20, 12 ], "Ratio Error": [ 1, 0.5, 2, 1.5, 0.5 ] }, "visual_intent": "A figure with 2 subplots: (1) a horizontal bar chart about countries and higher education enrollment rates with error bars, titled Higher Education Enrollment Rate, (2) a horizontal bar chart about countries and student-teacher ratios with error bars, titled Student-Teacher Ratio(size of the desired plot: width=6.0, height=6.0)", "path_to_gt_image": "images/errorbar_17.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\ncategories = [\"United States\", \"Germany\", \"India\", \"Brazil\", \"Japan\"]\n\nvalues = [0.88, 0.65, 0.25, 0.36, 0.62]\nerrors = [0.03, 0.02, 0.05, 0.04, 0.03]\n\ncategories2 = [\"United States\", \"Germany\", \"India\", \"Brazil\", \"Japan\"]\nvalues2 = [16, 15, 35, 20, 12]\nerrors2 = [1, 0.5, 2, 1.5, 0.5]\n\ntitles = [\"Higher Education Enrollment Rate\", \"Student-Teacher Ratio\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = plt.get_cmap(\"Set3\")(np.linspace(0.2, 0.8, 5))\nfig, (ax1, ax2) = plt.subplots(2, 1, figsize=(6, 6))\nax1.barh(categories, values, xerr=errors, color=colors, capsize=3)\nax2.barh(categories2, values2, xerr=errors2, color=colors, capsize=3)\n\nax1.set_title(titles[0])\nax2.set_title(titles[1])\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorbar_17.pdf\", bbox_inches=\"tight\")\n", "width": 6.0, "height": 6.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "bar" }, { "id": "test_155", "content": { "Series Labels": [ "E16.6", "L26.8", "D19.7", "L22.2", "L22.2" ], "λ=0.06 Positive": [ 39.4, 32.84, 19.66, 26.82, 22.0 ], "λ=0.06 Negative": [ -17, -9, -11, -20, 0 ], "λ=0.08 Positive": [ 35.18, 20.84, 28.0, 30.0, 22.0 ], "λ=0.08 Negative": [ -19, -12, -14, -30, 0 ], "λ=0.1 Positive": [ 34.06, 30.84, 24.27, 34.06, 22.0 ], "λ=0.1 Negative": [ -16, -14, -20, -35, 0 ] }, "visual_intent": "A grouped bar chart about Series Labels and Reward Values, displaying positive and negative value bars for three different categories (λ=0.06, λ=0.08, λ=0.1).(size of the desired plot: width=10.0, height=5.0)", "path_to_gt_image": "images/bar_74.jpg", "original_category": "bar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data\ncategories = [\"λ=0.06\", \"λ=0.08\", \"λ=0.1\"]\nvalues1 = [39.4, 35.18, 34.06]\nvalues2 = [32.84, 20.84, 30.84]\nvalues3 = [19.66, 28.0, 24.27]\nvalues4 = [26.82, 30, 34.06]\nvalues5 = [22, 22, 22]\n\nvalues1minus = [-17, -19, -16]\nvalues2minus = [-9, -12, -14]\nvalues3minus = [-11, -14, -20]\nvalues4minus = [-20, -30, -35]\nvalues5minus = [0, 0, 0]\n\nvalues = [values1, values2, values3, values4, values5]\nvalues_minus = [values1minus, values2minus, values3minus, values4minus, values5minus]\nlabels = [\"E16.6\", \"L26.8\", \"D19.7\", \"L22.2\", \"L22.2\"]\nxlabel = \"Series Labels\"\nyticks = np.arange(-40, 41, 10)\nylabel = \"Reward Values\"\nlegendtitle = \"Categories\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#f6c3cb\", \"#fbe5c8\", \"#55b0aa\", \"#6f94e7\", \"#e6e6f9\"]\n# Set up the figure size\nplt.figure(figsize=(10, 5))\n\n# Set up the bar width\nbarWidth = 0.2\n\n# Set up positions for the bars\npositions = np.arange(len(labels))\n\n# Creating bars for each category\nfor i, category in enumerate(categories):\n pos = [x + barWidth * i for x in positions] # shift each bar by `barWidth * i`\n plt.bar(\n pos,\n [v[i] for v in values],\n color=colors[i],\n width=barWidth,\n edgecolor=\"black\",\n label=category,\n )\n plt.bar(\n pos,\n [v[i] for v in values_minus],\n color=colors[i],\n width=barWidth,\n edgecolor=\"black\",\n alpha=0.5,\n )\n\n # Add text on top and bottom of the bars\n for idx, val in enumerate(pos):\n plt.text(\n val,\n values[idx][i] - 1,\n f\"{values[idx][i]}\",\n ha=\"center\",\n va=\"top\",\n rotation=-90,\n )\n plt.text(\n val,\n values_minus[idx][i] + 1,\n f\"{-values_minus[idx][i]}\",\n ha=\"center\",\n va=\"bottom\",\n rotation=-90,\n )\n\n# Adding axis labels and ticks\nplt.xlabel(xlabel)\nplt.xticks([r + barWidth * 1.0 for r in range(len(labels))], labels)\nplt.yticks(yticks)\n\n# Add a legend and display the plot\nplt.ylabel(ylabel)\nplt.legend(title=legendtitle)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"bar_74.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 5.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_156", "content": { "Metric": [ "Reach", "Engagement", "Sentiment", "Shares", "Comments", "Likes", "Views" ], "Campaign A": [ 7, 8.5, 6, 7.5, 5, 9, 8 ], "Campaign B": [ 6, 7, 7, 6, 8, 6.5, 9 ] }, "visual_intent": "A radar chart comparing media metrics for Campaign A and Campaign B, titled Media Metrics Comparison(size of the desired plot: width=6.0, height=6.0)", "path_to_gt_image": "images/radar_51.jpg", "original_category": "radar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\nfrom math import pi\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n\n# Define the data for the radar chart\ncategories = [\n \"Reach\",\n \"Engagement\",\n \"Sentiment\",\n \"Shares\",\n \"Comments\",\n \"Likes\",\n \"Views\",\n]\nvalues1 = [7, 8.5, 6, 7.5, 5, 9, 8] # Values for Campaign A\nvalues2 = [6, 7, 7, 6, 8, 6.5, 9] # Values for Campaign B\n\n# Number of variables\nN = len(categories)\n\n# Compute angle for each category\nangles = [n / float(N) * 2 * pi for n in range(N)]\nvalues1 += values1[:1]\nvalues2 += values2[:1]\nangles += angles[:1]\n\n# Extracted variables\nline_label1 = \"Campaign A\"\nline_label2 = \"Campaign B\"\nxticks = angles[:-1]\nxtickslabel = categories\nyticks = [0, 2, 4, 6, 8, 10]\nytickslabel = [\"0\", \"2\", \"4\", \"6\", \"8\", \"10\"]\nylim = (0, 10)\nlegend_loc = \"lower center\"\nlegend_bbox_to_anchor = (0.5, 1.2)\nlegend_ncol = 2\nlegend_frameon = False\n\n# Chart title\nchart_title = \"Media Metrics Comparison\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Initialize the spider plot\nfig, ax = plt.subplots(figsize=(6, 6), subplot_kw=dict(polar=True))\n\n# Draw one axe per variable and add labels with increased padding\nplt.xticks(xticks, xtickslabel, color=\"black\", size=10)\nax.tick_params(pad=20) # Increase the distance of the label from the axis\n\n# Draw ylabels\nax.set_rlabel_position(0)\nplt.yticks(yticks, ytickslabel, color=\"black\", size=7)\nplt.ylim(ylim)\n\n# Plot data for Campaign A\nax.plot(\n angles, values1, linewidth=1.5, linestyle=\"solid\", label=line_label1, color=\"#005f9e\"\n)\nax.fill(angles, values1, \"#005f9e\", alpha=0.3)\n\n# Plot data for Campaign B\nax.plot(\n angles, values2, linewidth=1.5, linestyle=\"--\", label=line_label2, color=\"#8a2be2\"\n)\nax.fill(angles, values2, \"#8a2be2\", alpha=0.3)\n\n# Add legend\nplt.legend(\n loc=legend_loc,\n bbox_to_anchor=legend_bbox_to_anchor,\n ncol=legend_ncol,\n frameon=legend_frameon,\n)\n\n# Set the background color inside the radar chart to white\nax.set_facecolor(\"white\")\n\n# Add chart title\nplt.title(chart_title, size=15, color=\"black\", y=1.1)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit\nplt.tight_layout()\n\n# Show the plot\nplt.savefig(\"radar_51.pdf\", bbox_inches=\"tight\")\n", "width": 6.0, "height": 6.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_157", "content": { "Category": [ "KASHMIR", "COVID/LOCKDOWN", "SPORTS", "CHINA", "PULWAMA-BALAKOT" ], "Mean_Fraction": [ 0.22, 0.23, 0.18, 0.12, 0.05 ], "Error_Minus": [ 0.03, 0.02, 0.05, 0.06, 0.02 ], "Error_Plus": [ 0.01, 0.02, 0.03, 0.04, 0.05 ] }, "visual_intent": "An error bar chart about news categories and the fraction of videos with female face presence(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/errorpoint_5.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\ncategories = [\n \"KASHMIR\",\n \"COVID/LOCKDOWN\",\n \"SPORTS\",\n \"CHINA\",\n \"PULWAMA-BALAKOT\",\n] # Capitalized category labels\nmeans = [0.22, 0.23, 0.18, 0.12, 0.05]\nerrors = [0.03, 0.02, 0.05, 0.06, 0.02]\ndownerrors = [0.01, 0.02, 0.03, 0.04, 0.05]\nlegendtitles = [\"Dataset mean\", \"Mean\"]\ntexttitle = \"Dataset mean\"\nylabel = \"Female Face presence (Fraction of videos)\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nfig, ax = plt.subplots(\n figsize=(8, 6)\n) # Adjusting figure size to match original image dimensions\nax.errorbar(\n categories,\n means,\n yerr=[errors, downerrors],\n fmt=\"o\",\n color=\"blue\",\n ecolor=\"blue\",\n capsize=5,\n)\n\n# Adding a legend with both \"Mean\" and \"Dataset mean\"\ndataset_mean = 0.253\nmean_line = ax.errorbar(\n [], [], yerr=[], fmt=\"o\", color=\"blue\", ecolor=\"blue\", capsize=5\n)\ndataset_mean_line = ax.axhline(\n y=dataset_mean, color=\"gray\", linestyle=\"--\", linewidth=1\n)\nax.legend(\n [dataset_mean_line, mean_line],\n legendtitles,\n loc=\"upper right\",\n fancybox=True,\n framealpha=1,\n shadow=True,\n borderpad=1,\n)\n# Adding a horizontal line for dataset mean and text annotation with a white background\nax.text(\n 0.95,\n dataset_mean,\n texttitle,\n va=\"center\",\n ha=\"right\",\n backgroundcolor=\"white\",\n transform=ax.get_yaxis_transform(),\n)\n# Setting labels\nax.set_ylabel(ylabel)\nax.set_title(\"\")\nplt.xticks(rotation=30)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorpoint_5.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_158", "content": { "Region": [ "North America", "Europe", "Australia", "South Asia", "Sub-Saharan Africa", "Latin America" ], "CO2 Emissions (metric tons per capita)": [ 16, 8, 17, 1.8, 0.8, 2.5 ], "Change in CO2 Emissions (%)": [ -1.2, -0.8, -1.5, 0.5, 0.2, 0.7 ], "Renewable Energy Usage (%)": [ 20, 30, 25, 10, 5, 15 ], "Change in Renewable Energy Usage (%)": [ 3.5, 2.0, 4.0, 1.0, 0.5, 1.2 ] }, "visual_intent": "A figure with 2 subplots: (1) a custom arrow chart displaying CO2 emissions and renewable energy changes for developed regions, (2) a similar chart for developing regions, titled Climate Change Data Visualization(size of the desired plot: width=14.0, height=7.0)", "path_to_gt_image": "images/quiver_45.jpg", "original_category": "quiver", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.lines as mlines\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for the plot\nregions_1 = [\"North America\", \"Europe\", \"Australia\"]\nco2_emissions_1 = [16, 8, 17] # CO2 Emissions (metric tons per capita)\nco2_emissions_change_1 = [-1.2, -0.8, -1.5] # Change in CO2 emissions (%)\nrenewable_energy_1 = [20, 30, 25] # Renewable Energy Usage (%)\nrenewable_energy_change_1 = [3.5, 2.0, 4.0] # Change in Renewable Energy Usage (%)\n\nregions_2 = [\"South Asia\", \"Sub-Saharan Africa\", \"Latin America\"]\nco2_emissions_2 = [1.8, 0.8, 2.5] # CO2 Emissions (metric tons per capita)\nco2_emissions_change_2 = [0.5, 0.2, 0.7] # Change in CO2 emissions (%)\nrenewable_energy_2 = [10, 5, 15] # Renewable Energy Usage (%)\nrenewable_energy_change_2 = [1.0, 0.5, 1.2] # Change in Renewable Energy Usage (%)\n\nax1_labels = [\"Change in CO2 Emissions (%)\", \"Change in Renewable Energy Usage (%)\"]\nax2_labels = [\"Change in CO2 Emissions (%)\", \"Change in Renewable Energy Usage (%)\"]\n\nxlabel = \"Percentage\"\nylabel = \"Regions\"\ntitle1 = \"Developed Regions: Climate Change Data\"\ntitle2 = \"Developing Regions: Climate Change Data\"\nsuptitle = \"Climate Change Data Visualization\"\nlegend_label_co2 = \"CO2 Emissions\"\nlegend_label_renewable = \"Renewable Energy Usage\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure with two subplots\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 7))\nfig.suptitle(suptitle, fontsize=16)\n\n# Set the y-axis offsets to be in the middle of each grid\noffset = 0.5\n\n\n# Function to plot on the given axis\ndef plot_climate_data(\n ax,\n regions,\n co2_emissions,\n co2_emissions_change,\n renewable_energy,\n renewable_energy_change,\n labels,\n title,\n):\n for i, region in enumerate(regions):\n # CO2 Emissions change line with arrow and grey dots at start and end\n ax.annotate(\n \"\",\n xy=(co2_emissions[i], i + offset * 3 / 2),\n xytext=(\n co2_emissions[i] + co2_emissions_change[i],\n i + offset * 3 / 2,\n ),\n arrowprops=dict(arrowstyle=\"<-\", color=\"grey\"),\n )\n ax.scatter(\n [\n co2_emissions[i],\n co2_emissions[i] + co2_emissions_change[i],\n ],\n [i + offset * 3 / 2, i + offset * 3 / 2],\n color=\"black\",\n s=25,\n )\n ax.annotate(\n f\"{co2_emissions_change[i]:.2f}\",\n (co2_emissions[i] + co2_emissions_change[i], i + offset * 1.75),\n color=\"grey\",\n ha=\"right\",\n va=\"center\",\n )\n\n # Renewable Energy change line with arrow and green dots at start and end\n ax.annotate(\n \"\",\n xy=(renewable_energy[i], i + offset / 2),\n xytext=(renewable_energy[i] + renewable_energy_change[i], i + offset / 2),\n arrowprops=dict(arrowstyle=\"<-\", color=\"green\"),\n )\n ax.scatter(\n [renewable_energy[i], renewable_energy[i] + renewable_energy_change[i]],\n [i + offset / 2, i + offset / 2],\n color=\"black\",\n s=25,\n )\n ax.annotate(\n f\"{renewable_energy_change[i]:.2f}\",\n (renewable_energy[i] + renewable_energy_change[i], i + offset * 0.75),\n color=\"green\",\n ha=\"left\",\n va=\"center\",\n )\n\n # set axis limits\n ax.set_ylim(0, len(regions))\n ax.set_xlim(0, 40)\n # Set y-ticks and labels\n ax.set_yticks([i + offset for i in range(len(regions))])\n ax.set_yticklabels(regions)\n ax.set_xlabel(xlabel)\n ax.set_ylabel(ylabel)\n ax.set_title(title, fontsize=14)\n\n # Offset grid lines on the y-axis\n ax.set_yticks([i for i in range(len(regions))], minor=True)\n ax.yaxis.grid(True, which=\"minor\", linewidth=0.5, alpha=0.7, color=\"grey\")\n\n # add x-axis grid lines\n ax.xaxis.set_major_locator(plt.MultipleLocator(5))\n ax.grid(axis=\"x\", linestyle=\"--\", linewidth=0.5)\n\n\n# Plot data\nplot_climate_data(\n ax1,\n regions_1,\n co2_emissions_1,\n co2_emissions_change_1,\n renewable_energy_1,\n renewable_energy_change_1,\n ax1_labels,\n title1,\n)\nplot_climate_data(\n ax2,\n regions_2,\n co2_emissions_2,\n co2_emissions_change_2,\n renewable_energy_2,\n renewable_energy_change_2,\n ax2_labels,\n title2,\n)\n\n# Set legends\ngrey_arrow = mlines.Line2D(\n [],\n [],\n color=\"grey\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=legend_label_co2,\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\ngreen_arrow = mlines.Line2D(\n [],\n [],\n color=\"green\",\n marker=\">\",\n linestyle=\"-\",\n markersize=8,\n label=legend_label_renewable,\n linewidth=2,\n markeredgewidth=2,\n markevery=(1, 1),\n)\nfig.legend(\n handles=[grey_arrow, green_arrow],\n bbox_to_anchor=(0.5, -0.05),\n loc=\"upper center\",\n ncol=2,\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout(rect=[0, 0.03, 1, 0.95])\nplt.savefig(\"quiver_45.pdf\", bbox_inches=\"tight\")\n", "width": 14.0, "height": 7.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_159", "content": { "Label": [ "Nestle\n30%", "PepsiCo\n25%", "Coca-Cola\n15%", "Unilever\n10%", "Danone\n12%", "Others\n8%" ], "Share": [ 0.3, 0.25, 0.15, 0.1, 0.12, 0.08 ] }, "visual_intent": "A treemap about major food and beverage companies and their market shares(size of the desired plot: width=12.0, height=8.0)", "path_to_gt_image": "images/tree_9.jpg", "original_category": "tree", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data\nsizes = [0.30, 0.25, 0.15, 0.10, 0.12, 0.08]\nlabels = [\n \"Nestle\\n30%\",\n \"PepsiCo\\n25%\",\n \"Coca-Cola\\n15%\",\n \"Unilever\\n10%\",\n \"Danone\\n12%\",\n \"Others\\n8%\",\n]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#56b1bf\", \"#59c3c3\", \"#74d3ae\", \"#a1de93\", \"#f2e394\", \"#f2ae73\"]\n# Create a figure with the specified size\nfig = plt.figure(figsize=(12, 8))\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes,\n label=labels,\n color=colors,\n text_kwargs={\"fontsize\": 18, \"color\": \"black\"},\n pad=0.25,\n)\n\n# Remove axes\nplt.axis(\"off\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\n# Save plot\nplt.savefig(\"tree_9.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 8.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_160", "content": { "Team": [ "Team A", "Team B", "Team C", "Team D" ], "Offense Score": [ 75, 82, 78, 80 ], "Offense Error": [ 3, 4, 3, 2 ], "Defense Score": [ 68, 75, 70, 72 ], "Defense Error": [ 4, 3, 4, 3 ] }, "visual_intent": "A grouped bar chart about teams, offense scores, and defense scores, titled Team Performance Scores(size of the desired plot: width=8.0, height=5.0)", "path_to_gt_image": "images/errorbar_118.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data setup\nimport numpy as np\n\nnp.random.seed(0)\n\n# Teams\nteams = [\"Team A\", \"Team B\", \"Team C\", \"Team D\"]\nx = np.arange(len(teams)) # X-axis points\n\n# Performance scores for two metrics in different teams\noffense_scores = np.array([75, 82, 78, 80]) # Example scores for offensive performance\ndefense_scores = np.array([68, 75, 70, 72]) # Example scores for defensive performance\n\n# Errors for both metrics\noffense_errors = np.array([3, 4, 3, 2])\ndefense_errors = np.array([4, 3, 4, 3])\n\nlabels = [\"Offense Performance\", \"Defense Performance\"]\nylabels = [\"Offense Score\", \"Defense Score\"]\n\ntitle = \"Team Performance Scores\"\nylims = [[60, 90], [60, 90]]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting setup\nfig, ax1 = plt.subplots(figsize=(8, 5))\n\n# Bar width and hatch patterns\nwidth = 0.35\nhatch_patterns = [\"//\", \"oo\"]\n\n# Colors for the bars\ncolors = [\"#4CAF50\", \"#FF9800\"] # Green and Orange\n\n# Plot data on the left y-axis (offense scores)\nax1.bar(\n x,\n offense_scores,\n width,\n color=colors[0],\n hatch=hatch_patterns[0],\n label=labels[0],\n yerr=offense_errors,\n capsize=5,\n edgecolor=\"black\",\n)\n\n# Create a second y-axis sharing the same x-axis (defense scores)\nax2 = ax1.twinx()\nax2.bar(\n x + width,\n defense_scores,\n width,\n color=colors[1],\n hatch=hatch_patterns[1],\n label=labels[1],\n yerr=defense_errors,\n capsize=5,\n edgecolor=\"black\",\n)\n\n# Set the x-ticks to be in the middle of the two bars and add the labels\nax1.set_xticks(x + width / 2)\nax1.set_xticklabels(teams)\n\n# Add a legend\nax1.legend(loc=\"upper left\")\nax2.legend(loc=\"upper right\")\n\n# Set labels for y-axes\nax1.set_ylabel(ylabels[0], color=colors[0])\nax2.set_ylabel(ylabels[1], color=colors[1])\n\n# Set colors for y-axes\nax1.tick_params(axis=\"y\", colors=colors[0])\nax2.tick_params(axis=\"y\", colors=colors[1])\n\n# Set the limits for y-axes to fit the data\nax1.set_ylim(ylims[0])\nax2.set_ylim(ylims[0])\n\n# Set title for the chart\nplt.title(title)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorbar_118.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 5.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" }, { "id": "test_161", "content": { "Component": [ "Model", "Optimizer", "Gradient", "Unused" ], "LoRA": [ 15.7, 19.9, 33.0, 31.4 ], "QLoRA": [ 10.5, 6.3, 28.4, 54.9 ] }, "visual_intent": "A figure with 2 subplots: (1) a donut chart about LoRA components, titled LoRA, (2) a donut chart about QLoRA components, titled QLoRA(size of the desired plot: width=10.0, height=4.0)", "path_to_gt_image": "images/pie_12.jpg", "original_category": "pie", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for the charts\nlabels = [\"Model\", \"Optimizer\", \"Gradient\", \"Unused\"]\nfull_finetuning_data = [15.7, 19.9, 33.0, 31.4]\nqlora_data = [10.5, 6.3, 28.4, 54.9]\n\ntitiles = [\"LoRA\", \"QLoRA\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure with specific dimensions\nfig, ax = plt.subplots(1, 2, figsize=(10, 4))\n\ncolors = [\"#ff9999\", \"#66b3ff\", \"#99ff99\", \"#ffcc99\"]\n\n# Full Finetuning Donut Chart\nexplode1 = (0.1, 0, 0, 0)\nax[0].pie(\n full_finetuning_data,\n labels=labels,\n colors=colors,\n startangle=90,\n counterclock=False,\n wedgeprops=dict(width=0.3),\n explode=explode1,\n autopct=\"%1.1f%%\",\n)\nax[0].set_title(titiles[0])\n\n# QLoRA Donut Chart\nexplode2 = (0, 0.2, 0, 0)\nax[1].pie(\n qlora_data,\n labels=labels,\n colors=colors,\n startangle=90,\n counterclock=False,\n wedgeprops=dict(width=0.3),\n explode=explode2,\n autopct=\"%1.1f%%\",\n)\nax[1].set_title(titiles[1])\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout to prevent overlap and Show plot\nplt.tight_layout()\nplt.savefig(\"pie_12.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 4.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_162", "content": { "Model": [ "SeViLA", "LongViViT", "ShortViViT", "ImageViT", "Bard + ImageViT", "Bard + ShortViViT", "Bard + PALI", "MC-ViT-B", "MC-ViT-L" ], "EgoSchema VQA accuracy": [ 25, 30, 35, 30, 35, 40, 45, 40, 45 ], "Perception Test VQA accuracy": [ 38, 40, 42, 44, 46, 48, 50, 55, 40 ], "Number of parameters": [ 203, 424, 1000, 4000, 4000, 4000, 4000, 4000, 4000 ] }, "visual_intent": "A bubble chart about EgoSchema VQA accuracy and Perception Test VQA accuracy for various models, with bubble size representing the number of parameters(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/scatter_12.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\nnames = [\n \"SeViLA\",\n \"LongViViT\",\n \"ShortViViT\",\n \"ImageViT\",\n \"Bard + ImageViT\",\n \"Bard + ShortViViT\",\n \"Bard + PALI\",\n \"MC-ViT-B\",\n \"MC-ViT-L\",\n]\nx = [25, 30, 35, 30, 35, 40, 45, 40, 45]\ny = [38, 40, 42, 44, 46, 48, 50, 55, 40]\nsizes = [203, 424, 1000, 4000, 4000, 4000, 4000, 4000, 4000]\nxlabel = \"EgoSchema VQA accuracy\"\nylabel = \"Perception Test VQA accuracy\"\nlegend_sizes = [203, 424, 1000, 4000, 5000]\nlegend_labels = [\"203M\", \"424M\", \"1B\", \"4B\", \">4B\"]\nlegend_title = \"Number of parameters\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and plot\nfig, ax = plt.subplots(figsize=(8, 6))\ncolors = [\"blue\", \"blue\", \"blue\", \"blue\", \"blue\", \"blue\", \"blue\", \"red\", \"red\"]\nscatter = ax.scatter(x, y, s=sizes, c=colors, alpha=0.3)\n\n# Add annotations\nfor i, name in enumerate(names):\n ax.annotate(\n name,\n (x[i], y[i]),\n textcoords=\"offset points\",\n xytext=(0, 0),\n ha=\"center\",\n fontsize=8,\n )\n\n# Customize the axes\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\nax.set_xlim(20, 50)\nax.set_ylim(35, 60)\n\n# Add legend for bubble sizes\nfor size, label in zip(legend_sizes, legend_labels):\n ax.scatter([], [], c=\"grey\", alpha=0.3, s=size, label=label)\n\n# Adjust the legend to have increased spacing\nax.legend(\n scatterpoints=1,\n frameon=False,\n labelspacing=3,\n handletextpad=-2,\n columnspacing=8,\n title=legend_title,\n fontsize=8,\n loc=\"upper center\",\n bbox_to_anchor=(0.5, 1.3),\n ncol=len(legend_sizes),\n)\n\nplt.grid(True)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"scatter_12.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_163", "content": { "Year": [ 2017, 2018, 2019, 2020, 2021 ], "City 1 Temperature": [ 15, 16, 15.5, 16.5, 17 ], "City 2 Temperature": [ 14, 14.5, 15, 15.2, 15.8 ], "City 3 Temperature": [ 13, 13.2, 13.5, 14, 14.5 ], "City 1 Precipitation": [ 120, 110, 115, 130, 125 ], "City 2 Precipitation": [ 95, 100, 105, 110, 115 ], "City 3 Precipitation": [ 80, 85, 90, 95, 100 ] }, "visual_intent": "A figure with 6 subplots: (1) a combined line and scatter chart about Year and City 1 Temperature, titled Temperature in City 1, (2) a combined line and scatter chart about Year and City 2 Temperature, titled Temperature in City 2, (3) a combined line and scatter chart about Year and City 3 Temperature, titled Temperature in City 3, (4) a combined line and scatter chart about Year and City 1 Precipitation, titled Precipitation in City 1, (5) a combined line and scatter chart about Year and City 2 Precipitation, titled Precipitation in City 2, (6) a combined line and scatter chart about Year and City 3 Precipitation, titled Precipitation in City 3(size of the desired plot: width=18.0, height=10.0)", "path_to_gt_image": "images/scatter_100.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(1)\n# Prepare data\nyears = np.array([2017, 2018, 2019, 2020, 2021]) # Years\ncity1_temp = np.array([15, 16, 15.5, 16.5, 17]) # Avg temp in city 1\ncity2_temp = np.array([14, 14.5, 15, 15.2, 15.8]) # Avg temp in city 2\ncity3_temp = np.array([13, 13.2, 13.5, 14, 14.5]) # Avg temp in city 3\n\ncity1_precip = np.array([120, 110, 115, 130, 125]) # Precipitation in city 1\ncity2_precip = np.array([95, 100, 105, 110, 115]) # Precipitation in city 2\ncity3_precip = np.array([80, 85, 90, 95, 100]) # Precipitation in city 3\n\nsizes_temp = np.random.randint(100, 300, size=len(years))\nsizes_precip = np.random.randint(100, 300, size=len(years))\n\nlabels = [\"City 1 Temperature\", \"City 2 Temperature\", \"City 3 Temperature\"]\ntitles = [\"Temperature in City 1\", \"Temperature in City 2\", \"Temperature in City 3\"]\nxlabel = \"Year\"\nylabel_temp = \"Average Temperature (°C)\"\nylabel_precip = \"Precipitation (mm)\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create subplots with 2 rows and 3 columns\nfig, axs = plt.subplots(2, 3, figsize=(18, 10))\n\n# Define color schemes\ncolors_temp = [\"red\", \"orange\", \"yellow\"]\ncolors_precip = [\"blue\", \"cyan\", \"skyblue\"]\n\n# Plot temperature data\nfor ax, temp, sizes, color, label, title in zip(\n axs[0],\n [city1_temp, city2_temp, city3_temp],\n [sizes_temp, sizes_temp, sizes_temp],\n colors_temp,\n labels,\n titles,\n):\n scatter = ax.scatter(\n years,\n temp,\n s=sizes,\n c=np.linspace(0.1, 1, len(years)),\n cmap=\"autumn\", # Warm colors for temperature\n alpha=0.6,\n label=label,\n marker=\"o\",\n )\n ax.plot(years, temp, linestyle=\"--\", color=color, linewidth=2, alpha=0.7)\n ax.set_title(title)\n ax.set_xlabel(xlabel)\n ax.set_ylabel(ylabel_temp)\n ax.legend()\n\n# Plot precipitation data\nfor ax, precip, sizes, color, label, title in zip(\n axs[1],\n [city1_precip, city2_precip, city3_precip],\n [sizes_precip, sizes_precip, sizes_precip],\n colors_precip,\n [\"City 1 Precipitation\", \"City 2 Precipitation\", \"City 3 Precipitation\"],\n [\"Precipitation in City 1\", \"Precipitation in City 2\", \"Precipitation in City 3\"],\n):\n scatter = ax.scatter(\n years,\n precip,\n s=sizes,\n c=np.linspace(0.1, 1, len(years)),\n cmap=\"winter\", # Cool colors for precipitation\n alpha=0.6,\n label=label,\n marker=\"s\",\n )\n ax.plot(years, precip, linestyle=\"-.\", color=color, linewidth=2, alpha=0.7)\n ax.set_title(title)\n ax.set_xlabel(xlabel)\n ax.set_ylabel(ylabel_precip)\n ax.legend()\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better presentation\nplt.tight_layout()\n# Show the plot\nplt.savefig(\"scatter_100.pdf\", bbox_inches=\"tight\")\n", "width": 18.0, "height": 10.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_164", "content": { "Categories": [ "SEQ", "REPLAY", "MTL" ], "Probing FGT": [ -9.44, -9.12, -3.51 ], "Observed FGT": [ -84.3, -37.9, -3.67 ], "Feature Embedding Distance": [ 0.83, 0.6, 0.11 ] }, "visual_intent": "A grouped bar chart with dual y-axes about categories, FGT accuracy, and feature embedding distance(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/bar_7.jpg", "original_category": "bar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data\ncategories = [\"SEQ\", \"REPLAY\", \"MTL\"]\nprobing_fgt = [-9.44, -9.12, -3.51]\nobserved_fgt = [-84.30, -37.90, -3.67]\nfeature_embedding_distance = [0.83, 0.60, 0.11]\n\nlabels = [\"Probing FGT\", \"Observed FGT\", \"Feature Embedding Distance\"]\nxlabel = \"Categories\"\nylabel = \"Accuracy (%)\"\nylabel2 = \"Feature Embedding Distance\"\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nxticks = np.arange(len(categories))\nylim = [-100, 100]\nylim2 = [-1, 1]\nnum_yticks = 5\nyticks = np.linspace(-100, 0, num_yticks)\nyticks2 = np.linspace(0, 1, num_yticks)\n\n# Create figure and axes\nfig, ax1 = plt.subplots(\n figsize=(8, 6)\n) # Adjusted to match the original image's dimensions\n# Create a second y-axis\nax2 = ax1.twinx()\n\n# Bar plots\nbar_width = 0.25\nindex = np.arange(len(categories))\n\nbar1 = ax1.bar(\n index,\n probing_fgt,\n bar_width,\n label=labels[0],\n color=\"#6e7a5f\",\n edgecolor=\"black\",\n zorder=3,\n)\nbar2 = ax1.bar(\n index + bar_width,\n observed_fgt,\n bar_width,\n label=labels[1],\n color=\"#b8b7a5\",\n edgecolor=\"black\",\n zorder=3,\n)\nbar3 = ax2.bar(\n index + 2 * bar_width,\n feature_embedding_distance,\n bar_width,\n label=labels[2],\n color=\"#f4f1e0\",\n edgecolor=\"black\",\n zorder=3,\n)\n\n# Add values on top of the bars\nfor bars in [bar1, bar2]:\n for bar in bars:\n height = bar.get_height()\n ax1.annotate(\n \"{}\".format(height),\n xy=(bar.get_x() + bar.get_width() / 2, height - 4),\n xytext=(0, 3), # 3 points vertical offset\n textcoords=\"offset points\",\n ha=\"center\",\n va=\"top\",\n )\nfor bars in [bar3]:\n for bar in bars:\n height = bar.get_height()\n ax2.annotate(\n \"{}\".format(height),\n xy=(bar.get_x() + bar.get_width() / 2, height),\n xytext=(0, 3), # 3 points vertical offset\n textcoords=\"offset points\",\n ha=\"center\",\n va=\"bottom\",\n )\n\n# Set the axes background color and add grid lines\nfor ax in [ax1, ax2]:\n ax.set_facecolor(\"#e6e6e6\") # Set the axes background color\n ax.grid(True, color=\"white\", zorder=2) # Add grid lines\n\n# Axes labels and title\nax1.set_xlabel(xlabel)\nax1.set_ylabel(ylabel)\n# ax1.set_title('Comparison of FGT and Feature Embedding Distance')\nax2.set_ylabel(ylabel2)\n\n# Set x-axis category labels\nax1.set_ylim(ylim)\nax2.set_ylim(ylim2)\nax1.set_xticks(index + bar_width)\nax1.set_xticklabels(categories)\n\n# Calculate the number of y-ticks on the left y-axis\nnum_yticks = 5\nax1.set_yticks(yticks)\nax2.set_yticks(yticks2)\n\n# Create legend & Show plot\nhandles, labels = ax1.get_legend_handles_labels()\nhandles2, labels2 = ax2.get_legend_handles_labels()\nfig.legend(\n handles + handles2,\n labels + labels2,\n loc=\"lower right\",\n bbox_to_anchor=(0.9, 0.1),\n frameon=False,\n framealpha=0,\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust the subplot layout and save the figure\nplt.tight_layout()\nplt.savefig(\"bar_7.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" }, { "id": "test_165", "content": { "Error Types": [ "Type", "Span", "T&S", "Spurious", "Total" ], "USA_Manual Mapping": [ 55, 20, 40, 10, 50 ], "USA_LLM-revision": [ 60, 30, 45, 15, 55 ], "USA_LLM-revision w/CoT": [ 70, 40, 50, 20, 65 ], "USA_VerifNER": [ 80, 50, 55, 25, 75 ], "Canada_Manual Mapping": [ 50, 25, 35, 15, 45 ], "Canada_LLM-revision": [ 55, 35, 40, 20, 50 ], "Canada_LLM-revision w/CoT": [ 65, 45, 50, 25, 60 ], "Canada_VerifNER": [ 75, 55, 60, 30, 70 ] }, "visual_intent": "A figure with 2 subplots: (1) a grouped bar chart about error types and error correction rates for USA, (2) a grouped bar chart about error types and error correction rates for Canada, titled Error Correction Rate (%) for Different Geographic Regions(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/bar_106.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for USA\nusa_categories = [\"Type\", \"Span\", \"T&S\", \"Spurious\", \"Total\"]\nusa_manual_mapping = [55, 20, 40, 10, 50]\nusa_llm_revision = [60, 30, 45, 15, 55]\nusa_llm_revision_wcot = [70, 40, 50, 20, 65]\nusa_verifner = [80, 50, 55, 25, 75]\n\n# Data for Canada\ncanada_categories = [\"Type\", \"Span\", \"T&S\", \"Spurious\", \"Total\"]\ncanada_manual_mapping = [50, 25, 35, 15, 45]\ncanada_llm_revision = [55, 35, 40, 20, 50]\ncanada_llm_revision_wcot = [65, 45, 50, 25, 60]\ncanada_verifner = [75, 55, 60, 30, 70]\n\nlabels = [\"Manual Mapping\", \"LLM-revision\", \"LLM-revision w/CoT\", \"VerifNER\"]\ntitle = \"Error Correction Rate (%) for Different Geographic Regions\"\ntitle1 = \"USA\"\ntitle2 = \"Canada\"\n\n# Axis and Legend Labels\nxlabel = \"Error Types\"\nylabel = \"Error Correction Rate (%)\"\nlegend_location = \"upper right\"\n\nylim1 = [0, 90]\nyticks1 = np.arange(0, 91, 15)\nylim2 = [0, 90]\nyticks2 = np.arange(0, 91, 15)\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n\n# Set up the figure and axes\nfig, axs = plt.subplots(2, 1, figsize=(10, 8)) # Width, Height in inches\n\n# Colors\ncolors = [\"#49759c\", \"#7da6a6\", \"#dea06e\", \"#948b57\"]\nx = np.arange(len(usa_categories))\nwidth = 0.18 # Adjust this value to change the width of the bars\nspacing = 0.2 # Adjust this value to change the spacing between the bars\n\n# Plot for USA\naxs[0].bar(\n x - spacing * 1.5,\n usa_manual_mapping,\n width,\n label=labels[0],\n color=colors[0],\n)\naxs[0].bar(x - spacing / 2, usa_llm_revision, width, label=labels[1], color=colors[1])\naxs[0].bar(\n x + spacing / 2,\n usa_llm_revision_wcot,\n width,\n label=labels[2],\n color=colors[2],\n)\naxs[0].bar(x + spacing * 1.5, usa_verifner, width, label=labels[3], color=colors[3])\naxs[0].set_title(title1, fontsize=14)\naxs[0].set_xticks(x)\naxs[0].set_xticklabels(usa_categories, fontsize=12)\naxs[0].set_ylim(ylim1)\naxs[0].set_yticks(yticks1)\naxs[0].legend(loc=legend_location, ncol=2, fontsize=10)\n\n# Plot for Canada\nx = np.arange(len(canada_categories))\naxs[1].bar(x - spacing * 1.5, canada_manual_mapping, width, color=colors[0])\naxs[1].bar(x - spacing / 2, canada_llm_revision, width, color=colors[1])\naxs[1].bar(x + spacing / 2, canada_llm_revision_wcot, width, color=colors[2])\naxs[1].bar(x + spacing * 1.5, canada_verifner, width, color=colors[3])\naxs[1].set_title(title2, fontsize=14)\naxs[1].set_xticks(x)\naxs[1].set_xticklabels(canada_categories, fontsize=12)\naxs[1].set_ylim(ylim2)\naxs[1].set_yticks(yticks2)\n\n# Add a common y-axis label and a super title\nfig.text(\n 0.0001,\n 0.5,\n ylabel,\n va=\"center\",\n rotation=\"vertical\",\n fontsize=12,\n)\nfig.suptitle(title, fontsize=16)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the figure\nplt.tight_layout()\nplt.savefig(\"bar_106.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "bar" }, { "id": "test_166", "content": { "Art Movements": [ "Impressionism", "Cubism", "Surrealism", "Expressionism", "Baroque", "Renaissance", "Modernism", "Realism" ], "Majority Preference": [ 0.85, 0.8, 0.75, 0.7, 0.65, 0.6, 0.55, 0.5 ], "Minority Preference": [ 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5 ] }, "visual_intent": "A scatter plot about Art Movements and Preference Rating, titled Art Movement Preferences across Different Styles (Art Survey)(size of the desired plot: width=8.0, height=4.0)", "path_to_gt_image": "images/scatter_65.jpg", "original_category": "scatter", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data for plotting\ncategories = [\n \"Impressionism\",\n \"Cubism\",\n \"Surrealism\",\n \"Expressionism\",\n \"Baroque\",\n \"Renaissance\",\n \"Modernism\",\n \"Realism\",\n]\nmajority_preference = [0.85, 0.80, 0.75, 0.70, 0.65, 0.60, 0.55, 0.50]\nminority_preference = [0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50]\nxlabel = \"Art Movements\"\nylabel = \"Preference Rating\"\nlabels = [\"Majority Preference\", \"Minority Preference\"]\ntitle = \"Art Movement Preferences across Different Styles (Art Survey)\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set figure size\nplt.figure(figsize=(8, 4))\n\n# Plotting the data\nplt.scatter(categories, majority_preference, color=\"#FF5733\", label=labels[0], marker='o')\nplt.scatter(categories, minority_preference, color=\"#33C1FF\", label=labels[1], marker='s')\n\n# Adding labels and title\nplt.xlabel(xlabel, fontsize=12)\nplt.ylabel(ylabel, fontsize=12)\nplt.title(title, fontsize=14)\n\n# Adding grid\nplt.grid(True, linestyle=\"--\", linewidth=0.5)\n\n# Rotate x-axis labels for better readability\nplt.xticks(rotation=45, fontsize=10)\nplt.ylim(0, 1)\n\n# Adjusting legend placement\nplt.legend(loc=\"upper right\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout\nplt.tight_layout()\nplt.savefig(\"scatter_65.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 4.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_167", "content": { "Years": [ 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 ], "Civil Cases": [ 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500 ], "Criminal Cases": [ 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300 ] }, "visual_intent": "A stacked bar chart showing the breakdown of civil and criminal cases handled by courts across different years, titled \"Number of Cases Handled by Courts Over Years\"(size of the desired plot: width=12.0, height=7.0)", "path_to_gt_image": "images/PIP_25.jpg", "original_category": "PIP", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(1)\n# Generate some dummy data for the law domain\ncivil_cases = [500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500]\ncriminal_cases = [300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300]\nyears = range(2011, 2022)\nlabels = [\"Civil Cases\", \"Criminal Cases\"]\nxlabel = \"Years\"\nxlim = [2010.5, 2021.5]\nylim = [0, 3300]\nylabel = \"Number of Cases\"\nxticks = np.arange(2011, 2022, 1)\nyticks = np.arange(0, 3301, 500)\nleft, bottom, width, height = [0.2, 0.5, 0.3, 0.3]\ninsetxlim = [2010.5, 2016.5]\ninsetxticks = np.arange(2011, 2017, 1)\ninsetylim = [0, 2200]\ninsetyticks = np.arange(0, 2201, 300)\nmainpointleft = [2011, 1300]\nmainpointright = [2016, 1100]\ninsetleft = [2011, 0]\ninsetright = [2016, 0]\ntitle = \"Number of Cases Handled by Courts Over Years\"\nsuptitle = \"Analysis of Civil and Criminal Cases\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create main plot with adjusted bar widths and white borders\nfig, ax_main = plt.subplots(figsize=(12, 7))\nbar_width = 0.3 # Slightly less than the bin width to create a gap\nax_main.bar(\n years,\n civil_cases,\n width=bar_width,\n color=\"#8B4513\", # SaddleBrown color for civil cases\n align=\"center\",\n label=labels[0],\n edgecolor=\"white\",\n)\nax_main.bar(\n years,\n criminal_cases,\n width=bar_width,\n color=\"#A52A2A\", # Brown color for criminal cases\n align=\"center\",\n bottom=civil_cases,\n label=labels[1],\n edgecolor=\"white\",\n)\nax_main.set_xlabel(xlabel, fontsize=14)\nax_main.set_xlim(xlim)\nax_main.set_xticks(xticks)\nax_main.set_ylabel(ylabel, fontsize=14)\nax_main.set_ylim(ylim)\nax_main.set_yticks(yticks)\nax_main.legend(loc=\"upper left\", prop={\"size\": 12})\nax_main.grid()\nax_main.set_title(title, fontsize=16)\nfig.suptitle(suptitle, fontsize=18)\n\n# Create inset plot with adjusted bar widths and white borders\nax_inset = fig.add_axes([left, bottom, width, height])\nax_inset.bar(\n years[:6],\n civil_cases[:6],\n width=bar_width,\n color=\"#8B4513\",\n align=\"center\",\n edgecolor=\"white\",\n)\nax_inset.bar(\n years[:6],\n criminal_cases[:6],\n width=bar_width,\n color=\"#A52A2A\",\n align=\"center\",\n bottom=civil_cases[:6],\n edgecolor=\"white\",\n)\nax_inset.set_xlim(insetxlim) # Zoom in on the right part of the data\nax_inset.set_xticks(insetxticks) # Zoom in on the right part of the data\nax_inset.set_ylim(insetylim)\nax_inset.set_yticks(insetyticks)\nax_inset.grid()\n\n# Adding lines to connect the plots.\n# Coordinates of the main plot corners\nmain_plot_left = ax_main.transData.transform_point(mainpointleft)\nmain_plot_right = ax_main.transData.transform_point(mainpointright)\n\n# Coordinates of the inset corners\ninset_left = ax_inset.transData.transform_point(insetleft)\ninset_right = ax_inset.transData.transform_point(insetright)\n\n# Transform to figure coordinates for annotation\nmain_plot_left = fig.transFigure.inverted().transform(main_plot_left)\nmain_plot_right = fig.transFigure.inverted().transform(main_plot_right)\ninset_left = fig.transFigure.inverted().transform(inset_left)\ninset_right = fig.transFigure.inverted().transform(inset_right)\n\n# Draw lines connecting corners\nfig.add_artist(\n plt.Line2D(\n (main_plot_left[0], inset_left[0]),\n (main_plot_left[1], inset_left[1]),\n color=\"gray\",\n )\n)\nfig.add_artist(\n plt.Line2D(\n (main_plot_right[0], inset_right[0]),\n (main_plot_right[1], inset_right[1]),\n color=\"gray\",\n )\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"PIP_25.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 7.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_168", "content": { "Years": [ 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 ], "Liberal Support": [ 20, 25, 27, 30, 35, 40, 45, 50, 55, 57, 60 ], "Conservative Support": [ 30, 35, 37, 38, 40, 43, 45, 47, 50, 52, 55 ] }, "visual_intent": "A grouped bar chart about political support trends over time with a zoomed inset view, titled Political Support Trends Over Time(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/PIP_66.jpg", "original_category": "PIP", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# Generate some political data\nliberal_support = [20, 25, 27, 30, 35, 40, 45, 50, 55, 57, 60] # Liberal Support (in %)\nconservative_support = [\n 30,\n 35,\n 37,\n 38,\n 40,\n 43,\n 45,\n 47,\n 50,\n 52,\n 55,\n] # Conservative Support (in %)\nyears = list(range(2010, 2021))\nlabels = [\"Liberal Support\", \"Conservative Support\"]\nxmainlabel = \"Years\"\nxmainlim = [2009, 2021]\nxmainticks = list(range(2010, 2021))\nymainlabel = \"Support Percentage (%)\"\nymainlim = [0, 100]\nymainticks = list(range(0, 101, 10))\n\nxinsetlim = [2015, 2021]\nxinsetticks = list(range(2016, 2022))\nyinsetlim = [0, 60]\nyinsetticks = list(range(0, 61, 10))\n\ntitle_main = \"Political Support Trends Over Time\"\ntitle_inset = \"Zoomed View (2015-2021)\"\n\n# Coordinates for lines connecting the plots (main and inset)\nmainplotline = [(2015.5, 0), (2021, 0)]\nmaininsetline = [(2015, 0), (2021, 0)]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create main plot with adjusted bar widths and white borders\nfig, ax_main = plt.subplots(figsize=(10, 6))\nbar_width = 0.4 # Slightly less than the year interval to create a gap\n\n# Liberal support bar\nax_main.bar(\n [year - bar_width / 2 for year in years],\n liberal_support,\n width=bar_width,\n color=\"#FF5733\", # Red for Liberal Support\n align=\"center\",\n label=labels[0],\n edgecolor=\"white\",\n)\n\n# Conservative support bar\nax_main.bar(\n [year + bar_width / 2 for year in years],\n conservative_support,\n width=bar_width,\n color=\"#337AB7\", # Blue for Conservative Support\n align=\"center\",\n label=labels[1],\n edgecolor=\"white\",\n)\n\nax_main.set_xlabel(xmainlabel)\nax_main.set_xlim(xmainlim)\nax_main.set_xticks(xmainticks)\nax_main.set_ylabel(ymainlabel)\nax_main.set_ylim(ymainlim)\nax_main.set_yticks(ymainticks)\nax_main.legend(loc=\"upper left\", prop={\"size\": 12})\nax_main.set_title(title_main)\n\n# Inset plot configuration\nax_inset = fig.add_axes([0.55, 0.58, 0.3, 0.3])\nax_inset.bar(\n [year - bar_width / 2 for year in years[5:]],\n liberal_support[5:],\n width=bar_width,\n color=\"#FF5733\",\n align=\"center\",\n edgecolor=\"white\",\n)\nax_inset.bar(\n [year + bar_width / 2 for year in years[5:]],\n conservative_support[5:],\n width=bar_width,\n color=\"#337AB7\",\n align=\"center\",\n edgecolor=\"white\",\n)\nax_inset.set_xlim(xinsetlim) # Zoom in on the years 2015-2021\nax_inset.set_xticks(xinsetticks)\nax_inset.set_ylim(yinsetlim)\nax_inset.set_yticks(yinsetticks)\nax_inset.set_title(title_inset)\n\n# Adding lines to connect the plots.\n# Coordinates of the main plot corners\nmain_plot_left = ax_main.transData.transform_point(mainplotline[0])\nmain_plot_right = ax_main.transData.transform_point(mainplotline[1])\n\n# Coordinates of the inset corners\ninset_left = ax_inset.transData.transform_point(maininsetline[0])\ninset_right = ax_inset.transData.transform_point(maininsetline[1])\n\n# Transform to figure coordinates for annotation\nmain_plot_left = fig.transFigure.inverted().transform(main_plot_left)\nmain_plot_right = fig.transFigure.inverted().transform(main_plot_right)\ninset_left = fig.transFigure.inverted().transform(inset_left)\ninset_right = fig.transFigure.inverted().transform(inset_right)\n\n# Draw lines connecting corners\nfig.add_artist(\n plt.Line2D(\n (main_plot_left[0], inset_left[0]),\n (main_plot_left[1], inset_left[1]),\n color=\"gray\",\n )\n)\nfig.add_artist(\n plt.Line2D(\n (main_plot_right[0], inset_right[0]),\n (main_plot_right[1], inset_right[1]),\n color=\"gray\",\n )\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"PIP_66.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_169", "content": { "Pie_Labels": [ "Transportation", "Industry", "Residential" ], "Pie_Sizes": [ 45.0, 35.0, 20.0 ], "Pie_Counts": [ 450, 350, 200 ], "Bar_Labels": [ "Road Transport", "Aviation", "Shipping" ], "Bar_Sizes": [ 70.0, 20.0, 10.0 ], "Bar_Counts": [ 70, 20, 10 ] }, "visual_intent": "A figure with 2 subplots: (1) a pie chart about general carbon emission sectors, (2) a stacked bar chart showing the breakdown of transport emissions, titled Carbon Emissions Breakdown(size of the desired plot: width=10.0, height=5.0)", "path_to_gt_image": "images/CB_74.jpg", "original_category": "CB", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Data for pie chart\npie_labels = [\"Transportation\", \"Industry\", \"Residential\"]\npie_sizes = [45.0, 35.0, 20.0]\npie_counts = [450, 350, 200]\n\n# Data for stacked bar chart\nbar_labels = [\"Road Transport\", \"Aviation\", \"Shipping\"]\nbar_sizes = [70.0, 20.0, 10.0]\nbar_counts = [70, 20, 10]\n\ntitle = \"Carbon Emissions Breakdown\"\n\n# Textual elements\nxlabel = \"\"\nylabel = \"\"\nlegend_labels = [\"Road Transport\", \"Aviation\", \"Shipping\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\npie_colors = [\"#66c2a5\", \"#fc8d62\", \"#8da0cb\"]\nbar_colors = [\"#fee08b\", \"#e6f598\", \"#d53e4f\"]\n\n# Pie chart\nfig, (ax1, ax2) = plt.subplots(\n 1, 2, figsize=(10, 5), gridspec_kw={\"width_ratios\": [6, 1]}\n)\n\nax1.pie(\n pie_sizes,\n labels=pie_labels,\n colors=pie_colors,\n autopct=lambda p: \"{:.1f}%\\n({})\".format(p, int(round(p * sum(pie_counts) / 100))),\n startangle=140,\n)\nax1.axis(\"equal\") # Equal aspect ratio ensures that pie is drawn as a circle.\n\n# Stacked bar chart\nbar_positions = [0] # Single bar at position 0\nbottom = 0 # Initial bottom is 0 for the first bar segment\n\nfor size, color, count, bar_label in zip(bar_sizes, bar_colors, bar_counts, bar_labels):\n ax2.bar(\n bar_positions,\n [size],\n color=color,\n edgecolor=None,\n bottom=[bottom],\n label=bar_label,\n width=0.1,\n )\n # Calculate the middle position for the text\n mid_pos = bottom + (size / 2)\n # Add text annotation inside the bar\n ax2.text(\n 0,\n mid_pos,\n \"{} {}%\".format(bar_label, size),\n color=\"black\",\n ha=\"center\",\n va=\"center\",\n )\n bottom += size # Update bottom for the next bar segment\n\nax2.set_axis_off()\n\n# set the title\nax2.set_title(title)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save plot\nplt.tight_layout()\nplt.savefig(\"CB_74.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 5.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_170", "content": { "Sales_Region": [ "North", "South", "East", "West", "Central", "Others" ], "Sales_Distribution_Value": [ 50, 30, 10, 5, 3, 2 ], "Satisfaction_Region": [ "North", "South", "East", "West", "Central", null ], "Satisfaction_Value": [ 40, 30, 15, 10, 5, null ] }, "visual_intent": "A figure with 2 subplots: (1) a treemap about Sales Distribution by Region, (2) a pie chart about Customer Satisfaction Ratings by Region, titled Business Data Analysis(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/multidiff_26.jpg", "original_category": "multidiff", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\nfrom matplotlib.gridspec import GridSpec\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Treemap data for sales distribution by region\nsizes_treemap = [50, 30, 10, 5, 3, 2]\nlabels_treemap = [\n \"North\\n50%\",\n \"South\\n30%\",\n \"East\\n10%\",\n \"West\\n5%\",\n \"Central\\n3%\",\n \"Others\\n2%\",\n]\n\n# Pie chart data for customer satisfaction ratings by region\nsizes_pie = [40, 30, 15, 10, 5]\nlabels_pie = [\"North\", \"South\", \"East\", \"West\", \"Central\"]\n\ntitle = \"Customer Satisfaction Ratings by Region\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors_treemap = [\"#66c2a5\", \"#fc8d62\", \"#8da0cb\", \"#e78ac3\", \"#a6d854\", \"#ffd92f\"]\ncolors_pie = [\"#66c2a5\", \"#fc8d62\", \"#8da0cb\", \"#e78ac3\", \"#a6d854\"]\nexplode_pie = (0.1, 0, 0, 0, 0) # Highlight the first slice\n\n# Create figure and set GridSpec\nfig = plt.figure(figsize=(12, 6))\ngs = GridSpec(1, 2, figure=fig)\n\n# General title for the figure\nfig.suptitle('Business Data Analysis', fontsize=16)\n\n# Create treemap subplot\nax1 = fig.add_subplot(gs[0, 0])\nsquarify.plot(\n sizes=sizes_treemap,\n label=labels_treemap,\n color=colors_treemap,\n alpha=0.8,\n text_kwargs={\"fontsize\": 14, \"weight\": \"bold\"}\n)\nax1.axis(\"off\") # Disable the axes\nax1.set_title(\"Sales Distribution by Region\", fontsize=14, pad=10)\n\n# Create pie chart subplot\nax2 = fig.add_subplot(gs[0, 1])\nwedges, texts, autotexts = ax2.pie(\n sizes_pie,\n explode=explode_pie,\n labels=labels_pie,\n colors=colors_pie,\n autopct=\"%1.1f%%\",\n shadow=True,\n startangle=90,\n textprops={'fontsize': 12, 'weight': 'bold'}\n)\nax2.set_title(title, fontsize=14, pad=20)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the figure\nplt.tight_layout(rect=[0, 0, 1, 0.95])\nplt.savefig(\"multidiff_26.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_171", "content": { "Transportation Mode": [ "Car", "Bus", "Train", "Bicycle", "Airplane", "Boat", "Motorbike", "Walk" ], "Market Share (%)": [ 35.0, 20.0, 15.0, 10.0, 8.0, 6.0, 4.0, 2.0 ] }, "visual_intent": "A treemap about transportation modes and market share, titled Market Share of Different Modes of Transportation(size of the desired plot: width=12.0, height=8.0)", "path_to_gt_image": "images/tree_41.jpg", "original_category": "tree", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data\nsizes = [35.00, 20.00, 15.00, 10.00, 8.00, 6.00, 4.00, 2.00]\nlabels = [\n \"Car\\n35.00%\",\n \"Bus\\n20.00%\",\n \"Train\\n15.00%\",\n \"Bicycle\\n10.00%\",\n \"Airplane\\n8.00%\",\n \"Boat\\n6.00%\",\n \"Motorbike\\n4.00%\",\n \"Walk\\n2.00%\",\n]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with the specified size\nfig = plt.figure(figsize=(12, 8))\n\ncolors = [\n \"#1f77b4\", # Car\n \"#ff7f0e\", # Bus\n \"#2ca02c\", # Train\n \"#d62728\", # Bicycle\n \"#9467bd\", # Airplane\n \"#8c564b\", # Boat\n \"#e377c2\", # Motorbike\n \"#7f7f7f\", # Walk\n]\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes, label=labels, color=colors, alpha=0.8, text_kwargs={\"fontsize\": 18}\n)\n\n\n# Remove axes\nplt.axis(\"off\")\n\n# Set the title\nplt.title(\"Market Share of Different Modes of Transportation\", fontsize=24)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout and save to file\nplt.tight_layout()\nplt.savefig(\"tree_41.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 8.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_172", "content": { "Technology": [ "4G", "4G", "5G", "5G", "Wi-Fi", "Wi-Fi", "Bluetooth", "Bluetooth", "Zigbee", "Zigbee", "LoRaWAN", "LoRaWAN" ], "Data Rate (Mbps)": [ 10, 20, 30, 40, 15, 25, 5, 15, 3, 10, 2, 8 ], "Signal Quality (WRMSE)": [ 450, 350, 300, 250, 400, 330, 500, 450, 520, 480, 600, 550 ] }, "visual_intent": "A scatter plot about Data Rate (Mbps) and Signal Quality (WRMSE) for various communication technologies, titled Communication Technologies: Signal Quality vs Data Rate(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/scatter_40.jpg", "original_category": "scatter", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data points for each group representing communication technologies\ng4 = [(10, 450), (20, 350)]\ng5 = [(30, 300), (40, 250)]\nwifi = [(15, 400), (25, 330)]\nbluetooth = [(5, 500), (15, 450)]\nzigbee = [(3, 520), (10, 480)]\nlorawan = [(2, 600), (8, 550)]\nlabels = [\"4G\", \"5G\", \"Wi-Fi\", \"Bluetooth\", \"Zigbee\", \"LoRaWAN\"]\nxlabel = \"Data Rate (Mbps)\"\nylabel = \"Signal Quality (WRMSE)\"\ntitle = \"Communication Technologies: Signal Quality vs Data Rate\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a scatter plot\nfig, ax = plt.subplots(figsize=(8, 6))\n\n# Define color and marker scheme\ncolors = [\"#1f77b4\", \"#ff7f0e\", \"#2ca02c\", \"#d62728\", \"#9467bd\", \"#8c564b\"]\nmarkers = [\"o\", \"s\", \"D\", \"^\", \"v\", \"<\"]\n\n# Plot each group with different color and marker\nax.scatter(*zip(*g4), color=colors[0], label=labels[0], marker=markers[0])\nax.scatter(*zip(*g5), color=colors[1], label=labels[1], marker=markers[1])\nax.scatter(*zip(*wifi), color=colors[2], label=labels[2], marker=markers[2])\nax.scatter(*zip(*bluetooth), color=colors[3], label=labels[3], marker=markers[3])\nax.scatter(*zip(*zigbee), color=colors[4], label=labels[4], marker=markers[4])\nax.scatter(*zip(*lorawan), color=colors[5], label=labels[5], marker=markers[5])\n\n# Add legend\nax.legend(loc=\"upper right\")\n\n# Add labels and title\nax.set_xlabel(xlabel, fontsize=12)\nax.set_ylabel(ylabel, fontsize=12)\nax.set_title(title, fontsize=14)\nax.grid(True) # Adding grid\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nfig.tight_layout()\nplt.savefig(\"scatter_40.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_173", "content": { "Civilization": [ "Roman Empire", "Ancient Egypt", "Ancient China", "Ancient Greece" ], "Civilization_Prominence": [ 35, 25, 20, 20 ], "Roman_Period": [ "Republic Period", "Imperial Period", "Late Antiquity", "Byzantine Period" ], "Roman_Period_Size": [ 20, 40, 20, 20 ] }, "visual_intent": "A concentric pie chart about historical civilizations and Roman periods, titled Historical Eras and Prominent Periods(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/pie_24.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n\n# Historical periods for the outer ring\nouter_labels = [\"Roman Empire\", \"Ancient Egypt\", \"Ancient China\", \"Ancient Greece\"]\nouter_sizes = [35, 25, 20, 20] # Relative prominence sizes\n\n# Notable periods within the Roman Empire for the inner ring\ninner_labels = [\"Republic Period\", \"Imperial Period\", \"Late Antiquity\", \"Byzantine Period\"]\ninner_sizes = [20, 40, 20, 20] # Period sizes within Roman Empire\n\n# Chart labels\ntitle = \"Historical Eras and Prominent Periods\"\nsuptitle = \"Ancient Civilizations and Periods within the Roman Empire\"\nlegendlabels = outer_labels\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, ax = plt.subplots(figsize=(8, 8))\n# Appropriate historical color palette\nouter_colors = [\"#d9bf77\", \"#e79962\", \"#9c755f\", \"#4b8d8f\"]\ninner_colors = [\"#f0e4d7\", \"#e0bb95\", \"#b8a892\", \"#8f6c5d\"]\n\n# Outer ring\nwedges, texts, autotexts = ax.pie(\n outer_sizes,\n labels=outer_labels,\n radius=1.2,\n colors=outer_colors,\n autopct=\"%1.1f%%\",\n pctdistance=0.85,\n startangle=140,\n)\n\n# Inner ring\nwedges2, texts2, autotexts2 = ax.pie(\n inner_sizes,\n radius=0.8,\n colors=inner_colors,\n autopct=\"%1.1f%%\",\n pctdistance=0.75,\n startangle=140,\n)\n\n# Equal aspect ratio ensures that pie chart is drawn as a circle\nax.axis(\"equal\")\n\n# Adding a title and supertitle\nplt.title(title, fontsize=16)\nplt.suptitle(suptitle, fontsize=12)\n\n# Adding a legend with outer labels\nax.legend(wedges, legendlabels, loc=\"center left\", bbox_to_anchor=(1, 0.5))\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"pie_24.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_174", "content": { "Quarter": [ "Q1", "Q2", "Q3", "Q4" ], "Action Movies": [ 55, 52, 60, 58 ], "Comedy Movies": [ 48, 50, 53, 51 ], "Drama Movies": [ 45, 47, 49, 46 ], "Sci-Fi Movies": [ 62, 65, 70, 68 ], "Baseline Revenue": [ 50, 50, 50, 50 ] }, "visual_intent": "A grouped bar chart with an overlaying line chart about movie genres and quarterly revenue, titled Quarterly Box Office Revenue by Movie Genre(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/errorbar_59.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data\nquarters = [1, 2, 3, 4]\nbaseline = [50] * len(quarters) # Average baseline revenue in millions\naction_movies = [55, 52, 60, 58]\ncomedy_movies = [48, 50, 53, 51]\ndrama_movies = [45, 47, 49, 46]\nsci_fi_movies = [62, 65, 70, 68]\nerrors = [2, 2.5, 3, 1.5]\n\n# Labels and Plot Types\nlabel1 = \"Action Movies\"\nlabel2 = \"Comedy Movies\"\nlabel3 = \"Drama Movies\"\nlabel4 = \"Sci-Fi Movies\"\nlabel_baseline = \"Baseline Revenue\"\n\n# Axes Limits and Labels\nxlabel_value = \"Quarter of the Year\"\nylabel_value = \"Average Box Office Revenue (in millions)\"\ntitle = \"Quarterly Box Office Revenue by Movie Genre\"\nxticklabels = [\"Q1\", \"Q2\", \"Q3\", \"Q4\"]\nylim_values = [40, 80]\nyticks_values = np.arange(40, 81, 10)\nlegend_title = \"Movie Genre\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting\nfig, ax = plt.subplots(figsize=(10, 6)) # Adjusted for the given dimensions\nbar_width = 0.2\nopacity = 0.8\n\nbar1 = ax.bar(\n np.array(quarters) - 1.5 * bar_width,\n action_movies,\n bar_width,\n alpha=opacity,\n color=\"#ff9999\",\n label=label1,\n yerr=errors,\n capsize=3,\n)\n\nbar2 = ax.bar(\n np.array(quarters) - 0.5 * bar_width,\n comedy_movies,\n bar_width,\n alpha=opacity,\n color=\"#66b3ff\",\n label=label2,\n yerr=errors,\n capsize=3,\n)\n\nbar3 = ax.bar(\n np.array(quarters) + 0.5 * bar_width,\n drama_movies,\n bar_width,\n alpha=opacity,\n color=\"#99ff99\",\n label=label3,\n yerr=errors,\n capsize=3,\n)\n\nbar4 = ax.bar(\n np.array(quarters) + 1.5 * bar_width,\n sci_fi_movies,\n bar_width,\n alpha=opacity,\n color=\"#ffcc99\",\n label=label4,\n yerr=errors,\n capsize=3,\n)\n\nax.plot(\n quarters,\n baseline,\n linestyle=\"--\",\n color=\"black\",\n linewidth=2,\n label=label_baseline,\n)\n\nax.set_xlabel(xlabel_value)\nax.set_ylabel(ylabel_value)\nax.set_title(title)\nax.set_xticks(quarters)\nax.set_xticklabels(xticklabels)\nax.set_ylim(ylim_values)\nax.set_yticks(yticks_values)\nax.legend(loc=\"upper left\", title=legend_title)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"errorbar_59.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_175", "content": { "Bias Type": [ "Confirmation Bias (35%)", "Anchoring (25%)", "Hindsight Bias (20%)", "Self-Serving Bias (10%)", "Availability Heuristic (5%)", "Overconfidence (5%)" ], "Percentage": [ 35, 25, 20, 10, 5, 5 ] }, "visual_intent": "A treemap about Cognitive Biases and their distribution percentages, titled Distribution of Cognitive Biases(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/tree_31.jpg", "original_category": "tree", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# Data\nsizes = [35, 25, 20, 10, 5, 5]\nlabels = [\"Confirmation Bias (35%)\", \"Anchoring (25%)\", \"Hindsight Bias (20%)\", \"Self-Serving Bias (10%)\", \"Availability Heuristic (5%)\", \"Overconfidence (5%)\"]\ntitle = 'Distribution of Cognitive Biases'\nxlabel = 'Bias Type'\nylabel = 'Percentage'\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with the specified size\nfig = plt.figure(figsize=(10, 6))\n\ncolors = [\"#1f77b4\", \"#aec7e8\", \"#ff7f0e\", \"#ffbb78\", \"#2ca02c\", \"#98df8a\"]\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes,\n label=labels,\n color=colors,\n alpha=0.8,\n text_kwargs={\"fontsize\": 12, \"color\": \"black\"},\n ec=\"white\"\n)\n\n# Add a title\nplt.title(title, fontsize=18, fontweight='bold')\n\n# Remove axes\nplt.axis(\"off\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout and save to file\nplt.tight_layout()\nplt.savefig(\"tree_31.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_176", "content": { "N": [ 4, 6, 10, 15, 30 ], "Standard": [ 1e-08, 0.001, 1e-05, 0.0001, 1e-06 ], "Constrained": [ 1e-12, 1e-13, 1e-12, 1e-11, 1e-10 ] }, "visual_intent": "A line chart about N, Standard, and Constrained values(size of the desired plot: width=9.0, height=6.0)", "path_to_gt_image": "images/line_9.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\nfrom matplotlib.ticker import FuncFormatter, FixedLocator\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for plotting\nN = np.array([4, 6, 10, 15, 30])\nstandard = np.array([1e-8, 1e-3, 1e-5, 1e-4, 1e-6])\nconstrained = np.array([1e-12, 1e-13, 1e-12, 1e-11, 1e-10])\n\n# Axes Limits and Labels\nxlabel_value = \"N\"\n\nyticks_values = [10**-2, 10**-4, 10**-6, 10**-8, 10**-10, 10**-12, 10**-14]\nyticks_labels = [\n \"$10^{-2}$\",\n \"$10^{-4}$\",\n \"$10^{-6}$\",\n \"$10^{-8}$\",\n \"$10^{-10}$\",\n \"$10^{-12}$\",\n \"$10^{-14}$\",\n]\nylim_values = [0.5e-15, 5e-2]\n\naxvline_x = 10**1\n\n# Labels\nlabel_Standard = \"Standard\"\nlabel_Constrained = \"Constrained\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nplt.figure(figsize=(9, 6))\nplt.plot(\n N,\n standard,\n \"o-\",\n label=label_Standard,\n color=\"#1f77b4\",\n linewidth=1.4,\n markersize=4,\n)\nplt.plot(\n N,\n constrained,\n \"x-\",\n label=label_Constrained,\n color=\"#ff7f0e\",\n markersize=6,\n markeredgewidth=1,\n)\n\n# Setting the x-axis and y-axis to log scale\nplt.xscale(\"log\")\nplt.yscale(\"log\")\n\n# Set y-axis to only display specific ticks and extend y-axis to leave space at top\nplt.yticks(\n yticks_values,\n yticks_labels,\n)\nplt.ylim(ylim_values) # Extend y-axis to leave some space above 10^-1\n\n# Disable the automatic grid for x-axis\nplt.grid(True, which=\"both\", ls=\"--\", axis=\"y\") # Only enable y-axis grid\n\n# Manually add a grid line for x=10**1\nplt.axvline(x=axvline_x, color=\"grey\", linestyle=\"--\", linewidth=0.5)\n\n# Adjusting x-axis ticks to only show x=10**1\nplt.gca().xaxis.set_major_locator(FixedLocator([10**1]))\n\n# Formatting the x-axis and y-axis tick labels\nplt.gca().xaxis.set_major_formatter(FuncFormatter(lambda value, _: \"10\"))\nplt.gca().yaxis.set_major_formatter(FuncFormatter(lambda y, _: \"{:.0e}\".format(y)))\n\n# Adding labels and title\nplt.xlabel(xlabel_value, fontsize=12)\n\n# Adding a legend at the center right\nplt.legend(loc=\"center left\", bbox_to_anchor=(0.67, 0.5), fontsize=18)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to reduce white space\nplt.tight_layout()\nplt.savefig(\"line_9.pdf\", bbox_inches=\"tight\")\n", "width": 9.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_177", "content": { "Metric": [ "Faith Strength", "Community Engagement", "Religious Knowledge", "Service Attendance", "Spiritual Practices" ], "Christianity": [ 4, 5, 3, 5, 4 ], "Islam": [ 3, 3, 4, 2, 5 ], "Buddhism": [ 5, 4, 5, 4, 3 ] }, "visual_intent": "A figure with 3 subplots: (1) a radar chart about religious metrics and scores, titled Christianity, (2) a radar chart about religious metrics and scores, titled Islam, (3) a radar chart about religious metrics and scores, titled Buddhism(size of the desired plot: width=14.0, height=8.0)", "path_to_gt_image": "images/radar_30.jpg", "original_category": "radar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Define the data for each religious group\nlabels = np.array([\"Faith Strength\", \"Community Engagement\", \"Religious Knowledge\", \"Service Attendance\", \"Spiritual Practices\"])\nstats = np.array([[4, 5, 3, 5, 4], [3, 3, 4, 2, 5], [5, 4, 5, 4, 3]])\ntitles = [\"Christianity\", \"Islam\", \"Buddhism\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the figure size\nfig, ax = plt.subplots(figsize=(14, 8), nrows=1, ncols=3, subplot_kw=dict(polar=True))\n\n# Define the number of variables\nnum_vars = len(labels)\n# Compute angle for each axis\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n# The plot is made circular\nstats = np.concatenate((stats, stats[:, [0]]), axis=1)\nangles += angles[:1]\n\n# Define color palette\ncolors = ['#1f77b4', '#ff7f0e', '#2ca02c']\n\n# Draw one radar chart for each religious group\nfor idx, (title, case_data) in enumerate(zip(titles, stats)):\n thisColor = colors[idx]\n ax[idx].fill(angles, case_data, color=thisColor, alpha=0.25)\n ax[idx].plot(angles, case_data, color=thisColor, linewidth=2, linestyle='-')\n ax[idx].set_yticks([1, 2, 3, 4, 5])\n ax[idx].set_yticklabels([\"1\", \"2\", \"3\", \"4\", \"5\"], color='grey', size=10)\n ax[idx].set_xticks(angles[:-1])\n ax[idx].set_xticklabels(labels, fontsize=12)\n ax[idx].set_title(title, size=16, color='black', position=(0.5, 1.1))\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit\nplt.tight_layout()\n\n# Show the plot\nplt.savefig(\"radar_30.pdf\", bbox_inches=\"tight\")\n", "width": 14.0, "height": 8.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "radar" }, { "id": "test_178", "content": { "Phenomena": [ "Heatwaves", "Floods", "Droughts", "Wildfires", "Hurricanes" ], "Mean Occurrence Rate": [ 0.5, 0.4, 0.35, 0.3, 0.25 ], "Error Minus": [ 0.05, 0.04, 0.03, 0.05, 0.04 ], "Error Plus": [ 0.03, 0.02, 0.02, 0.04, 0.03 ] }, "visual_intent": "An error bar plot about climate phenomena and occurrence rates, titled Cybersecurity Threat Incident Rates(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/errorpoint_16.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\ncategories = [\n \"Heatwaves\",\n \"Floods\",\n \"Droughts\",\n \"Wildfires\",\n \"Hurricanes\",\n]\nmeans = [0.50, 0.40, 0.35, 0.30, 0.25] # Example mean occurrence rates\nerrors = [0.05, 0.04, 0.03, 0.05, 0.04] # Example upper error margins\ndownerrors = [0.03, 0.02, 0.02, 0.04, 0.03] # Example lower error margins\nlegendtitles = [\"Dataset Mean\", \"Mean Occurrence\"]\ntexttitle = \"Climate Phenomena Occurrence\"\nylabel = \"Occurrence Rate (Fraction of total events)\"\ntitle = \"Cybersecurity Threat Incident Rates\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nfig, ax = plt.subplots(figsize=(10, 8))\n\n# Adjusting color scheme and marker style\nax.errorbar(\n categories,\n means,\n yerr=[errors, downerrors],\n fmt=\"o\",\n color=\"cyan\",\n ecolor=\"cyan\",\n capsize=5,\n markersize=8,\n markerfacecolor=\"purple\",\n markeredgewidth=2,\n)\n\n# Adding a legend with both \"Mean Occurrence\" and \"Dataset Mean\"\ndataset_mean = 0.29\nmean_line = ax.errorbar(\n [], [], yerr=[], fmt=\"^\", color=\"cyan\", ecolor=\"cyan\", capsize=5, markersize=8,\n markerfacecolor=\"purple\", markeredgewidth=2\n)\ndataset_mean_line = ax.axhline(\n y=dataset_mean, color=\"teal\", linestyle=\"--\", linewidth=2\n)\nax.legend(\n [dataset_mean_line, mean_line],\n legendtitles,\n loc=\"upper right\",\n fancybox=True,\n framealpha=1,\n shadow=True,\n borderpad=1,\n)\n\n# Adding a horizontal line for dataset mean and text annotation with a white background\nax.text(\n 0.95,\n dataset_mean,\n texttitle,\n va=\"center\",\n ha=\"right\",\n backgroundcolor=\"white\",\n transform=ax.get_yaxis_transform(),\n fontsize=10,\n weight='bold'\n)\n\n# Setting labels and title\nax.set_ylabel(ylabel)\nax.set_title(title)\nplt.xticks(rotation=45)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorpoint_16.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_179", "content": { "Digit Length": [ 6, 7, 8, 9 ], "Direct (100 samples)": [ 1.05, 0.95, 0.7, 0.75 ], "RFFT (100 samples)": [ 1.0, 0.9, 0.88, 0.6 ], "Scratchpad (100 samples)": [ 0.72, 0.52, 0.45, 0.38 ], "Scratchpad (5000 samples)": [ 0.65, 0.75, 0.8, 0.95 ] }, "visual_intent": "A line chart about Digit Length and Accuracy(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/line_31.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Placeholder data\ndigit_length = np.arange(6, 10)\ndirect_accuracy = [1.05, 0.95, 0.7, 0.75]\nrfft_accuracy = [1.0, 0.9, 0.88, 0.6]\nscratchpad_100_accuracy = [0.72, 0.52, 0.45, 0.38]\nscratchpad_5000_accuracy = [0.65, 0.75, 0.8, 0.95]\n\n# Placeholder error values\ndirect_error = np.random.uniform(0.01, 0.05, len(digit_length))\nrfft_error = np.random.uniform(0.01, 0.05, len(digit_length))\nscratchpad_100_error = np.random.uniform(0.01, 0.05, len(digit_length))\nscratchpad_5000_error = np.random.uniform(0.01, 0.05, len(digit_length))\n\n# Axes Limits and Labels\nxlabel_value = \"Digit Length\"\n\nylabel_value = \"Accuracy\"\nylim_values = [0.5, 1.1]\nyticks_values = np.arange(0.3, 1.1, 0.1)\n\n# Labels\nlabel_1 = \"Direct (100 samples)\"\nlabel_2 = \"RFFT (100 samples)\"\nlabel_3 = \"Scratchpad (100 samples)\"\nlabel_4 = \"Scratchpad (5000 samples)\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nplt.figure(figsize=(8, 6)) # Adjusting figure size to match original image dimensions\nplt.errorbar(\n digit_length,\n direct_accuracy,\n yerr=direct_error,\n fmt=\"-o\",\n label=label_1,\n color=\"blue\",\n linestyle=\"dashed\",\n)\nplt.errorbar(\n digit_length,\n rfft_accuracy,\n yerr=rfft_error,\n fmt=\"-s\",\n label=label_2,\n color=\"green\",\n linestyle=\"dashed\",\n)\nplt.errorbar(\n digit_length,\n scratchpad_100_accuracy,\n yerr=scratchpad_100_error,\n fmt=\"-^\",\n label=label_3,\n color=\"orange\",\n linestyle=\"dashed\",\n)\nplt.errorbar(\n digit_length,\n scratchpad_5000_accuracy,\n yerr=scratchpad_5000_error,\n fmt=\"-d\",\n label=label_4,\n color=\"red\",\n linestyle=\"dashed\",\n)\n\n# Adding labels and title\nplt.xlabel(xlabel_value)\nplt.ylabel(ylabel_value)\nplt.xticks(digit_length)\nplt.ylim(ylim_values)\nplt.yticks(yticks_values)\n\n# Adding legend, lower left corner\nplt.legend(loc=\"lower left\")\n\n# Moving axes spines\nax = plt.gca() # get current axes\nax.spines[\"right\"].set_color(\"none\") # hide the right spine\nax.spines[\"top\"].set_color(\"none\") # hide the top spine\nax.grid(\n True, which=\"both\", axis=\"both\", color=\"lightgray\", linestyle=\"--\", linewidth=0.5\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Display the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"line_31.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_180", "content": { "Technology Level": [ "Intro", "Beginner", "Intermediate", "Advanced", "Expert", "Master", null ], "AI Expertise": [ 5, 10, 20, 35, 50, 70, null ], "Big Data Expertise": [ 10, 15, 25, 30, 45, 65, null ], "Cloud Computing Expertise": [ 10, 20, 30, 40, 55, 75, null ], "Technology Field": [ "AI", "Big Data", "Cloud Computing", "Cybersecurity", "IoT", "Blockchain", "Quantum Computing" ], "Publications": [ 300, 250, 400, 220, 200, 180, 150 ] }, "visual_intent": "A figure with 2 subplots: (1) a stacked area chart illustrating the increase in expertise levels for AI, Big Data, and Cloud Computing, titled 'Expertise Increase by Technology Level', (2) a bar chart displaying the number of publications across various technology fields, titled 'Number of Publications by Technology Field'(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/multidiff_75.jpg", "original_category": "multidiff", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data for Area Chart - Represents percentage increases in expertise by technology level\ntech_levels = [\"Intro\", \"Beginner\", \"Intermediate\", \"Advanced\", \"Expert\", \"Master\"]\nai = np.array([5, 10, 20, 35, 50, 70])\nbig_data = np.array([10, 15, 25, 30, 45, 65])\ncloud_computing = np.array([10, 20, 30, 40, 55, 75])\n\n# Cumulative data for the stacked Area chart\ncumulative_ai = ai\ncumulative_big_data = cumulative_ai + big_data\ncumulative_cloud_computing = cumulative_big_data + cloud_computing\n\n# Data for Bar Chart - Shows the number of publications by technology field\ntech_fields = [\n \"AI\",\n \"Big Data\",\n \"Cloud Computing\",\n \"Cybersecurity\",\n \"IoT\",\n \"Blockchain\",\n \"Quantum Computing\",\n]\npublications = [300, 250, 400, 220, 200, 180, 150]\ntitles = [\n \"Expertise Increase by Technology Level\",\n \"Number of Publications by Technology Field\",\n]\nxlabels = [\"Technology Level\", \"Technology Field\"]\nylabels = [\"Cumulative Expertise (%)\", \"Publications\"]\nax1labels = [\"AI\", \"Big Data\", \"Cloud Computing\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Creating the subplot layout\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))\n\n# Plotting the Area Chart\nax1.fill_between(\n tech_levels, 0, cumulative_ai, label=ax1labels[0], color=\"#1f77b4\", alpha=0.6\n)\nax1.fill_between(\n tech_levels,\n cumulative_ai,\n cumulative_big_data,\n label=ax1labels[1],\n color=\"#ff7f0e\",\n alpha=0.6,\n)\nax1.fill_between(\n tech_levels,\n cumulative_big_data,\n cumulative_cloud_computing,\n label=ax1labels[2],\n color=\"#2ca02c\",\n alpha=0.6,\n)\nax1.set_title(titles[0])\nax1.set_xlabel(xlabels[0])\nax1.set_ylabel(ylabels[0])\nax1.legend(loc=\"upper left\")\n\n# Plotting the Bar Chart\nax2.bar(tech_fields, publications, color=\"#d62728\")\nax2.set_title(titles[1])\nax2.set_xlabel(xlabels[1])\nax2.set_ylabel(ylabels[1])\nax2.set_xticklabels(tech_fields, rotation=45)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout and saving the figure\nplt.tight_layout()\nplt.savefig(\"multidiff_75.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_181", "content": { "System": [ "Summit", "Perlmutter", "Corona", "Frontier" ], "Kokkos": [ 876.0, 750.0, 764.0, 482.0 ], "RAJA": [ 136.0, 1737.0, 676.0, 120.0 ], "OMP": [ 435.0, 742.0, 782.0, 843.0 ], "OACC": [ 534.0, 375.0, null, 1170.0 ], "SYCL": [ 322.0, 750.0, 421.0, 925.0 ], "Native Port": [ 804.0, 1825.0, null, 911.0 ] }, "visual_intent": "A heatmap about Programming Model and System memory bandwidth, titled BabelStream triad Average Memory Bandwidth (GB/s)(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/heatmap_6.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Define the data with correct shape\ndata = np.array(\n [\n [876, 136, 435, 534, 322, 804],\n [750, 1737, 742, 375, 750, 1825],\n [764, 676, 782, np.nan, 421, np.nan], # Assumed another NaN value for padding\n [482, 120, 843, 1170, 925, 911],\n ]\n)\n\ntitle = \"BabelStream triad Average Memory Bandwidth (GB/s)\"\nxlabel = \"Programming Model\"\nxticklabels = [\"Kokkos\", \"RAJA\", \"OMP\", \"OACC\", \"SYCL\", \"Native Port\"]\nyticklabels = [\"Summit\", \"Perlmutter\", \"Corona\", \"Frontier\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the heatmap with adjusted colorbar and new theme color\n# Create mask for NaN values to hatch them later\nmask = np.isnan(data)\n\n# Defining a new color palette\ncmap = plt.get_cmap(\"RdGy\")\nnorm = plt.Normalize(vmin=np.nanmin(data), vmax=np.nanmax(data))\n\nfig, ax = plt.subplots(figsize=(10, 8))\ncax = ax.imshow(data, cmap=cmap, norm=norm)\ncbar = fig.colorbar(cax, ax=ax, extend=\"both\")\n\n# Add hatches for NaN values\nfor i, j in zip(*np.where(mask)):\n ax.add_patch(\n plt.Rectangle(\n (j - 0.5, i - 0.5), 1, 1, fill=False, hatch=\"//\", edgecolor=\"black\"\n )\n )\n\n# Adding titles and labels\nplt.title(title)\nplt.xlabel(xlabel)\n\n# Define the labels for x and y axis\nax.set_xticks(range(6))\nax.set_xticklabels(xticklabels, rotation=45)\nax.set_yticks(range(4))\nax.set_yticklabels(yticklabels, rotation=0)\n\n# Add annotations\nfor i in range(4):\n for j in range(6):\n if not np.isnan(data[i, j]):\n if data[i, j] > np.nanmean(data) * 1.5:\n ax.text(\n j, i, f\"{data[i, j]:.0f}\", ha=\"center\", va=\"center\", color=\"white\"\n )\n else:\n ax.text(\n j, i, f\"{data[i, j]:.0f}\", ha=\"center\", va=\"center\", color=\"black\"\n )\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"heatmap_6.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_182", "content": { "Product Category": [ "Smartphones", "Laptops", "Tablets", "Wearables", "Others" ], "Market Share (%)": [ 40.2, 25.8, 18.3, 10.2, 5.5 ] }, "visual_intent": "A pie chart about product categories and market share, titled Market Share Distribution of Technology Product Categories(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/pie_69.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Data to plot\nsizes = [\n 40.2,\n 25.8,\n 18.3,\n 10.2,\n 5.5,\n] # New data of market share percentages for tech products\nlabels = [\"Smartphones\", \"Laptops\", \"Tablets\", \"Wearables\", \"Others\"]\n\n# Plot configuration\ntitle = \"Market Share Distribution of Technology Product Categories\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nexplode = (0.1, 0, 0, 0.1, 0) # add explode parameter to separate slices\ntitle_pad = 20\nautopct_format = \"%1.1f%%\"\nstartangle = 140\nwedgeprops = dict(edgecolor=\"w\", linewidth=1.5)\n\n# Color palette for technology categories\ncolors = [\"#1f77b4\", \"#ff7f0e\", \"#2ca02c\", \"#d62728\", \"#9467bd\"]\n\n# Plot\nfig, ax = plt.subplots(figsize=(8, 8))\nax.pie(\n sizes,\n colors=colors,\n autopct=autopct_format,\n startangle=startangle,\n wedgeprops=wedgeprops,\n explode=explode,\n labels=labels,\n)\nax.set_title(title, pad=title_pad) # Set the title with padding\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout\nplt.tight_layout()\nplt.savefig(\"pie_69.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_183", "content": { "Country": [ "USA", "Germany", "China", "India" ], "GDP Rank": [ "#1", "#4", "#2", "#5" ], "Inflation Rank": [ "#6", "#8", "#7", "#3" ], "Unemployment Rank": [ "#9", "#2", "#8", "#12" ] }, "visual_intent": "A figure with 2 subplots: (1) a heatmap about countries and economic indicator ranks, titled Economic Indicators, (2) a heatmap about the same data with reversed country order, titled Reversed Economic Indicators(size of the desired plot: width=10.0, height=5.0)", "path_to_gt_image": "images/heatmap_96.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport pandas as pd\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Creating a new dataset related to economics, representing ranks of different economic indicators for various countries\ndata_economics = {\n \"Country\": [\"USA\", \"Germany\", \"China\", \"India\"],\n \"GDP Rank\": [\"#1\", \"#4\", \"#2\", \"#5\"],\n \"Inflation Rank\": [\"#6\", \"#8\", \"#7\", \"#3\"],\n \"Unemployment Rank\": [\"#9\", \"#2\", \"#8\", \"#12\"],\n}\n\ndata_economics_reversed = {\n \"Country\": [\"India\", \"China\", \"Germany\", \"USA\"],\n \"GDP Rank\": [\"#5\", \"#2\", \"#4\", \"#1\"],\n \"Inflation Rank\": [\"#3\", \"#7\", \"#8\", \"#6\"],\n \"Unemployment Rank\": [\"#12\", \"#8\", \"#2\", \"#9\"],\n}\n\n# Convert to DataFrame\ndata_economics_df = pd.DataFrame(data_economics).set_index(\"Country\")\ndata_economics_reversed_df = pd.DataFrame(data_economics_reversed).set_index(\"Country\")\n\n# Creating a function to convert the string indices to numeric values for plotting\ndef convert_to_numeric(cell):\n return int(cell.replace(\"#\", \"\"))\n\n# Convert the dataframes\ndata_economics_numeric = data_economics_df.applymap(convert_to_numeric)\ndata_economics_reversed_numeric = data_economics_reversed_df.applymap(convert_to_numeric)\n\n# Axes Limits and Labels\nax1_title = \"Economic Indicators\"\nax1_ylabel = \"Countries\"\nax2_title = \"Reversed Economic Indicators\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Creating the heatmap using matplotlib with increased linewidths for separation\nfig, (ax1, ax2) = plt.subplots(\n ncols=2, figsize=(10, 5), gridspec_kw={\"width_ratios\": [1, 1], \"wspace\": 0.3}\n)\n\n# Setting a custom color map appropriate for the domain\ncmap_custom1 = plt.get_cmap(\"YlGnBu\")\ncmap_custom2 = plt.get_cmap(\"YlOrRd\")\n\n# Heatmap for Economic Indicators with increased cell borders\nim1 = ax1.imshow(data_economics_numeric, cmap=cmap_custom1)\nax1.set_title(ax1_title)\nax1.set_ylabel(ax1_ylabel)\nax1.set_xticks(range(len(data_economics_df.columns)))\nax1.set_xticklabels(data_economics_df.columns, rotation=45)\nax1.set_yticks(range(len(data_economics_df.index)))\nax1.set_yticklabels(data_economics_df.index, rotation=0)\n\n# Add annotations for Economic Indicators\nfor i in range(len(data_economics_df.index)):\n for j in range(len(data_economics_df.columns)):\n ax1.text(j, i, data_economics_df.iloc[i, j], ha=\"center\", va=\"center\", color=\"black\")\n\n# Heatmap for Reversed Economic Indicators with increased cell borders\nim2 = ax2.imshow(data_economics_reversed_numeric, cmap=cmap_custom2)\nax2.set_title(ax2_title)\nax2.set_xticks(range(len(data_economics_reversed_df.columns)))\nax2.set_xticklabels(data_economics_reversed_df.columns, rotation=45)\nax2.set_yticks(range(len(data_economics_reversed_df.index)))\nax2.set_yticklabels(data_economics_reversed_df.index, rotation=0)\n\n# Add annotations for Reversed Economic Indicators\nfor i in range(len(data_economics_reversed_df.index)):\n for j in range(len(data_economics_reversed_df.columns)):\n ax2.text(j, i, data_economics_reversed_df.iloc[i, j], ha=\"center\", va=\"center\", color=\"black\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"heatmap_96.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 5.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_184", "content": { "Sector": [ "E-commerce", "Education", "Entertainment", "Technology" ], "External": [ 250, 150, 100, 300 ], "Internal": [ 200, 100, 150, 250 ] }, "visual_intent": "A double layer donut chart about market share distribution across different sectors (E-commerce, Education, Entertainment, Technology) comparing external and internal metrics, titled Market Share by Sector - External vs. Internal(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/pie_15.jpg", "original_category": "pie", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# New example data for the double layer donut chart\nvals1 = [250, 150, 100, 300]\nvals2 = [200, 100, 150, 250]\nvals3 = [700] # This will be the white center\n\n# Define labels and colors\nlabels = [\"E-commerce\", \"Education\", \"Entertainment\", \"Technology\"]\n\n\n# Variables for plot configuration\ntitle_text = \"Market Share by Sector - External vs. Internal\"\n\nlegend_labels = labels\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, ax = plt.subplots(figsize=(8, 6))\n\ncolors1 = [\"#FFD700\", \"#FF8C00\", \"#1E90FF\", \"#32CD32\"]\ncolors2 = [\"#F0E68C\", \"#FFA07A\", \"#87CEFA\", \"#98FB98\"]\n\nlegend_bbox_to_anchor = (1, 1)\nlegend_frameon = False\n\n# Outer donut chart\nwedges1, texts1, autotexts1 = ax.pie(\n vals1,\n labels=labels,\n radius=1.2,\n colors=colors1,\n autopct=\"%1.1f%%\",\n pctdistance=0.9,\n wedgeprops=dict(width=0.3, edgecolor=\"w\"),\n)\n\n# Inner donut chart\nwedges2, texts2, autotexts2 = ax.pie(\n vals2,\n radius=0.9,\n colors=colors2,\n autopct=\"%1.1f%%\",\n pctdistance=0.75,\n wedgeprops=dict(width=0.3, edgecolor=\"w\"),\n)\n\n# White center circle for the 'hole'\nax.pie(vals3, radius=0.6, colors=\"w\", wedgeprops=dict(width=0.3, edgecolor=\"w\"))\n\n# Equal aspect ratio ensures that pie chart is drawn as a circle\nax.axis(\"equal\")\n\n# Title for the donut chart\nax.set_title(title_text)\n\n# Show the plot with a legend\nplt.legend(legend_labels, bbox_to_anchor=legend_bbox_to_anchor, frameon=legend_frameon)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"pie_15.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_185", "content": { "X-axis": [ 5, 7, 8, 7, 2, 17, 2, 9, 4, 11, 12, 9, 6 ], "Y-axis": [ 99, 86, 87, 88, 111, 86, 103, 87, 94, 78, 77, 85, 86 ], "Color_Values": [ 0, 10, 20, 30, 40, 45, 50, 55, 60, 70, 80, 90, 100 ] }, "visual_intent": "A scatter plot about X-axis and Y-axis(size of the desired plot: width=6.0, height=6.0)", "path_to_gt_image": "images/scatter_19.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for the scatter plot\nx = np.array([5, 7, 8, 7, 2, 17, 2, 9, 4, 11, 12, 9, 6])\ny = np.array([99, 86, 87, 88, 111, 86, 103, 87, 94, 78, 77, 85, 86])\nxlabel = \"X-axis\"\nylabel = \"Y-axis\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nplt.figure(figsize=(6, 6))\ncolors = np.array([0, 10, 20, 30, 40, 45, 50, 55, 60, 70, 80, 90, 100])\nplt.scatter(x, y, c=colors, cmap=\"viridis\")\nplt.grid(True)\nplt.xlabel(xlabel)\nplt.ylabel(ylabel)\nplt.colorbar()\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"scatter_19.pdf\", bbox_inches=\"tight\")\n", "width": 6.0, "height": 6.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_186", "content": { "True_Category_Index": [ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3 ], "Predicted_Category_Index": [ 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3 ], "Basketball": [ 50, 10, 5, 5, 7, 40, 3, 10, 5, 3, 30, 7, 3, 2, 5, 40 ], "Football": [ 45, 5, 2, 8, 6, 35, 12, 7, 3, 10, 29, 10, 1, 4, 6, 35 ], "Tennis": [ 55, 12, 2, 3, 5, 38, 10, 7, 2, 4, 35, 6, 3, 5, 7, 40 ], "Baseball": [ 60, 15, 4, 1, 10, 50, 8, 2, 5, 10, 40, 3, 2, 8, 5, 55 ], "Swimming": [ 40, 12, 6, 4, 8, 30, 15, 5, 3, 7, 35, 10, 1, 5, 8, 40 ], "Volleyball": [ 50, 10, 5, 5, 5, 42, 7, 6, 6, 8, 40, 8, 3, 2, 4, 50 ], "Hockey": [ 58, 12, 5, 3, 10, 45, 10, 5, 4, 6, 43, 7, 2, 5, 3, 60 ], "Skiing": [ 65, 15, 4, 2, 12, 55, 6, 3, 5, 6, 54, 5, 3, 6, 2, 70 ] }, "visual_intent": "A figure with 8 subplots displaying confusion matrices for predicted vs true categories across different sports: (1) Basketball, (2) Football, (3) Tennis, (4) Baseball, (5) Swimming, (6) Volleyball, (7) Hockey, and (8) Skiing(size of the desired plot: width=14.0, height=7.0)", "path_to_gt_image": "images/heatmap_44.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation \n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Placeholder data for confusion matrices (sports domain)\ndata_basketball = np.array([[50, 10, 5, 5], [7, 40, 3, 10], [5, 3, 30, 7], [3, 2, 5, 40]])\ndata_football = np.array([[45, 5, 2, 8], [6, 35, 12, 7], [3, 10, 29, 10], [1, 4, 6, 35]])\ndata_tennis = np.array([[55, 12, 2, 3], [5, 38, 10, 7], [2, 4, 35, 6], [3, 5, 7, 40]])\ndata_baseball = np.array([[60, 15, 4, 1], [10, 50, 8, 2], [5, 10, 40, 3], [2, 8, 5, 55]])\ndata_swimming = np.array([[40, 12, 6, 4], [8, 30, 15, 5], [3, 7, 35, 10], [1, 5, 8, 40]])\ndata_volleyball = np.array([[50, 10, 5, 5], [5, 42, 7, 6], [6, 8, 40, 8], [3, 2, 4, 50]])\ndata_hockey = np.array([[58, 12, 5, 3], [10, 45, 10, 5], [4, 6, 43, 7], [2, 5, 3, 60]])\ndata_skiing = np.array([[65, 15, 4, 2], [12, 55, 6, 3], [5, 6, 54, 5], [3, 6, 2, 70]])\n\n# Titles for the subplots\ntitles = [\"Basketball\", \"Football\", \"Tennis\", \"Baseball\", \"Swimming\", \"Volleyball\", \"Hockey\", \"Skiing\"]\nxlabel = \"Predicted Category\"\nylabel = \"True Category\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, axes = plt.subplots(nrows=2, ncols=4, figsize=(14, 7)) # Adjusted for better fit\n\n# New colormap for a vibrant sport theme\ncmap = plt.cm.plasma\n\n# Function to create a single confusion matrix plot\ndef plot_confusion_matrix(ax, data, title):\n im = ax.imshow(data, interpolation=\"nearest\", cmap=cmap)\n ax.figure.colorbar(im, ax=ax)\n ax.set(\n title=title,\n xlabel=xlabel,\n ylabel=ylabel,\n xticks=np.arange(data.shape[1]),\n yticks=np.arange(data.shape[0]),\n )\n # Loop over data dimensions and create text annotations.\n for i in range(data.shape[0]):\n for j in range(data.shape[1]):\n ax.text(j, i, data[i, j], ha=\"center\", va=\"center\", color=\"white\")\n\n# Plot each confusion matrix\nplot_confusion_matrix(axes[0, 0], data_basketball, titles[0])\nplot_confusion_matrix(axes[0, 1], data_football, titles[1])\nplot_confusion_matrix(axes[0, 2], data_tennis, titles[2])\nplot_confusion_matrix(axes[0, 3], data_baseball, titles[3])\nplot_confusion_matrix(axes[1, 0], data_swimming, titles[4])\nplot_confusion_matrix(axes[1, 1], data_volleyball, titles[5])\nplot_confusion_matrix(axes[1, 2], data_hockey, titles[6])\nplot_confusion_matrix(axes[1, 3], data_skiing, titles[7])\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit and save the figure\nplt.tight_layout()\nplt.savefig(\"heatmap_44.pdf\", bbox_inches=\"tight\")\n", "width": 14.0, "height": 7.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_187", "content": { "Crop": [ "Wheat", "Corn", "Rice", "Barley", "Soybean", "Oats" ], "Production": [ 20, 15, 25, 10, 18, 12 ] }, "visual_intent": "A pie chart about agricultural crop production shares, titled Agricultural Crop Production Distribution(size of the desired plot: width=7.0, height=7.0)", "path_to_gt_image": "images/pie_33.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Data to plot\nsizes = [20, 15, 25, 10, 18, 12]\nlabels = ['Wheat', 'Corn', 'Rice', 'Barley', 'Soybean', 'Oats']\ntitle = \"Agricultural Crop Production Distribution\"\nsuptitle = 'Crop Production - 2023'\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot\nfig, ax = plt.subplots(figsize=(7, 7))\nexplode = (0.1, 0.1, 0.1, 0.1, 0.1, 0.1) # add explode parameter to separate slices\ncolors = ['#8FBC8F', '#556B2F', '#6B8E23', '#2E8B57', '#3CB371', '#228B22']\nax.pie(\n sizes,\n labels=labels,\n colors=colors,\n autopct=\"%1.1f%%\",\n startangle=140,\n wedgeprops=dict(edgecolor=\"w\"),\n explode=explode,\n)\n\n# Set aspect ratio to be equal so that pie is drawn as a circle.\nax.axis(\"equal\")\n\nplt.title(title, fontsize=16)\nplt.suptitle(suptitle, fontsize=20)\n\n# Adding a legend outside the pie chart\nplt.legend(labels, loc=\"center left\", bbox_to_anchor=(1, 0.5))\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"pie_33.pdf\", bbox_inches=\"tight\")\n", "width": 7.0, "height": 7.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_188", "content": { "Category": [ "Painting", "Sculpture", "Digital Art", "Craft", "Oil", "Watercolor", "Bronze", "Marble", "3D", "2D", "Knitting", "Pottery" ], "Value": [ 180, 120, 160, 240, 90, 90, 60, 60, 80, 80, 120, 120 ], "Group": [ "Art Mediums", "Art Mediums", "Art Mediums", "Art Mediums", "Sub-categories", "Sub-categories", "Sub-categories", "Sub-categories", "Sub-categories", "Sub-categories", "Sub-categories", "Sub-categories" ] }, "visual_intent": "A double layer donut chart about Art Mediums and Sub-categories, titled Popularity of Art Mediums and Their Sub-categories(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/pie_65.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\n# New example data for the double layer donut chart\nvals1 = [180, 120, 160, 240] # Example: Painting, Sculpture, Digital Art, Craft\nvals2 = [90, 90, 60, 60, 80, 80, 120, 120] # Corresponding sub-categories\nvals3 = [700] # This will be the white center\n\n# Define labels and colors\nlabels1 = [\"Painting\", \"Sculpture\", \"Digital Art\", \"Craft\"]\nlabels2 = [\"Oil\", \"Watercolor\", \"Bronze\", \"Marble\", \"3D\", \"2D\", \"Knitting\", \"Pottery\"]\n\ntitle_text = \"Popularity of Art Mediums and Their Sub-categories\"\n\nlegend_labels1 = labels1\nlegend_labels2 = labels2\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, ax = plt.subplots(figsize=(10, 7))\n# Variables for plot configuration\ncolors1 = [\"#FFB6C1\", \"#FF69B4\", \"#FFDAB9\", \"#E6E6FA\"]\ncolors2 = [\"#FFA07A\", \"#FA8072\", \"#FF6347\", \"#FF4500\", \"#FFDEAD\", \"#FF8C00\", \"#FFD700\", \"#FFE4B5\"]\n\nlegend_bbox_to_anchor = (1, 0.5)\nlegend_frameon = False\n\n# Outer donut chart\nwedges1, texts1, autotexts1 = ax.pie(\n vals1,\n labels=labels1,\n radius=1.3,\n colors=colors1,\n autopct=\"%1.1f%%\",\n pctdistance=0.85,\n wedgeprops=dict(width=0.3, edgecolor=\"w\"),\n)\n\n# Inner donut chart\nwedges2, texts2, autotexts2 = ax.pie(\n vals2,\n radius=1.0,\n colors=colors2,\n autopct=\"%1.1f%%\",\n pctdistance=0.75,\n wedgeprops=dict(width=0.3, edgecolor=\"w\"),\n)\n\n# White center circle for the 'hole'\nax.pie(vals3, radius=0.7, colors=\"w\", wedgeprops=dict(width=0.3, edgecolor=\"w\"))\n\n# Equal aspect ratio ensures that pie chart is drawn as a circle\nax.axis(\"equal\")\n\n# Title for the donut chart\nax.set_title(title_text, fontsize=14, fontweight='bold')\n\n# Show the plot with a legend for main categories\nfirst_legend = plt.legend(wedges1, legend_labels1, title=\"Art Mediums\", bbox_to_anchor=(1, 0.75), frameon=legend_frameon)\nplt.gca().add_artist(first_legend)\n\n# Show the plot with a legend for sub-categories\nplt.legend(wedges2, legend_labels2, title=\"Sub-categories\", bbox_to_anchor=(1, 0.5), frameon=legend_frameon)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"pie_65.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_189", "content": { "Statistic": [ "Shooting Accuracy", "Assists", "Rebounds", "Steals", "Blocks", "Stamina", "Speed", "Free Throws" ], "Player A": [ 0.85, 0.7, 0.65, 0.9, 0.55, 0.89, 0.78, 0.8 ], "Player B": [ 0.75, 0.8, 0.7, 0.6, 0.8, 0.76, 0.88, 0.85 ] }, "visual_intent": "A radar chart about player statistics for Player A and Player B, titled Player Performance Comparison(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/radar_28.jpg", "original_category": "radar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom matplotlib.lines import Line2D\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data for Player A and Player B\nvalues_player_a = [0.85, 0.70, 0.65, 0.90, 0.55, 0.89, 0.78, 0.80] # Player A statistics\nvalues_player_b = [0.75, 0.80, 0.70, 0.60, 0.80, 0.76, 0.88, 0.85] # Player B statistics\n\nnum_vars = len(values_player_a)\nlabels = [\"Player A\", \"Player B\"]\nticks = [0.1, 0.3, 0.5, 0.7, 0.9]\ntickslabel = [\"10%\", \"30%\", \"50%\", \"70%\", \"90%\"]\n\nangle_labels = [\"Shooting Accuracy\", \"Assists\", \"Rebounds\", \"Steals\", \"Blocks\", \"Stamina\", \"Speed\", \"Free Throws\"]\ntitle = \"Player Performance Comparison\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Compute angle for each axis\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n\n# The plot is circular, so we need to \"complete the loop\" and append the start to the end.\nvalues_player_a += values_player_a[:1]\nvalues_player_b += values_player_b[:1]\nangles += angles[:1]\n\n# Draw the radar chart\nfig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True))\nax.fill(angles, values_player_a, color=\"blue\", alpha=0.1)\nax.plot(angles, values_player_a, color=\"blue\", linewidth=2, linestyle='solid', label=labels[0])\nax.scatter(angles[:-1], values_player_a[:-1], color=\"blue\", s=50, marker=\"o\")\nax.fill(angles, values_player_b, color=\"green\", alpha=0.1)\nax.plot(angles, values_player_b, color=\"green\", linewidth=2, linestyle='dashed', label=labels[1])\nax.scatter(angles[:-1], values_player_b[:-1], color=\"green\", s=50, marker=\"^\")\n\n# Add labels to the plot\nax.set_yticklabels([])\ngrid_angles = np.linspace(0, 2 * np.pi, 8, endpoint=False)\nax.set_xticks(grid_angles)\nax.set_xticklabels(angle_labels, fontsize=12, fontweight='bold')\n\n# Add grid lines and labels for the concentric circles\nax.set_rgrids(\n ticks,\n labels=tickslabel,\n angle=30,\n color=\"grey\",\n size=10,\n)\n\n# Create legend handles manually\nlegend_elements = [\n Line2D([0], [0], color=\"blue\", linewidth=2, marker=\"o\", markersize=8, linestyle='solid', label=labels[0]),\n Line2D([0], [0], color=\"green\", linewidth=2, marker=\"^\", markersize=8, linestyle='dashed', label=labels[1]),\n]\n\n# Add legend and title\nax.legend(handles=legend_elements, loc=\"upper right\", bbox_to_anchor=(1.1, 1.1), frameon=False)\nax.set_title(title, size=16, color=\"darkred\", fontweight='bold', pad=30)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_28.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_190", "content": { "Day 1 Age": [ 5, 7, 8, 7, 2, 17, 2, 9, 4, 11, 12, 9, 6 ], "Day 1 Speed": [ 99, 86, 87, 88, 111, 86, 103, 87, 94, 78, 77, 85, 86 ], "Day 2 Age": [ 2, 2, 8, 1, 15, 8, 12, 9, 7, 3, 11, 4, 7, 14, 12 ], "Day 2 Speed": [ 100, 105, 84, 105, 90, 99, 90, 95, 94, 100, 79, 112, 91, 80, 85 ] }, "visual_intent": "A scatter plot about age and speed of cars for Day 1 and Day 2(size of the desired plot: width=6.0, height=6.0)", "path_to_gt_image": "images/scatter_18.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Day one, the age and speed of 13 cars:\nx = np.array([5, 7, 8, 7, 2, 17, 2, 9, 4, 11, 12, 9, 6])\ny = np.array([99, 86, 87, 88, 111, 86, 103, 87, 94, 78, 77, 85, 86])\n\n# Day two, the age and speed of 15 cars:\nx2 = np.array([2, 2, 8, 1, 15, 8, 12, 9, 7, 3, 11, 4, 7, 14, 12])\ny2 = np.array([100, 105, 84, 105, 90, 99, 90, 95, 94, 100, 79, 112, 91, 80, 85])\n\nlegend_labels = [\"Day 1\", \"Day 2\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nplt.figure(figsize=(6, 6))\nplt.scatter(x, y)\nplt.scatter(x2, y2)\nplt.grid(True)\nplt.legend(legend_labels)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"scatter_18.pdf\", bbox_inches=\"tight\")\n", "width": 6.0, "height": 6.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_191", "content": { "Department": [ "Cardiology", "Neurology", "Orthopedics", "Pediatrics", "Dermatology" ], "Distribution": [ 25, 15, 20, 10, 30 ] }, "visual_intent": "A pie chart about health departments and patient distribution, titled Patient Distribution Across Health Departments(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/pie_78.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# Data to plot\nlabels = [\"Cardiology\", \"Neurology\", \"Orthopedics\", \"Pediatrics\", \"Dermatology\"]\nsizes = [25, 15, 20, 10, 30]\n\nexplode = (0.1, 0, 0, 0, 0.1) # Highlight the largest and smallest segments\n\n# Extracted variables\nplot_title = \"Patient Distribution Across Health Departments\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = [\"#4F81BD\", \"#C0504D\", \"#9BBB59\", \"#8064A2\", \"#4BACC6\"] # Health-related calm colors\nautopct_format = \"%1.1f%%\"\nshadow_option = True\nstart_angle = 90\nlegend_location = \"upper right\"\nlegend_fontsize = 10\ntitle_fontsize = 16\ntitle_y_position = 1.05\n# Plot\nplt.figure(figsize=(8, 6))\nplt.pie(\n sizes,\n explode=explode,\n colors=colors,\n autopct=autopct_format,\n shadow=shadow_option,\n startangle=start_angle,\n)\nplt.axis(\"equal\")\n\n# Add legend\nplt.legend(labels, loc=legend_location, fontsize=legend_fontsize)\nplt.title(plot_title, fontsize=title_fontsize, y=title_y_position)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"pie_78.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_192", "content": { "Company": [ "Company E", "Company D", "Company C", "Company B", "Company A" ], "Total Sales (Million $)": [ -5000, -7000, -11000, -12000, -8000 ], "Sales Error": [ 800, 950, 800, 950, 800 ], "Growth Rate (%)": [ 2.0, 3.0, 4.5, 7.0, 5.0 ], "Growth Error": [ 0.55, 0.5, 0.65, 0.75, 0.5 ] }, "visual_intent": "A figure with 2 subplots: (1) a horizontal bar chart about total sales by company, titled Total Sales by Company, (2) a horizontal bar chart about growth rate by company, titled Growth Rate by Company(size of the desired plot: width=12.0, height=8.0)", "path_to_gt_image": "images/errorbar_93.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# Categories and values for different companies\ncompanies = [\"Company A\", \"Company B\", \"Company C\", \"Company D\", \"Company E\"][::-1]\ntotal_sales = [-8000, -12000, -11000, -7000, -5000][::-1] # Total sales in million dollars\nsales_error = [800, 950, 800, 950, 800][::-1] # Error values for total sales\n\ngrowth_rate = [5, 7, 4.5, 3, 2][::-1] # Growth rate as percentage of previous year\ngrowth_error = [0.5, 0.75, 0.65, 0.5, 0.55][::-1] # Error values for growth rate\nxlabels = [\"Total Sales (Million $)\", \"Growth Rate (%)\"]\ntitles = [\"Total Sales by Company\", \"Growth Rate by Company\"]\nxlims = [[-13000, 0], [0, 10]]\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create horizontal bar chart with subplots\nfig, axes = plt.subplots(1, 2, figsize=(12, 8), sharey=True) # Adjust figure size\n\n# Setting colors for the bars\nneg_colors = [\"#FF9999\"] * 5 # Warm red color for negative values\npos_colors = [\"#98FB98\"] * 5 # Cool green color for positive values\n\n# Plotting bars for negative values (Total Sales)\nbars = axes[0].barh(\n companies,\n total_sales,\n color=neg_colors,\n edgecolor=\"white\",\n height=0.5,\n xerr=sales_error,\n capsize=3,\n)\naxes[0].set_xlabel(xlabels[0])\naxes[0].set_title(titles[0], fontsize=14)\naxes[0].invert_yaxis()\naxes[0].set_xlim(xlims[0])\naxes[0].xaxis.grid(True, linestyle='--', linewidth=0.7)\naxes[0].spines[\"top\"].set_visible(False)\naxes[0].spines[\"right\"].set_visible(False)\n\n# Plotting bars for positive values (Growth Rate)\nbars2 = axes[1].barh(\n companies,\n growth_rate,\n color=pos_colors,\n edgecolor=\"white\",\n height=0.5,\n xerr=growth_error,\n capsize=3,\n)\naxes[1].set_xlabel(xlabels[1])\naxes[1].set_title(titles[1], fontsize=14)\naxes[1].invert_yaxis()\naxes[1].set_xlim(xlims[1])\naxes[1].xaxis.grid(True, linestyle='--', linewidth=0.7)\naxes[1].spines[\"top\"].set_visible(False)\naxes[1].spines[\"right\"].set_visible(False)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorbar_93.pdf\", bbox_inches=\"tight\")\n\n", "width": 12.0, "height": 8.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" }, { "id": "test_193", "content": { "X": [ -1.29, -0.04, 0.52, 0.77, 2.16, -0.37, 1.1, 0.64, -0.02, 0.28, 5.91, 5.79, 4.06, 4.98, 7.26, 4.04, 4.54, 3.46, 5.16, 4.4, 3.58, 4.46, 3.84, 6.49, 5.43, -5.64, -5.13, -5.31, -3.85, -5.81, -4.48, -4.86, -4.31, -5.73, -6.58, -6.19, -5.6, -6.94, -4.48, -5.31, -4.6, -3.04, -5.65, -4.51, -7.03, 4.89, 4.31, 5.29, 3.95, 5.69, 4.37, 7.3, 4.86, 5.1, 4.6, 3.69, 4.88, 5.67, 3.67, 5.69, -5.13, -6.13, -5.38, -5.04, -5.06, -5.72, -4.73, -6.16, -5.16, -5.7, 0.75, 0.77, -2.66, -1.76, -0.68, 1.07, -0.69, -0.44, -0.36, 0.58, -0.76, 1.36, -0.65, -1.84, -0.48, 0.7, 0.93, -0.02, -0.19, -0.27, 0.28, 0.84, 0.05, 0.64, -0.21 ], "Y": [ 0.27, -1.17, -0.17, 0.82, 1.34, -0.24, 0.66, -1.62, -0.74, -0.1, 5.32, 4.53, 4.59, 5.38, 4.96, 4.65, 5.48, 5.06, 5.23, 4.76, 4.51, 5.42, 5.78, 2.93, 5.68, 4.6, 4.7, 3.32, 6.08, 3.53, 4.42, 4.68, 5.69, 3.62, 5.61, 4.49, 4.95, 5.19, 5.09, 5.1, 2.23, 5.39, 4.61, 4.88, 7.06, -3.98, -3.46, -4.39, -3.79, -3.7, -5.48, -6.06, -3.86, -4.42, -4.63, -3.34, -5.68, -5.46, -6.35, -5.16, -3.92, -5.73, -4.91, -5.29, -5.11, -5.81, -5.89, -5.31, -2.74, -4.06, 8.81, 8.82, 10.61, 10.45, 11.66, 9.55, 8.79, 9.72, 10.16, 10.35, 8.56, 9.31, 9.48, 9.52, 10.62, 10.0, 10.34, 10.16, 9.61, 8.87, 9.01, 9.75, 10.49, 8.43, 10.88 ], "Cluster": [ "cluster_1", "cluster_1", "cluster_1", "cluster_1", "cluster_1", "cluster_1", "cluster_1", "cluster_1", "cluster_1", "cluster_1", "cluster_2", "cluster_2", "cluster_2", "cluster_2", "cluster_2", "cluster_2", "cluster_2", "cluster_2", "cluster_2", "cluster_2", "cluster_2", "cluster_2", "cluster_2", "cluster_2", "cluster_2", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_3", "cluster_4", "cluster_4", "cluster_4", "cluster_4", "cluster_4", "cluster_4", "cluster_4", "cluster_4", "cluster_4", "cluster_4", "cluster_4", "cluster_4", "cluster_4", "cluster_4", "cluster_4", "cluster_5", "cluster_5", "cluster_5", "cluster_5", "cluster_5", "cluster_5", "cluster_5", "cluster_5", "cluster_5", "cluster_5", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6", "cluster_6" ] }, "visual_intent": "A scatter plot about x and y coordinates grouped into six clusters(size of the desired plot: width=5.0, height=5.0)", "path_to_gt_image": "images/scatter_4.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\nclusters = {\n \"cluster_1\": np.array(\n [\n [-1.29, 0.27],\n [-0.04, -1.17],\n [0.52, -0.17],\n [0.77, 0.82],\n [2.16, 1.34],\n [-0.37, -0.24],\n [1.1, 0.66],\n [0.64, -1.62],\n [-0.02, -0.74],\n [0.28, -0.1],\n ]\n ),\n \"cluster_2\": np.array(\n [\n [5.91, 5.32],\n [5.79, 4.53],\n [4.06, 4.59],\n [4.98, 5.38],\n [7.26, 4.96],\n [4.04, 4.65],\n [4.54, 5.48],\n [3.46, 5.06],\n [5.16, 5.23],\n [4.4, 4.76],\n [3.58, 4.51],\n [4.46, 5.42],\n [3.84, 5.78],\n [6.49, 2.93],\n [5.43, 5.68],\n ]\n ),\n \"cluster_3\": np.array(\n [\n [-5.64, 4.6],\n [-5.13, 4.7],\n [-5.31, 3.32],\n [-3.85, 6.08],\n [-5.81, 3.53],\n [-4.48, 4.42],\n [-4.86, 4.68],\n [-4.31, 5.69],\n [-5.73, 3.62],\n [-6.58, 5.61],\n [-6.19, 4.49],\n [-5.6, 4.95],\n [-6.94, 5.19],\n [-4.48, 5.09],\n [-5.31, 5.1],\n [-4.6, 2.23],\n [-3.04, 5.39],\n [-5.65, 4.61],\n [-4.51, 4.88],\n [-7.03, 7.06],\n ]\n ),\n \"cluster_4\": np.array(\n [\n [4.89, -3.98],\n [4.31, -3.46],\n [5.29, -4.39],\n [3.95, -3.79],\n [5.69, -3.7],\n [4.37, -5.48],\n [7.3, -6.06],\n [4.86, -3.86],\n [5.1, -4.42],\n [4.6, -4.63],\n [3.69, -3.34],\n [4.88, -5.68],\n [5.67, -5.46],\n [3.67, -6.35],\n [5.69, -5.16],\n ]\n ),\n \"cluster_5\": np.array(\n [\n [-5.13, -3.92],\n [-6.13, -5.73],\n [-5.38, -4.91],\n [-5.04, -5.29],\n [-5.06, -5.11],\n [-5.72, -5.81],\n [-4.73, -5.89],\n [-6.16, -5.31],\n [-5.16, -2.74],\n [-5.7, -4.06],\n ]\n ),\n \"cluster_6\": np.array(\n [\n [0.75, 8.81],\n [0.77, 8.82],\n [-2.66, 10.61],\n [-1.76, 10.45],\n [-0.68, 11.66],\n [1.07, 9.55],\n [-0.69, 8.79],\n [-0.44, 9.72],\n [-0.36, 10.16],\n [0.58, 10.35],\n [-0.76, 8.56],\n [1.36, 9.31],\n [-0.65, 9.48],\n [-1.84, 9.52],\n [-0.48, 10.62],\n [0.7, 10.0],\n [0.93, 10.34],\n [-0.02, 10.16],\n [-0.19, 9.61],\n [-0.27, 8.87],\n [0.28, 9.01],\n [0.84, 9.75],\n [0.05, 10.49],\n [0.64, 8.43],\n [-0.21, 10.88],\n ]\n ),\n}\n\n# Variables for plot configuration\nxlim = None\nylim = None\nxlabel = None\nylabel = None\nxticks = None\nyticks = None\nxtickslabel = None\nytickslabel = None\ntitle = None\naxhline = None\naxvline = None\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create the scatter plot\nplt.figure(figsize=(5, 5))\n\n# Colors for each cluster (replace with actual colors)\ncolors = {\n \"cluster_1\": \"red\",\n \"cluster_2\": \"blue\",\n \"cluster_3\": \"green\",\n \"cluster_4\": \"purple\",\n \"cluster_5\": \"orange\",\n \"cluster_6\": \"yellow\",\n}\n\nfor cluster, data in clusters.items():\n plt.scatter(data[:, 0], data[:, 1], c=colors[cluster], alpha=0.5)\n\n# Remove axes and grid\nplt.axis(\"off\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"scatter_4.pdf\", bbox_inches=\"tight\")\n", "width": 5.0, "height": 5.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_194", "content": { "Month": [ "January", "February", "March", "April" ], "City A": [ 5, 7, 12, 18 ], "City B": [ 6, 8, 14, 20 ], "City C": [ 2, 5, 10, 15 ], "City D": [ -1, 3, 8, 12 ] }, "visual_intent": "A line chart about Month and Temperature (°C) with two zoomed-in inset plots, titled Monthly Temperature Trends by City(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/PIP_29.jpg", "original_category": "PIP", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# Data\nx = [\"January\", \"February\", \"March\", \"April\"]\ny1 = [5, 7, 12, 18]\ny2 = [6, 8, 14, 20]\ny3 = [2, 5, 10, 15]\ny4 = [-1, 3, 8, 12]\nlabels = [\"City A\", \"City B\", \"City C\", \"City D\"]\ninsertax1 = [0.2, 0.6, 0.2, 0.2]\ninsertylim1 = [-2, 8]\ninsertxlim1 = [0.5, 1.5]\ninsertax2 = [0.7, 0.2, 0.2, 0.2]\ninsertylim2 = [10, 20]\ninsertxlim2 = [2.5, 3.5]\nxlabel = \"Month\"\nylabel = \"Temperature (°C)\"\ntitle = \"Monthly Temperature Trends by City\"\ninsetaxes = [0.2, 0.6, 0.2, 0.2]\narrowend1 = [0.25, 0.75]\narrowend2 = [0.75, 0.25]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plot\nfig, ax = plt.subplots(figsize=(10, 6)) # Adjust figure size to match original image's dimensions\n\nax.plot(x, y1, \"o--\", color=\"#1f77b4\", label=labels[0]) # Blue: City A\nax.plot(x, y2, \"s-.\", color=\"#ff7f0e\", label=labels[1]) # Orange: City B\nax.plot(x, y3, \"d-\", color=\"#2ca02c\", label=labels[2]) # Green: City C\nax.plot(x, y4, \"v:\", color=\"#d62728\", label=labels[3]) # Red: City D\n\n# Create the first inset with the zoomed-in view\nax_inset1 = fig.add_axes(insertax1)\nax_inset1.plot(x, y1, \"o--\", color=\"#1f77b4\")\nax_inset1.plot(x, y2, \"s-.\", color=\"#ff7f0e\")\nax_inset1.plot(x, y3, \"d-\", color=\"#2ca02c\")\nax_inset1.plot(x, y4, \"v:\", color=\"#d62728\")\nax_inset1.spines[\"bottom\"].set_color(\"black\")\nax_inset1.spines[\"left\"].set_color(\"black\")\nax_inset1.spines[\"top\"].set_color(\"black\")\nax_inset1.spines[\"right\"].set_color(\"black\")\nax_inset1.set_ylim(insertylim1)\nax_inset1.set_xlim(insertxlim1)\n\n# Create the second inset with the zoomed-in view\nax_inset2 = fig.add_axes(insertax2)\nax_inset2.plot(x, y1, \"o--\", color=\"#1f77b4\")\nax_inset2.plot(x, y2, \"s-.\", color=\"#ff7f0e\")\nax_inset2.plot(x, y3, \"d-\", color=\"#2ca02c\")\nax_inset2.plot(x, y4, \"v:\", color=\"#d62728\")\nax_inset2.spines[\"bottom\"].set_color(\"black\")\nax_inset2.spines[\"left\"].set_color(\"black\")\nax_inset2.spines[\"top\"].set_color(\"black\")\nax_inset2.spines[\"right\"].set_color(\"black\")\nax_inset2.set_ylim(insertylim2)\nax_inset2.set_xlim(insertxlim2)\n\n# Customizing the plot\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\nax.set_title(title)\nax.legend(loc=\"upper left\")\nax.grid(True)\n\n# Annotate with arrows\nax.annotate(\n \"\",\n xy=(x[1], y4[1]),\n xytext=arrowend1,\n textcoords=\"axes fraction\",\n arrowprops=dict(facecolor=\"black\", lw=0.1, shrink=0.01),\n)\nax.annotate(\n \"\",\n xy=(x[3], y4[3]),\n xytext=arrowend2,\n textcoords=\"axes fraction\",\n arrowprops=dict(facecolor=\"black\", lw=0.1, shrink=0.01),\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot\nplt.tight_layout()\nplt.savefig(\"PIP_29.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_195", "content": { "Model": [ "GPT4", "Mixtal-8x7B", "MPT-7B", "Llama2-70B", "Falcom-40B", "Davinci-003", "Davinci-002", "Claude-2", "Claude-1" ], "Model-Basedness": [ 1.8, 1.5, 1.8, 1.2, 1.6, 1.4, 1.9, 1.1, 1.3 ], "Meta-Cognition": [ 0.8, 0.6, 0.7, 0.5, 0.9, 0.4, 1.0, 0.3, 0.2 ], "Exploration": [ 0.3, 0.5, 0.4, 0.6, 0.2, 0.7, 0.1, 0.8, 0.9 ], "Risk Taking": [ 0.9, 0.7, 0.8, 0.6, 1.0, 0.5, 0.4, 0.2, 0.3 ], "Bayesian Reasoning": [ 0.2, 0.4, 0.3, 0.5, 0.1, 0.6, 0.7, 0.9, 0.8 ], "Simple Bandits": [ 0.5, 0.3, 0.4, 0.2, 0.6, 0.1, 0.7, 0.8, 0.9 ] }, "visual_intent": "A figure with 4 subplots displaying scatter plots of AI model scores: (1) Model-Basedness, (2) Meta-Cognition, (3) Exploration, and (4) Risk Taking, plotted against specific models.(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/scatter_23.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\nmodels = [\n \"GPT4\",\n \"Mixtal-8x7B\",\n \"MPT-7B\",\n \"Llama2-70B\",\n \"Falcom-40B\",\n \"Davinci-003\",\n \"Davinci-002\",\n \"Claude-2\",\n \"Claude-1\",\n]\nvalues = {\n \"Model-Basedness\": [1.8, 1.5, 1.8, 1.2, 1.6, 1.4, 1.9, 1.1, 1.3],\n \"Meta-Cognition\": [0.8, 0.6, 0.7, 0.5, 0.9, 0.4, 1.0, 0.3, 0.2],\n \"Exploration\": [0.3, 0.5, 0.4, 0.6, 0.2, 0.7, 0.1, 0.8, 0.9],\n \"Risk Taking\": [0.9, 0.7, 0.8, 0.6, 1.0, 0.5, 0.4, 0.2, 0.3],\n \"Bayesian Reasoning\": [0.2, 0.4, 0.3, 0.5, 0.1, 0.6, 0.7, 0.9, 0.8],\n \"Simple Bandits\": [0.5, 0.3, 0.4, 0.2, 0.6, 0.1, 0.7, 0.8, 0.9],\n}\nxlabel = \"Models\"\nylabel = \"Score\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create subplots 2x2\nfig, axs = plt.subplots(2, 2, figsize=(8, 8), sharey=True)\ncolors = [\"blue\", \"orange\", \"green\", \"red\", \"purple\", \"brown\"]\naxes = axs.flatten()\n\n# Plot each category\nfor ax, (category, color) in zip(axes, zip(values.keys(), colors)):\n ax.scatter(\n models,\n values[category],\n color=color,\n label=category,\n s=100,\n edgecolor=\"black\",\n alpha=0.6,\n marker=\"o\",\n )\n ax.set_title(category)\n ax.set_xticks(models)\n ax.set_xticklabels(models, rotation=45, ha=\"right\")\n ax.set_xlabel(xlabel)\n ax.set_ylabel(ylabel)\n ax.legend()\n\n# Enhance style\nfor ax in axes:\n ax.spines[\"top\"].set_visible(False)\n ax.spines[\"right\"].set_visible(False)\n ax.grid(True, linestyle=\"--\", alpha=0.5)\n ax.set_ylim(0, 2) # Ensure all plots have the same y-axis limits\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save plot\nplt.tight_layout()\nplt.savefig(\"scatter_23.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_196", "content": { "Device Category": [ "SMARTPHONES", "TABLETS", "WEARABLES", "SMART TVS", "SMART SPEAKERS" ], "Projected Market Share": [ 0.65, 0.32, 0.38, 0.35, 0.45 ], "Error Lower": [ 0.04, 0.03, 0.02, 0.05, 0.04 ], "Error Upper": [ 0.03, 0.02, 0.03, 0.03, 0.04 ] }, "visual_intent": "An errorbar plot about smart device categories and projected market share, titled Projected Increase in Smart Device Market Share(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/errorpoint_17.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\ncategories = [\n \"SMARTPHONES\",\n \"TABLETS\",\n \"WEARABLES\",\n \"SMART TVS\",\n \"SMART SPEAKERS\",\n] # Capitalized category labels\nmeans = [0.65, 0.32, 0.38, 0.35, 0.45] # Increased mean values to show upward trend\nerrors = [0.04, 0.03, 0.02, 0.05, 0.04] # Adjusted error margins\ndownerrors = [0.03, 0.02, 0.03, 0.03, 0.04]\nlegendtitles = [\"Mean\", \"Projected market share\"]\ntexttitle = \"Baseline\"\ntitle = \"Projected Increase in Smart Device Market Share\"\nylabel = \"Projected Share of Global Market (Fraction)\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nfig, ax = plt.subplots(\n figsize=(10, 6)\n) # Adjusting figure size to match new image dimensions\nax.errorbar(\n categories,\n means,\n yerr=[errors, downerrors],\n fmt=\"s\",\n color=\"green\",\n ecolor=\"darkgreen\",\n capsize=5,\n markerfacecolor=\"lightgreen\",\n markeredgewidth=2,\n markeredgecolor=\"darkgreen\",\n)\n\n# Adding a legend with both \"Mean\" and \"Dataset mean\"\ndataset_mean = 0.22\nmean_line = ax.errorbar(\n [], [], yerr=[], fmt=\"o\", color=\"green\", ecolor=\"darkgreen\", capsize=5\n)\ndataset_mean_line = ax.axhline(\n y=dataset_mean, color=\"gray\", linestyle=\"--\", linewidth=1\n)\nax.legend(\n [dataset_mean_line, mean_line],\n legendtitles,\n loc=\"upper right\",\n fancybox=True,\n framealpha=1,\n shadow=True,\n borderpad=1,\n)\n# Adding a horizontal line for dataset mean and text annotation with a white background\nax.text(\n 0.95,\n dataset_mean,\n texttitle,\n va=\"center\",\n ha=\"right\",\n backgroundcolor=\"white\",\n transform=ax.get_yaxis_transform(),\n)\n\n# Setting labels and a title\nax.set_ylabel(ylabel)\nax.set_title(title)\nplt.xticks(rotation=30)\nplt.grid(True, which=\"both\", axis=\"y\", linestyle=\"--\", linewidth=0.5)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorpoint_17.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_197", "content": { "Number of Parameters": [ 10, 30, 50, 70, 90, 110 ], "Log KL Divergence": [ 0.03, 0.04, 0.015, 0.006, 0.0025, 0.001 ] }, "visual_intent": "A line chart about Number of Parameters and Log KL Divergence(size of the desired plot: width=6.0, height=4.0)", "path_to_gt_image": "images/line_17.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for plotting\nparameters = np.array([10, 30, 50, 70, 90, 110])\nkl_divergence = np.array([0.03, 0.04, 0.015, 0.006, 0.0025, 0.001])\n\n# Axes Limits and Labels\nxlabel_value = \"Number of Parameters\"\nxlim_values = [0, 125]\nxticks_values = np.arange(0, 121, 20)\n\nylabel_value = \"Log KL Divergence\"\nylim_values = [10**-5, 10**-1]\nyticks_values = [10**-5, 10**-4, 10**-3, 10**-2, 10**-1]\nyticklabels = [\"$10^{-5}$\", \"$10^{-4}$\", \"$10^{-3}$\", \"$10^{-2}$\", \"$10^{-1}$\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create the plot\nfig, ax = plt.subplots(figsize=(6, 4)) # Use subplots to get access to the axis object\nax.plot(parameters, kl_divergence, marker=\"o\", linestyle=\"-\", color=\"#1f77b4\")\n\n# Set the scale of the y-axis to logarithmic\nax.set_yscale(\"log\")\n\n# Set y-axis to only display specific ticks and extend y-axis to leave space at top\nax.set_yticks(yticks_values)\nax.set_yticklabels(yticklabels)\nax.set_ylim(ylim_values) # Set limits to include a small margin\n\n# Remove minor ticks\nax.tick_params(axis=\"y\", which=\"minor\", left=False)\n\n# Setting x-axis ticks\nax.set_xticks(xticks_values) # Set x-ticks to be every 20\nax.set_xlim(xlim_values) # Set limits to include a small margin\n\n# Adjusting tick label size\nplt.xticks(fontsize=10, fontweight=\"100\")\nplt.yticks(fontsize=10, fontweight=\"100\")\n\n# Remove tick lines outside the plotting area\nax.tick_params(\n axis=\"both\", which=\"both\", length=0, color=\"#d2d2d2\"\n) # Remove tick marks and set their color\n\n# Set labels and title\nax.set_xlabel(xlabel_value, fontsize=14)\nax.set_ylabel(ylabel_value, fontsize=14)\n\n# Show grid with lighter color and only major lines\nax.grid(True, which=\"major\", color=\"lightgrey\", linestyle=\"-\", linewidth=0.5)\n\n# Change the axis colors\nax.spines[\"bottom\"].set_color(\"#d2d2d2\")\nax.spines[\"top\"].set_color(\"#d2d2d2\") # Optional: hide or set color\nax.spines[\"left\"].set_color(\"#d2d2d2\")\nax.spines[\"right\"].set_color(\"#d2d2d2\") # Optional: hide or set color\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to add more space on the right\nplt.tight_layout()\nplt.savefig(\"line_17.pdf\", bbox_inches=\"tight\")\n", "width": 6.0, "height": 4.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_198", "content": { "Energy Methods": [ "Solar Panels", "Wind Turbines", "Hydro Power", "Geothermal", "Biomass", "Nuclear" ], "Energy Usage": [ 0.15, 0.3, 0.25, 0.4, 0.35, 0.2 ], "Carbon Footprint": [ 0.05, 0.1, 0.2, 0.15, 0.3, 0.25 ], "Cost per Unit": [ 0.4, 0.35, 0.3, 0.5, 0.45, 0.4 ], "Maintenance Cost": [ 0.1, 0.2, 0.25, 0.3, 0.3, 0.35 ], "Effectiveness (%)": [ 85, 75, 90, 80, 70, 95 ] }, "visual_intent": "A dual-axis combination chart displaying grouped bars for various cost and usage factors alongside a line plot for effectiveness across different energy methods(size of the desired plot: width=10.0, height=5.0)", "path_to_gt_image": "images/CB_41.jpg", "original_category": "CB", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n\n# Data for plotting\nmethods = [\n \"Solar Panels\",\n \"Wind Turbines\",\n \"Hydro Power\",\n \"Geothermal\",\n \"Biomass\",\n \"Nuclear\",\n]\nenergy_usage = [0.15, 0.3, 0.25, 0.4, 0.35, 0.2]\ncarbon_footprint = [0.05, 0.1, 0.2, 0.15, 0.3, 0.25]\ncost_per_unit = [0.4, 0.35, 0.3, 0.5, 0.45, 0.4]\nmaintenance_cost = [0.1, 0.2, 0.25, 0.3, 0.3, 0.35]\neffectiveness = [85, 75, 90, 80, 70, 95]\nlabels = [\"Energy Usage\", \"Carbon Footprint\", \"Cost per Unit\", \"Maintenance Cost\"]\nx_name = \"Energy Methods\"\nbar_name = \"Normalized Factors (lower is better)\"\nline_name = \"Effectiveness (%)\"\n\nline_label = \"Effectiveness\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set figure size to match original image's dimensions\nfig, ax1 = plt.subplots(figsize=(10, 5))\n\n# Bar plot\nbar_width = 0.2\nindex = np.arange(len(methods))\nbar1 = ax1.bar(index, energy_usage, bar_width, label=labels[0], color=\"#76c7c0\")\nbar2 = ax1.bar(\n index + bar_width,\n carbon_footprint,\n bar_width,\n label=labels[1],\n color=\"#ffcc5c\",\n)\nbar3 = ax1.bar(\n index + 2 * bar_width, cost_per_unit, bar_width, label=labels[2], color=\"#6b5b95\"\n)\nbar4 = ax1.bar(\n index + 3 * bar_width,\n maintenance_cost,\n bar_width,\n label=labels[3],\n color=\"#d64161\",\n)\n\n# Line plot\nax2 = ax1.twinx()\nline = ax2.plot(\n index + bar_width + bar_width / 2,\n effectiveness,\n label=line_label,\n color=\"black\",\n marker=\"D\",\n markersize=10,\n linewidth=2,\n linestyle='--',\n markeredgecolor=\"white\",\n)\n\n# Labels, title and legend\nax1.set_xlabel(x_name, fontsize=12)\nax1.set_ylabel(bar_name, fontsize=12)\nax1.set_xticks(index + bar_width + bar_width / 2)\nax1.set_xticklabels(methods, fontsize=12)\nax1.legend(loc=\"upper left\")\nax2.legend(loc=\"upper right\")\nax2.set_ylabel(line_name, fontsize=12)\n\nax1.tick_params(axis=\"y\", labelsize=12)\nax2.tick_params(axis=\"y\", labelsize=12)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot\nplt.tight_layout()\nplt.savefig(\"CB_41.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 5.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_199", "content": { "Years": [ 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 ], "Country A": [ 2.5, 3.0, 3.7, 4.1, 4.8, 2.5, 3.0, 4.2 ], "Country B": [ 1.8, 2.2, 2.6, 3.0, 3.5, 1.8, 2.3, 3.8 ] }, "visual_intent": "A figure with 2 subplots: (1) a line chart about years and tourist arrivals in Country A, titled Tourist Arrivals in Country A, (2) a line chart about years and tourist arrivals in Country B, titled Tourist Arrivals in Country B. The figure has a super title Tourist Arrivals Over Recent Years(size of the desired plot: width=10.0, height=5.0)", "path_to_gt_image": "images/line_124.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Sample data for tourism domain\nyears = np.array([2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022])\ntourists_country_a = np.array([2.5, 3.0, 3.7, 4.1, 4.8, 2.5, 3.0, 4.2]) # in millions\ntourists_country_b = np.array([1.8, 2.2, 2.6, 3.0, 3.5, 1.8, 2.3, 3.8]) # in millions\n\n# Labels and titles\nxlabel_value = \"Years\"\nylabel_value = \"Tourist Arrivals (in millions)\"\nlabel_1 = \"Country A\"\nlabel_2 = \"Country B\"\ntitle_1 = \"Tourist Arrivals in Country A\"\ntitle_2 = \"Tourist Arrivals in Country B\"\nsuptitle_value = \"Tourist Arrivals Over Recent Years\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the figure size\nplt.figure(figsize=(10, 5))\n\n# First subplot\nplt.subplot(1, 2, 1)\nplt.plot(\n years,\n tourists_country_a,\n marker=\"v\",\n color=\"#2ca02c\", # green\n label=label_1,\n markerfacecolor=\"#2ca02c\",\n linewidth=2,\n linestyle=\"--\",\n markersize=6,\n)\nplt.fill_between(years, tourists_country_a - 0.3, tourists_country_a + 0.3, color=\"#2ca02c\", alpha=0.2)\nplt.title(title_1, fontsize=14)\nplt.xlabel(xlabel_value, fontsize=12)\nplt.ylabel(ylabel_value, fontsize=12)\n\n# Second subplot\nplt.subplot(1, 2, 2)\nplt.plot(\n years,\n tourists_country_b,\n marker=\"s\",\n color=\"#ff7f0e\", # orange\n label=label_2,\n markerfacecolor=\"#ff7f0e\",\n linewidth=2,\n linestyle=\"-.\",\n markersize=6,\n)\nplt.fill_between(years, tourists_country_b - 0.2, tourists_country_b + 0.2, color=\"#ff7f0e\", alpha=0.2)\nplt.title(title_2, fontsize=14)\nplt.xlabel(xlabel_value, fontsize=12)\nplt.ylabel(ylabel_value, fontsize=12)\nplt.legend(loc=\"upper left\", frameon=True)\n\n# Add a super title for the whole figure\nplt.suptitle(suptitle_value, fontsize=16)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save plot\nplt.tight_layout(rect=[0, 0, 1, 0.96]) # Adjust the layout to make room for suptitle\nplt.savefig(\"line_124.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 5.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "line" }, { "id": "test_200", "content": { "Model": [ "ResNet-50", "ResNet-101", "EfficientNet-B0", "EfficientNet-B7", "VGG-16", "VGG-19", "DenseNet-121", "DenseNet-201", "InceptionV3", "MobileNetV2", "NASNetMobile" ], "CIFAR-10": [ 93.5, 94.2, 92.8, 95.7, 91.3, 91.8, 93.0, 94.1, 93.6, 92.1, 90.8 ], "CIFAR-100": [ 74.0, 74.8, 72.9, 76.1, 70.6, 71.2, 74.3, 75.4, 73.7, 71.6, 70.1 ], "ImageNet": [ 76.1, 77.2, 74.4, 79.1, 71.6, 72.1, 76.0, 77.5, 76.8, 74.2, 72.9 ], "SVHN": [ 96.5, 97.1, 96.0, 97.6, 95.3, 95.7, 96.4, 96.8, 96.7, 95.9, 94.8 ], "Fashion-MNIST": [ 93.2, 93.8, 92.7, 94.5, 91.1, 91.5, 92.9, 93.7, 93.3, 92.4, 91.0 ], "MNIST": [ 99.0, 99.2, 98.8, 99.4, 98.5, 98.7, 99.0, 99.2, 99.1, 98.7, 98.3 ], "TinyImagenet": [ 60.2, 61.5, 58.4, 63.1, 56.7, 57.1, 60.3, 61.8, 60.9, 58.5, 56.3 ] }, "visual_intent": "A figure with 7 subplots showing bar charts about deep learning models and performance accuracy for different datasets: (1) CIFAR-10, (2) CIFAR-100, (3) ImageNet, (4) SVHN, (5) Fashion-MNIST, (6) MNIST, and (7) TinyImagenet.(size of the desired plot: width=12.0, height=10.0)", "path_to_gt_image": "images/bar_208.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nnp.random.seed(0)\n\n# Placeholder data\ncategories = [\n \"ResNet-50\",\n \"ResNet-101\",\n \"EfficientNet-B0\",\n \"EfficientNet-B7\",\n \"VGG-16\",\n \"VGG-19\",\n \"DenseNet-121\",\n \"DenseNet-201\",\n \"InceptionV3\",\n \"MobileNetV2\",\n \"NASNetMobile\",\n]\nscores = {\n \"CIFAR-10\": [93.5, 94.2, 92.8, 95.7, 91.3, 91.8, 93.0, 94.1, 93.6, 92.1, 90.8],\n \"CIFAR-100\": [74.0, 74.8, 72.9, 76.1, 70.6, 71.2, 74.3, 75.4, 73.7, 71.6, 70.1],\n \"ImageNet\": [76.1, 77.2, 74.4, 79.1, 71.6, 72.1, 76.0, 77.5, 76.8, 74.2, 72.9],\n \"SVHN\": [96.5, 97.1, 96.0, 97.6, 95.3, 95.7, 96.4, 96.8, 96.7, 95.9, 94.8],\n \"Fashion-MNIST\": [93.2, 93.8, 92.7, 94.5, 91.1, 91.5, 92.9, 93.7, 93.3, 92.4, 91.0],\n \"MNIST\": [99.0, 99.2, 98.8, 99.4, 98.5, 98.7, 99.0, 99.2, 99.1, 98.7, 98.3],\n \"TinyImagenet\": [60.2, 61.5, 58.4, 63.1, 56.7, 57.1, 60.3, 61.8, 60.9, 58.5, 56.3],\n}\n\nylim = [50, 100]\nylabel = \"Performance Accuracy (%)\"\nyticks = [50, 60, 70, 80, 90, 100]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nplt.figure(figsize=(12, 10))\n\n# Create subplots for each category\nn_rows = 3\nn_cols = 3\nsubplot_idx = 1\nfor category, score in scores.items():\n ax = plt.subplot(n_rows, n_cols, subplot_idx)\n subplot_idx += 1\n\n # Create bar chart\n x = np.arange(len(categories))\n ax.bar(\n x,\n score,\n color=[\n \"#ff9999\",\n \"#66b3ff\",\n \"#99ff99\",\n \"#ffcc99\",\n \"#c2c2f0\",\n \"#ffb3e6\",\n \"#c4e17f\",\n \"#ffccff\",\n \"#ff6666\",\n \"#c2c2f0\",\n \"#ffb366\",\n ],\n )\n\n # Add data labels\n for j, val in enumerate(score):\n ax.text(j, val + 1, f\"{val:.1f}\", ha=\"center\", va=\"bottom\", fontsize=6)\n\n # Set title and labels\n ax.set_title(category, fontsize=10)\n ax.set_xticks(x)\n ax.set_xticklabels(categories, rotation=45, ha=\"right\", fontsize=7)\n ax.set_ylim(ylim)\n ax.set_ylabel(ylabel, fontsize=8)\n ax.set_yticks(yticks)\n\n ax.tick_params(axis=\"both\", which=\"both\", length=0, labelsize=7)\n\n # Add y grid\n ax.yaxis.grid(True)\n ax.set_axisbelow(True)\n\n ax.spines[\"top\"].set_color(\"gray\")\n ax.spines[\"right\"].set_color(\"gray\")\n ax.spines[\"bottom\"].set_color(\"gray\")\n ax.spines[\"left\"].set_color(\"gray\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout\nplt.tight_layout()\nplt.savefig(\"bar_208.pdf\", bbox_inches=\"tight\")\n\n", "width": 12.0, "height": 10.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "bar" }, { "id": "test_201", "content": { "Time Periods": [ "Q1", "Q2", "Q3", "Q4" ], "Traditional Energy": [ 200, 180, 150, 130 ], "Energy Savings (%)": [ 20, 35, 45, 60 ], "Green Energy": [ 150, 130, 100, 80 ], "Green Energy Savings (%)": [ 30, 50, 60, 75 ] }, "visual_intent": "A figure with 2 subplots: (1) a line chart about Traditional Energy consumption and savings over time periods, titled Energy Consumption and Savings (Traditional), (2) a line chart about Green Energy consumption and savings over time periods, titled Energy Consumption and Savings (Green)(size of the desired plot: width=12.0, height=5.0)", "path_to_gt_image": "images/line_82.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for plotting\ntime_periods = [\"Q1\", \"Q2\", \"Q3\", \"Q4\"] # Update for categorical x-axis\nenergy_consumption = [200, 180, 150, 130]\nenergy_savings = [20, 35, 45, 60]\ngreen_energy_consumption = [150, 130, 100, 80]\ngreen_energy_savings = [30, 50, 60, 75]\n\n# Axes Limits and Labels\nxticks_values = range(len(time_periods))\nylabel_value = \"Energy (kWh) and Savings (%)\"\nxlabel_value = \"Time Periods\"\n\n# Labels\nlabel_1 = \"Traditional Energy\"\nlabel_2 = \"Green Energy\"\n\n# Titles\ntitle_1 = \"Energy Consumption and Savings (Traditional)\"\ntitle_2 = \"Energy Consumption and Savings (Green)\"\n\n# Texts\ntext_1 = \"25.0%\"\ntext_2 = \"37.5%\"\n\nlabels = [\"Energy Savings (%)\", \"Green Energy Savings (%)\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and axes\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))\n\n# Plotting for Traditional Energy\nax1.set_xticks(xticks_values) # Setting categorical x-axis\nax1.plot(\n time_periods,\n energy_consumption,\n marker=\"s\",\n color=\"#1f77b4\",\n label=label_1,\n linewidth=2,\n markersize=6,\n)\nax1.plot(\n time_periods,\n energy_savings,\n marker=\"^\",\n linestyle=\"--\",\n color=\"#ff7f0e\",\n label=labels[0],\n linewidth=2,\n markersize=6,\n)\nax1.set_title(title_1, fontsize=16)\nax1.set_ylabel(ylabel_value, fontsize=14) \nax1.legend(loc=\"best\", fontsize=12)\nax1.set_xticklabels(time_periods, fontsize=12) \nax1.grid(True, which=\"both\", ls=\"--\", color=\"grey\", linewidth=1, axis=\"y\", alpha=0.5)\nax1.annotate(\n \"\",\n xy=(0, energy_savings[0]),\n xytext=(0, energy_consumption[0]),\n arrowprops=dict(color=\"green\", shrink=0.05, width=1.5, headwidth=8),\n annotation_clip=False,\n)\nax1.text(\n 0.1,\n (energy_consumption[0] + energy_savings[0]) / 2,\n text_1,\n ha=\"left\",\n va=\"center\",\n fontsize=12,\n color=\"black\",\n)\n\n# Plotting for Green Energy\nax2.plot(\n time_periods,\n green_energy_consumption,\n marker=\"s\",\n color=\"#2ca02c\",\n label=label_2,\n linewidth=2,\n markersize=6,\n)\nax2.plot(\n time_periods,\n green_energy_savings,\n marker=\"^\",\n linestyle=\"--\",\n color=\"#d62728\",\n label=labels[1],\n linewidth=2,\n markersize=6,\n)\nax2.set_title(title_2, fontsize=16) \nax2.legend(loc=\"best\", fontsize=12)\nax2.set_xticklabels(time_periods, fontsize=12) \nax2.grid(True, which=\"both\", ls=\"--\", color=\"grey\", linewidth=1, axis=\"y\", alpha=0.5)\nax2.annotate(\n \"\",\n xy=(0, green_energy_savings[0]),\n xytext=(0, green_energy_consumption[0]),\n arrowprops=dict(color=\"green\", shrink=0.05, width=1.5, headwidth=8),\n annotation_clip=False,\n)\nax2.text(\n 0.1,\n (green_energy_consumption[0] + green_energy_savings[0]) / 2,\n text_2,\n ha=\"left\",\n va=\"center\",\n fontsize=12,\n color=\"black\",\n)\n\n# Common x-axis label\nfig.text(0.5, 0.04, xlabel_value, ha='center', fontsize=14)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and add common annotation for resolution\nplt.tight_layout()\nplt.savefig(\"line_82.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 5.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "line" }, { "id": "test_202", "content": { "Investment Method": [ "Stocks", "Bonds", "Real Estate", "Cryptocurrency", "Mutual Funds", "ETFs" ], "Plot 1 Portfolio Diversification": [ 0.8, 2.1, 1.9, 1.5, 2.3, 1.6 ], "Plot 1 Return Accuracy (%)": [ 55, 60, 45, 75, 50, 80 ], "Plot 2 Portfolio Diversification": [ 1.5, 3.2, 5.0, 4.5, 3.8, 2.6 ], "Plot 2 Return Accuracy (%)": [ 65, 70, 85, 80, 75, 90 ], "Scatter Size": [ 80, 120, 100, 160, 200, 180 ] }, "visual_intent": "A figure with 2 subplots titled Performance of Investment Methods Over Time. Both subplots are scatter plots displaying Portfolio Diversification vs. Return Accuracy (%) for various investment methods, where each method represents a data point with a specific size and color.(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/scatter_33.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib.lines as mlines\nimport numpy as np\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# New dataset for Financial Analysis focusing on Investment Methods\nmethods = [\"Stocks\", \"Bonds\", \"Real Estate\", \"Cryptocurrency\", \"Mutual Funds\", \"ETFs\"]\n\n# Data for the subplots representing two different timelines.\ndiversity_data = [[0.8, 2.1, 1.9, 1.5, 2.3, 1.6], [1.5, 3.2, 5.0, 4.5, 3.8, 2.6]]\naccuracy_data = [[55, 60, 45, 75, 50, 80], [65, 70, 85, 80, 75, 90]]\nscatter_sizes = [80, 120, 100, 160, 200, 180]\n\n# Legend labels for the subplots.\nax1_legend_names = [\"1 Year\", \"5 Years\", \"10 Years\", \"20 Years\"]\nax2_legend_names = [\"Short-term\", \"Medium-term\", \"Long-term\", \"Very Long-term\"]\nax1_legend_title = \"Investment Horizon\"\nax2_legend_title = \"Investment Period\"\nxlabel = \"Portfolio Diversification\"\nylabel = \"Return Accuracy (%)\"\nsuptitle = \"Performance of Investment Methods Over Time\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create 2x1 grid of subplots with a specified figure size.\nfig, axs = plt.subplots(2, 1, figsize=(8, 8))\n\n# Use new colors for the points to distinguish them better.\ncolors = [\"#1f77b4\", \"#ff7f0e\", \"#2ca02c\", \"#d62728\", \"#9467bd\", \"#8c564b\"]\n\n# Populate the subplots with scatter points and add text labels.\nfor idx, ax in enumerate(axs):\n for method, div, acc, size, color in zip(\n methods, diversity_data[idx], accuracy_data[idx], scatter_sizes, colors\n ):\n ax.scatter(\n div, acc, s=size, color=color, alpha=0.6, edgecolors=\"w\", linewidth=1\n ) # Plot the scatter points.\n ax.text(\n div, acc + 2, method, fontsize=9, ha=\"center\", color=\"black\", weight=\"bold\"\n ) # Add text labels above scatter points.\n\n ax.set_xlabel(xlabel, fontsize=12) # X-axis label.\n ax.set_ylabel(ylabel, fontsize=12) # Y-axis label.\n ax.grid(True, linestyle=\"--\", alpha=0.6) # Add grid lines for better readability.\n ax.tick_params(\n axis=\"both\", which=\"major\", labelsize=10\n ) # Customize tick parameters.\n\n# Adjust the x and y limits and ticks for the subplots.\naxs[0].set_xlim(0.5, 2.5)\naxs[0].set_ylim(40, 90)\naxs[0].set_xticks(np.arange(0.5, 2.6, 0.5))\naxs[0].set_yticks(np.arange(40, 91, 10))\naxs[1].set_xlim(1.0, 6.0)\naxs[1].set_ylim(60, 100)\naxs[1].set_xticks(np.arange(1.0, 6.1, 1.0))\naxs[1].set_yticks(np.arange(60, 101, 10))\n\nsize_legend_handles = [80, 120, 160, 200] # Sizes for the legend handles.\n\n# Create custom legend handles for the first subplot.\nax1_legend_handles = [\n mlines.Line2D(\n [],\n [],\n color=color,\n marker=\"o\",\n linestyle=\"None\",\n markersize=(size**0.5) * 0.8,\n label=name,\n )\n for size, name, color in zip(\n size_legend_handles, ax1_legend_names, colors[: len(ax1_legend_names)]\n )\n]\n\n# Create custom legend handles for the second subplot.\nax2_legend_handles = [\n mlines.Line2D(\n [],\n [],\n color=color,\n marker=\"o\",\n linestyle=\"None\",\n markersize=(size**0.5) * 0.8,\n label=name,\n )\n for size, name, color in zip(\n size_legend_handles, ax2_legend_names, colors[: len(ax2_legend_names)]\n )\n]\n\n# Add legends to the subplots.\naxs[0].legend(\n handles=ax1_legend_handles,\n loc=\"upper left\",\n title=ax1_legend_title,\n labelspacing=1.5,\n edgecolor=\"gray\",\n)\naxs[1].legend(\n handles=ax2_legend_handles,\n loc=\"upper left\",\n title=ax2_legend_title,\n labelspacing=1.5,\n edgecolor=\"gray\",\n)\n\n# Add a common title for the entire figure\nfig.suptitle(suptitle, fontsize=14, fontweight=\"bold\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout(rect=[0, 0, 1, 0.96])\nplt.savefig(\"scatter_33.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_203", "content": { "Sales Rep": [ "Alice", "Alice", "Alice", "Alice", "Alice", "Alice", "Alice", "Bob", "Bob", "Bob", "Bob", "Bob", "Bob", "Bob", "Charlie", "Charlie", "Charlie", "Charlie", "Charlie", "Charlie", "Charlie", "David", "David", "David", "David", "David", "David", "David", "Eve", "Eve", "Eve", "Eve", "Eve", "Eve", "Eve", "Frank", "Frank", "Frank", "Frank", "Frank", "Frank", "Frank", "Grace", "Grace", "Grace", "Grace", "Grace", "Grace", "Grace" ], "Region": [ "North", "South", "East", "West", "Central", "Northeast", "Northwest", "North", "South", "East", "West", "Central", "Northeast", "Northwest", "North", "South", "East", "West", "Central", "Northeast", "Northwest", "North", "South", "East", "West", "Central", "Northeast", "Northwest", "North", "South", "East", "West", "Central", "Northeast", "Northwest", "North", "South", "East", "West", "Central", "Northeast", "Northwest", "North", "South", "East", "West", "Central", "Northeast", "Northwest" ], "Sales (in thousands)": [ 12, 24, 35, 29, 15, 40, 18, 22, 15, 30, 11, 27, 20, 12, 15, 24, 18, 33, 19, 24, 22, 16, 21, 14, 18, 26, 19, 17, 10, 18, 24, 39, 21, 30, 12, 17, 14, 21, 25, 19, 28, 24, 11, 20, 17, 14, 23, 16, 31 ] }, "visual_intent": "A heatmap about regions and sales representatives showing sales values, titled Tech Product Sales by Region and Sales Rep(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/heatmap_101.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib\nimport matplotlib as mpl\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n\n# Define regions and sales reps\nregions = [\"North\", \"South\", \"East\", \"West\", \"Central\", \"Northeast\", \"Northwest\"]\nsales_reps = [\n \"Alice\",\n \"Bob\",\n \"Charlie\",\n \"David\",\n \"Eve\",\n \"Frank\",\n \"Grace\",\n]\n\n# Simulate sales data (in thousands)\nsales_data = np.array(\n [\n [12, 24, 35, 29, 15, 40, 18],\n [22, 15, 30, 11, 27, 20, 12],\n [15, 24, 18, 33, 19, 24, 22],\n [16, 21, 14, 18, 26, 19, 17],\n [10, 18, 24, 39, 21, 30, 12],\n [17, 14, 21, 25, 19, 28, 24],\n [11, 20, 17, 14, 23, 16, 31],\n ]\n)\n\nxlabel = \"Regions\"\nylabel = \"Sales Reps\"\ntitle = \"Tech Product Sales by Region and Sales Rep\"\ncbarlabel = \"Sales (in thousands)\"\noutput_filename = \"heatmap_24_5.pdf\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n\n\ndef heatmap(\n data, row_labels, col_labels, ax=None, cbar_kw=None, cbarlabel=\"\", **kwargs\n):\n if ax is None:\n ax = plt.gca()\n\n if cbar_kw is None:\n cbar_kw = {}\n\n # Plot the heatmap\n im = ax.imshow(data, **kwargs)\n\n # Create colorbar\n cbar = ax.figure.colorbar(im, ax=ax, **cbar_kw)\n cbar.ax.set_ylabel(cbarlabel, rotation=-90, va=\"bottom\")\n\n # Show all ticks and label them with the respective list entries.\n ax.set_xticks(np.arange(data.shape[1]), labels=col_labels)\n ax.set_yticks(np.arange(data.shape[0]), labels=row_labels)\n\n # Let the horizontal axes labeling appear on top.\n ax.tick_params(top=True, bottom=False, labeltop=True, labelbottom=False)\n\n # Rotate the tick labels and set their alignment.\n plt.setp(ax.get_xticklabels(), rotation=-30, ha=\"right\", rotation_mode=\"anchor\")\n\n # Turn spines off and create white grid.\n ax.spines[:].set_visible(False)\n\n ax.set_xticks(np.arange(data.shape[1] + 1) - 0.5, minor=True)\n ax.set_yticks(np.arange(data.shape[0] + 1) - 0.5, minor=True)\n ax.grid(which=\"minor\", color=\"w\", linestyle=\"-\", linewidth=3)\n ax.tick_params(which=\"minor\", bottom=False, left=False)\n\n return im, cbar\n\n\ndef annotate_heatmap(\n im,\n data=None,\n valfmt=\"{x:.2f}\",\n textcolors=(\"black\", \"white\"),\n threshold=None,\n **textkw\n):\n if not isinstance(data, (list, np.ndarray)):\n data = im.get_array()\n\n # Normalize the threshold to the images color range.\n if threshold is not None:\n threshold = im.norm(threshold)\n else:\n threshold = im.norm(data.max()) / 2.0\n\n # Set default alignment to center, but allow it to be\n # overwritten by textkw.\n kw = dict(horizontalalignment=\"center\", verticalalignment=\"center\")\n kw.update(textkw)\n\n # Get the formatter in case a string is supplied\n if isinstance(valfmt, str):\n valfmt = matplotlib.ticker.StrMethodFormatter(valfmt)\n\n # Loop over the data and create a `Text` for each \"pixel\".\n # Change the text's color depending on the data.\n texts = []\n for i in range(data.shape[0]):\n for j in range(data.shape[1]):\n kw.update(color=textcolors[int(im.norm(data[i, j]) > threshold)])\n text = im.axes.text(j, i, valfmt(data[i, j], None), **kw)\n texts.append(text)\n\n return texts\n\n\nfig, ax = plt.subplots(figsize=(10, 8))\nim, cbar = heatmap(\n sales_data, sales_reps, regions, ax=ax, cmap=\"coolwarm\", cbarlabel=cbarlabel\n)\ntexts = annotate_heatmap(im, valfmt=\"{x:.1f}k\")\n\n# Title and labels\nax.set_title(title, fontsize=16, weight='bold')\nax.set_xlabel(xlabel, fontsize=14)\nax.set_ylabel(ylabel, fontsize=14)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nfig.tight_layout()\nplt.savefig(\"heatmap_101.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_204", "content": { "Energy Source": [ "Solar", "Wind", "Hydro", "Geothermal", "Biomass" ], "Nationwide Consumption": [ 250, 300, 200, 150, 100 ], "Project Consumption": [ 100, 120, 80, 60, 40 ] }, "visual_intent": "A nested pie chart about energy sources, nationwide consumption, and project consumption, titled Renewable Energy Consumption - National vs. Project(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/pie_47.jpg", "original_category": "pie", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# New data for environmental science domain\nlabels = [\"Solar\", \"Wind\", \"Hydro\", \"Geothermal\", \"Biomass\"]\nouter_sizes = [250, 300, 200, 150, 100] # Nationwide energy source distribution\ninner_sizes = [100, 120, 80, 60, 40] # Project-specific energy source distribution\n\n# Text labels\ntitle = \"Renewable Energy Consumption - National vs. Project\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, ax = plt.subplots(figsize=(8, 8))\n\n# New color schemes for environmental themes\nouter_colors = [\"#ffddc1\", \"#afd3e2\", \"#ccff99\", \"#c0ca33\", \"#d7ccc8\"]\ninner_colors = [\"#f8bbd0\", \"#b2dfdb\", \"#dcedc8\", \"#ffecb3\", \"#8c9eff\"]\n\n# Explode the first slice (Solar) for emphasis\nexplode_outer = (0.1, 0, 0, 0, 0)\n\n# Outer ring\nwedges, texts, autotexts = ax.pie(\n outer_sizes,\n labels=labels,\n radius=1.2,\n colors=outer_colors,\n explode=explode_outer,\n autopct=\"%1.1f%%\",\n pctdistance=0.85,\n startangle=140,\n)\n\n# Inner ring\nwedges2, texts2, autotexts2 = ax.pie(\n inner_sizes,\n radius=0.8,\n colors=inner_colors,\n autopct=\"%1.1f%%\",\n pctdistance=0.75,\n startangle=140,\n)\n\n# Equal aspect ratio ensures that pie chart is drawn as a circle\nax.axis(\"equal\")\n\n# Title for the double-layer pie chart\nax.set_title(title, fontsize=20, y=1.05)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"pie_47.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_205", "content": { "Metric": [ "Query Error", "Privacy", "MLA", "Fidelity(D_train)", "Fidelity(D_test)" ], "PGM (ε = ∞)": [ 3, 4, 2, 5, 3 ], "PrivSyn (ε = ∞)": [ 4, 3, 3, 4, 2 ], "TVAE": [ 2, 5, 4, 3, 4 ] }, "visual_intent": "A figure with 3 subplots: (1) a radar chart about performance metrics for PGM (ε = ∞), (2) a radar chart about performance metrics for PrivSyn (ε = ∞), (3) a radar chart about performance metrics for TVAE(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/radar_4.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Define the data for each method\nlabels = np.array(\n [\"Query Error\", \"Privacy\", \"MLA\", \"Fidelity(D_train)\", \"Fidelity(D_test)\"]\n)\nstats = np.array([[3, 4, 2, 5, 3], [4, 3, 3, 4, 2], [2, 5, 4, 3, 4]])\ntitles = [\"PGM (ε = ∞)\", \"PrivSyn (ε = ∞)\", \"TVAE\"]\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the figure size\nfig, ax = plt.subplots(figsize=(10, 6), nrows=1, ncols=3, subplot_kw=dict(polar=True))\n\n# Define the number of variables\nnum_vars = len(labels)\n# Compute angle for each axis\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n# The plot is made circular\nstats = np.concatenate((stats, stats[:, [0]]), axis=1)\nangles += angles[:1]\n\n\n# Draw one radar chart for each method\nfor idx, (title, case_data) in enumerate(zip(titles, stats)):\n thisColor = np.random.rand(\n 3,\n )\n # ax[idx].fill(angles, case_data, color=thisColor, alpha=0.1)\n ax[idx].plot(\n angles, case_data, color=thisColor, linewidth=2\n ) # Change the color for each method\n ax[idx].set_yticks([1, 2, 3, 4, 5])\n ax[idx].set_xticks(angles[:-1])\n ax[idx].set_xticklabels(labels)\n ax[idx].set_title(title, size=14, color=\"black\", position=(0.5, -0.1))\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit\nplt.tight_layout()\n\n# Show the plot\nplt.savefig(\"radar_4.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "radar" }, { "id": "test_206", "content": { "Exhibitions": [ "Sculptures", "Sculptures", "Sculptures", "Sculptures", "Sculptures", "Sculptures", "Sculptures", "Paintings", "Paintings", "Paintings", "Paintings", "Paintings", "Paintings", "Paintings", "Photographs", "Photographs", "Photographs", "Photographs", "Photographs", "Photographs", "Photographs", "Installations", "Installations", "Installations", "Installations", "Installations", "Installations", "Installations", "Digital Art", "Digital Art", "Digital Art", "Digital Art", "Digital Art", "Digital Art", "Digital Art", "Ceramics", "Ceramics", "Ceramics", "Ceramics", "Ceramics", "Ceramics", "Ceramics", "Textiles", "Textiles", "Textiles", "Textiles", "Textiles", "Textiles", "Textiles" ], "Months": [ "January", "February", "March", "April", "May", "June", "July", "January", "February", "March", "April", "May", "June", "July", "January", "February", "March", "April", "May", "June", "July", "January", "February", "March", "April", "May", "June", "July", "January", "February", "March", "April", "May", "June", "July", "January", "February", "March", "April", "May", "June", "July", "January", "February", "March", "April", "May", "June", "July" ], "Attendance": [ 152, 184, 200, 132, 175, 210, 190, 134, 118, 177, 165, 160, 150, 140, 170, 165, 180, 175, 160, 165, 155, 110, 125, 145, 155, 150, 140, 130, 190, 200, 220, 210, 215, 230, 225, 125, 130, 135, 140, 145, 150, 155, 180, 175, 185, 190, 195, 200, 205 ] }, "visual_intent": "A heatmap about exhibitions and months, titled Monthly Attendance of Art Exhibitions(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/heatmap_102.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport matplotlib\nimport matplotlib as mpl\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\nexhibitions = [\"Sculptures\", \"Paintings\", \"Photographs\", \"Installations\", \"Digital Art\", \"Ceramics\", \"Textiles\"]\nmonths = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\"]\n\nattendance = np.array(\n [\n [152, 184, 200, 132, 175, 210, 190],\n [134, 118, 177, 165, 160, 150, 140],\n [170, 165, 180, 175, 160, 165, 155],\n [110, 125, 145, 155, 150, 140, 130],\n [190, 200, 220, 210, 215, 230, 225],\n [125, 130, 135, 140, 145, 150, 155],\n [180, 175, 185, 190, 195, 200, 205],\n ]\n)\n\n# Setting the labels and titles\nxlabel = \"Months\"\nylabel = \"Exhibitions\"\ntitle = \"Monthly Attendance of Art Exhibitions\"\ncbarlabel = \"Attendance\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n\ndef heatmap(data, row_labels, col_labels, ax=None, cbar_kw=None, cbarlabel=\"\", **kwargs):\n if ax is None:\n ax = plt.gca()\n\n if cbar_kw is None:\n cbar_kw = {}\n\n # Plot the heatmap\n im = ax.imshow(data, **kwargs)\n\n # Create colorbar\n cbar = ax.figure.colorbar(im, ax=ax, **cbar_kw)\n cbar.ax.set_ylabel(cbarlabel, rotation=-90, va=\"bottom\")\n\n # Show all ticks and label them with the respective list entries.\n ax.set_xticks(np.arange(data.shape[1]), labels=col_labels)\n ax.set_yticks(np.arange(data.shape[0]), labels=row_labels)\n\n # Let the horizontal axes labeling appear on top.\n ax.tick_params(top=True, bottom=False, labeltop=True, labelbottom=False)\n\n # Rotate the tick labels and set their alignment.\n plt.setp(ax.get_xticklabels(), rotation=-30, ha=\"right\", rotation_mode=\"anchor\")\n\n # Turn spines off and create white grid.\n ax.spines[:].set_visible(False)\n\n ax.set_xticks(np.arange(data.shape[1] + 1) - 0.5, minor=True)\n ax.set_yticks(np.arange(data.shape[0] + 1) - 0.5, minor=True)\n ax.grid(which=\"minor\", color=\"w\", linestyle=\"-\", linewidth=3)\n ax.tick_params(which=\"minor\", bottom=False, left=False)\n\n return im, cbar\n\n\ndef annotate_heatmap(im, data=None, valfmt=\"{x:.2f}\", textcolors=(\"black\", \"white\"), threshold=None, **textkw):\n if not isinstance(data, (list, np.ndarray)):\n data = im.get_array()\n\n # Normalize the threshold to the images color range.\n if threshold is not None:\n threshold = im.norm(threshold)\n else:\n threshold = im.norm(data.max()) / 2.0\n\n # Set default alignment to center, but allow it to be\n # overwritten by textkw.\n kw = dict(horizontalalignment=\"center\", verticalalignment=\"center\")\n kw.update(textkw)\n\n # Get the formatter in case a string is supplied\n if isinstance(valfmt, str):\n valfmt = matplotlib.ticker.StrMethodFormatter(valfmt)\n\n # Loop over the data and create a `Text` for each \"pixel\".\n # Change the text's color depending on the data.\n texts = []\n for i in range(data.shape[0]):\n for j in range(data.shape[1]):\n kw.update(color=textcolors[int(im.norm(data[i, j]) > threshold)])\n text = im.axes.text(j, i, valfmt(data[i, j], None), **kw)\n texts.append(text)\n\n return texts\n\n\nfig, ax = plt.subplots(figsize=(10, 8))\nim, cbar = heatmap(attendance, exhibitions, months, ax=ax, cmap=\"coolwarm\", cbarlabel=cbarlabel)\ntexts = annotate_heatmap(im, valfmt=\"{x:.0f}\")\n\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\nax.set_title(title)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nfig.tight_layout()\nplt.savefig(\"heatmap_102.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_207", "content": { "Article Type": [ "Clinical", "Theoretical", "Applied", null, null, null, null, null, null, null, null, null ], "Article Proportion": [ 0.4, 0.35, 0.25, null, null, null, null, null, null, null, null, null ], "Study Outcomes": [ "Hypothesis 1", "Hypothesis 1", "Hypothesis 1", "Hypothesis 1", "Hypothesis 2", "Hypothesis 2", "Hypothesis 2", "Hypothesis 2", "Hypothesis 3", "Hypothesis 3", "Hypothesis 3", "Hypothesis 3" ], "Outcomes": [ "Outcome A", "Outcome B", "Outcome C", "Outcome D", "Outcome A", "Outcome B", "Outcome C", "Outcome D", "Outcome A", "Outcome B", "Outcome C", "Outcome D" ], "Heatmap Value": [ 0.6, 0.2, 0.4, 0.1, 0.2, 0.5, 0.3, 0.4, 0.3, 0.1, 0.6, 0.2 ] }, "visual_intent": "A figure with 2 subplots, titled Scientific Study Analysis: (1) a bar chart about Article Type and Article Proportion, titled Distribution of Scientific Article Types, (2) a heatmap about Outcomes and Study Outcomes.(size of the desired plot: width=12.0, height=5.0)", "path_to_gt_image": "images/multidiff_69.jpg", "original_category": "multidiff", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\nnp.random.seed(0)\n\n# Data for bar plot\ncategories = [\"Clinical\", \"Theoretical\", \"Applied\"]\nvalues = [0.4, 0.35, 0.25]\n\n# Data for heatmap\ndata = np.array(\n [[0.6, 0.2, 0.4, 0.1], [0.2, 0.5, 0.3, 0.4], [0.3, 0.1, 0.6, 0.2]]\n)\nrows = [\"Hypothesis 1\", \"Hypothesis 2\", \"Hypothesis 3\"]\ncolumns = [\"Outcome A\", \"Outcome B\", \"Outcome C\", \"Outcome D\"]\nylabel = \"Article Proportion\"\nxlabel_bar = \"Article Type\"\nylabel_heatmap = \"Study Outcomes\"\ntitle = \"Distribution of Scientific Article Types\"\nsupertitle = \"Scientific Study Analysis\"\ncolor_bar = \"#88CCEE\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the figure size to match the original image's dimensions\nplt.figure(figsize=(12, 5))\nplt.suptitle(supertitle, fontsize=16)\n\n# Create the bar plot on the left\nplt.subplot(1, 2, 1)\nbars = plt.bar(categories, values, color=\"#117733\")\nplt.ylabel(ylabel)\nplt.xlabel(xlabel_bar)\nplt.ylim([0, 0.5])\nplt.title(title)\n\n# Create the heatmap on the right\nplt.subplot(1, 2, 2)\nheatmap = plt.imshow(\n data, cmap=\"BuGn\", interpolation=\"nearest\", vmin=0, vmax=1.0\n)\nplt.xticks(np.arange(len(columns)), columns, rotation=30, ha=\"right\")\nplt.yticks(np.arange(len(rows)), rows)\nplt.colorbar(heatmap)\nplt.xlabel(\"Outcomes\")\nplt.ylabel(ylabel_heatmap)\n\n# Annotate the heatmap with text\nfor i in range(len(rows)):\n for j in range(len(columns)):\n plt.text(j, i, f\"{data[i, j]:.2f}\", ha=\"center\", va=\"center\", color=\"black\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout to prevent overlap\nplt.tight_layout(rect=[0, 0, 1, 0.96])\n\nplt.savefig(\"multidiff_69.pdf\", bbox_inches=\"tight\")\n\n", "width": 12.0, "height": 5.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_208", "content": { "Year": [ 2000, 2005, 2010, 2015, 2020 ], "Group A": [ 0.45, 0.5, 0.55, 0.6, 0.64 ], "Group B": [ 0.35, 0.4, 0.43, 0.44, 0.45 ], "Group C": [ 0.15, 0.2, 0.25, 0.28, 0.3 ], "Group D": [ 0.05, 0.1, 0.15, 0.18, 0.2 ] }, "visual_intent": "A line chart about Year and Proportion of Followers, titled Religious Group Trends Over Time(size of the desired plot: width=8.0, height=5.0)", "path_to_gt_image": "images/line_168.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Sample data for religious trends over years\nyears = [2000, 2005, 2010, 2015, 2020]\ngroup_a = [0.45, 0.50, 0.55, 0.60, 0.64] # Group A proportion\ngroup_b = [0.35, 0.40, 0.43, 0.44, 0.45] # Group B proportion\ngroup_c = [0.15, 0.20, 0.25, 0.28, 0.30] # Group C proportion\ngroup_d = [0.05, 0.10, 0.15, 0.18, 0.20] # Group D proportion\n\n# Axes Limits and Labels\nxlabel_value = \"Year\"\nxlim_values = [1995, 2025]\nxticks_values = np.arange(2000, 2021, 5)\n\nylabel_value = \"Proportion of Followers\"\nylim_values = [0.00, 0.70]\nyticks_values = np.arange(0.0, 0.71, 0.10)\n\n# Labels\nlabel_1 = \"Group A\"\nlabel_2 = \"Group B\"\nlabel_3 = \"Group C\"\nlabel_4 = \"Group D\"\ntitle=\"Religious Group Trends Over Time\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create the plot\nplt.figure(figsize=(8, 5)) # Adjusted to match the original image's dimensions\nplt.plot(years, group_a, marker=\"o\", linestyle=\"-\", color=\"#1f77b4\", label=label_1)\nplt.plot(years, group_b, marker=\"s\", linestyle=\"--\", color=\"#2ca02c\", label=label_2)\nplt.plot(years, group_c, marker=\"^\", linestyle=\":\", color=\"#ff7f0e\", label=label_3)\nplt.plot(years, group_d, marker=\"d\", linestyle=\"-.\", color=\"#d62728\", label=label_4)\n\n# Set x,y-axis to only display specific ticks and extend y-axis to leave space at top\nplt.xticks(xticks_values, fontsize=10)\nplt.xlim(xlim_values) \nplt.yticks(yticks_values, fontsize=10)\nplt.ylim(ylim_values) \n\n# Add vertical dotted line\nplt.axvline(x=2010, color=\"grey\", linestyle=\":\", linewidth=1.2)\n\n# Add legend\nplt.legend(loc=\"upper left\", fontsize=12)\n\n# Add labels and title\nplt.xlabel(xlabel_value, fontsize=12)\nplt.ylabel(ylabel_value, fontsize=12)\nplt.title(title, fontsize=14)\n\n# Add grid for better readability\nplt.grid(True, linestyle='--', linewidth=0.5)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save plot\nplt.tight_layout()\nplt.savefig(\"line_168.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 5.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_209", "content": { "Model": [ "LSTM-2-730b", "Mistral-7b-v0.1", "Mixtral-8x7b-v0.1", "Yi-34b", "Zephyr-7b-beta", "Qwen-72b", "Meditron-70b", "Med-PaLM", "Med-PaLM 2", "GPT-4", "Gemini Pro" ], "MedMCQA": [ 48.1, 48.0, 57.2, 59.3, 45.9, 64.9, 48.4, 57.6, 72.3, 79.1, 54.3 ], "MedQA (USMLE)": [ 56.0, 50.8, 62.2, 64.4, 51.7, 64.4, 58.0, 67.6, 86.5, 90.2, 58.0 ], "PubMedQA": [ 74.4, 75.8, 76.8, 77.4, 76.8, 79.0, 76.2, 79.0, 81.8, 82.0, 70.7 ], "MMLU Anatomy": [ 55.6, 56.3, 70.4, 75.6, 58.5, 71.1, 54.1, 63.7, 84.4, 89.6, 66.7 ], "MMLU Clinical knowledge": [ 70.2, 69.4, 79.2, 77.7, 64.2, 82.3, 67.9, 80.4, 88.7, 95.8, 76.7 ], "MMLU College biology": [ 78.5, 68.8, 84.0, 86.1, 66.7, 94.8, 78.5, 88.9, 95.8, 93.2, 88.0 ], "MMLU College medicine": [ 68.8, 57.8, 67.6, 69.4, 61.3, 78.6, 63.6, 76.3, 83.2, 89.0, 69.2 ], "MMLU Medical genetics": [ 72.0, 71.0, 76.0, 90.0, 66.0, 82.0, 76.0, 75.0, 92.0, 93.0, 75.8 ], "MMLU Professional medicine": [ 76.8, 68.8, 79.8, 80.9, 65.4, 83.1, 74.3, 83.8, 95.2, 95.2, 77.7 ] }, "visual_intent": "A figure with 9 subplots arranged in a 3x3 grid, where each subplot is a bar chart comparing the performance scores of various language models on a specific medical benchmark dataset (e.g., MedMCQA, MedQA, PubMedQA).(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/bar_43.jpg", "original_category": "bar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Placeholder data\ncategories = [\n \"LSTM-2-730b\",\n \"Mistral-7b-v0.1\",\n \"Mixtral-8x7b-v0.1\",\n \"Yi-34b\",\n \"Zephyr-7b-beta\",\n \"Qwen-72b\",\n \"Meditron-70b\",\n \"Med-PaLM\",\n \"Med-PaLM 2\",\n \"GPT-4\",\n \"Gemini Pro\",\n]\nscores = {\n \"MedMCQA\": [48.1, 48.0, 57.2, 59.3, 45.9, 64.9, 48.4, 57.6, 72.3, 79.1, 54.3],\n \"MedQA (USMLE)\": [56.0, 50.8, 62.2, 64.4, 51.7, 64.4, 58.0, 67.6, 86.5, 90.2, 58.0],\n \"PubMedQA\": [74.4, 75.8, 76.8, 77.4, 76.8, 79.0, 76.2, 79.0, 81.8, 82.0, 70.7],\n \"MMLU Anatomy\": [55.6, 56.3, 70.4, 75.6, 58.5, 71.1, 54.1, 63.7, 84.4, 89.6, 66.7],\n \"MMLU Clinical knowledge\": [\n 70.2,\n 69.4,\n 79.2,\n 77.7,\n 64.2,\n 82.3,\n 67.9,\n 80.4,\n 88.7,\n 95.8,\n 76.7,\n ],\n \"MMLU College biology\": [\n 78.5,\n 68.8,\n 84.0,\n 86.1,\n 66.7,\n 94.8,\n 78.5,\n 88.9,\n 95.8,\n 93.2,\n 88.0,\n ],\n \"MMLU College medicine\": [\n 68.8,\n 57.8,\n 67.6,\n 69.4,\n 61.3,\n 78.6,\n 63.6,\n 76.3,\n 83.2,\n 89.0,\n 69.2,\n ],\n \"MMLU Medical genetics\": [\n 72.0,\n 71.0,\n 76.0,\n 90.0,\n 66.0,\n 82.0,\n 76.0,\n 75.0,\n 92.0,\n 93.0,\n 75.8,\n ],\n \"MMLU Medical genetics\": [\n 72.0,\n 71.0,\n 76.0,\n 90.0,\n 66.0,\n 82.0,\n 76.0,\n 75.0,\n 92.0,\n 93.0,\n 75.8,\n ],\n \"MMLU Professional medicine\": [\n 76.8,\n 68.8,\n 79.8,\n 80.9,\n 65.4,\n 83.1,\n 74.3,\n 83.8,\n 95.2,\n 95.2,\n 77.7,\n ],\n}\n\nylim = [40, 100]\nylabel = \"Performance Score (%)\"\nyticks = [40, 50, 60, 70, 80, 90, 100]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nplt.figure(figsize=(10, 8))\n\n# Create subplots for each category\nn_rows = 3\nn_cols = 3\nsubplot_idx = 1\nfor category, score in scores.items():\n ax = plt.subplot(n_rows, n_cols, subplot_idx)\n subplot_idx += 1\n\n # Create bar chart\n x = np.arange(len(categories))\n ax.bar(\n x,\n score,\n color=[\n \"#697ac7\",\n \"#8598dd\",\n \"#a0b4eb\",\n \"#cdd7ea\",\n \"#dddcdc\",\n \"#e5d1c5\",\n \"#e5d1c5\",\n \"#e5beaa\",\n \"#dba38d\",\n \"#c98371\",\n \"#b25f55\",\n ],\n )\n\n # Add data labels\n for j, val in enumerate(score):\n ax.text(j, val + 1, f\"{val}\", ha=\"center\", va=\"bottom\", fontsize=6)\n\n # Set title and labels\n ax.set_title(category)\n ax.set_xticks(x)\n ax.set_xticklabels(categories, rotation=45, ha=\"right\", fontsize=6)\n ax.set_ylim(ylim)\n ax.set_ylabel(ylabel)\n ax.set_yticks(yticks)\n\n plt.tick_params(axis=\"both\", which=\"both\", length=0)\n\n # Add y grid\n plt.gca().yaxis.grid(True)\n plt.gca().set_axisbelow(True)\n\n ax = plt.gca()\n ax.spines[\"top\"].set_color(\"gray\")\n ax.spines[\"right\"].set_color(\"gray\")\n ax.spines[\"bottom\"].set_color(\"gray\")\n ax.spines[\"left\"].set_color(\"gray\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout\nplt.tight_layout()\nplt.savefig(\"bar_43.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "bar" }, { "id": "test_210", "content": { "City": [ "New York", "New York", "New York", "New York", "Los Angeles", "Los Angeles", "Los Angeles", "Los Angeles", "Chicago", "Chicago", "Chicago", "Chicago" ], "Metric": [ "Temperature", "Humidity", "Wind Speed", "Precipitation", "Temperature", "Humidity", "Wind Speed", "Precipitation", "Temperature", "Humidity", "Wind Speed", "Precipitation" ], "Value": [ 68, 55, 12, 3, 75, 65, 8, 1, 60, 70, 15, 5 ], "Error": [ 5.0, 4.0, 3.0, 0.5, 4.0, 6.0, 2.0, 0.2, 6.0, 5.0, 4.0, 1.0 ] }, "visual_intent": "A figure with 3 subplots: (1) a bar chart about weather metrics for New York, (2) a bar chart about weather metrics for Los Angeles, (3) a bar chart about weather metrics for Chicago, titled Weather Statistics for Selected Cities(size of the desired plot: width=10.0, height=9.0)", "path_to_gt_image": "images/errorbar_87.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0) # For reproducibility\n\n# Data representing weather statistics for three different cities\ncities = [\"New York\", \"Los Angeles\", \"Chicago\"]\nmetrics = [\"Temperature\", \"Humidity\", \"Wind Speed\", \"Precipitation\"]\nperformance = np.array([\n [68, 55, 12, 3],\n [75, 65, 8, 1],\n [60, 70, 15, 5],\n])\nerrors = np.array([\n [5, 4, 3, 0.5],\n [4, 6, 2, 0.2],\n [6, 5, 4, 1],\n])\nylim = [0, 80]\nylabel = \"Units\"\nlegendlabels = [\"Temperature (°F)\", \"Humidity (%)\", \"Wind Speed (mph)\", \"Precipitation (in)\"]\nsuptitle = \"Weather Statistics for Selected Cities\"\nfilename = \"errorbar_19_8.pdf\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, axes = plt.subplots(3, 1, figsize=(10, 9), sharex=True)\ncolors = [\"#3498db\", \"#2ecc71\", \"#e67e22\", \"#9b59b6\"] # New color scheme reflecting the weather domain\n\n# Plotting bars\nfor i, ax in enumerate(axes):\n for j, metric in enumerate(metrics):\n ax.bar(\n j,\n performance[i, j],\n width=0.8,\n color=colors[j],\n yerr=errors[i, j],\n capsize=5,\n label=metric if i == 0 else \"\",\n )\n\n # Setting x-axis labels, y-axis limits, and titles for each subplot\n ax.set_xticks(range(len(metrics)))\n ax.set_xticklabels(metrics, rotation=45)\n ax.set_ylim(ylim)\n ax.set_xlabel(f\"({chr(97+i)}) {cities[i]}\")\n ax.set_ylabel(ylabel)\n ax.yaxis.grid(True)\n ax.set_axisbelow(True)\n\n# Adding a legend outside of the plot on top\nfig.legend(legendlabels, loc=\"upper center\", bbox_to_anchor=(0.5, 1.05), ncol=len(metrics))\n\n# Adding a suptitle to the figure\nfig.suptitle(suptitle, fontsize=16)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout(rect=[0, 0, 1, 0.96]) # Adjust layout to make space for the suptitle\nplt.savefig(\"errorbar_87.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 9.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "bar" }, { "id": "test_211", "content": { "Quarter": [ "Q1", "Q2", "Q3", "Q4" ], "CityA": [ 500, 550, 580, 600 ], "CityB": [ 480, 530, 560, 590 ], "CityC": [ 470, 520, 550, 580 ], "CityD": [ 460, 510, 540, 570 ], "Growth": [ 0.05, 0.03, 0.04, 0.02 ] }, "visual_intent": "A dual-axis combination chart about city populations and growth percentage across quarters(size of the desired plot: width=8.0, height=6.0)", "path_to_gt_image": "images/CB_120.jpg", "original_category": "CB", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n\n# Sample geography data: Population growth in thousands\nquarters = [\"Q1\", \"Q2\", \"Q3\", \"Q4\"]\nCityA = [500, 550, 580, 600]\nCityB = [480, 530, 560, 590]\nCityC = [470, 520, 550, 580]\nCityD = [460, 510, 540, 570]\ngrowth = [0.05, 0.03, 0.04, 0.02]\n\n# Errors (e.g., standard deviation)\nerrorA = [30, 25, 35, 20]\nerrorB = [28, 26, 34, 22]\nerrorC = [27, 24, 33, 21]\nerrorD = [25, 23, 30, 19]\nerror_growth = [0.005, 0.003, 0.004, 0.002]\nlabels = [\"CityA\", \"CityB\", \"CityC\", \"CityD\"]\nxlabel = \"Quarter\"\nylabel1 = \"Population (1000s)\"\nylabel2 = \"Growth %\"\nlegend_title = \"Cities\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and axis\nfig, ax1 = plt.subplots(figsize=(8, 6))\n\n# Bar plot with error bars\nbar_width = 0.2\nindex = np.arange(len(quarters))\nax1.bar(\n index,\n CityA,\n bar_width,\n label=labels[0],\n color=\"forestgreen\",\n yerr=errorA,\n capsize=5,\n ecolor=\"black\",\n)\nax1.bar(\n index + bar_width,\n CityB,\n bar_width,\n label=labels[1],\n color=\"skyblue\",\n yerr=errorB,\n capsize=5,\n ecolor=\"black\",\n)\nax1.bar(\n index + 2 * bar_width,\n CityC,\n bar_width,\n label=labels[2],\n color=\"gold\",\n yerr=errorC,\n capsize=5,\n ecolor=\"black\",\n)\nax1.bar(\n index + 3 * bar_width,\n CityD,\n bar_width,\n label=labels[3],\n color=\"coral\",\n yerr=errorD,\n capsize=5,\n ecolor=\"black\",\n)\n\n# Line plot with error bars\nax2 = ax1.twinx()\nax2.errorbar(\n index + 1.5 * bar_width,\n growth,\n yerr=error_growth,\n fmt=\"s--\",\n color=\"darkblue\",\n label=\"Growth\",\n linewidth=2,\n markersize=5,\n capsize=5,\n)\n\n# Set labels and title\nax1.set_xlabel(xlabel)\nax1.set_ylabel(ylabel1)\nax2.set_ylabel(ylabel2)\n\n# Set x-axis tick labels\nax1.set_xticks(index + 1.5 * bar_width)\nax1.set_xticklabels(quarters)\n\n# Add legends\nax1.legend(loc=\"lower center\", ncol=4, bbox_to_anchor=(0.5, -0.25), title=legend_title)\nax2.legend(loc=\"upper left\", ncol=1)\n\n# Set ax2.yticklabels to be percentage\nax2.set_ylim(0, 0.1)\nax2.set_yticks(np.linspace(0, 0.1, 11))\nax2.set_yticklabels([f\"{x*100:.0f}%\" for x in ax2.get_yticks()])\n\n# Grid and layout adjustment\nax1.grid(axis=\"y\")\nax1.set_axisbelow(True)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"CB_120.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "misc" }, { "id": "test_212", "content": { "Category": [ "Architecture", "Philosophy", "Art", "Science", "Military", "Commerce", "Literature" ], "Ancient Rome": [ 85, 85, 80, 80, 80, 85, 88 ], "Medieval Europe": [ 70, 75, 75, 70, 75, 70, 70 ], "Renaissance Italy": [ 65, 60, 65, 68, 60, 65, 60 ] }, "visual_intent": "A radar chart about achievements across various fields for Ancient Rome, Medieval Europe, and Renaissance Italy, titled Historical Civilizations' Achievements(size of the desired plot: width=8.0, height=7.0)", "path_to_gt_image": "images/radar_26.jpg", "original_category": "radar", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom math import pi\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Define the data for each historical civilization\nvalues1 = [85, 85, 80, 80, 80, 85, 88] # Ancient Rome\nvalues2 = [70, 75, 75, 70, 75, 70, 70] # Medieval Europe\nvalues3 = [65, 60, 65, 68, 60, 65, 60] # Renaissance Italy\nxlabels = [\n \"Architecture\",\n \"Philosophy\",\n \"Art\",\n \"Science\",\n \"Military\",\n \"Commerce\",\n \"Literature\",\n]\nyticks = [20, 40, 60, 80, 100]\ntitle = \"Historical Civilizations' Achievements\"\nlabels = [\"Ancient Rome\", \"Medieval Europe\", \"Renaissance Italy\"]\nylim = [0, 100]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Initialize the spider plot\nfig, ax = plt.subplots(figsize=(8, 7), subplot_kw=dict(polar=True))\n\n# Number of variables\nnum_vars = len(values1)\n\n# Compute angle for each axis\nangles = [n / float(num_vars) * 2 * pi for n in range(num_vars)]\nangles += angles[:1] # Complete the loop\n\n# Repeat the first value to close the circle\nvalues1 += values1[:1]\nvalues2 += values2[:1]\nvalues3 += values3[:1]\n\n# Draw one axe per variable and add labels\nplt.xticks(\n angles[:-1],\n xlabels,\n size=10,\n)\n\n# Draw ylabels\nax.set_rlabel_position(0)\nplt.yticks(yticks, [], color=\"#d4af37\", size=7)\nplt.ylim(ylim)\n\n# Draw the inner circles with gold color lines\nfor circle in ax.get_ygridlines():\n circle.set_color(\"#d4af37\")\n\n# Plot each civilization with different styles\nax.plot(\n angles, values1, linewidth=2, linestyle=\"solid\", label=labels[0], color=\"#cc5500\"\n)\nax.fill(angles, values1, \"#cc5500\", alpha=0.1)\n\nax.plot(\n angles, values2, linewidth=2, linestyle=\"dashed\", label=labels[1], color=\"#0033a0\"\n)\nax.fill(angles, values2, \"#0033a0\", alpha=0.1)\n\nax.plot(\n angles, values3, linewidth=2, linestyle=\"dashdot\", label=labels[2], color=\"#228b22\"\n)\nax.fill(angles, values3, \"#228b22\", alpha=0.1)\n\n# Add data labels\nfor i in range(num_vars):\n plt.text(\n angles[i],\n values1[i],\n str(values1[i]),\n horizontalalignment=\"center\",\n size=8,\n color=\"black\",\n )\n plt.text(\n angles[i],\n values2[i],\n str(values2[i]),\n horizontalalignment=\"center\",\n size=8,\n color=\"black\",\n )\n plt.text(\n angles[i],\n values3[i],\n str(values3[i]),\n horizontalalignment=\"center\",\n size=8,\n color=\"black\",\n )\n\n# Add a legend and title\nplt.legend(loc=\"lower center\", bbox_to_anchor=(0.5, -0.1), ncol=3)\nplt.title(title, position=(0.5, -0.1), ha=\"center\")\n\n# Adjust figure size to match original image's dimensions\nfig.set_size_inches(8, 7)\nax.spines[\"polar\"].set_color(\"#d4af37\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_26.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 7.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_213", "content": { "Car Type": [ "Electric Cars", "Hybrid Cars", "Sedan", "SUV", "Sports Cars" ], "Average Speed (km/h)": [ 120.5, 110.2, 95.6, 85.3, 140.7 ], "Speed Variance (km/h)": [ 5.0, 4.3, 3.8, 6.1, 4.9 ] }, "visual_intent": "A horizontal error bar chart about car types and their average speeds, titled Average Speed by Car Type(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/errorpoint_12.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\ncategories = [\"Electric Cars\", \"Hybrid Cars\", \"Sedan\", \"SUV\", \"Sports Cars\"]\naverage_speeds = [120.5, 110.2, 95.6, 85.3, 140.7] # Average speed (km/h)\nerrors = [5.0, 4.3, 3.8, 6.1, 4.9] # Speed variance (km/h)\nworld_mean = [105.4] # Global average speed (km/h)\nxlabel = \"Average Speed (km/h)\"\nlabel = \"Global Average Speed\"\nplot_title = 'Average Speed by Car Type'\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nplt.figure(figsize=(10, 7)) # Adjusting figure size for better readability\nplt.errorbar(\n average_speeds,\n categories,\n xerr=errors,\n fmt=\"*\",\n color=\"#2a9d8f\",\n ecolor=\"#1B998B\",\n capsize=3,\n elinewidth=2,\n markeredgewidth=2,\n label=\"Car Type Mean\",\n)\nplt.axvline(world_mean[0], color=\"#2a9d8f\", linestyle=\"--\", linewidth=3, label=label)\n\n# Customizing the plot\nplt.xlabel(xlabel)\nplt.title(plot_title)\nplt.legend(loc='upper right')\nplt.grid(True, linestyle='--', linewidth=0.5, alpha=0.7)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting the layout and saving the figure\nplt.tight_layout()\nplt.savefig(\"errorpoint_12.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_214", "content": { "Ratio of 4-bit Utilization (%)": [ 40, 50, 60, 70, 80, 90, 100 ], "Perplexity (PPL)": [ 7.5, 6.5, 6.0, 5.75, 5.6, 5.5, 5.5 ], "Bit Annotations": [ "2.91 bit", "3.11 bit", "3.32 bit", "3.53 bit", "3.63 bit", "3.74 bit", "3.94 bit" ] }, "visual_intent": "A line chart about Ratio of 4-bit Utilization (%) and Perplexity (PPL)(size of the desired plot: width=5.0, height=4.0)", "path_to_gt_image": "images/line_22.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\nimport numpy as np\n\nnp.random.seed(0)\nx = [40, 50, 60, 70, 80, 90, 100]\ny = [7.5, 6.5, 6.0, 5.75, 5.6, 5.5, 5.5]\nbits = [\n \"2.91 bit\",\n \"3.11 bit\",\n \"3.32 bit\",\n \"3.53 bit\",\n \"3.63 bit\",\n \"3.74 bit\",\n \"3.94 bit\",\n] # Removed the extra '4.15 bit'\n\n# Axes Limits and Labels\nxlabel_value = \"Ratio of 4-bit Utilization (%)\"\nxlim_values = [35, 105]\nxticks_values = np.arange(40, 101, 10)\n\nylabel_value = \"Perplexity (PPL)\"\nylim_values = [5.0, 8.0]\nyticks_values = np.arange(5.0, 7.6, 0.5)\n\n# Labels\nlabel_1 = \"APTQ\"\nlabel_2 = \"LLaMa-7B (FP16): 5.22\"\nlabel_3 = \"OWQ-4bit: 5.56\"\nlabel_4 = \"GPTQ-4bit: 5.62\"\nlabel_5 = \"LLM-QAT-4bit: 7.4\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create the plot\nfig, ax = plt.subplots(figsize=(5, 4))\n\n# Plot the line\nax.plot(x, y, marker=\"o\", color=\"blue\", label=label_1)\n\n# Set x,y-axis to only display specific ticks and extend y-axis to leave space at top\nplt.yticks(yticks_values, fontsize=10)\nplt.xticks(xticks_values, fontsize=10)\nplt.xlim(xlim_values) # Adjusted y-axis limit\n\n# Annotate the points with bit values\nfor i, txt in enumerate(bits):\n ax.annotate(\n txt, (x[i], y[i]), textcoords=\"offset points\", xytext=(0, 10), ha=\"center\"\n )\n\n# Horizontal lines for comparison\nax.axhline(y=5.22, color=\"magenta\", linestyle=\"--\", label=label_2)\nax.axhline(y=5.56, color=\"orange\", linestyle=\"--\", label=label_3)\nax.axhline(y=5.62, color=\"green\", linestyle=\"--\", label=label_4)\nax.axhline(y=7.4, color=\"red\", linestyle=\"--\", label=label_5)\n\n# Set labels and title\nax.set_xlabel(xlabel_value, fontsize=12)\nax.set_ylim(ylim_values) # Adjusted y-axis limit\nax.set_xlim(xlim_values) # Adjusted x-axis limit\nax.set_ylabel(ylabel_value, fontsize=12)\n\n# Set the legend\nax.legend(loc=\"center right\", fontsize=10)\n\n# Set grid\nax.grid(True)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting layout to add more space on the right\nplt.tight_layout()\nplt.savefig(\"line_22.pdf\", bbox_inches=\"tight\")\n", "width": 5.0, "height": 4.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "line" }, { "id": "test_215", "content": { "Category": [ "Food", "Transport", "Utilities", "Entertainment", "Others" ], "Company_Expenses": [ 350, 450, 200, 120, 80 ], "Project_Expenses": [ 150, 250, 120, 60, 20 ] }, "visual_intent": "A double-layer pie chart comparing company expenses (outer ring) and project expenses (inner ring) across different categories, titled Expenses - Company vs. Project(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/pie_11.jpg", "original_category": "pie", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Different data for another example\nlabels = [\"Food\", \"Transport\", \"Utilities\", \"Entertainment\", \"Others\"]\nouter_sizes = [350, 450, 200, 120, 80] # usage of platforms in a tech company\ninner_sizes = [150, 250, 120, 60, 20] # usage of platforms for a specific project\n\ntitle = \"Expenses - Company vs. Project\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, ax = plt.subplots(figsize=(8, 8))\n\nouter_colors = [\"#ff9999\", \"#66b3ff\", \"#99ff99\", \"#ffcc99\", \"#c2c2f0\"]\ninner_colors = [\"#c4e17f\", \"#76dd1e\", \"#5a69af\", \"#edc214\", \"#ebefc9\"]\nouter_hatch = [\"/\", \"\\\\\", \"|\", \"-\", \"+\"] # Different hatching for outer ring\ninner_hatch = [\"x\", \"*\", \"o\", \"O\", \".\"] # Different hatching for inner ring\n\nexplode_outer = (0.1, 0, 0, 0, 0) # only explode the 1st slice (IOS)\n\n# Outer ring\nwedges, texts, autotexts = ax.pie(\n outer_sizes,\n labels=labels,\n radius=1.2,\n colors=outer_colors,\n explode=explode_outer,\n autopct=\"%1.1f%%\",\n pctdistance=0.85,\n startangle=160,\n wedgeprops=dict(width=0.3, edgecolor=\"w\", hatch=\"*\"),\n)\n\n# Inner ring\nwedges2, texts2, autotexts2 = ax.pie(\n inner_sizes,\n radius=0.9,\n colors=inner_colors,\n autopct=\"%1.1f%%\",\n pctdistance=0.75,\n startangle=160,\n wedgeprops=dict(width=0.3, edgecolor=\"w\", hatch=\"o\"),\n)\n\n# Customizing the autotexts for better visibility\nfor autotext in autotexts + autotexts2:\n autotext.set_color(\"black\")\n autotext.set_fontsize(10)\n\n# Title for the double layer pie chart\nax.set_title(title, fontsize=16, y=1.05)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Improve layout to make room for legend or labels if necessary\nplt.tight_layout()\n\n# Show the plot\nplt.savefig(\"pie_11.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "tree_pie" }, { "id": "test_216", "content": { "Country": [ "USA", "China", "India", "Germany", "France", "Brazil" ], "2018": [ 16.2, 7.5, 2.1, 9.7, 5.2, 2.6 ], "2019": [ 16.1, 7.4, 2.2, 9.6, 5.1, 2.7 ], "2020": [ 15.8, 7.3, 2.3, 9.4, 5.0, 2.8 ] }, "visual_intent": "A figure with 2 subplots: (1) a grouped bar chart about countries and CO2 emissions for the years 2018-2020, (2) a grouped bar chart about countries and CO2 emissions for the years 2018-2020(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/bar_121.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data\nlabels = [\"USA\", \"China\", \"India\", \"Germany\", \"France\", \"Brazil\"]\nyear_2018 = [16.2, 7.5, 2.1, 9.7, 5.2, 2.6]\nyear_2019 = [16.1, 7.4, 2.2, 9.6, 5.1, 2.7]\nyear_2020 = [15.8, 7.3, 2.3, 9.4, 5.0, 2.8]\n\nx = np.arange(len(labels)) # the label locations\nwidth = 0.25 # the width of the bars\n\n# Variables for plot configuration\nylabel = \"CO2 Emissions (tons per capita)\"\nxlabel_co2_wts = \"World Trends Study\"\nxlabel_co2_inv = \"Investigation Data\"\n\nlegend_label_2018 = \"2018\"\nlegend_label_2019 = \"2019\"\nlegend_label_2020 = \"2020\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nxticks = x\nxticklabels = labels\nylim_ax1 = (0, 20)\nylim_ax2 = (0, 20)\nyticks_ax1 = np.arange(0, 21, 5)\nyticks_ax2 = np.arange(0, 21, 5)\n\n# Setting up the figure and axes for a 2 x 1 layout\nfig, (ax1, ax2) = plt.subplots(\n 2, 1, figsize=(10, 8), gridspec_kw={\"height_ratios\": [1, 1], \"hspace\": 0.3}\n)\n\n# Upper plot\nrects1 = ax1.bar(\n x - width - 0.04,\n year_2018,\n width,\n label=legend_label_2018,\n color=\"#6baed6\",\n edgecolor=\"black\",\n)\nrects2 = ax1.bar(\n x, year_2019, width, label=legend_label_2019, color=\"#31a354\", edgecolor=\"black\"\n)\nrects3 = ax1.bar(\n x + width + 0.04,\n year_2020,\n width,\n label=legend_label_2020,\n color=\"#c994c7\",\n edgecolor=\"black\",\n)\n# Lower plot\nrects4 = ax2.bar(\n x - width - 0.04, year_2018, width, color=\"#6baed6\", edgecolor=\"black\"\n)\nrects5 = ax2.bar(x, year_2019, width, color=\"#31a354\", edgecolor=\"black\")\nrects6 = ax2.bar(\n x + width + 0.04, year_2020, width, color=\"#c994c7\", edgecolor=\"black\"\n)\n\n# Add some text for labels, title and custom x-axis tick labels, etc.\nax1.set_ylabel(ylabel)\nax2.set_ylabel(ylabel)\nax1.set_xlabel(xlabel_co2_wts)\nax2.set_xlabel(xlabel_co2_inv)\nax1.set_xticks(xticks)\nax1.set_xticklabels(xticklabels)\nax2.set_xticks(xticks)\nax2.set_xticklabels(xticklabels)\nax1.legend(loc=\"upper center\", bbox_to_anchor=(0.5, 1.25), ncol=3, frameon=False)\n\n# Set y-axis limit to match the reference picture\nax1.set_ylim(ylim_ax1)\nax2.set_ylim(ylim_ax2)\nax1.tick_params(axis=\"x\", which=\"both\", length=0)\nax2.tick_params(axis=\"x\", which=\"both\", length=0)\nax1.set_yticks(yticks_ax1)\nax2.set_yticks(yticks_ax2)\n\n# Set grid color and style\nax1.grid(axis=\"y\", color=\"gray\", linestyle=\"--\", linewidth=0.5)\nax2.grid(axis=\"y\", color=\"gray\", linestyle=\"--\", linewidth=0.5)\nax1.tick_params(axis=\"y\", which=\"major\", color=\"gray\")\nax2.tick_params(axis=\"y\", which=\"major\", color=\"gray\")\nax1.set_axisbelow(True)\nax2.set_axisbelow(True)\n\n# Remove top and right borders\nax1.spines[\"top\"].set_visible(False)\nax1.spines[\"right\"].set_visible(False)\nax1.spines[\"bottom\"].set_visible(False)\nax1.spines[\"left\"].set_color(\"gray\")\nax2.spines[\"top\"].set_visible(False)\nax2.spines[\"right\"].set_visible(False)\nax2.spines[\"bottom\"].set_visible(False)\nax2.spines[\"left\"].set_color(\"gray\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"bar_121.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "bar" }, { "id": "test_217", "content": { "Business Areas": [ "Revenue Growth", "Customer Satisfaction", "Market Share", "Operational Efficiency", "Employee Engagement" ], "Performance Metrics (Percentage)": [ 0.3, 0.25, 0.23, 0.2, 0.18 ], "Error": [ 0.05, 0.04, 0.03, 0.02, 0.02 ] }, "visual_intent": "A horizontal error bar plot about Business Areas and Performance Metrics (Percentage), titled Business Performance Metrics Analysis(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/errorpoint_25.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n# Data for plotting\ncategories = [\"Revenue Growth\", \"Customer Satisfaction\", \"Market Share\", \"Operational Efficiency\", \"Employee Engagement\"]\nmeans = [0.30, 0.25, 0.23, 0.20, 0.18]\nerrors = [0.05, 0.04, 0.03, 0.02, 0.02]\ndataset_mean = [0.23]\n\n# Text labels\nxlabel = \"Performance Metrics (Percentage)\"\nylabel = \"Business Areas\"\ntitle = \"Business Performance Metrics Analysis\"\nlegend_mean_label = \"Mean\"\nlegend_dataset_label = \"Dataset Mean\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nplt.figure(figsize=(10, 7)) # Adjusting figure size\n\n# Define color palette\nmean_color = \"#1f78b4\" # Navy blue for means\nerror_color = \"#a6cee3\" # Light blue for errors\n\nplt.errorbar(\n means,\n categories,\n xerr=errors,\n fmt=\"s\", # Square markers\n color=mean_color,\n ecolor=error_color,\n capsize=5,\n label=legend_mean_label,\n)\n\n# Adding vertical line for dataset mean\nplt.axvline(dataset_mean, linestyle=\"--\", color=\"gray\", linewidth=2, label=legend_dataset_label)\n\n# Customizing the plot\nplt.xlabel(xlabel, fontsize=14)\nplt.ylabel(ylabel, fontsize=14)\nplt.title(title, fontsize=16)\nplt.legend()\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjusting the layout and saving the figure\nplt.tight_layout()\nplt.savefig(\"errorpoint_25.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_218", "content": { "Category Label": [ "Movies\n30%", "Music\n25%", "Video Games\n20%", "Books\n15%", "TV Shows\n10%", "Streaming\n18%" ], "Market Share Size": [ 30, 25, 20, 15, 10, 18 ] }, "visual_intent": "A treemap about entertainment categories and their market share sizes, titled Entertainment Industry Market Share(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/tree_33.jpg", "original_category": "tree", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport squarify\nimport numpy as np\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data\nsizes = [30, 25, 20, 15, 10, 18] # Example sizes representing market share/popularity\nlabels = [\n \"Movies\\n30%\",\n \"Music\\n25%\",\n \"Video Games\\n20%\",\n \"Books\\n15%\",\n \"TV Shows\\n10%\",\n \"Streaming\\n18%\",\n]\ntitle = \"Entertainment Industry Market Share\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with the specified size\nfig = plt.figure(figsize=(8, 8))\n\n# Define custom colors\ncolors = [\"#FF6347\", \"#FFD700\", \"#8A2BE2\", \"#3CB371\", \"#1E90FF\", \"#FF69B4\"]\n\n# Create a treemap\nsquarify.plot(\n sizes=sizes,\n label=labels,\n color=colors,\n alpha=0.8,\n text_kwargs={\"fontsize\": 14, \"color\": \"white\"},\n pad=True,\n ec=\"black\",\n)\n\n# Set title\nplt.title(title, fontsize=20, fontweight=\"bold\")\n\n# Remove axes\nplt.axis(\"off\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show plot with tight layout and save to file\nplt.tight_layout()\nplt.savefig(\"tree_33.pdf\", bbox_inches=\"tight\")\n\n# Show the plot\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_219", "content": { "Positive bound_X": [ 0.7, 0.75, 0.8, 0.85, 0.9 ], "Positive bound_Y": [ 76, 78, 80, 79, 77 ], "Positive bound_Error": [ 3, 2, 4, 3, 3 ], "Negative bound_X": [ 0.1, 0.2, 0.3, 0.4 ], "Negative bound_Y": [ 74, 78, 76, 72 ], "Negative bound_Error": [ 4, 2, 2, 2 ], "Contrastive loss weight_X": [ 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 ], "Contrastive loss weight_Y": [ 75, 78, 70, 65, 60, 55 ], "Contrastive loss weight_Error": [ 3, 2, 5, 4, 6, 5 ], "Fuzzy coefficient_X": [ 400, 600, 800, 1000, 1200 ], "Fuzzy coefficient_Y": [ 80, 82, 77, 75, 72 ], "Fuzzy coefficient_Error": [ 2, 3, 4, 3, 2 ] }, "visual_intent": "A figure with 4 subplots showing performance metrics with error bars: (1) Positive bound, (2) Negative bound, (3) Contrastive loss weight, and (4) Fuzzy coefficient(size of the desired plot: width=9.0, height=6.0)", "path_to_gt_image": "images/line_52.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Sample data\nx1 = np.array([0.7, 0.75, 0.8, 0.85, 0.9])\ny1 = np.array([76, 78, 80, 79, 77])\ne1 = np.array([3, 2, 4, 3, 3])\n\nx2 = np.array([0.1, 0.2, 0.3, 0.4])\ny2 = np.array([74, 78, 76, 72])\ne2 = np.array([4, 2, 2, 2])\n\nx3 = np.array([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])\ny3 = np.array([75, 78, 70, 65, 60, 55])\ne3 = np.array([3, 2, 5, 4, 6, 5])\n\nx4 = np.array([400, 600, 800, 1000, 1200])\ny4 = np.array([80, 82, 77, 75, 72])\ne4 = np.array([2, 3, 4, 3, 2])\n\n# Titles\ntitles = [\n \"(a) Positive bound\",\n \"(b) Negative bound\",\n \"(d) Contrastive loss weight\",\n \"(c) Fuzzy coefficient\",\n]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create 2x2 subplots\nfig, axs = plt.subplots(2, 2, figsize=(9, 6))\n\n# Flatten the axis array for easy iteration\naxs = axs.flatten()\n\n# Setting data for each subplot\ndata = [(x1, y1, e1), (x2, y2, e2), (x3, y3, e3), (x4, y4, e4)]\n\n# Plot with error bars in each subplot\nfor ax, (x, y, e), title in zip(axs, data, titles):\n ax.errorbar(\n x, y, yerr=e, fmt=\"-o\", color=\"blue\", ecolor=\"red\", capsize=5, markersize=6\n )\n ax.set_title(title, fontsize=16)\n ax.grid(True, alpha=0.5)\n ax.set_xticks(x)\n ax.set_yticks(np.linspace(min(y) - min(e), max(y) + max(e), num=5, endpoint=True))\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the figure\nplt.tight_layout()\nplt.savefig(\"line_52.pdf\", bbox_inches=\"tight\")\n", "width": 9.0, "height": 6.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "line" }, { "id": "test_220", "content": { "Teaching Method": [ "Lectures", "Online Courses", "Workshops", "Seminars", "Textbooks", "Interactive", "Projects" ], "Cost (in $)": [ 1500, 800, 1000, 600, 400, 1200, 1000 ], "Effectiveness (%)": [ 75, 80, 70, 65, 60, 85, 90 ], "Time Invested (in Hours)": [ 3000, 2000, 2500, 1500, 1000, 3500, 3000 ] }, "visual_intent": "A figure with 2 subplots: (1) a scatter plot about cost and effectiveness of teaching methods, titled Teaching Methods (Effectiveness versus Cost), (2) a scatter plot about time invested and effectiveness of teaching methods, titled Teaching Methods (Effectiveness versus Time Invested in Hours)(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/scatter_69.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n\n# Data for the plots\nnames = [\n \"Lectures\",\n \"Online Courses\",\n \"Workshops\",\n \"Seminars\",\n \"Textbooks\",\n \"Interactive\",\n \"Projects\",\n]\nx1 = [1500, 800, 1000, 600, 400, 1200, 1000]\ny1 = [75, 80, 70, 65, 60, 85, 90]\n\nx2 = [3000, 2000, 2500, 1500, 1000, 3500, 3000]\ny2 = [75, 80, 70, 65, 60, 85, 90]\n\ntitles = [\n \"Teaching Methods (Effectiveness versus Cost)\",\n \"Teaching Methods (Effectiveness versus Time Invested in Hours)\",\n]\nxlabels = [\"Cost (in $)\", \"Time Invested (in Hours)\"]\nylabels = [\"Effectiveness (%)\", \"Effectiveness (%)\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and axes\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 6))\n\n\n# Define colors (pastel shades)\ncolors1 = [\"#FFB6C1\", \"#ADD8E6\", \"#98FB98\", \"#FFD700\", \"#87CEFA\", \"#FF69B4\", \"#FFA07A\"]\ncolors2 = [\"#FFB6C1\", \"#ADD8E6\", \"#98FB98\", \"#FFD700\", \"#87CEFA\", \"#FF69B4\", \"#FFA07A\"]\n\n# First subplot\nax1.scatter(x1, y1, c=colors1, marker=\"o\", edgecolor=\"black\", s=100)\nax1.set_title(titles[0], fontsize=14)\nax1.set_xlabel(xlabels[0], fontsize=12)\nax1.set_ylabel(ylabels[0], fontsize=12)\nax1.invert_xaxis() # Invert x-axis\nfor i, txt in enumerate(names):\n ax1.annotate(\n txt, (x1[i], y1[i]), xytext=(-10, 5), textcoords=\"offset points\", fontsize=10\n )\nax1.set_xlim([1600, 0])\nax1.set_ylim([55, 95])\n\n# Second subplot\nax2.scatter(x2, y2, c=colors2, marker=\"s\", edgecolor=\"black\", s=100)\nax2.set_title(titles[1], fontsize=14)\nax2.set_xlabel(xlabels[1], fontsize=12)\nax2.set_ylabel(ylabels[1], fontsize=12)\nax2.ticklabel_format(style=\"sci\", axis=\"x\", scilimits=(0, 0)) # Use scientific notation\nfor i, txt in enumerate(names):\n ax2.annotate(\n txt, (x2[i], y2[i]), xytext=(-15, 5), textcoords=\"offset points\", fontsize=10\n )\nax2.set_xlim([4000, 0])\nax2.set_ylim([55, 95])\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save plot\nplt.tight_layout()\nplt.savefig(\"scatter_69.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_221", "content": { "Psychological Attributes": [ "Self-Esteem", "Anxiety", "Depression", "Motivation", "Stress" ], "Mean Scores": [ 0.75, 0.4, 0.3, 0.65, 0.55 ], "Error Lower": [ 0.05, 0.06, 0.04, 0.03, 0.05 ], "Error Upper": [ 0.04, 0.05, 0.03, 0.02, 0.04 ] }, "visual_intent": "An errorbar plot showing mean scores for various psychological attributes, titled Psychological Attributes: Study Trends(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/errorpoint_71.jpg", "original_category": "errorpoint", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Importing additional necessary library\nimport numpy as np\n\n# Data for plotting\ncategories = [\n \"Self-Esteem\",\n \"Anxiety\",\n \"Depression\",\n \"Motivation\",\n \"Stress\",\n] # Psychological attributes\nmeans = [0.75, 0.40, 0.30, 0.65, 0.55] # Mean values reflecting study trends in psychology\nerrors = [0.05, 0.06, 0.04, 0.03, 0.05] # Error margins\ndownerrors = [0.04, 0.05, 0.03, 0.02, 0.04]\nlegendtitles = [\"Mean\", \"Dataset mean\"]\ntexttitle = \"Average\"\ntitle = \"Psychological Attributes: Study Trends\"\nylabel = \"Mean Scores\"\nxlabel = \"Psychological Attributes\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the data\nfig, ax = plt.subplots(\n figsize=(10, 6)\n) # Adjusting figure size\nax.errorbar(\n categories,\n means,\n yerr=[errors, downerrors],\n fmt=\"o\",\n color=\"darkblue\",\n ecolor=\"purple\",\n capsize=5,\n markerfacecolor=\"lightblue\",\n markeredgewidth=2,\n markeredgecolor=\"navy\",\n)\n\n# Adding a legend with both \"Mean\" and \"Dataset mean\"\ndataset_mean = 0.50 # Adjusted dataset mean to reflect psychology domain data\nmean_line = ax.errorbar(\n [], [], yerr=[], fmt=\"o\", color=\"darkblue\", ecolor=\"purple\", capsize=5\n)\ndataset_mean_line = ax.axhline(\n y=dataset_mean, color=\"gray\", linestyle=\"--\", linewidth=1\n)\nax.legend(\n [dataset_mean_line, mean_line],\n legendtitles,\n loc=\"upper right\",\n fancybox=True,\n framealpha=1,\n shadow=True,\n borderpad=1,\n)\n# Adding a horizontal line for dataset mean and text annotation with a white background\nax.text(\n 0.95,\n dataset_mean,\n texttitle,\n va=\"center\",\n ha=\"right\",\n backgroundcolor=\"white\",\n transform=ax.get_yaxis_transform(),\n)\n\n# Setting labels and a title\nax.set_ylabel(ylabel)\nax.set_xlabel(xlabel)\nax.set_title(title)\nplt.xticks(rotation=30)\nplt.grid(True, which=\"both\", axis=\"y\", linestyle=\"--\", linewidth=0.5)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorpoint_71.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_222", "content": { "Attribute": [ "Speed", "Battery Life", "Display Quality", "Durability", "Camera Quality", "User Interface", "Software Updates", "Customer Support", "Price" ], "Brand A": [ 85, 90, 75, 80, 85, 88, 92, 86, 80 ], "Brand B": [ 78, 82, 88, 90, 84, 80, 78, 85, 70 ] }, "visual_intent": "A radar chart comparing product attributes for Brand A and Brand B, titled Technology Product Performance Comparison(size of the desired plot: width=8.0, height=8.0)", "path_to_gt_image": "images/radar_64.jpg", "original_category": "radar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# Data\ncategories = [\n \"Speed\",\n \"Battery Life\",\n \"Display Quality\",\n \"Durability\",\n \"Camera Quality\",\n \"User Interface\",\n \"Software Updates\",\n \"Customer Support\",\n \"Price\",\n]\nvalues1 = [85, 90, 75, 80, 85, 88, 92, 86, 80] # Brand A\nvalues2 = [78, 82, 88, 90, 84, 80, 78, 85, 70] # Brand B\n\n# Number of variables\nnum_vars = len(categories)\n\n# Compute angle for each category\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n\n# The plot is circular, so we need to \"complete the loop\" and append the start to the end.\nvalues1 += values1[:1]\nvalues2 += values2[:1]\nangles += angles[:1]\n\n# Extracted variables\nline_label1 = \"Brand A\"\nline_label2 = \"Brand B\"\nxticks_labels = categories\nyticks_values = [20, 40, 60, 80]\nyticks_labels = [str(value) for value in yticks_values]\nylim_values = (0, 100)\ntitle_text = \"Technology Product Performance Comparison\"\ntitle_size = 16\ntitle_color = \"navy\"\ntitle_y = 1.1\nlegend_loc = \"lower center\"\nlegend_ncol = 2\nlegend_bbox_to_anchor = (0.5, -0.2)\nlegend_fontsize = \"medium\"\nlegend_frameon = True\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Size of the figure\nfig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True))\n\n# Draw one axe per variable and add labels, aligned vertically\nplt.xticks(angles[:-1], xticks_labels, color=\"darkblue\", size=11, ha=\"center\")\n\n# Draw ylabels\nax.set_rlabel_position(0)\nplt.yticks(yticks_values, yticks_labels, color=\"grey\", size=8)\nplt.ylim(ylim_values)\n\n# Plot data with markers and new colors\nax.plot(\n angles,\n values2,\n linewidth=2,\n linestyle=\"dashed\",\n marker=\"o\",\n label=line_label2,\n color=\"#ff4500\",\n)\nax.fill(angles, values2, \"#ff4500\", alpha=0.25)\n\nax.plot(\n angles,\n values1,\n linewidth=2,\n linestyle=\"solid\",\n marker=\"s\",\n label=line_label1,\n color=\"#4682b4\",\n)\nax.fill(angles, values1, \"#4682b4\", alpha=0.25)\n\n# Add a title to the radar chart\nplt.title(title_text, size=title_size, color=title_color, y=title_y)\n\n# Add legend\nplt.legend(\n loc=legend_loc,\n ncol=legend_ncol,\n bbox_to_anchor=legend_bbox_to_anchor,\n fontsize=legend_fontsize,\n frameon=legend_frameon,\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_64.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_223", "content": { "Category": [ "Fruits", "Proteins", "Vegetables", "Grains", "Dairy" ], "Value": [ 25, 35, 20, 10, 10 ] }, "visual_intent": "A donut chart about food categories and nutritional distribution sizes, titled Nutritional Distribution(size of the desired plot: width=6.0, height=6.0)", "path_to_gt_image": "images/pie_14.jpg", "original_category": "pie", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\n\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Example data\ncategories = [\"Fruits\", \"Proteins\", \"Vegetables\", \"Grains\", \"Dairy\"]\nsizes = [25, 35, 20, 10, 10] # These values are for illustrative purposes\n\n\n# Variables for plot configuration\ntitle_text = \"Nutritional Distribution\" # Title for the donut chart\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nfig, ax = plt.subplots(figsize=(6, 6))\n\ncolors = [\"#ff9999\", \"#66b3ff\", \"#99ff99\", \"#ffcc99\", \"#c2c2f0\"]\nexplode = (0, 0, 0, 0, 0) # Only \"explode\" the 1st slice (Fruits)\n\n# The pie function also handles donuts with the 'wedgeprops' argument\nwedges, texts, autotexts = ax.pie(\n sizes,\n labels=categories,\n colors=colors,\n autopct=\"%1.1f%%\",\n startangle=90,\n explode=explode,\n wedgeprops=dict(width=0.3, edgecolor=\"w\"),\n)\n\n# Draw a circle at the center of pie to make it a donut\ncentre_circle = plt.Circle((0, 0), 0.70, fc=\"white\")\nfig.gca().add_artist(centre_circle)\n\n# Equal aspect ratio ensures that pie is drawn as a circle\nax.axis(\"equal\")\n\n# Set title for the donut chart\nax.set_title(title_text)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"pie_14.pdf\", bbox_inches=\"tight\")\n", "width": 6.0, "height": 6.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_224", "content": { "Iterations": [ 0, 250, 500, 750, 1000, 1250, 1500, 1750, 2000 ], "School A": [ 0.2, 0.35, 0.5, 0.6, 0.7, 0.75, 0.8, 0.85, 0.9 ], "School A (Enriched)": [ 0.1, 0.25, 0.4, 0.55, 0.65, 0.7, 0.75, 0.8, 0.85 ], "School B": [ 0.15, 0.3, 0.45, 0.55, 0.65, 0.7, 0.75, 0.8, 0.85 ], "School B (Enriched)": [ 0.05, 0.2, 0.35, 0.5, 0.6, 0.65, 0.7, 0.75, 0.8 ] }, "visual_intent": "A figure with 2 subplots: (1) a line chart comparing interest levels for School A and its enriched version over iterations, titled Interest in School A over Time, (2) a line chart comparing interest levels for School B and its enriched version over iterations, titled Interest in School B over Time(size of the desired plot: width=12.0, height=6.0)", "path_to_gt_image": "images/line_122.jpg", "original_category": "line", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Sample data for philosophy domain\niterations = np.array([0, 250, 500, 750, 1000, 1250, 1500, 1750, 2000])\nschool_a = np.array([0.2, 0.35, 0.5, 0.6, 0.7, 0.75, 0.8, 0.85, 0.9])\nschool_a_ft = np.array([0.1, 0.25, 0.4, 0.55, 0.65, 0.7, 0.75, 0.8, 0.85])\nschool_b = np.array([0.15, 0.3, 0.45, 0.55, 0.65, 0.7, 0.75, 0.8, 0.85])\nschool_b_ft = np.array([0.05, 0.2, 0.35, 0.5, 0.6, 0.65, 0.7, 0.75, 0.8])\n\n# Axes Limits and Labels\nxlabel_value = \"Iterations\"\nylabel_value = \"Interest Level\"\n\n# Labels\nlabel_1 = \"School A\"\nlabel_2 = \"School A (Enriched)\"\nlabel_3 = \"School B\"\nlabel_4 = \"School B (Enriched)\"\n\n# Titles\ntitle_1 = \"Interest in School A over Time\"\ntitle_2 = \"Interest in School B over Time\"\n\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set the figure size to ensure good readability\nplt.figure(figsize=(12, 6))\n\n# First subplot\nplt.subplot(1, 2, 1)\nplt.plot(\n iterations,\n school_a,\n marker=\"s\",\n linestyle=\"--\",\n color=\"#FF6347\",\n label=label_1,\n markerfacecolor=\"#FF6347\",\n linewidth=2,\n markersize=7,\n)\nplt.plot(\n iterations,\n school_a_ft,\n marker=\"o\",\n linestyle=\"-\",\n color=\"#4682B4\",\n label=label_2,\n markerfacecolor=\"#4682B4\",\n linewidth=2,\n markersize=7,\n)\nplt.fill_between(iterations, school_a - 0.05, school_a + 0.05, color=\"#FF6347\", alpha=0.2)\nplt.fill_between(\n iterations, school_a_ft - 0.03, school_a_ft + 0.03, color=\"#4682B4\", alpha=0.2\n)\nplt.title(title_1, fontsize=16)\nplt.xlabel(xlabel_value, fontsize=14)\nplt.ylabel(ylabel_value, fontsize=14)\nplt.legend(loc=\"lower right\", frameon=True, fontsize=12)\n\n# Second subplot\nplt.subplot(1, 2, 2)\nplt.plot(\n iterations,\n school_b,\n marker=\"s\",\n linestyle=\"--\",\n color=\"#32CD32\",\n label=label_3,\n markerfacecolor=\"#32CD32\",\n linewidth=2,\n markersize=7,\n)\nplt.plot(\n iterations,\n school_b_ft,\n marker=\"o\",\n linestyle=\"-\",\n color=\"#8A2BE2\",\n label=label_4,\n markerfacecolor=\"#8A2BE2\",\n linewidth=2,\n markersize=7,\n)\nplt.fill_between(\n iterations, school_b - 0.05, school_b + 0.05, color=\"#32CD32\", alpha=0.2\n)\nplt.fill_between(\n iterations, school_b_ft - 0.03, school_b_ft + 0.03, color=\"#8A2BE2\", alpha=0.2\n)\nplt.title(title_2, fontsize=16)\nplt.xlabel(xlabel_value, fontsize=14)\nplt.ylabel(ylabel_value, fontsize=14)\nplt.legend(loc=\"lower right\", frameon=True, fontsize=12, bbox_to_anchor=(1, 0.1))\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save plot\nplt.tight_layout()\nplt.savefig(\"line_122.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "line" }, { "id": "test_225", "content": { "Products": [ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3 ], "Regions": [ 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3 ], "Sales Volume": [ 10, 15, 20, 25, 15, 20, 25, 30, 20, 25, 30, 35, 25, 30, 35, 40 ] }, "visual_intent": "A 3D bar chart about Products and Regions showing Sales Volume, titled Sales Performance across Regions(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/3d_49.jpg", "original_category": "3d", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Define new sales data for different products across regions\nsales_data = np.array([[10, 15, 20, 25], [15, 20, 25, 30], [20, 25, 30, 35], [25, 30, 35, 40]])\n\n# Define the edges of the bins\nxedges = np.array([0, 1, 2, 3, 4])\nyedges = np.array([0, 1, 2, 3, 4])\n\n# Construct arrays for the anchor positions of the 4 bars.\nxpos, ypos = np.meshgrid(xedges[:-1] + 0.25, yedges[:-1] + 0.25, indexing=\"ij\")\nxpos = xpos.ravel()\nypos = ypos.ravel()\nzpos = 0\n\n# Flatten the sales data and filter non-zero bars\ndz = sales_data.ravel()\nnon_zero_indices = dz > 0\nxpos = xpos[non_zero_indices]\nypos = ypos[non_zero_indices]\ndz = dz[non_zero_indices]\n\n# All bars have the same width and depth\ndx = dy = 0.5 * np.ones_like(dz)\n\n# Axes Limits and Labels\nax_xlabel = \"Products\"\nax_ylabel = \"Regions\"\nax_zlabel = \"Sales Volume\"\nchart_title = \"Sales Performance across Regions\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a new figure for the modified 3D bar plot\nfig = plt.figure(figsize=(10, 7))\nax = fig.add_subplot(projection=\"3d\")\n\nzticks_values = [0, 10, 20, 30, 40]\n\n# Define a color palette for the bars\ncolors = plt.cm.viridis(dz / dz.max())\n\nax.bar3d(xpos, ypos, zpos, dx, dy, dz, zsort=\"average\", color=colors)\n\n# Set axis labels and title\nax.set_xlabel(ax_xlabel, labelpad=10)\nax.set_ylabel(ax_ylabel, labelpad=10)\nax.set_zlabel(ax_zlabel, labelpad=10)\nax.set_title(chart_title, pad=20)\n\n# Set z-axis ticks\nax.set_zticks(zticks_values)\n\nax.set_box_aspect(aspect=None, zoom=0.8)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"3d_49.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "misc" }, { "id": "test_226", "content": { "Art Style": [ "Impressionism", "Cubism", "Surrealism", "Abstract", "Modern", "Renaissance" ], "Number of Exhibitions": [ 50, 30, 20, 15, 10, 5 ], "Popularity Score (%)": [ 50, 75, 60, 55, 40, 30 ] }, "visual_intent": "A scatter plot about number of exhibitions and popularity score (%) for various art styles, titled Art Style Popularity vs. Number of Exhibitions(size of the desired plot: width=8.0, height=5.0)", "path_to_gt_image": "images/scatter_45.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data points for art styles, number of exhibitions and popularity score.\nart_styles = [\n \"Impressionism\",\n \"Cubism\",\n \"Surrealism\",\n \"Abstract\",\n \"Modern\",\n \"Renaissance\",\n]\nexhibitions = [50, 30, 20, 15, 10, 5] # Number of exhibitions held\npopularity = [50, 75, 60, 55, 40, 30] # Popularity score (%)\n\n# Labels and title\nxlabel = \"Number of Exhibitions\"\nylabel = \"Popularity Score (%)\"\ntitle = \"Art Style Popularity vs. Number of Exhibitions\"\nsupertitle = \"Art Style Analysis\"\nlegend_labels = art_styles\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure and a subplot with a specific size.\nfig, ax = plt.subplots(figsize=(8, 5))\n\n# Color scheme reflecting art styles\ncolors = [\"#FFB6C1\", \"#87CEEB\", \"#FFD700\", \"#40E0D0\", \"#FFA07A\", \"#9370DB\"]\nmarkers = [\"o\", \"v\", \"^\", \"<\", \">\", \"*\"]\n\n# Scatter plot each art style's data point and add text annotation.\nfor i in range(len(art_styles)):\n ax.scatter(\n exhibitions[i],\n popularity[i],\n color=colors[i],\n marker=markers[i],\n s=100,\n edgecolor=\"k\",\n )\n ax.text(\n exhibitions[i] + 1,\n popularity[i] + 1,\n art_styles[i],\n fontsize=10,\n ha=\"left\",\n va=\"bottom\",\n )\n\n# Add a horizontal and a vertical dashed reference line.\nax.axhline(\n y=50, color=\"gray\", linestyle=\"--\", linewidth=1\n) # Horizontal line at Popularity=50%\nax.axvline(\n x=15, color=\"gray\", linestyle=\"--\", linewidth=1\n) # Vertical line at Exhibitions=15\n\n# Set the scales of the axes to logarithmic.\nax.set_xscale(\"log\")\nax.set_yscale(\"log\")\n\n# Set the labels for the axes.\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\n\n# Set the title of the plot.\nax.set_title(title)\nfig.suptitle(supertitle, fontsize=14)\n\n# Adding grid\nax.grid(True, which=\"both\", linestyle=\"--\", linewidth=0.5)\n\n# Adding legend\nfor i, label in enumerate(legend_labels):\n ax.scatter([], [], color=colors[i], marker=markers[i], label=label)\nax.legend(title=\"Art Styles\")\n\n# Define major ticks for both axes.\nax.set_xticks([5, 10, 20, 50, 100])\nax.get_xaxis().set_major_formatter(plt.ScalarFormatter())\nax.set_yticks([30, 40, 50, 60, 75, 90])\nax.get_yaxis().set_major_formatter(plt.ScalarFormatter())\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Show the plot with a tight layout to ensure all elements fit within the figure area.\nplt.tight_layout(rect=[0, 0, 1, 0.95]) # Adjust for supertitle\nplt.savefig(\"scatter_45.pdf\", bbox_inches=\"tight\")\n", "width": 8.0, "height": 5.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "scatter" }, { "id": "test_227", "content": { "Resolution": [ "224", "128", "64", "32" ], "Serial_ImageNet-1k_Accuracy": [ 75, 65, 50, 35 ], "Serial_ImageNet-C/P_(Fog)_Accuracy": [ 40, 30, 20, 0 ], "Parallel_ImageNet-1k_Accuracy": [ 80, 70, 55, 40 ], "Parallel_ImageNet-C/P_(Fog)_Accuracy": [ 50, 40, 30, 10 ] }, "visual_intent": "A figure with 2 subplots: (1) a line chart about image resolution and Top-1 accuracy for Serial processing, titled Serial (n=8, m=1), (2) a line chart about image resolution and Top-1 accuracy for Parallel processing, titled Parallel (n=2, m=4)(size of the desired plot: width=9.0, height=4.0)", "path_to_gt_image": "images/line_4.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data for plotting\nresolutions = [\"224\", \"128\", \"64\", \"32\"] # Update for categorical x-axis\nresolutions_int = [224, 128, 64, 32]\nserial_imagenet1k = [75, 65, 50, 35]\nserial_imagenet_cp = [40, 30, 20, 0]\nparallel_imagenet1k = [80, 70, 55, 40]\nparallel_imagenet_cp = [50, 40, 30, 10]\n\n# Axes Limits and Labels\nxticks_values = range(len(resolutions))\nylabel_value = \"Top-1 Acc. (%)\"\n\n# Labels\nlabel_1 = \"ImageNet-1k\"\nlabel_2 = \"ImageNet-C/P (Fog)\"\n\n# Titles\ntitle_1 = \"Serial (n=8, m=1)\"\ntitle_2 = \"Parallel (n=2, m=4)\"\n\n# Texts\ntext_1 = \"39.1%\"\ntext_2 = \"22.9%\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create figure and axes\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 4))\n\n# Plotting for Serial\nax1.set_xticks(xticks_values) # Setting categorical x-axis\nax1.plot(\n resolutions,\n serial_imagenet1k,\n marker=\"o\",\n color=\"#f5a45f\",\n label=label_1,\n linewidth=4,\n markersize=8,\n)\nax1.plot(\n resolutions,\n serial_imagenet_cp,\n marker=\"o\",\n linestyle=\"--\",\n color=\"#f5a45f\",\n label=label_2,\n linewidth=4,\n markersize=8,\n)\nax1.set_title(title_1, fontsize=16)\nax1.set_ylabel(ylabel_value, fontsize=16) # Adjusted font size\nax1.legend(loc=\"lower left\", fontsize=14)\nax1.set_xticklabels(resolutions, fontsize=12) # Adjust font size for x-axis labels\nax1.grid(True, which=\"both\", ls=\"--\", color=\"grey\", linewidth=1, axis=\"y\", alpha=0.5)\nax1.annotate(\n \"\",\n xy=(0, serial_imagenet_cp[0]),\n xytext=(0, serial_imagenet1k[0]),\n arrowprops=dict(color=\"red\", shrink=0.05, width=1.5, headwidth=8),\n annotation_clip=False,\n)\nax1.text(\n 0.1,\n (serial_imagenet1k[0] + serial_imagenet_cp[0]) / 2,\n text_1,\n ha=\"left\",\n va=\"center\",\n fontsize=14,\n color=\"black\",\n)\n\n# Plotting for Parallel\nax2.plot(\n resolutions,\n parallel_imagenet1k,\n marker=\"o\",\n color=\"#3ebcec\",\n label=label_1,\n linewidth=4,\n markersize=8,\n)\nax2.plot(\n resolutions,\n parallel_imagenet_cp,\n marker=\"o\",\n linestyle=\"--\",\n color=\"#3ebcec\",\n label=label_2,\n linewidth=4,\n markersize=8,\n)\nax2.set_title(title_2, fontsize=16) # Adjusted font size\nax2.legend(loc=\"lower left\", fontsize=14)\nax2.set_xticklabels(\n resolutions, fontsize=12\n) # Ensure x-axis labels are set for both axes\nax2.grid(True, which=\"both\", ls=\"--\", color=\"grey\", linewidth=1, axis=\"y\", alpha=0.5)\nax2.annotate(\n \"\",\n xy=(0, parallel_imagenet_cp[0]),\n xytext=(0, parallel_imagenet1k[0]),\n arrowprops=dict(color=\"red\", shrink=0.05, width=1.5, headwidth=8),\n annotation_clip=False,\n)\nax2.text(\n 0.1,\n (parallel_imagenet1k[0] + parallel_imagenet_cp[0]) / 2,\n text_2,\n ha=\"left\",\n va=\"center\",\n fontsize=14,\n color=\"black\",\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and add common annotation for resolution\nplt.tight_layout()\nplt.savefig(\"line_4.pdf\", bbox_inches=\"tight\")\n", "width": 9.0, "height": 4.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "line" }, { "id": "test_228", "content": { "Moisture Levels": [ 0.0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5 ], "Wheat Yield": [ 600, 750, 900, 1100, 1300, 1200, 1000, 800, 600, 500, 400 ], "Corn Yield": [ 400, 620, 850, 1000, 1100, 1050, 900, 720, 550, 450, 300 ] }, "visual_intent": "A stacked bar chart about moisture levels and crop yields (Wheat and Corn), featuring an inset plot zooming in on the higher moisture ranges(size of the desired plot: width=10.0, height=6.0)", "path_to_gt_image": "images/PIP_30.jpg", "original_category": "PIP", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n# Generate some dummy data for agriculture\nmoisture_levels = [0.0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.4, 0.45, 0.5]\nwheat_yield = [\n 600,\n 750,\n 900,\n 1100,\n 1300,\n 1200,\n 1000,\n 800,\n 600,\n 500,\n 400,\n] # Wheat yield\ncorn_yield = [\n 400,\n 620,\n 850,\n 1000,\n 1100,\n 1050,\n 900,\n 720,\n 550,\n 450,\n 300,\n] # Corn yield\nlabels = [\"Wheat\", \"Corn\"]\nxmainlabel = \"Moisture Levels\"\nxmainlim = [-0.1, 0.8]\nxmainticks = [0.0, 0.2, 0.4, 0.6]\nymainlabel = \"Yield (kg/hectare)\"\nymainlim = [0, 3000]\nymainticks = [0, 300, 600, 900, 1200, 1500, 1800, 2100, 2400, 2700, 3000]\n\nxinsetlim = [0.20, 0.55]\nxinsetticks = [0.25, 0.30, 0.35, 0.40, 0.45, 0.50]\nyinsetlim = [0, 3000]\nyinsetticks = [0, 300, 600, 900, 1200, 1500, 1800, 2100, 2400, 2700, 3000]\n# Create inset plot with adjusted bar widths and white borders\nleft, bottom, width, height = [0.5, 0.6, 0.3, 0.3]\nmainplotline = [(0.235, 600), (0.55, 600)]\nmaininsetline = [(0.20, 0), (0.55, 0)]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create main plot with adjusted bar widths and white borders\nfig, ax_main = plt.subplots(figsize=(10, 6))\nbar_width = 0.05 # Slightly less than the bin width to create a gap\nax_main.bar(\n moisture_levels,\n wheat_yield,\n width=bar_width,\n color=\"#8FBF73\", # Earthy green color\n align=\"center\",\n label=labels[0],\n edgecolor=\"white\",\n)\nax_main.bar(\n moisture_levels,\n corn_yield,\n width=bar_width,\n color=\"#C99069\", # Earthy brown color\n align=\"center\",\n bottom=wheat_yield,\n label=labels[1],\n edgecolor=\"white\",\n)\nax_main.set_xlabel(xmainlabel)\nax_main.set_xlim(xmainlim)\nax_main.set_xticks(xmainticks)\nax_main.set_ylabel(ymainlabel)\nax_main.set_ylim(ymainlim)\nax_main.set_yticks(ymainticks)\nax_main.legend(loc=\"upper right\", prop={\"size\": 16})\nax_main.grid(True, linestyle='--', linewidth=0.5)\n\nax_inset = fig.add_axes([left, bottom, width, height])\nax_inset.bar(\n moisture_levels[5:],\n wheat_yield[5:],\n width=bar_width,\n color=\"#8FBF73\",\n align=\"center\",\n edgecolor=\"white\",\n)\nax_inset.bar(\n moisture_levels[5:],\n corn_yield[5:],\n width=bar_width,\n color=\"#C99069\",\n align=\"center\",\n bottom=wheat_yield[5:],\n edgecolor=\"white\",\n)\nax_inset.set_xlim(xinsetlim) # Zoom in on the right part of the data\nax_inset.set_xticks(xinsetticks) # Zoom in on the right part of the data\nax_inset.set_ylim(yinsetlim)\nax_inset.set_yticks(yinsetticks)\nax_inset.grid(True, linestyle='--', linewidth=0.5)\n\n# Adding lines to connect the plots.\n# Coordinates of the main plot corners\nmain_plot_left = ax_main.transData.transform_point(mainplotline[0])\nmain_plot_right = ax_main.transData.transform_point(mainplotline[1])\n\n# Coordinates of the inset corners\ninset_left = ax_inset.transData.transform_point(maininsetline[0])\ninset_right = ax_inset.transData.transform_point(maininsetline[1])\n\n# Transform to figure coordinates for annotation\nmain_plot_left = fig.transFigure.inverted().transform(main_plot_left)\nmain_plot_right = fig.transFigure.inverted().transform(main_plot_right)\ninset_left = fig.transFigure.inverted().transform(inset_left)\ninset_right = fig.transFigure.inverted().transform(inset_right)\n\n# Draw lines connecting corners\nfig.add_artist(\n plt.Line2D(\n (main_plot_left[0], inset_left[0]),\n (main_plot_left[1], inset_left[1]),\n color=\"gray\",\n )\n)\nfig.add_artist(\n plt.Line2D(\n (main_plot_right[0], inset_right[0]),\n (main_plot_right[1], inset_right[1]),\n color=\"gray\",\n )\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"PIP_30.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 6.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "misc" }, { "id": "test_229", "content": { "Company": [ "Company A", "Company B", "Company C", "Company D", "Company E", "Company F", "Company G", "Company H", "Company I" ], "Revenue Growth": [ 8, 6.5, 7.8, 5.2, 6.6, 4.4, 7.9, 3.1, 5.3 ], "Market Share": [ 15, 10, 12, 8, 14, 7.5, 16, 6, 9 ], "Customer Satisfaction": [ 80, 70, 75, 65, 85, 60, 90, 55, 50 ], "Innovation": [ 3, 2.5, 2.8, 1.2, 2.6, 1.4, 2.9, 1.1, 1.3 ] }, "visual_intent": "A figure with 2 subplots: (1) a scatter plot about Revenue Growth and Market Share versus companies, titled Financial Metrics, (2) a scatter plot about Customer Satisfaction and Innovation versus companies, titled Performance Metrics. The overall figure is titled Comparison of Business Performance Metrics(size of the desired plot: width=14.0, height=7.0)", "path_to_gt_image": "images/scatter_91.jpg", "original_category": "scatter", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\ncompanies = [\n \"Company A\",\n \"Company B\",\n \"Company C\",\n \"Company D\",\n \"Company E\",\n \"Company F\",\n \"Company G\",\n \"Company H\",\n \"Company I\",\n]\nvalues = {\n \"Revenue Growth\": [8, 6.5, 7.8, 5.2, 6.6, 4.4, 7.9, 3.1, 5.3],\n \"Market Share\": [15, 10, 12, 8, 14, 7.5, 16, 6, 9],\n \"Customer Satisfaction\": [80, 70, 75, 65, 85, 60, 90, 55, 50],\n \"Innovation\": [3, 2.5, 2.8, 1.2, 2.6, 1.4, 2.9, 1.1, 1.3],\n \"Risk Management\": [4.1, 3.7, 4.0, 3.6, 4.2, 3.5, 4.3, 2.9, 3.3],\n \"Operational Efficiency\": [75, 65, 70, 60, 80, 55, 85, 50, 45],\n}\ncategorys1 = [\"Revenue Growth\", \"Market Share\"]\ncategorys2 = [\"Customer Satisfaction\", \"Innovation\"]\ntitles = [\"Financial Metrics\", \"Performance Metrics\"]\nxlabel = \"Score\"\nylabel = \"Companies\"\nsuper_title = \"Comparison of Business Performance Metrics\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create subplots\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 7), sharey=True)\ncolors1 = [\"#1f77b4\", \"#ff7f0e\"] # Sophisticated color palette\ncolors2 = [\"#2ca02c\", \"#d62728\"]\n\n# Plotting for ax1 - first two categories\nfor category, color in zip(categorys1, colors1):\n ax1.scatter(\n values[category],\n companies,\n color=color,\n label=category,\n marker=\"o\",\n edgecolor=\"k\",\n )\nax1.set_title(titles[0])\nax1.set_xlabel(xlabel)\nax1.set_ylabel(ylabel)\nax1.legend()\n\n# Plotting for ax2 - next two categories\nfor category, color in zip(categorys2, colors2):\n ax2.scatter(\n values[category],\n companies,\n color=color,\n label=category,\n marker=\"^\",\n edgecolor=\"k\",\n )\nax2.set_title(titles[1])\nax2.set_xlabel(xlabel)\nax2.legend()\n\n# Common settings\nfor ax in [ax1, ax2]:\n ax.set_yticks(range(len(companies)))\n ax.set_yticklabels(companies)\n ax.grid(True, linestyle=\"--\", alpha=0.6)\n\nfig.suptitle(super_title)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and show plot\nplt.tight_layout(rect=[0, 0.03, 1, 0.95]) # Adjust layout to fit suptitle\nplt.savefig(\"scatter_91.pdf\", bbox_inches=\"tight\")\n", "width": 14.0, "height": 7.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "scatter" }, { "id": "test_230", "content": { "Region_Context": [ "Party A v.s. Party B (Region North)", "Party A v.s. Party B (Region North)", "Party A v.s. Party B (Region North)", "Party A v.s. Party B (Region North)", "Party A v.s. Party B (Region South)", "Party A v.s. Party B (Region South)", "Party A v.s. Party B (Region South)", "Party A v.s. Party B (Region South)", "Party A v.s. Party B (Region East)", "Party A v.s. Party B (Region East)", "Party A v.s. Party B (Region East)", "Party A v.s. Party B (Region East)", "Party A v.s. Party B (Region West)", "Party A v.s. Party B (Region West)", "Party A v.s. Party B (Region West)", "Party A v.s. Party B (Region West)" ], "Category": [ "North", "South", "East", "West", "North", "South", "East", "West", "North", "South", "East", "West", "North", "South", "East", "West" ], "Win": [ 30, 35, 40, 50, 45, 55, 60, 70, 50, 40, 55, 65, 70, 75, 80, 85 ], "Tie": [ 40, 30, 30, 20, 25, 20, 15, 10, 20, 30, 20, 15, 10, 10, 15, 10 ], "Lose": [ 30, 35, 30, 30, 30, 25, 25, 20, 30, 30, 25, 20, 20, 15, 5, 5 ] }, "visual_intent": "A figure with 4 subplots displaying horizontal stacked bar charts showing Win, Tie, and Lose percentages for different geographic categories across four regional contexts (North, South, East, West).(size of the desired plot: width=13.0, height=6.0)", "path_to_gt_image": "images/bar_221.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(1) # Seed for reproducibility\n\n# Data for the bar charts\ncategories = [\"North\", \"South\", \"East\", \"West\"]\nwin = [30, 35, 40, 50, 45, 55, 60, 70, 50, 40, 55, 65, 70, 75, 80, 85]\ntie = [40, 30, 30, 20, 25, 20, 15, 10, 20, 30, 20, 15, 10, 10, 15, 10]\nlose = [30, 35, 30, 30, 30, 25, 25, 20, 30, 30, 25, 20, 20, 15, 5, 5]\n\n# Chart labels\nlabels = [\"Win\", \"Tie\", \"Lose\"]\n\n# Titles for the subplots\ntitles = [\n \"Party A v.s. Party B (Region North)\",\n \"Party A v.s. Party B (Region South)\",\n \"Party A v.s. Party B (Region East)\",\n \"Party A v.s. Party B (Region West)\",\n]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Create a figure with custom size\nfig, axes = plt.subplots(2, 2, figsize=(13, 6))\n\n# Function to create a bar chart\ndef create_bar_chart(ax, win, tie, lose, title):\n bar_width = 0.5\n indices = np.arange(len(categories))\n\n ax.barh(indices, win, bar_width, color=\"#2e8b57\", label=labels[0])\n ax.barh(indices, tie, bar_width, left=win, color=\"#4682b4\", label=labels[1])\n ax.barh(\n indices,\n lose,\n bar_width,\n left=np.add(win, tie),\n color=\"#cd5c5c\",\n label=labels[2],\n )\n\n ax.set_yticks(indices)\n ax.set_yticklabels(categories)\n ax.invert_yaxis() # labels read top-to-bottom\n ax.set_title(title)\n ax.set_xlim(0, 100)\n\n for i, (w, t, l) in enumerate(zip(win, tie, lose)):\n ax.text(w / 2, i, f\"{w}%\", ha=\"center\", va=\"center\", color=\"white\")\n ax.text(w + t / 2, i, f\"{t}%\", ha=\"center\", va=\"center\", color=\"white\")\n ax.text(w + t + l / 2, i, f\"{l}%\", ha=\"center\", va=\"center\", color=\"white\")\n for spine in ax.spines.values():\n spine.set_visible(False)\n\n\n# Create each bar chart\ncreate_bar_chart(axes[0, 0], win[:4], tie[:4], lose[:4], titles[0])\ncreate_bar_chart(axes[1, 0], win[4:8], tie[4:8], lose[4:8], titles[1])\ncreate_bar_chart(axes[0, 1], win[8:12], tie[8:12], lose[8:12], titles[2])\ncreate_bar_chart(axes[1, 1], win[12:], tie[12:], lose[12:], titles[3])\n\n# Add a legend\nhandles, labels = axes[0, 0].get_legend_handles_labels()\nfig.legend(handles, labels, loc=\"lower center\", ncol=3)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout and save the figure\nplt.tight_layout(rect=[0, 0.05, 1, 1])\nplt.savefig(\"bar_221.pdf\", bbox_inches=\"tight\")\n", "width": 13.0, "height": 6.0, "rounded_ratio": "21:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_231", "content": { "Philosophy_Type": [ "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Classical Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy", "Modern Philosophy" ], "Philosophical_School_Index": [ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5 ], "Predicted_Category_Index": [ 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5 ], "Count": [ 30, 5, 10, 0, 0, 0, 15, 35, 5, 5, 0, 0, 8, 7, 20, 10, 10, 0, 0, 0, 5, 25, 5, 5, 0, 0, 8, 10, 22, 5, 0, 0, 0, 8, 10, 15, 5, 0, 0, 15, 5, 0, 0, 7, 5, 10, 8, 0, 0, 0, 12, 9, 10, 10, 10, 5, 0, 0, 5, 5, 15, 8, 0, 0, 10, 10, 10, 15, 20, 0, 5, 7 ] }, "visual_intent": "A figure with 2 subplots: (1) a confusion matrix heatmap about Classical Philosophy predictions, titled Classical Philosophy, (2) a confusion matrix heatmap about Modern Philosophy predictions, titled Modern Philosophy(size of the desired plot: width=6.0, height=5.0)", "path_to_gt_image": "images/heatmap_64.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(42)\n\n# Placeholder data for philosophy-related matrices\ndata_classical = np.array(\n [\n [30, 5, 10, 0, 0, 0],\n [15, 35, 5, 5, 0, 0],\n [8, 7, 20, 10, 10, 0],\n [0, 0, 5, 25, 5, 5],\n [0, 0, 8, 10, 22, 5],\n [0, 0, 0, 8, 10, 15],\n ]\n)\ndata_modern = np.array(\n [\n [5, 0, 0, 15, 5, 0],\n [0, 7, 5, 10, 8, 0],\n [0, 0, 12, 9, 10, 10],\n [10, 5, 0, 0, 5, 5],\n [15, 8, 0, 0, 10, 10],\n [10, 15, 20, 0, 5, 7],\n ]\n)\n\n# Titles for the subplots\ntitles = [\"Classical Philosophy\", \"Modern Philosophy\"]\nylabel = \"Philosophical School\"\nxlabel = \"Predicted Category\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Increase the figure height and adjust subplot layout\nfig, axes = plt.subplots(nrows=1, ncols=2, figsize=(6, 5))\n\n\n# Function to create a single confusion matrix plot\ndef plot_confusion_matrix(ax, data, title):\n im = ax.imshow(data, interpolation=\"nearest\", cmap=\"Blues\")\n ax.set(\n title=title,\n ylabel=ylabel,\n xlabel=xlabel,\n xticks=np.arange(data.shape[1]),\n yticks=np.arange(data.shape[0]),\n )\n ax.axhline(y=2.5, color=\"black\", linewidth=2.5, linestyle='--')\n ax.axvline(x=2.5, color=\"black\", linewidth=2.5, linestyle='--')\n # unset the ticks\n ax.set_xticks([])\n ax.set_yticks([])\n # unset the spines\n ax.spines[\"top\"].set_visible(False)\n ax.spines[\"right\"].set_visible(False)\n ax.spines[\"bottom\"].set_visible(False)\n ax.spines[\"left\"].set_visible(False)\n return im\n\n\n# Plot each confusion matrix\nim1 = plot_confusion_matrix(axes[0], data_classical, titles[0])\nim2 = plot_confusion_matrix(axes[1], data_modern, titles[1])\n\n# Adjust the position and size of the colorbars\ncbar_ax1 = fig.add_axes([0.05, 0.15, 0.45, 0.02]) # Adjusted for the first subplot\ncbar_ax2 = fig.add_axes([0.55, 0.15, 0.45, 0.02]) # Adjusted for the second subplot\nfig.colorbar(im1, cax=cbar_ax1, orientation=\"horizontal\")\nfig.colorbar(im2, cax=cbar_ax2, orientation=\"horizontal\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nfig.tight_layout()\nplt.savefig(\"heatmap_64.pdf\", bbox_inches=\"tight\")\n", "width": 6.0, "height": 5.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_232", "content": { "Policy Areas": [ "Economic policy", "Healthcare policy", "Foreign policy", "Immigration policy", "Social policy", "Environmental policy", "Education policy", "Public safety policy", "Infrastructure policy", "Tax policy", "Civil rights policy" ], "Impact": [ 0.05, -0.03, 0.04, -0.06, 0.02, -0.01, 0.03, -0.02, 0.06, -0.04, 0.08 ] }, "visual_intent": "A horizontal waterfall chart about Policy Areas and Impact on Approval Rating, titled Impact of Different Policies on Approval Rating(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/HR_59.jpg", "original_category": "HR", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nfrom matplotlib import patches\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# New domain data: Politics\nfeatures = [\n \"Economic policy\",\n \"Healthcare policy\",\n \"Foreign policy\",\n \"Immigration policy\",\n \"Social policy\",\n \"Environmental policy\",\n \"Education policy\",\n \"Public safety policy\",\n \"Infrastructure policy\",\n \"Tax policy\",\n \"Civil rights policy\",\n]\nimpact_values = [0.05, -0.03, 0.04, -0.06, 0.02, -0.01, 0.03, -0.02, 0.06, -0.04, 0.08]\n# Starting x-axis value\nstart_x = 0.60\ncumulative_values = [start_x]\n\naxvhline = 0.70\nylim = [-0.5, 11]\nxlim = [0.4, 0.8]\nxticks = [0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75]\ntextposition = [[0.70, 10.5], [0.60, -2]]\ntextlabels = [\"Policy Impact = 0.70\", \"Initial Value = 0.60\"]\nxlabel = \"Impact on Approval Rating\"\nylabel = \"Policy Areas\"\ntitle = \"Impact of Different Policies on Approval Rating\"\nfig_suptitle = \"Political Impact Analysis\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Calculate the start point for each bar\ncolors_positive = \"#1f77b4\" # Blue shades for positive impact\ncolors_negative = \"#ff7f0e\" # Orange shades for negative impact\n\nfor impact in impact_values:\n next_value = cumulative_values[-1] + impact\n cumulative_values.append(next_value)\n\n# Define colors for positive and negative impact\ncolors = [colors_positive if impact > 0 else colors_negative for impact in impact_values]\n\nfig, ax = plt.subplots(figsize=(10, 8))\n# Add dashed lines to connect bars\nfor i in range(len(impact_values) - 1):\n plt.plot(\n [cumulative_values[i + 1], cumulative_values[i + 1]],\n [features[i], features[i + 1]],\n \"k--\",\n linewidth=0.5,\n color=\"gray\",\n )\n# Customize bars with arrows\nfor idx, (feature, impact) in enumerate(zip(features, impact_values)):\n left = cumulative_values[idx]\n bar_width = 0.6 # Set the bar width\n\n if impact > 0:\n color = colors_positive\n width = impact\n text_x = left + width\n # Draw the main bar body\n ax.add_patch(\n patches.Rectangle(\n (left, idx - bar_width / 2),\n width - 0.005,\n bar_width,\n facecolor=color,\n )\n )\n # Draw the tip\n ax.add_patch(\n patches.Polygon(\n [\n (left + width - 0.005, idx - bar_width / 2),\n (left + width, idx),\n (left + width - 0.005, idx + bar_width / 2),\n ],\n closed=True,\n facecolor=color,\n )\n )\n ax.text(text_x, idx, f\"+{impact}\", va=\"center\", ha=\"left\", color=color)\n else:\n color = colors_negative\n width = -impact # Width is positive for drawing\n text_x = left - width\n if impact == 0:\n ax.add_patch(\n patches.Rectangle(\n (left - width, idx - bar_width / 2),\n width,\n bar_width,\n facecolor=color,\n edgecolor=color,\n )\n )\n else:\n # Draw the main bar body\n ax.add_patch(\n patches.Rectangle(\n (left - width + 0.005, idx - bar_width / 2),\n width - 0.005,\n bar_width,\n facecolor=color,\n )\n )\n # Draw the tip\n ax.add_patch(\n patches.Polygon(\n [\n (left - width + 0.005, idx - bar_width / 2),\n (left - width, idx),\n (left - width + 0.005, idx + bar_width / 2),\n ],\n closed=True,\n facecolor=color,\n )\n )\n\n ax.text(\n text_x, idx, f\"-{np.abs(impact)}\", va=\"center\", ha=\"right\", color=color\n )\n\nax.axvline(axvhline, linestyle=\"--\", color=\"gray\", alpha=0.3)\n# Set labels and title\nax.yaxis.grid(True, linestyle=\"dotted\", color=\"gray\", alpha=0.3)\nax.set_axisbelow(True)\nax.tick_params(axis=\"both\", length=0)\n# Remove spines\nax.spines[\"right\"].set_visible(False)\nax.spines[\"top\"].set_visible(False)\nax.spines[\"left\"].set_visible(False)\nax.set_ylim(ylim)\nax.set_xlim(xlim)\nax.set_xticks(xticks)\nax.set_xlabel(xlabel)\nax.set_ylabel(ylabel)\nax.set_title(title)\nfig.suptitle(fig_suptitle)\n# Add text annotation for initial value and policy impact\nax.text(\n textposition[0][0],\n textposition[0][1],\n textlabels[0],\n va=\"bottom\",\n ha=\"center\",\n color=\"grey\",\n)\nax.text(\n textposition[1][0],\n textposition[1][1],\n textlabels[1],\n va=\"bottom\",\n ha=\"center\",\n color=\"grey\",\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"HR_59.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "misc" }, { "id": "test_233", "content": { "Sports": [ "Soccer", "Basketball", "Tennis", "Swimming", "Running" ], "Player A": [ 85, 90, 75, 65, 70 ], "Player B": [ 70, 78, 82, 60, 75 ], "Player C": [ 88, 85, 80, 70, 85 ], "Player D": [ 78, 80, 65, 75, 80 ], "Player E": [ 75, 83, 70, 68, 78 ] }, "visual_intent": "A grouped bar chart about player performance across different sports, titled Player Performance Across Different Sports(size of the desired plot: width=10.0, height=5.0)", "path_to_gt_image": "images/bar_129.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n# Data\nsports = [\"Soccer\", \"Basketball\", \"Tennis\", \"Swimming\", \"Running\"]\nPlayer_A = [85, 90, 75, 65, 70]\nPlayer_B = [70, 78, 82, 60, 75]\nPlayer_C = [88, 85, 80, 70, 85]\nPlayer_D = [78, 80, 65, 75, 80]\nPlayer_E = [75, 83, 70, 68, 78]\n\n# Plot labels\nxlabel = \"Sports\"\nylabel = \"Performance (%)\"\ntitle = \"Player Performance Across Different Sports\"\n\n# Legend labels\nPlayer_A_label = \"Player A\"\nPlayer_B_label = \"Player B\"\nPlayer_C_label = \"Player C\"\nPlayer_D_label = \"Player D\"\nPlayer_E_label = \"Player E\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\nbarWidth = 0.16\nxticks = [r + barWidth * 2 for r in range(len(Player_A))]\nxtickslabel = sports\nyticks = [50, 60, 70, 80, 90, 100]\nytickslabel = None\nxlim = None\nylim = (50, 100)\n\n# Set figure size\nplt.figure(figsize=(10, 5))\n\n# Set position of bar on X axis\nr1 = np.arange(len(Player_A))\nr2 = [x + barWidth for x in r1]\nr3 = [x + barWidth for x in r2]\nr4 = [x + barWidth for x in r3]\nr5 = [x + barWidth for x in r4]\n\n# Make the plot\nplt.bar(\n r1,\n Player_A,\n color=\"#6a994e\",\n width=barWidth,\n edgecolor=\"white\",\n label=Player_A_label,\n)\nplt.bar(\n r2,\n Player_B,\n color=\"#4ea8de\",\n width=barWidth,\n edgecolor=\"white\",\n label=Player_B_label,\n)\nplt.bar(\n r3,\n Player_C,\n color=\"#f77f00\",\n width=barWidth,\n edgecolor=\"white\",\n label=Player_C_label,\n)\nplt.bar(\n r4,\n Player_D,\n color=\"#9d4edd\",\n width=barWidth,\n edgecolor=\"white\",\n label=Player_D_label,\n)\nplt.bar(\n r5, Player_E, color=\"#ffb4a2\", width=barWidth, edgecolor=\"white\", label=Player_E_label\n)\n\n# Add labels\nfor i in range(len(sports)):\n plt.text(\n r1[i],\n Player_A[i] + 1,\n str(Player_A[i]),\n ha=\"center\",\n fontsize=8,\n rotation=45,\n )\n plt.text(\n r2[i],\n Player_B[i] + 1,\n str(Player_B[i]),\n ha=\"center\",\n fontsize=8,\n rotation=45,\n )\n plt.text(\n r3[i],\n Player_C[i] + 1,\n str(Player_C[i]),\n ha=\"center\",\n fontsize=8,\n rotation=45,\n )\n plt.text(\n r4[i],\n Player_D[i] + 1,\n str(Player_D[i]),\n ha=\"center\",\n fontsize=8,\n rotation=45,\n )\n plt.text(\n r5[i], Player_E[i] + 1, str(Player_E[i]), ha=\"center\", fontsize=8, rotation=45\n )\n\n# Add xticks on the middle of the group bars\nplt.xlabel(xlabel, fontsize=12)\nplt.xticks(xticks, xtickslabel)\n\n# Create legend & Show graphic\nplt.ylabel(ylabel, fontsize=12)\nplt.ylim(ylim)\nplt.yticks(yticks)\nplt.legend(loc=\"upper center\", bbox_to_anchor=(0.5, 1.15), frameon=False, ncol=5)\n\nplt.tick_params(axis=\"x\", which=\"both\", length=0)\nplt.tick_params(axis=\"y\", color=\"gray\")\n\n# Add y grid\nplt.gca().yaxis.grid(True)\nplt.gca().set_axisbelow(True)\n\n# Remove top and right borders\nplt.gca().spines[\"top\"].set_visible(False)\nplt.gca().spines[\"right\"].set_visible(False)\nplt.gca().spines[\"bottom\"].set_visible(False)\nplt.gca().spines[\"left\"].set_color(\"gray\")\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"bar_129.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 5.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_234", "content": { "Activity": [ "Reading", "Exercising", "Working", "Entertainment", "Others" ], "Percentage": [ 20, 15, 40, 15, 10 ] }, "visual_intent": "A donut chart about daily activities and percentages, titled Daily Activity Breakdown(size of the desired plot: width=10.0, height=10.0)", "path_to_gt_image": "images/pie_19.jpg", "original_category": "pie", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for new pie chart\ncategories = [\"Reading\", \"Exercising\", \"Working\", \"Entertainment\", \"Others\"]\npercentages = [20, 15, 40, 15, 10]\n\n\n# Extracted text variables\nchart_title = \"Daily Activity Breakdown\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\ncolors = plt.cm.Paired(np.linspace(0, 1, 5)) # Different colormap for visual diversity\nexplode = (0.05, 0.05, 0.05, 0.05, 0.05) # Smaller explosion for subtler separation\nautopct_format = \"%1.1f%%\"\nlegend_location = \"best\"\nlegend_bbox_to_anchor = (0, 0.8)\n# Plot\nfig, ax = plt.subplots(figsize=(10, 10)) # Adjust figure size for better visualization\npatches, texts, autotexts = ax.pie(\n percentages,\n colors=colors,\n autopct=autopct_format,\n startangle=90,\n wedgeprops=dict(edgecolor=\"black\"),\n explode=explode,\n pctdistance=0.75, # Adjust percentage labels position for better clarity\n)\n\n# Optional: creating a donut chart by adding a center circle\ndonut_circle = plt.Circle((0, 0), 0.60, fc=\"white\")\nfig.gca().add_artist(donut_circle)\n\n# Ensure pie is drawn as a circle\nax.axis(\"equal\")\n\nplt.title(chart_title, fontsize=22)\nplt.legend(\n patches, categories, loc=legend_location, bbox_to_anchor=legend_bbox_to_anchor\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Display the plot and save with an updated filename\nplt.tight_layout()\nplt.savefig(\"pie_19.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 10.0, "rounded_ratio": "1:1" }, "difficulty": "easy", "category": "tree_pie" }, { "id": "test_235", "content": { "Critic": [ "Critic A", "Critic B", "Critic C", "Critic D" ], "Impressionism_Popularity": [ 75, 70, 85, 80 ], "Impressionism_Std": [ 5, 4, 5, 4 ], "Cubism_Popularity": [ 60, 55, 70, 65 ], "Cubism_Std": [ 4, 3, 4, 3 ], "Surrealism_Popularity": [ 65, 60, 75, 70 ], "Surrealism_Std": [ 3, 4, 5, 4 ], "Abstract_Popularity": [ 70, 65, 80, 75 ], "Abstract_Std": [ 5, 4, 3, 5 ], "Pop Art_Popularity": [ 80, 75, 85, 80 ], "Pop Art_Std": [ 4, 3, 4, 3 ], "Modernism_Popularity": [ 90, 85, 95, 90 ], "Modernism_Std": [ 6, 5, 6, 5 ] }, "visual_intent": "A grouped bar chart with error bars displaying the popularity percentage of various art styles (Impressionism, Cubism, Surrealism, Abstract, Pop Art, Modernism) as rated by four critics, featuring custom bar widths and hatching for Impressionism.(size of the desired plot: width=12.0, height=7.0)", "path_to_gt_image": "images/errorbar_35.jpg", "original_category": "errorbar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data\ncritics = [\"Critic A\", \"Critic B\", \"Critic C\", \"Critic D\"]\nart_styles = [\n \"Impressionism\",\n \"Cubism\",\n \"Surrealism\",\n \"Abstract\",\n \"Pop Art\",\n \"Modernism\",\n]\npopularity_means = np.array(\n [\n [75, 60, 65, 70, 80, 90], # Critic A\n [70, 55, 60, 65, 75, 85], # Critic B\n [85, 70, 75, 80, 85, 95], # Critic C\n [80, 65, 70, 75, 80, 90], # Critic D\n ]\n)\npopularity_std = np.array(\n [\n [5, 4, 3, 5, 4, 6], # Critic A\n [4, 3, 4, 4, 3, 5], # Critic B\n [5, 4, 5, 3, 4, 6], # Critic C\n [4, 3, 4, 5, 3, 5], # Critic D\n ]\n)\nlegendtitle = \"Art Style\"\nxlabel = \"Critic\"\nylabel = \"Popularity (%)\"\nylim = [0, 100]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Set figure size to match the original image's dimensions\nfig, ax = plt.subplots(figsize=(12, 7))\n\n# New artistic colors inspired by famous art movements\ncolors = [\n \"#e69f00\", # Impressionism (Orange)\n \"#56b4e9\", # Cubism (Sky Blue)\n \"#009e73\", # Surrealism (Green)\n \"#f0e442\", # Abstract (Yellow)\n \"#0072b2\", # Pop Art (Blue)\n \"#d55e00\", # Modernism (Red)\n]\n\n# Bar width\nbar_width = 0.15\nbar_width_primary = 0.75\n\n# Set position of bar on X axis\nr = np.arange(len(critics))\n\n# Draw bars for 'Impressionism' art style\ni = art_styles.index(\"Impressionism\")\nax.bar(\n r + (i + 3) * bar_width,\n popularity_means[:, i],\n yerr=popularity_std[:, i],\n width=bar_width_primary,\n label=art_styles[i],\n capsize=5,\n color=colors[i],\n hatch=\"///\",\n edgecolor=\"black\",\n)\n\n# Draw bars for other art styles\nfor i in range(len(art_styles)):\n if art_styles[i] == \"Impressionism\":\n continue\n ax.bar(\n r + i * bar_width,\n popularity_means[:, i],\n yerr=popularity_std[:, i],\n width=bar_width,\n label=art_styles[i],\n capsize=5,\n color=colors[i],\n edgecolor=\"black\",\n )\n\n# Add xticks on the middle of the group bars\nax.set_xlabel(xlabel)\nax.set_xticks(r + bar_width * (len(art_styles) - 1) / 2)\nax.set_xticklabels(critics)\n\n# Create legend & Show graphic\nhandles, labels = ax.get_legend_handles_labels()\norder = [0, 1, 2, 4, 3, 5] # Reordering the legend\nax.legend(\n [handles[idx] for idx in order],\n [labels[idx] for idx in order],\n loc=\"upper center\",\n bbox_to_anchor=(0.5, 1.15),\n ncol=6,\n title=legendtitle,\n)\nax.set_ylabel(ylabel)\nax.set_ylim(ylim) # Adjust y-axis limit to accommodate error bars\n\n# Improve aesthetics\nax.grid(True, which='both', linestyle='--', linewidth=0.5)\nax.set_facecolor('#f7f7f7')\n\n# ===================\n# Part 4: Saving Output\n# ===================\nplt.tight_layout()\nplt.savefig(\"errorbar_35.pdf\", bbox_inches=\"tight\")\n", "width": 12.0, "height": 7.0, "rounded_ratio": "16:9" }, "difficulty": "hard", "category": "bar" }, { "id": "test_236", "content": { "Technology": [ "Artificial Intelligence", "Cybersecurity", "Blockchain", "IoT", "Cloud Computing", "Quantum Computing", "5G Technology", "AR/VR", "Robotics", "Edge Computing" ], "Previous Year": [ 65, 55, 40, 50, 70, 30, 75, 25, 35, 45 ], "Current Year": [ 85, 75, 60, 70, 90, 50, 95, 45, 55, 65 ] }, "visual_intent": "A radar chart comparing adoption rates of various technologies for the current year and the previous year(size of the desired plot: width=10.0, height=10.0)", "path_to_gt_image": "images/radar_33.jpg", "original_category": "radar", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(1)\n\n# Data for the radar chart\nlabels = np.array(\n [\n \"Artificial Intelligence\",\n \"Cybersecurity\",\n \"Blockchain\",\n \"IoT\",\n \"Cloud Computing\",\n \"Quantum Computing\",\n \"5G Technology\",\n \"AR/VR\",\n \"Robotics\",\n \"Edge Computing\",\n ]\n)\n\n# Adoption rates for the current year and the previous year\ncurrent_year_values = np.array([85, 75, 60, 70, 90, 50, 95, 45, 55, 65])\nprevious_year_values = np.array([65, 55, 40, 50, 70, 30, 75, 25, 35, 45])\n\nyticks = [20, 40, 60, 80, 100]\nytickslabel = [\"20\", \"40\", \"60\", \"80\", \"100\"]\nylim = [0, 100]\nlabels2 = [\"Previous Year\", \"Current Year\"]\nrgrids = [20, 40, 60, 80, 100]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Size of the figure\nfig, ax = plt.subplots(figsize=(10, 10), subplot_kw=dict(polar=True))\n\n# Number of variables\nnum_vars = len(labels)\n\n# Compute angle for each axis\nangles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()\n\n# The plot is circular, so we need to \"complete the loop\" and append the start to the end.\ncurrent_year_values = np.concatenate((current_year_values, [current_year_values[0]]))\nprevious_year_values = np.concatenate((previous_year_values, [previous_year_values[0]]))\nangles += angles[:1]\n\n# Draw one axe per variable and add labels\nplt.xticks(angles[:-1], [], color=\"black\", size=10, ha=\"right\")\nfor angle, label in zip(angles[:-1], labels): # Remove the appended first element\n if angle < np.pi / 2 or angle > 3 * np.pi / 2: # If the text is at the bottom or right side of the chart\n ax.text(\n angle,\n 110,\n label,\n horizontalalignment=\"left\",\n size=10,\n verticalalignment=\"bottom\",\n )\n else: # If the text is at the top or left side of the chart\n ax.text(\n angle,\n 110,\n label,\n horizontalalignment=\"right\",\n size=10,\n verticalalignment=\"bottom\",\n )\n\n# Draw ylabels\nax.set_rlabel_position(0)\nplt.yticks(\n yticks,\n ytickslabel,\n color=\"grey\",\n size=10,\n)\nplt.ylim(ylim)\n\n# Plot data\nax.plot(\n angles,\n previous_year_values,\n linewidth=1.5,\n linestyle=\"dotted\",\n label=labels2[0],\n color=\"teal\",\n marker='o',\n)\nax.fill(angles, previous_year_values, \"teal\", alpha=0.1)\n\nax.plot(\n angles,\n current_year_values,\n linewidth=1.5,\n linestyle=\"solid\",\n label=labels2[1],\n color=\"coral\",\n marker='s',\n)\nax.fill(angles, current_year_values, \"coral\", alpha=0.1)\n\n# Add legend\nplt.legend(loc=\"upper right\", bbox_to_anchor=(0.1, 0.1))\n\n# Adjust gridlines\nax.set_rgrids(\n rgrids,\n labels=rgrids,\n angle=0,\n color=\"black\",\n)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Adjust layout for better fit and save the plot\nplt.tight_layout()\nplt.savefig(\"radar_33.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 10.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "radar" }, { "id": "test_237", "content": { "City": [ "City A", "City B", "City C", "City D" ], "Jan": [ 30.0, 22.0, 15.0, 10.0 ], "Feb": [ 25.0, 19.0, 17.0, 12.0 ], "Mar": [ 28.0, 21.0, null, 14.0 ], "Apr": [ 33.0, 26.0, 20.0, 13.0 ], "May": [ 29.0, 23.0, 18.0, 16.0 ], "Jun": [ 31.0, 27.0, 19.0, 15.0 ] }, "visual_intent": "A heatmap about average monthly temperatures (°C) for different cities across months, titled Average Monthly Temperatures (°C)(size of the desired plot: width=10.0, height=8.0)", "path_to_gt_image": "images/heatmap_46.jpg", "original_category": "heatmap", "additional_info": { "gt_code": "\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Define the data for average monthly temperatures (°C)\ndata = np.array(\n [\n [30, 25, 28, 33, 29, 31],\n [22, 19, 21, 26, 23, 27],\n [15, 17, np.nan, 20, 18, 19], # Assumed another NaN value for padding\n [10, 12, 14, 13, 16, 15],\n ]\n)\n\ntitle = \"Average Monthly Temperatures (°C)\"\nxlabel = \"Month\"\nxticklabels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\"]\nyticklabels = [\"City A\", \"City B\", \"City C\", \"City D\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the heatmap with adjusted colorbar and new theme color\n# Create mask for NaN values to hatch them later\nmask = np.isnan(data)\n\n# Defining a new color palette\ncmap = plt.get_cmap(\"coolwarm\")\nnorm = plt.Normalize(vmin=np.nanmin(data), vmax=np.nanmax(data))\n\nfig, ax = plt.subplots(figsize=(10, 8))\ncax = ax.imshow(data, cmap=cmap, norm=norm)\ncbar = fig.colorbar(cax, ax=ax, extend=\"both\")\n\n# Add hatches for NaN values\nfor i, j in zip(*np.where(mask)):\n ax.add_patch(\n plt.Rectangle(\n (j - 0.5, i - 0.5), 1, 1, fill=False, hatch=\"//\", edgecolor=\"black\"\n )\n )\n\n# Adding titles and labels\nplt.title(title)\nplt.xlabel(xlabel)\n\n# Define the labels for x and y axis\nax.set_xticks(range(6))\nax.set_xticklabels(xticklabels, rotation=45)\nax.set_yticks(range(4))\nax.set_yticklabels(yticklabels, rotation=0)\n\n# Add annotations\nfor i in range(4):\n for j in range(6):\n if not np.isnan(data[i, j]):\n if data[i, j] > np.nanmean(data) * 1.5:\n ax.text(\n j, i, f\"{data[i, j]:.0f}\", ha=\"center\", va=\"center\", color=\"white\"\n )\n else:\n ax.text(\n j, i, f\"{data[i, j]:.0f}\", ha=\"center\", va=\"center\", color=\"black\"\n )\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"heatmap_46.pdf\", bbox_inches=\"tight\")\n", "width": 10.0, "height": 8.0, "rounded_ratio": "1:1" }, "difficulty": "hard", "category": "heatmap" }, { "id": "test_238", "content": { "xLLM_Steps": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ], "xLLM_Avg_Fidelity": [ 0.1, 0.125, 0.15, 0.1625, 0.175, 0.1875, 0.2, 0.2125, 0.225, 0.2375, 0.25, 0.25625, 0.2625, 0.26875, 0.275, 0.275, 0.275, 0.275, 0.275, 0.275 ], "Single_Pass_LLM_Steps": [ 0, 21 ], "Single_Pass_LLM_Avg_Fidelity": [ 0.1, 0.1 ] }, "visual_intent": "A line chart about # of Steps and Avg. Fidelity(size of the desired plot: width=4.0, height=3.0)", "path_to_gt_image": "images/line_29.jpg", "original_category": "line", "additional_info": { "gt_code": "# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\n# Data for plotting\nxllm_steps = range(1, 21)\nxLLM_fidelity = [\n 0.1,\n 0.125,\n 0.15,\n 0.1625,\n 0.175,\n 0.1875,\n 0.2,\n 0.2125,\n 0.225,\n 0.2375,\n 0.25,\n 0.25625,\n 0.2625,\n 0.26875,\n 0.275,\n 0.275,\n 0.275,\n 0.275,\n 0.275,\n 0.275,\n]\nsingle_steps = [0, 21]\nsingle_pass_fidelity = [0.1] * len(single_steps)\n\n# Axes Limits and Labels\nxlabel_value = \"# of Steps\"\nxlim_values = [0, 21]\nxticks_values = [0, 5, 10, 15, 20]\n\nylabel_value = \"Avg. Fidelity\"\nylim_values = [0, 100]\n\n# Labels\nlabel_1 = \"xLLM\"\nlabel_2 = \"Single-Pass LLM\"\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Plotting the lines\nplt.figure(figsize=(4, 3))\nplt.plot(xllm_steps, xLLM_fidelity, \"o-.\", label=label_1, color=\"#8280cd\")\nplt.plot(single_steps, single_pass_fidelity, \"-\", label=label_2, color=\"red\")\n\n# Adding legend\nplt.legend()\n\n# Labeling axes\nplt.xlabel(xlabel_value)\nplt.ylabel(ylabel_value)\nplt.xlim(xlim_values)\nplt.xticks(xticks_values)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Display the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"line_29.pdf\", bbox_inches=\"tight\")\n", "width": 4.0, "height": 3.0, "rounded_ratio": "3:2" }, "difficulty": "easy", "category": "line" }, { "id": "test_239", "content": { "Subjects": [ "Math", "Science", "English", "History" ], "Easy": [ 88, 85, 90, 78 ], "Medium": [ 75, 70, 80, 65 ], "Hard": [ 65, 60, 70, 55 ], "Very Hard": [ 55, 50, 60, 45 ] }, "visual_intent": "A grouped bar chart about subjects and performance scores across various difficulty levels, titled Student Performance by Subject and Difficulty Level(size of the desired plot: width=10.0, height=7.0)", "path_to_gt_image": "images/bar_226.jpg", "original_category": "bar", "additional_info": { "gt_code": "\n\n# ===================\n# Part 1: Importing Libraries\n# ===================\nimport matplotlib.pyplot as plt\n\n# ===================\n# Part 2: Data Preparation\n# ===================\nimport numpy as np\n\nnp.random.seed(0)\n\n# Data\nsubjects = [\"Math\", \"Science\", \"English\", \"History\"]\neasy = [88, 85, 90, 78]\nmedium = [75, 70, 80, 65]\nhard = [65, 60, 70, 55]\nvery_hard = [55, 50, 60, 45]\n\nlabels = [\"Easy\", \"Medium\", \"Hard\", \"Very Hard\"]\nxlabel = \"Subjects\"\nylabel = \"Performance Scores (%)\"\ntitle = \"Student Performance by Subject and Difficulty Level\"\nyaxhline = 90\nylim = [0, 100]\nyticks = np.arange(0, 110, 20)\n\n# Positions of bars on x-axis\nind = np.arange(len(subjects))\n\n# Text for annotations\ntexts = [\"-13%\", \"-15%\", \"-10%\", \"-15%\"]\n\n# ===================\n# Part 3: Plot Configuration and Rendering\n# ===================\n# Bar width\nbar_width = 0.2\n\n# Figure size\nplt.figure(figsize=(10, 7))\n\n# Plotting\nplt.bar(ind, easy, width=bar_width, label=labels[0], color=\"#7fc97f\")\nplt.bar(\n ind + bar_width,\n medium,\n width=bar_width,\n label=labels[1],\n color=\"#beaed4\",\n hatch=\"//\",\n)\nplt.bar(ind + bar_width * 2, hard, width=bar_width, label=labels[2], color=\"#fdc086\")\nplt.bar(\n ind + bar_width * 3,\n very_hard,\n width=bar_width,\n label=labels[3],\n color=\"#ffff99\",\n hatch=\"/\",\n)\n\n# Highlighting the most significant changes\ndistance = 0.05\nplt.annotate(\n \"\",\n xy=(ind[0] + bar_width, 75),\n xytext=(ind[0] + bar_width, 90),\n arrowprops=dict(facecolor=\"black\", shrink=0.02),\n)\nplt.text(ind[0] + bar_width + distance, 80, texts[0])\nplt.annotate(\n \"\",\n xy=(ind[1] + bar_width, 70),\n xytext=(ind[1] + bar_width, 90),\n arrowprops=dict(facecolor=\"black\", shrink=0.02),\n va=\"center\",\n)\nplt.text(ind[1] + bar_width + distance, 78, texts[1])\nplt.annotate(\n \"\",\n xy=(ind[2] + bar_width * 2, 70),\n xytext=(ind[2] + bar_width * 2, 90),\n arrowprops=dict(facecolor=\"black\", shrink=0.02),\n)\nplt.text(ind[2] + bar_width * 2 + distance, 80, texts[2])\nplt.annotate(\n \"\",\n xy=(ind[3] + bar_width * 3, 50),\n xytext=(ind[3] + bar_width * 3, 90),\n arrowprops=dict(facecolor=\"red\", shrink=0.02),\n ha=\"center\",\n)\nplt.text(ind[3] + bar_width * 3 + distance, 68, texts[3])\n\n# Adding horizontal line\nplt.axhline(y=yaxhline, color=\"blue\", linestyle=\"--\", linewidth=2)\n\n# X-axis labels\nplt.xticks(ind + bar_width * 1.5, subjects)\n\n# Y-axis labels\nplt.ylim(ylim)\nplt.yticks(yticks)\n\n# Legend\nplt.legend(loc=\"upper center\", bbox_to_anchor=(0.5, 1.15), ncol=2)\n\n# Grid lines\nplt.grid(axis=\"y\")\n\n# Labels and Title\nplt.xlabel(xlabel)\nplt.ylabel(ylabel)\nplt.title(title)\n\n# ===================\n# Part 4: Saving Output\n# ===================\n# Displaying the plot with tight layout to minimize white space\nplt.tight_layout()\nplt.savefig(\"bar_226.pdf\", bbox_inches=\"tight\")\n\n", "width": 10.0, "height": 7.0, "rounded_ratio": "3:2" }, "difficulty": "hard", "category": "bar" } ]