Question

I have taken readings on my software defined radio. I have three quantities, frequency, power and error rate. I would like to keep frequency on my x-axis as the latter quantities are measured with respect to frequency. Now I need to plot them on a single curve so that i can see frequency vs power and frequency vs error rate in one shot. I have been looking at matplotlib for quite some time but I see the 3d scatter plots and they seem to not convey the picture i want. So my question is

  1. Is 3d plot useless in my case and I better plot 2 graphs and join the y axes of both graphs together so that I could see both the graphs on top of each other.

  2. Is there a way in python or matlab such that you plot a 3d curve and then if you move the cursor you can see frequency vs power and if you move the cursor the other way you can see frequency vs error rate.

Any other ideas on how i can represent my readings better will be helpful.

Was it helpful?

Solution

When two sets of data share the same dependant variable (x-axis), it is common in scientific literature at least to plot them both in the following manner to save space:

Example

This is preferred to twining the xaxis which can cause confusion for some people. It works especially well if features are to be compared.

This plot was generated using:

import pylab as py

x = py.linspace(0,10,1000)
y = py.sin(x) 
z = py.sinc(x)

ax1 = py.subplot(211)
ax1.plot(x,y)
ax1.set_xticklabels([])  # Remove the xticks from the top figure
ax1.set_yticks(ax1.get_yticks()[1:]) # Stops the y axis overlapping

ax2 = py.subplot(212)
ax2.plot(x,z)

py.subplots_adjust(hspace=0.0)

py.show()

I believe there is a better way to remove the xticklabels but I can't remember it at the moment. Be careful not to just py.set_xticks([]) as if you then ask for a grid the top plot has no ticks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top