What would be the best way to implement rectangular coordinate?

I'm making a scientific calculator and I'm looking for a proper way to implement rectangular coordinare system and graphs. Requirements are following.
 x,y axis lines and grid (If those are not supported, I can implement them myself)
 Somthing like this : drawPixel(x, f(x))
Coordinates can be a double value, And I will use this function to draw a graph.
What would be the best choice?


QCustomPlot might also be an alternative.