Skip to content
Advertisement

Merge dataframes with mirrored values

I have a dataframe which stores measurement points of an circular area. So each point has a Radius_mm and Angle_deg value.

As a visual representation of the data, I would now like to create a section through the surface. I.e. I choose one angle and the corresponding angle that lies at 180° to it, including the center. The x-axis should display the Radius_mm and the y-axis the Value.

I could nearly archive this, as shown below. By plotting each data set separately, the result is unfortunatly not connected. I am sure there is a more elegant way, but couldn’t get to it, can some help?

Thanks!

JavaScript

Advertisement

Answer

You don’t need the filtered_dfs, you can do most of this in a couple of lines of Pandas, and keep the line connected:

JavaScript

then the plot:

JavaScript

enter image description here

If you want to keep the colours separate, you can replace the last line with this:

JavaScript

enter image description here

Advertisement