### Generate Pie Charts with Python Source: https://context7.com/timothytickle/quickplots/llms.txt Generates pie charts with automatic data normalization. Requires the pieChart module. ```python import json from pieChart import PieChart ``` -------------------------------- ### Implement Custom Chart Extending QuickPlot Base Class Source: https://context7.com/timothytickle/quickplots/llms.txt This snippet shows how to create a custom chart type by extending the `QuickPlot` base class. Implement the `func_plot` method for custom plotting logic. It handles JSON data loading and command-line argument parsing. ```python import abc import json from quickPlot import QuickPlot import quickPlot as qp class CustomChart(QuickPlot): def __init__(self): QuickPlot.__init__(self) def func_plot(self, json_data, str_output_file): """ Implement custom plotting logic. json_data: dict with required 'data' key plus optional: - title (default: "Histogram") - x_axis (default: "X Axis") - y_axis (default: "Count") - color (default: "cyan") str_output_file: output file path (supports PDF, PNG, etc.) """ # Access common JSON keys using constants title = json_data.get(qp.c_STR_TITLE, qp.c_STR_TITLE_DEFAULT) x_label = json_data.get(qp.c_STR_X_AXIS, qp.c_STR_X_AXIS_DEFAULT) y_label = json_data.get(qp.c_STR_Y_AXIS, qp.c_STR_Y_AXIS_DEFAULT) for data_series in json_data[qp.c_STR_DATA]: values = data_series[qp.c_STR_DATA] label = data_series.get(qp.c_STR_DATA_LABEL, None) color = data_series.get(qp.c_C_PLOT_COLOR, qp.c_C_PLOT_COLOR_DEFAULT) # Custom plotting implementation here return True # Use from command line or programmatically if __name__ == "__main__": CustomChart().func_make_figure() # Or use func_plot_from_paths for file-based input with open("data.json", "r") as f: chart = CustomChart() chart.func_plot_from_paths(f, "output.pdf") ``` -------------------------------- ### Create Pie Chart from JSON Data Source: https://context7.com/timothytickle/quickplots/llms.txt Use this snippet to generate a pie chart. Provide data in JSON format and specify the output file path. Supports programmatic and command-line execution. ```python json_data = { "title": "Market Share Distribution", "data": [ { "data": [35, 25, 20, 15, 5], "label": ["Company A", "Company B", "Company C", "Company D", "Others"], "color": ["#2ecc71", "#3498db", "#e74c3c", "#f39c12", "#9b59b6"] } ] } # Programmatic usage pie = PieChart() pie.func_plot(json_data, "market_share.pdf") # Command line usage: # python pieChart.py input.json output.pdf ``` -------------------------------- ### Generate Histograms with Python Source: https://context7.com/timothytickle/quickplots/llms.txt Generates histograms from raw data arrays with support for multiple overlapping series. Configurable bin counts allow for detailed distribution analysis. ```python import json from histogram import Histogram # JSON input format for overlapping histograms json_data = { "title": "Score Distribution", "x_axis": "Score", "y_axis": "Frequency", "bins": 20, # Default is 40 "data": [ { "label": "Class A", "color": "blue", "data": [72, 85, 91, 78, 82, 88, 95, 71, 83, 90, 87, 76, 81, 89, 94] }, { "label": "Class B", "color": "red", "data": [65, 70, 75, 68, 72, 77, 80, 62, 69, 74, 78, 66, 71, 73, 79] } ] } # Programmatic usage hist = Histogram() hist.func_plot(json_data, "score_distribution.pdf") # Command line usage: # python histogram.py input.json output.pdf ``` -------------------------------- ### Generate Scatter Plots with Python Source: https://context7.com/timothytickle/quickplots/llms.txt Creates scatter plots requiring exactly two data series for x and y coordinates. The first series maps to the x-axis and the second to the y-axis. ```python import json from scatter import ScatterPlot # JSON input format for scatter plot (requires exactly 2 data series) json_data = { "title": "Height vs Weight Correlation", "color": "orange", "data": [ { "label": "Height (inches)", "data": [62, 65, 68, 70, 72, 74, 67, 69, 71, 66] }, { "label": "Weight (lbs)", "data": [130, 145, 160, 175, 185, 195, 155, 165, 180, 150] } ] } # Programmatic usage scatter = ScatterPlot() scatter.func_plot(json_data, "height_weight.pdf") # Command line usage: # python scatter.py input.json output.pdf ``` -------------------------------- ### Generate Bar Charts with Python Source: https://context7.com/timothytickle/quickplots/llms.txt Creates grouped bar charts with support for error bars and custom sorting. Requires a JSON object defining the data series and axis labels. ```python import json from barChart import BarChart # JSON input format for a grouped bar chart with error bars json_data = { "title": "Sales Comparison", "x_axis": "Quarter", "y_axis": "Revenue ($K)", "sort": "lexical", # Options: "lexical", "numeric", or omit "y_limit": 15, # Optional: set max y-axis value "data": [ { "data": [5, 8, 12, 10], "error": [0.5, 0.8, 1.2, 0.9], "color": "blue", "label": "Product A", "x_ticks": ["Q1", "Q2", "Q3", "Q4"] }, { "data": [3, 6, 9, 11], "error": [0.3, 0.5, 0.7, 0.6], "color": "green", "label": "Product B" } ] } # Programmatic usage chart = BarChart() chart.func_plot(json_data, "sales_comparison.pdf") # Command line usage: # python barChart.py input.json output.pdf ``` -------------------------------- ### Generate Box Plots with Python Source: https://context7.com/timothytickle/quickplots/llms.txt Creates grouped box plots for comparing distributions across multiple categories. Input data is provided as a list of lists. ```python import json from boxPlot import BoxPlot # JSON input format for box plots json_data = { "title": "Performance by Category", "x_axis": "Category", "y_axis": "Score", "label": ["High", "Medium", "Low"], "data": [ [0.9, 0.85, 0.88, 0.92, 0.87, 0.91], [0.6, 0.55, 0.58, 0.62, 0.57, 0.61], [0.2, 0.15, 0.18, 0.22, 0.17, 0.21] ] } # Programmatic usage box = BoxPlot() box.func_plot(json_data, "performance_boxplot.pdf") # Command line usage: # python boxPlot.py input.json output.pdf ``` -------------------------------- ### Create Venn Diagram from JSON Data Source: https://context7.com/timothytickle/quickplots/llms.txt Use this snippet to generate a two-set Venn diagram visualizing the overlap between data sets. The library computes intersections automatically. Supports programmatic and command-line execution. ```python import json from vennDiagram import VennDiagram # JSON input format for 2-set Venn diagram json_data = { "title": "Feature Overlap Analysis", "data": [ { "label": "Dataset A", "color": "blue", "data": ["feature1", "feature2", "feature3", "feature4", "feature5"] }, { "label": "Dataset B", "color": "red", "data": ["feature3", "feature4", "feature5", "feature6", "feature7"] } ] } # Programmatic usage venn = VennDiagram() venn.func_plot(json_data, "feature_overlap.pdf") # Command line usage: # python vennDiagram.py input.json output.pdf ``` -------------------------------- ### Generate ROC Curve from JSON Data Source: https://context7.com/timothytickle/quickplots/llms.txt This snippet demonstrates how to create an ROC curve for evaluating binary classifier performance. Data points should be in the format [actual, predicted, threshold_value]. The AUC is automatically calculated and displayed. Supports programmatic and command-line execution. ```python import json from roc import PositiveROC # JSON input format for ROC curves # Each data point: [actual_class (bool), predicted_class (bool), threshold_value] json_data = { "title": "Classifier Performance Comparison", "data": [ { "label": "Model A", "color": "green", "data": [ [True, True, 1], [True, True, 1], [True, True, 2], [True, False, 2], [True, True, 3], [True, False, 3], [False, False, 4], [False, False, 4], [False, False, 5], [False, True, 5] ] }, { "label": "Model B", "color": "red", "data": [ [True, False, 1], [True, True, 1], [True, False, 2], [True, True, 2], [False, True, 3], [False, False, 3], [False, True, 4], [False, False, 4], [True, True, 5], [False, False, 5] ] } ] } # Programmatic usage roc = PositiveROC() roc.func_plot(json_data, "roc_comparison.pdf") # Command line usage: # python roc.py input.json output.pdf ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.