Skip to main content

Cmotions Dataviz

cmo_dataviz is a Python library created by The Analytics Lab, which is powered by Cmotions. This library makes it easy for us to create graphs in our prefered styling and using Cmotions colors by default. Nothing fancy, but very useful for our consultants. Mostly since this package is used in other packages, which makes our workflow simpler and more efficient.

Since we love to share what we do, why not also do that with our packages, that is why we've decided to make (almost) all of our packages open source, this way we hope to give back to the community that brings us so much. Enjoy!

Installation

Install cmo_dataviz using pip

pip install cmo-dataviz

If you want to be able to use the tutorial notebook or the code below, you also need to install pydataset using pip

pip install pydataset

Usage

from pydataset import data
import cmo_dataviz as dv
import matplotlib.pyplot as plt
import pandas as pd

# import your own stylesheet if relevant
dv.import_style('mydocuments/mystylesheet.mplstyle')

df = data("iris")
df_summary = df.groupby('Species').agg({'Sepal.Length': 'mean','Sepal.Width': 'sum', 'Petal.Length': 'mean', 'Petal.Width': 'sum'}).reset_index()

# create a single plot with default settings for size and so on
dv.create_horizontal_barplot(data=df_summary, x_var='Sepal.Width', y_var='Species', x_label="", title="", ax=None)
plt.show()

# adjust the size (or other settings) of the plot
fig, ax = plt.subplots(figsize=(5,5))
dv.create_horizontal_barplot(data=df_summary, x_var='Sepal.Width', y_var='Species', x_label="", title="", ax=ax)
plt.show()

# combine multiple graphs in a single plot
fig, ax = plt.subplots(2, 2, figsize=(10,7))
dv.create_histogram(data=df, var="Petal.Width", color_by="Species", bins=10, max_categories=50, ax=ax[0,0], title="our histogram")
dv.create_scatterplot(data=df, x_var="Sepal.Width", y_var="Sepal.Length", title="our scatterplot", ax=ax[0,1])
dv.create_boxplot(data=df, x_var="Petal.Length", y_var="Species", color_by=None, ax=ax[1,0], title="our boxplot")
dv.create_swarmplot(data=df, x_var="Sepal.Width", y_var=None, color_by= "Species", ax=ax[1,1])
plt.show()

# create example data for a network graph
networkdata = {
    'source': ['A', 'B', 'C', 'D', 'E', 'B', 'C', 'C', 'C'],
    'target': ['B', 'C', 'D', 'E', 'A', 'D', 'E', 'D', 'D'],
    'label': ['relation1', 'relation2', 'relation3', 'relation4', 'relation5', 'relation6', 'relation7', 'relation8', 'relation9']
}
networkdata = pd.DataFrame(networkdata)

# create a network graph
dv.create_network_graph(
    data=networkdata,
    node_1='source',
    node_2='target',
    edge_label='label',
    title="my network graph",
    figsize=(5, 5),
    ax=None,
    seed=1502)
plt.show()

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

License

GNU General Public License v3.0

Contributors

Jeanine Schoonemann
Contact us

Metadata

Release files for cmo-dataviz 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cmo-dataviz 0.1.2
File Size Uploaded Provenance Actions
cmo_dataviz-0.1.2.tar.gz 108.4 kB Without provenance Details for cmo_dataviz-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cmo-dataviz 0.1.2
File Interpreter ABI Platform Actions
cmo_dataviz-0.1.2-py3-none-any.whl Python 3 none any Details for cmo_dataviz-0.1.2-py3-none-any.whl

Total release size: 213.6 kB

Release files / cmo_dataviz-0.1.2.tar.gz

Download URL cmo_dataviz-0.1.2.tar.gz
Size 108.4 kB
Tags Source
SHA-256 checksum
How to use checksums
13d771e50324164a0893b85bc3b8cffa7a09af38dca477ce69f3c506ad5a572e
BLAKE2b-256 checksum
How to use checksums
95b4f74eedd687653bacf8d9c2dd00b440883a1436a85bb1219bd93769dcac81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.1

Release files / cmo_dataviz-0.1.2-py3-none-any.whl

Download URL cmo_dataviz-0.1.2-py3-none-any.whl
Size 105.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
632594e7a0d20cc59a0b92b2719fc34c375023e63ddec06d010b7191f07257aa
BLAKE2b-256 checksum
How to use checksums
47382eb61228c7b4777eabe31ca52d31d41dafdcd5c384d07aec1d81b4f1172e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.1

Security for cmo-dataviz 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page