Create Echart plots in a single simple function call, with internal data wrangling via polars
Project description
QuickEcharts
QuickEcharts is in the early stages. The idea is to design it similar to my R package AutoPlots. The goal is to make plotting echarts quick, easy, and to allow polars to do the data wrangling under the hood, saving the end user valuable time.
Installation
pip install git+https://github.com/AdrianAntico/QuickEcharts.git#egg=quickecharts
Code Examples
Histogram
Click for code example
# Environment
import pkg_resources
import polars as pl
from QuickEcharts import Charts
from pyecharts.globals import CurrentConfig, NotebookType
CurrentConfig.NOTEBOOK_TYPE = 'jupyter_lab'
# Pull Data from Package
FilePath = pkg_resources.resource_filename('QuickEcharts', 'datasets/FakeBevData.csv')
data = pl.read_csv(FilePath)
# Create Histogram Plot in Jupyter Lab
p1 = Charts.Histogram(
dt = data,
SampleSize = 100000,
YVar = "Daily Liters",
GroupVar = None,
FacetRows = 1,
FacetCols = 1,
FacetLevels = None,
YVarTrans = "sqrt",
RenderHTML = False,
Theme = 'wonderland',
Title = 'Histogram',
TitleColor = "#fff",
TitleFontSize = 20,
SubTitle = None,
SubTitleColor = "#fff",
SubTitleFontSize = 12,
XAxisTitle = 'Daily Liters Buckets',
XAxisNameLocation = 'middle',
XAxisNameGap = 42,
NumberBins = 20,
CategoryGap = "10%",
Legend = None,
LegendPosRight = '0%',
LegendPosTop = '5%',
ToolBox = True,
Brush = True,
DataZoom = True,
VerticalLine = None,
VerticalLineName = 'Line Name',
HorizonalLine = 500,
HorizonalLineName = 'Yaxis Value')
# Needed to display
p1.load_javascript()
p1.render_notebook()
Jupyter Lab View
# Environment
import pkg_resources
import polars as pl
from QuickEcharts import Charts
from pyecharts.globals import CurrentConfig, NotebookType
CurrentConfig.NOTEBOOK_TYPE = 'jupyter_lab'
# Pull Data from Package
FilePath = pkg_resources.resource_filename('QuickEcharts', 'datasets/FakeBevData.csv')
data = pl.read_csv(FilePath)
# Create Histogram Plot in Jupyter Lab
p1 = Charts.Histogram(
Notebook = 'jupyter_lab',
dt = data,
SampleSize = 100000,
YVar = "Daily Liters",
GroupVar = 'Brand',
FacetRows = 2,
FacetCols = 2,
FacetLevels = None,
YVarTrans = "sqrt",
Title = 'Histogram',
TitleColor = "#fff",
TitleFontSize = 20,
SubTitle = None,
SubTitleColor = "#fff",
SubTitleFontSize = 12,
XAxisTitle = 'Daily Liters Buckets',
XAxisNameLocation = 'middle',
XAxisNameGap = 42,
Theme = 'wonderland',
NumberBins = 20,
CategoryGap = "10%",
Legend = None,
LegendPosRight = '0%',
LegendPosTop = '5%',
ToolBox = True,
Brush = True,
DataZoom = True,
VerticalLine = None,
VerticalLineName = 'Line Name',
HorizonalLine = 500,
HorizonalLineName = 'Yaxis Value')
# Needed to display
p1.load_javascript()
p1.render_notebook()
Jupyter Lab View
Density
Click for code example
# Environment
import pkg_resources
import polars as pl
from QuickEcharts import Charts
from pyecharts.globals import CurrentConfig, NotebookType
CurrentConfig.NOTEBOOK_TYPE = 'jupyter_lab'
# Pull Data from Package
FilePath = "C:/Users/Bizon/Documents/GitHub/rappwd/FakeBevData.csv"
data = pl.read_csv(FilePath)
# Create Histogram Plot in Jupyter Lab
p1 = Charts.Density(
dt = data,
SampleSize = 100000,
YVar = "Daily Liters",
GroupVar = None,
FacetRows = 2,
FacetCols = 2,
FacetLevels = None,
YVarTrans = "sqrt",
LineWidth = 1,
FillOpacity = 0.75,
RenderHTML = False,
Title = 'Histogram Plot',
TitleColor = "#fff",
TitleFontSize = 20,
SubTitle = None,
SubTitleColor = "#fff",
SubTitleFontSize = 12,
XAxisTitle = 'Daily Liters Buckets',
XAxisNameLocation = 'middle',
XAxisNameGap = 42,
Theme = 'macarons',
Legend = 'top',
LegendPosRight = '0%',
LegendPosTop = '15%',
ToolBox = True,
Brush = True,
DataZoom = True,
VerticalLine = 35,
VerticalLineName = "Xaxis Value",
HorizontalLine = 45000,
HorizontalLineName = 'Yaxis Value')
# Needed to display
p1.load_javascript()
p1.render_notebook()
Jupyter Lab View
# Environment
import pkg_resources
import polars as pl
from QuickEcharts import Charts
from pyecharts.globals import CurrentConfig, NotebookType
CurrentConfig.NOTEBOOK_TYPE = 'jupyter_lab'
# Pull Data from Package
FilePath = "C:/Users/Bizon/Documents/GitHub/rappwd/FakeBevData.csv"
data = pl.read_csv(FilePath)
# Create Histogram Plot in Jupyter Lab
p1 = Charts.Density(
dt = data,
SampleSize = 100000,
YVar = "Daily Liters",
GroupVar = 'Brand',
FacetRows = 2,
FacetCols = 2,
FacetLevels = None,
YVarTrans = "sqrt",
LineWidth = 1,
FillOpacity = 0.75,
RenderHTML = False,
Title = 'Histogram Plot',
TitleColor = "#fff",
TitleFontSize = 20,
SubTitle = None,
SubTitleColor = "#fff",
SubTitleFontSize = 12,
XAxisTitle = 'Daily Liters Buckets',
XAxisNameLocation = 'middle',
XAxisNameGap = 42,
Theme = 'macarons',
Legend = 'top',
LegendPosRight = '0%',
LegendPosTop = '15%',
ToolBox = True,
Brush = True,
DataZoom = True,
VerticalLine = 35,
VerticalLineName = "Xaxis Value",
HorizontalLine = 45000,
HorizontalLineName = 'Yaxis Value')
# Needed to display
p1.load_javascript()
p1.render_notebook()
Jupyter Lab View
Box Plot
Click for code example
# Environment
import pkg_resources
import polars as pl
from QuickEcharts import Charts
from pyecharts.globals import CurrentConfig, NotebookType
CurrentConfig.NOTEBOOK_TYPE = 'jupyter_lab'
# Pull Data from Package
FilePath = "C:/Users/Bizon/Documents/GitHub/rappwd/FakeBevData.csv"
data = pl.read_csv(FilePath)
# Create BoxPlot in Jupyter Lab
p1 = Charts.BoxPlot(
dt = data,
SampleSize = 100000,
YVar = 'Daily Liters',
GroupVar = 'Brand',
YVarTrans = "logmin",
RenderHTML = False,
Title = 'Box Plot',
TitleColor = "#fff",
TitleFontSize = 20,
SubTitle = None,
SubTitleColor = "#fff",
SubTitleFontSize = 12,
AxisPointerType = 'cross',
YAxisTitle = None,
YAxisNameLocation = 'middle',
YAxisNameGap = 42,
XAxisTitle = None,
XAxisNameLocation = 'middle',
XAxisNameGap = 42,
Theme = 'wonderland',
Legend = None,
LegendPosRight = '0%',
LegendPosTop = '5%',
ToolBox = True,
Brush = True,
DataZoom = True,
HorizontalLine = None,
HorizontalLineName = 'Line Name')
# Needed to display
p1.load_javascript()
p1.render_notebook()
Jupyter Lab View
Pie
Click for code example
# Environment
import pkg_resources
import polars as pl
from QuickEcharts import Charts
from pyecharts.globals import CurrentConfig, NotebookType
CurrentConfig.NOTEBOOK_TYPE = 'jupyter_lab'
# Pull Data from Package
FilePath = "C:/Users/Bizon/Documents/GitHub/rappwd/FakeBevData.csv"
data = pl.read_csv(FilePath)
# Create Pie Chart in Jupyter Lab
p1 = Charts.Pie(
dt = data,
PreAgg = False,
YVar = 'Daily Liters',
GroupVar = 'Brand',
AggMethod = 'count',
YVarTrans = "Identity",
RenderHTML = False,
Title = 'Pie Chart',
TitleColor = "#fff",
TitleFontSize = 20,
SubTitle = None,
SubTitleColor = "#fff",
SubTitleFontSize = 12,
Theme = 'wonderland',
Legend = None,
LegendPosRight = '0%',
LegendPosTop = '5%')
# Needed to display
p1.load_javascript()
p1.render_notebook()
Jupyter Lab View
Rosetype
Click for code example
# Environment
import pkg_resources
import polars as pl
from QuickEcharts import Charts
from pyecharts.globals import CurrentConfig, NotebookType
CurrentConfig.NOTEBOOK_TYPE = 'jupyter_lab'
# Pull Data from Package
FilePath = "C:/Users/Bizon/Documents/GitHub/rappwd/FakeBevData.csv"
data = pl.read_csv(FilePath)
# Create RoseType Chart Plot in Jupyter Lab
p1 = Charts.Rosetype(
dt = data,
PreAgg = False,
YVar = 'Daily Liters',
GroupVar = 'Brand',
AggMethod = 'count',
YVarTrans = "Identity",
RenderHTML = False,
Type = "area",
Radius = "55%",
Title = 'Rosetype Chart',
TitleColor = "#fff",
TitleFontSize = 20,
SubTitle = None,
SubTitleColor = "#fff",
SubTitleFontSize = 12,
Theme = 'wonderland',
Legend = None,
LegendPosRight = '0%',
LegendPosTop = '5%')
# Needed to display
p1.load_javascript()
p1.render_notebook()
Jupyter Lab View
Donut
Click for code example
# Environment
import pkg_resources
import polars as pl
from QuickEcharts import Charts
from pyecharts.globals import CurrentConfig, NotebookType
CurrentConfig.NOTEBOOK_TYPE = 'jupyter_lab'
# Pull Data from Package
FilePath = "C:/Users/Bizon/Documents/GitHub/rappwd/FakeBevData.csv"
data = pl.read_csv(FilePath)
# Create RoseType Chart Plot in Jupyter Lab
p1 = Charts.Donut(
dt = data,
PreAgg = False,
YVar = 'Daily Liters',
GroupVar = 'Brand',
AggMethod = 'count',
YVarTrans = "Identity",
RenderHTML = False,
Title = 'Donut Chart',
TitleColor = "#fff",
TitleFontSize = 20,
SubTitle = None,
SubTitleColor = "#fff",
SubTitleFontSize = 12,
Theme = 'wonderland',
Legend = None,
LegendPosRight = '0%',
LegendPosTop = '5%')
# Needed to display
p1.load_javascript()
p1.render_notebook()
Jupyter Lab View
Word Cloud
Click for code example
# Environment
import pkg_resources
import polars as pl
from QuickEcharts import Charts
from pyecharts.globals import CurrentConfig, NotebookType
CurrentConfig.NOTEBOOK_TYPE = 'jupyter_lab'
import polars as pl
FilePath = "C:/Users/Bizon/Documents/GitHub/rappwd/FakeBevData.csv"
data = pl.read_csv(FilePath)
p1 = Charts.WordCloud(
dt = data,
SampleSize = 100000,
YVar = 'Brand',
RenderHTML = False,
SymbolType = 'diamond',
Title = 'Word Cloud',
TitleColor = "#fff",
TitleFontSize = 20,
SubTitle = None,
SubTitleColor = "#fff",
SubTitleFontSize = 12,
Theme = 'wonderland')
p1.load_javascript()
p1.render_notebook()
Jupyter Lab View
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
QuickEcharts-0.1.0.tar.gz
(48.8 kB
view hashes)
Built Distribution
Close
Hashes for QuickEcharts-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1e97bb8feda35028cd7b418057ff26e25ed86da38a255af063a61198ca0408d |
|
MD5 | 4d9bbca645cd65f4051681930a8dab94 |
|
BLAKE2b-256 | 4e45cda51dad78ef76090a3d570972394d3a352e16eb030fb04b999b0228a4f3 |