Customizing Visual Styles in Plotly
Code for a workshop originally developed for an Unconference session during the Outlier Conference hosted by Data Visualization Society.
To jump right in:
Fork this repository, or download the Jupyter Notebook file Styling_Plotly_Themes_Templates.ipynb.
Ever have that feeling that a lot of data viz you see screams the tool it was made in? Using the Plotly Open Source Python Graphing Library, we will take a look under the hood of:
- the style themes available,
- understand the visual elements like figure and chart backgrounds, and
- build our own default theme script inspired by 1980's computers.
This informal workshop is for a seasoned Pythonista wanting to add to your design toolbox or a newbie curious about custom interfaces beyond the usual BI tools (listen or follow along).
You can also check out all of Plotly's open source graphing libraries, including R, JavaScript, and more here.
Quick Start Prep
(most of this occurs before the workshop to follow along live...)
We're not going to spend too much time here, but if you're just starting out in Python, and want to get your hands dirty, here's a few building blocks useful to get the most from the workshop:
-
Python ...All you really need is a Python code interpreter installed as a foundation.
- Start from the source, Python Software Foundation's helpful steps and downloads (yep, the be all end all source).
- Many computers come with a version pre-installed, a bit old, but if you don't want to touch or download anything, it may get you acquainted, at least. (to check in command line or terminal, run python --version)
- Or Python comes with an Anaconda installation (bigger topic than this workshop, but if you're in it for the long haul using Python consider e.g. the Individual Edition or a miniconda).
- Start from the source, Python Software Foundation's helpful steps and downloads (yep, the be all end all source).
-
A virtual environment (optional, but do this next if you're doing it.)
- Skip this step if the sound of it or # steps has you scared away already! Don't go, stay!
- It's recommended, but not necessary, to make and work in an isolated virtual environment for any Python project like this one, to help manage work requiring different versions of things.
- Options to manage this:
- I find virtualenv a sure bet,
- (e.g. On Mac Terminal (Zsh), from my project root folder, I ran virtualenv plotlystyle_env to make it; to activate it, I'll run source plotlystyle_env/bin/activate) _pip install virtualenv_if necessary first.
- I'll refer you to the docs for Windows.
- the simplified venv built into Python version 3.3+,
- Conda which I feel is cleanest with its centralized file structure, but fussy at times like an angry schoolchild, and
- those are the big ones.
- I find virtualenv a sure bet,
- Options to manage this:
-
Jupyter Notebook (strongly recommended, we'll spend the workshop in the .ipynb Notebook file)
-
Notebooks run directly in your web browser, so you need: Chrome, Safari, or Firefox (up to date Opera and Edge maybe works)
-
If you installed an Anaconda distribution in step 1, congratulations, Jupyter Notebook is included! Read up on running the Notebook where we'll pick up!
-
You can alternately install Jupyter Notebook with the pip package manager.
-
If you're working in a virtual environment (step 2 above), also install the IPython kernel.
- Otherwise, this Jupyter Notebooks does have this automatically for your system Python interpreter.
- This basically supports more quick, interactive, code which makes Notebooks great for learning in chunks, and exploring without running a whole script.
-
-
Kiss your brain!
Who's tired of hyperlinks and docs already?! You promised fun!
General Disclaimer
This work is open source, like Plotly Open Source Graphing Libraries, so try it, use it and spread the love by teaching someone else!
To keep up with what others are working on, join the Plotly Community Forum. Made with