Hello all,
I am having an issue creating plots using contourf and tricontorf from an Argo Float dataset. I work with python and read in the data to Spyder using pandas, putting all of my variables into a pandas data frame. All of my variables are 1D, and the same size.
Because of all my variables being 1-D, I had issues trying to create biogeochemical contour plots from my data. I am aiming to make plots where my x-axis is the date time, y-axis is depth, and Z is a biogeochemical variable, like Oxygen for example. Contourf requires that the Z input be a 2-D array, but all of my variables in my pandas data frame are 1-D and the same size as each other.
This led me to attempt creating a function that instead uses tricontourf to create these plots, where I can choose my variable for the x-axis, the y-axis is depth, and I can choose a variable as my Z input. When I use the Argo Float’s station numbers as my variable for x-axis, I get really clean plots (Left Figure). However, something goes wrong when I use date as my x-axis and I’m not sure how to fix it (Right Figure). The dtype that is used as an input for the date is datetime64[ns].
I’ve seen a number of posts around Stack Overflow and other sources that both attempt to fix tricontourf, as well as some solutions that recommend converting your Z-input 1D array into a 2D array so it would run with contourf, but I have had no success with their suggestions to get either contourf or tricontourf to create the contour plots I am hoping for.
If anyone has worked with either contourf or tricontourf closely, recognizes my issue, has any suggestions on how to tackle this issue, or has any questions to help figure out what my issue may be, I would greatly appreciate your input! Thank you so much for your time!