1

I am using data collected from two different instruments which have different resolution because of the sampling rate of each instrument. For a specific time, one of the sets have >10k entries while the other has ~2.5k. They however capture data over the same time interval, and I want to plot them on top of each other even though they have different resolution in data. The minimum and maximum x of both sets are the same however one of them have more entries.

Simplified it could look like this:

1st set from instrument with higher sampling rate:

time(s)    value
0.0         10
0.2         11
0.4         12
0.6         13
0.8         14
...         ..
100         50

2nd set from instrument with lower sampling rate:

time(s)    value
0           100
1           120
2           125
3           128
4           130
.           ...
100         430

They are measuring different things, but I would like to display them in the same plot. How can I accomplish this?

William Miller
  • 9,839
  • 3
  • 25
  • 46
boking
  • 145
  • 1
  • 12
  • Given the scale difference of both datasets, your best bet is to use a twin axes, i.e., two y-axis sharing the x-axis. [Here](https://stackoverflow.com/questions/14762181/adding-a-y-axis-label-to-secondary-y-axis-in-matplotlib) is a simple example showing how to do it – Sheldore Mar 21 '19 at 18:14
  • @Bazingaa I am already using two axes, the problem is that the size of the samples are different for the two sets. Lets say one of the sets have 500 entries while the other has 100. They do however cover the same time span (same 100 seconds of measuring). One of the sets just has a higher resolution of the data, beacuse that instrument can read data at a higher rate. – boking Mar 21 '19 at 18:23
  • How are you plotting them? Using `ax1.plot(time, value1)` and `ax2.plot(time, value2)` should not care about the different sample densities, can you provide a [mcve]? – William Miller Mar 21 '19 at 18:31
  • @WilliamMiller Aaargh.. I found the mistake, which was on my part. I was trying to plot both datasets using the time data from the first instrument. Of course they need to be plotted with their respective time data and I put the first time data in the second plot by mistake. Thanks guys. – boking Mar 21 '19 at 18:46

1 Answers1

1

I found the mistake.. I was trying to plot both datasets using the time data from the first instrument. Of course they need to be plotted with their respective time data and I put the first time data in the second plot by mistake..

boking
  • 145
  • 1
  • 12