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
10.4k4 gold badges30 silver badges50 bronze badges
asked Mar 21, 2019 at 17:38
4
  • 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 is a simple example showing how to do it Commented Mar 21, 2019 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. Commented Mar 21, 2019 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 minimal reproducible example? Commented Mar 21, 2019 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. Commented Mar 21, 2019 at 18:46

1 Answer 1

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..

answered Mar 21, 2019 at 18:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.