Python ❤️ ECharts = pyecharts - comprehensive data visualization toolkit built on Apache ECharts
—
Core 2D chart types that form the foundation of pyecharts' visualization capabilities. These charts cover the most common data visualization needs including categorical data, time series, distributions, relationships, and hierarchical data.
Creates bar charts with rectangular bars representing categorical data. Supports horizontal and vertical orientations, stacking, and extensive styling options.
class Bar:
def __init__(self, init_opts=None, render_opts=None):
"""
Initialize a bar chart.
Args:
init_opts (InitOpts, optional): Chart initialization options
render_opts (RenderOpts, optional): Rendering options
"""
def add_xaxis(self, xaxis_data):
"""
Add x-axis data (categories).
Args:
xaxis_data (list): List of category names
Returns:
Bar: Self for method chaining
"""
def add_yaxis(self, series_name, y_axis, **kwargs):
"""
Add y-axis data series.
Args:
series_name (str): Name of the data series
y_axis (list): List of numeric values or BarItem objects
xaxis_index (int, optional): Index of x-axis to use
yaxis_index (int, optional): Index of y-axis to use
stack (str, optional): Stack group name for stacked bars
bar_width (str|int, optional): Bar width
bar_max_width (str|int, optional): Maximum bar width
bar_min_width (str|int, optional): Minimum bar width
category_gap (str, optional): Gap between categories
gap (str, optional): Gap between bars in same category
Returns:
Bar: Self for method chaining
"""
def reversal_axis(self):
"""
Swap x and y axes to create horizontal bar chart.
Returns:
Bar: Self for method chaining
"""Usage Example:
from pyecharts.charts import Bar
from pyecharts import options as opts
bar = (
Bar(init_opts=opts.InitOpts(width="800px", height="600px"))
.add_xaxis(["A", "B", "C", "D", "E"])
.add_yaxis("Series 1", [10, 20, 30, 40, 50])
.add_yaxis("Series 2", [15, 25, 35, 45, 55])
.set_global_opts(
title_opts=opts.TitleOpts(title="Bar Chart Example"),
legend_opts=opts.LegendOpts(is_show=True)
)
)Creates line charts connecting data points with lines. Ideal for time series data, trends, and continuous data visualization.
class Line:
def __init__(self, init_opts=None, render_opts=None):
"""
Initialize a line chart.
Args:
init_opts (InitOpts, optional): Chart initialization options
render_opts (RenderOpts, optional): Rendering options
"""
def add_xaxis(self, xaxis_data):
"""
Add x-axis data.
Args:
xaxis_data (list): List of x-axis values
Returns:
Line: Self for method chaining
"""
def add_yaxis(self, series_name, y_axis, **kwargs):
"""
Add y-axis data series.
Args:
series_name (str): Name of the data series
y_axis (list): List of numeric values or LineItem objects
is_smooth (bool, optional): Smooth line curves
is_connect_nones (bool, optional): Connect null values
is_step (bool|str, optional): Step line style
is_symbol_show (bool, optional): Show data point symbols
stack (str, optional): Stack group name
area_style_opts (AreaStyleOpts, optional): Area fill styling
Returns:
Line: Self for method chaining
"""Creates pie and donut charts for showing proportional data and part-to-whole relationships.
class Pie:
def __init__(self, init_opts=None, render_opts=None):
"""
Initialize a pie chart.
Args:
init_opts (InitOpts, optional): Chart initialization options
render_opts (RenderOpts, optional): Rendering options
"""
def add(self, series_name, data_pair, **kwargs):
"""
Add pie chart data.
Args:
series_name (str): Name of the data series
data_pair (list): List of [name, value] pairs or PieItem objects
radius (list, optional): Inner and outer radius ["20%", "80%"]
center (list, optional): Center position ["50%", "50%"]
rosetype (str, optional): Rose chart type ("radius" or "area")
is_clockwise (bool, optional): Clockwise order
start_angle (int, optional): Start angle in degrees
Returns:
Pie: Self for method chaining
"""Creates scatter plots for showing relationships between two numeric variables.
class Scatter:
def __init__(self, init_opts=None, render_opts=None):
"""
Initialize a scatter chart.
Args:
init_opts (InitOpts, optional): Chart initialization options
render_opts (RenderOpts, optional): Rendering options
"""
def add_xaxis(self, xaxis_data):
"""
Add x-axis data.
Args:
xaxis_data (list): List of x-axis values
Returns:
Scatter: Self for method chaining
"""
def add_yaxis(self, series_name, y_axis, **kwargs):
"""
Add y-axis data series.
Args:
series_name (str): Name of the data series
y_axis (list): List of y values or [x, y] pairs or ScatterItem objects
symbol (str, optional): Symbol type
symbol_size (int|list, optional): Symbol size
Returns:
Scatter: Self for method chaining
"""Enhanced scatter plots with animation effects and particle trails.
class EffectScatter:
def __init__(self, init_opts=None, render_opts=None):
"""
Initialize an effect scatter chart.
Args:
init_opts (InitOpts, optional): Chart initialization options
render_opts (RenderOpts, optional): Rendering options
"""
def add_xaxis(self, xaxis_data):
"""
Add x-axis data.
Args:
xaxis_data (list): List of x-axis values
Returns:
EffectScatter: Self for method chaining
"""
def add_yaxis(self, series_name, y_axis, **kwargs):
"""
Add y-axis data series with effects.
Args:
series_name (str): Name of the data series
y_axis (list): List of y values or EffectScatterItem objects
effect_opts (EffectOpts, optional): Animation effect options
Returns:
EffectScatter: Self for method chaining
"""Creates heatmaps for visualizing data through colors, useful for correlation matrices and 2D data density.
class HeatMap:
def __init__(self, init_opts=None, render_opts=None):
"""
Initialize a heatmap.
Args:
init_opts (InitOpts, optional): Chart initialization options
render_opts (RenderOpts, optional): Rendering options
"""
def add_xaxis(self, xaxis_data):
"""
Add x-axis categories.
Args:
xaxis_data (list): List of x-axis category names
Returns:
HeatMap: Self for method chaining
"""
def add_yaxis(self, series_name, yaxis_data, value, **kwargs):
"""
Add heatmap data.
Args:
series_name (str): Name of the data series
yaxis_data (list): List of y-axis category names
value (list): List of [x_index, y_index, value] triplets
Returns:
HeatMap: Self for method chaining
"""class Boxplot:
"""Box and whisker plots for statistical data visualization."""
def __init__(self, init_opts=None, render_opts=None): ...
def add_xaxis(self, xaxis_data): ...
def add_yaxis(self, series_name, y_axis, **kwargs): ...
class Funnel:
"""Funnel charts for process flow visualization."""
def __init__(self, init_opts=None, render_opts=None): ...
def add(self, series_name, data_pair, **kwargs): ...
class Gauge:
"""Gauge charts for dashboard-style metrics."""
def __init__(self, init_opts=None, render_opts=None): ...
def add(self, series_name, data_pair, **kwargs): ...
class Graph:
"""Network diagrams and relationship visualizations."""
def __init__(self, init_opts=None, render_opts=None): ...
def add(self, series_name, nodes, links, **kwargs): ...
class Kline:
"""Candlestick charts for financial data."""
def __init__(self, init_opts=None, render_opts=None): ...
def add_xaxis(self, xaxis_data): ...
def add_yaxis(self, series_name, y_axis, **kwargs): ...
class Liquid:
"""Liquid fill gauge charts."""
def __init__(self, init_opts=None, render_opts=None): ...
def add(self, series_name, data, **kwargs): ...
class Parallel:
"""Parallel coordinate plots for multivariate data."""
def __init__(self, init_opts=None, render_opts=None): ...
def add_schema(self, schema): ...
def add(self, series_name, data, **kwargs): ...
class PictorialBar:
"""Pictorial bar charts with custom symbols."""
def __init__(self, init_opts=None, render_opts=None): ...
def add_xaxis(self, xaxis_data): ...
def add_yaxis(self, series_name, y_axis, **kwargs): ...
class Polar:
"""Polar coordinate system charts."""
def __init__(self, init_opts=None, render_opts=None): ...
def add_schema(self, schema, **kwargs): ...
def add(self, series_name, data, **kwargs): ...
class Radar:
"""Radar/spider charts for multivariate data."""
def __init__(self, init_opts=None, render_opts=None): ...
def add_schema(self, schema, **kwargs): ...
def add(self, series_name, data, **kwargs): ...
class Sankey:
"""Sankey diagrams for flow visualization."""
def __init__(self, init_opts=None, render_opts=None): ...
def add(self, series_name, nodes, links, **kwargs): ...
class Sunburst:
"""Sunburst charts for hierarchical data."""
def __init__(self, init_opts=None, render_opts=None): ...
def add(self, series_name, data_pair, **kwargs): ...
class ThemeRiver:
"""Theme river charts for temporal categorical data."""
def __init__(self, init_opts=None, render_opts=None): ...
def add(self, series_name, data, **kwargs): ...
class Tree:
"""Tree diagrams for hierarchical structures."""
def __init__(self, init_opts=None, render_opts=None): ...
def add(self, series_name, data, **kwargs): ...
class TreeMap:
"""Treemap charts for hierarchical data with area encoding."""
def __init__(self, init_opts=None, render_opts=None): ...
def add(self, series_name, data, **kwargs): ...
class WordCloud:
"""Word cloud visualizations."""
def __init__(self, init_opts=None, render_opts=None): ...
def add(self, series_name, data_pair, **kwargs): ...
class Custom:
"""Custom chart definitions for advanced use cases."""
def __init__(self, init_opts=None, render_opts=None): ...
def add(self, series_name, data, **kwargs): ...
class Calendar:
"""Calendar heatmaps for temporal data."""
def __init__(self, init_opts=None, render_opts=None): ...
def add(self, series_name, data, **kwargs): ...All chart classes inherit common methods from the base Chart class:
class ChartMethods:
def set_global_opts(self, **kwargs):
"""
Set global chart options.
Args:
title_opts (TitleOpts, optional): Title configuration
legend_opts (LegendOpts, optional): Legend configuration
tooltip_opts (TooltipOpts, optional): Tooltip configuration
toolbox_opts (ToolboxOpts, optional): Toolbox configuration
xaxis_opts (AxisOpts, optional): X-axis configuration
yaxis_opts (AxisOpts, optional): Y-axis configuration
visualmap_opts (VisualMapOpts, optional): Visual mapping
datazoom_opts (DataZoomOpts, optional): Data zoom controls
Returns:
Chart: Self for method chaining
"""
def set_series_opts(self, **kwargs):
"""
Set series-specific options.
Args:
label_opts (LabelOpts, optional): Data label options
itemstyle_opts (ItemStyleOpts, optional): Item styling
linestyle_opts (LineStyleOpts, optional): Line styling
areastyle_opts (AreaStyleOpts, optional): Area styling
markpoint_opts (MarkPointOpts, optional): Mark points
markline_opts (MarkLineOpts, optional): Mark lines
Returns:
Chart: Self for method chaining
"""
def render(self, path="render.html"):
"""
Render chart to HTML file.
Args:
path (str): Output file path
Returns:
str: Generated HTML content
"""
def render_notebook(self):
"""
Render chart for Jupyter notebook display.
Returns:
HTML: Jupyter HTML display object
"""class BarItem:
def __init__(self, name=None, value=None, **kwargs): ...
class LineItem:
def __init__(self, name=None, value=None, **kwargs): ...
class PieItem:
def __init__(self, name=None, value=None, **kwargs): ...
class ScatterItem:
def __init__(self, name=None, value=None, **kwargs): ...
class EffectScatterItem:
def __init__(self, name=None, value=None, **kwargs): ...
class FunnelItem:
def __init__(self, name=None, value=None, **kwargs): ...
class RadarItem:
def __init__(self, name=None, value=None, **kwargs): ...
class TreeItem:
def __init__(self, name=None, value=None, children=None, **kwargs): ...
class SunburstItem:
def __init__(self, name=None, value=None, children=None, **kwargs): ...
class ThemeRiverItem:
def __init__(self, date=None, value=None, name=None): ...
class CandleStickItem:
def __init__(self, name=None, value=None): ...
class BoxplotItem:
def __init__(self, name=None, value=None): ...Install with Tessl CLI
npx tessl i tessl/pypi-pyecharts