'Plot three dataframe columns as x, y and value as contour
I want to plot preferably a contour plot from three columns of a dataframe df:
import pandas as pd
ids =[1, 2, 3, 1, 2, 3]
lons = [3, 5, 6, 3, 7, 8]
lats = [10, 10, 10, 30, 30, 30]
ratio = [.1, .4, .2, .3, .4, .5,]
df = pd.DataFrame({'ids' : ids, 'lons' : lons, 'lats' : lats, 'ratio' : ratio})
How do I create a plot that uses lons on the x axis, lats on the y axis and then creates a contour plot as the example below with the corresponding values ratio on that location?
What I ultimately want, something like this:
I realize the function wants a 2D grid as input, but how would I do this considering the values are stored in a single column as well?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

