I am trying to plot two datasets on a single figure. Essentially this is for tracking fluids in a 2 dimensional porespace.
Both data sets are 250x250 numpy array, the first with data ranging from 0 to 1, the second with data ranging from 2 to 3. The first one is tracking the amount of fluid in a location so 0 would mean 0% fluid and .35 would mean 35% fluid, etc. Similarly the second array would have 2.00 for 0%, 2.35 for 35%, 3.00 for 100%, etc.
Plotting them individually is pretty easy and you get a nice shade effect according to the % of fluid in a location in the array.
What I want to do is plot both images on the same figure with the first data set using Blues (so that 0 is white and 1 is blue and the data in the middle being shaded according to the blue colormap) and then plot the second data set on top of that using Greens (so 2 will be white and 3 will be green, and the data in the middle being shaded according to the green colormap).
from matplotlib import pyplot
import numpy
x = numpy.arange(10)
y = x
z = -x
pyplot.plot(x, y)
pyplot.plot(x, z) # pyplot.plot(x, y, x, z) works too.
pyplot.show()
You just plot everything before calling show and it'll show up on the same image.
You can also using do the same with imshow, scatter, etc all on the same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With