Suppose, I have the following list with {x, f(x)}
tuples:
fdata = {{2, 100}, {6, 90}, {10, 80}, {14, 65}, {18, 40}}
,
that can be plotted as:
ListPlot[fdata, Joined -> True, Frame -> True, FrameLabel -> {"x", "f(x)"}]
.
However, there is another list of data corresponding to the same values of 'x' containing {x, g(x)}
tuples:
gdata={{2, 0.1}, {6, 0.3}, {10, 0.37}, {14, 0.26}, {18, 0.05}}
.
I want to ListPlot
fdata
such that the color density of the plot depends on gdata
. I also want to add a BarLegend to the plot to indicate the variation of ‘g(x)’. Could you please help?