0

I have an application which I pull data from an FPGA & display it for the engineers. Good application ... until you start displaying data which are extremely different in ranges...

say: a signal perturbating around +4000 and another around zero (both with small peak-peak).

At the moment the only real workaround is to "export to csv" and then view in Excel but I would like to improve the application so that this isn't needed

Option 1 is a more dynamic pointer that will give you readings of ALL visible plots for the present x

Option 2. Multiple Y axis. This is where it gets a bit ... tight with respect to UI area.

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),
10*np.sin(t*2*np.pi*20),
20*np.sin(t*2*np.pi*30),
np.sin(t*2*np.pi*40)+5000,
np.sin(t*2*np.pi*50)-5000,
np.sin(t*2*np.pi*60),
np.sin(t*2*np.pi*70),
]

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',
                                                axes=axis_list[i],
                                                offset=(60*i,0))
    axis_list[i].axis['right'].toggle(all=True)
    axis_list[i].plot(t,data[i])

plt.show()

for i in data:
    plt.plot(t,i)
plt.show()

This code snippet doesn't contain any figure resize to ensure all 7 y-axis are visible BUT ignoring that, you can see it is quite large...

Any advice with respect to multi-Y or a better solution to displaying no more than 7 datasets?

Naib
  • 999
  • 7
  • 20
  • I can't grasp the code, but have you tried applying a logaritmic scale to the outputted Y values (`newY = log(oldY)`)? Or even more strict the function `newY=1-1/(oldY+1)` will set all Y values in the [0, 1) range, then multiply by whatever constant for scaling to UI size. – user2464424 Feb 15 '16 at 10:16
  • The code has three parts 1) dummy data generation 2) plot with multiple-Y [missing auto resizing fig area] 3) plotting the data as I do presently. Being able to compare the 4th & 5th is what drove the query from engineers to myself how to better represent but I am stuck with optimal display – Naib Feb 15 '16 at 10:19
  • have you considered drawing the datasets one on top of the other, but with different colours for each dataset and high transparency? like [this](http://stackoverflow.com/questions/3541713/how-to-plot-two-histograms-together-in-r). – user2464424 Feb 15 '16 at 10:51

0 Answers0