[Matplotlib-users] Data representation improvements
jon.roadleybattin at gmail.com
Sun Jul 31 16:08:05 EDT 2016
For some time now I have managed an application which acquires data from
bespoke hardware & optionally plots upto seven channels. Matplotlib is
embedded within a QT4 application & the "plotting" interface is almost
fully for matplotlib.
I have managed to free up some spare time from my main role & I would like
to vastly improve the representation of the data to the users in light of
some in-use observation.
The data is being acquired from a motor-drive & so there is some sinus data
( the motor's currents... 50Hz, 100A peak), data like speed (mostly DC
around 3000rpm with some ripple...) and then some digital flag (16bit
The fixed point data are (luckily) all relatively low in magnitude ... and
so plotting a 3000-value and a 100pk value is still visible, be it small
amplitude BUT the moment I plot one of the digital flag registers, these
dwarf the fixed-point data.
To help with the I have provided means to "hide" channels but I was
wondering if there is any better way?
I have considered 7 stacked x-y subplots but this will eat into vertical
re-estate very quickly.
I have played with secondary y-axis but this equally ends up taking a lot
of horizontal re-estate.
I have considered plotting the digital registers akin to a digital vector
so they are small, heightwise, plots as this will alleviate part of the
Any advice with regards to a usable presentation
Example code for multiple y-axis
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import numpy as np
t = np.arange(0,1,0.00001)
data = [5000*np.sin(t*2*np.pi*10),
fig = plt.figure()
host = host_subplot(111, axes_class=AA.Axes)
axis_list = [None]*7
for i in range(len(axis_list)):
axis_list[i] = host.twinx()
new_axis = axis_list[i].get_grid_helper().new_fixed_axis
axis_list[i].axis['right'] = new_axis(loc='right',
for i in data:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Matplotlib-users