简体   繁体   中英

Combined 2D/3D Plot in matplotlib

i have the following, simple code for plotting my well:

import matplotlib.pyplot as plt

a = 0
b = 0

plt.axis([-100,100,-100,100])
plt.plot(a,b,"ro")
plt.grid(True)      
plt.title ('Location of Well')       
plt.xlabel('Distance in x [m]')       
plt.ylabel('Distance in y [m]')     
plt.show()  

this code gives me my desired simple plot.

I have another contour plot here for my pressure distribution:

from scipy.special import *
import matplotlib.pyplot as plt
import numpy as np

## Definition der Parameter für Druckgleichung nach Rudnicki (1986) ##
q = 6.0/1000                   #Fluidmenge pro Fläche und Zeit [m³/s]
rhof = 1000                    #Dichte Flüssigkeit [kg/m³]
lameu = 11.2*10**9             #Lamé-Parameter, undrained [Pa]
lame = 8.4*10**9               #Lamé-Parameter, drained [Pa]
np.pi                             #durch Pythonmodul "math" gegeben
alpha = 0.65                   #Biot-Willis-Koeffizient
G = 8.4*10**9                  #Schermodul [Pa]
k = 1.0*10**(-15)              #Permeabilität [m²] bzw. [Darcy] 
eta = 0.001                    #Viskosität des Fluids [Pa*s]            
t = 1000*24*3600               #Zeit in [s]

## Beziehungen der Parameter untereinander ##
kappa = k/eta                  #Berechnung der Permeabilität nach Rudnicki (1986), [m³*s/kg]
print "kappa ist:",kappa       #Ausgabe Permabilität
c = (kappa*(lameu-lame)*(lame+2*G))/((alpha**2)*(lameu+2*G))    #Berechnung der Diffusivität
print "c ist:",c                                                #Ausgabe der Diffusivität

## Wertebereich in [m] ##
xmin = -100
xmax = 100
ymin = -100
ymax = 100

x = np.arange(xmin,xmax,5.0)
y = np.arange(ymin,ymax,5.0)
x, y = np.meshgrid(x, y)  # Erzeugung einer Matrix


## Formeln für den Druck ##
r = np.sqrt(x**2+y**2)                              # Abstandsvektor
P = (q/(rhof*4*np.pi*kappa))*(expn(1,(r**2)/(4*c*t)))  # Druckformel nach Rudnicki     
z = P/1e6                                  # Division durch 1e6, um Megapascal zu erhalten                                                                     
print z
z[z==np.inf] = np.nan            # Werte, die gegen unendlich gehen, werden nicht geplottet 

plt.figure() 
CS = plt.contour(x, y, z)
plt.clabel(CS, inline=1, fontsize=10)
plt.show()

Is there any way to combine these plots, ie seeing the well point and the contour plot together? In addition: how am i able to configure my x- and y-axis? In my contour plot, they dont range to their desired values.

q = 6.0/1000
rhof = 1000
lameu = 11.2*10**9
lame = 8.4*10**9
np.pi
alpha = 0.65
G = 8.4*10**9
k = 1.0*10**(-15)
eta = 0.001
t = 1000*24*3600

kappa = k/eta
print "kappa ist:",kappa
c = (kappa*(lameu-lame)*(lame+2*G))/((alpha**2)*(lameu+2*G))
print "c ist:",c


xmin = -100
xmax = 100
ymin = -100
ymax = 100

x = np.arange(xmin,xmax,5.0)
y = np.arange(ymin,ymax,5.0)
x, y = np.meshgrid(x, y)  # Erzeugung einer Matrix



r = np.sqrt(x**2+y**2)
P = (q/(rhof*4*np.pi*kappa))*(expn(1,(r**2)/(4*c*t)))
z = P/1e6
print z
z[z==np.inf] = np.nan
a = 0
b =0
plt.figure()
CS = plt.contour(x, y, z)
points = plt.plot(a,b, 'ro')
plt.xticks(np.arange(-80,80,5))  # xticks from -80 to 80 with step 5
plt.yticks(np.arange(-80,80, 5))
plt.clabel(CS, inline=1, fontsize=10)
plt.show()

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM