另一个关于 matplotlib 3d 曲面的问题......我有向 matplotlib 曲面图添加散点的代码。
我遇到的问题是该点总是出现在表面后面,无论您从哪个角度观察它。
如果我用 3 条短线来标记同一个点来拼凑一个(公认的丑陋)版本,它是可见的。

我关闭了这个depthshade功能,所以不是这个。任何人都可以解释发生了什么以及我如何纠正它?这是代码的简化版本:
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
df = pd.DataFrame({10: {10: 1,15: 1,20: 1,25: 1,30: 1,35: 1,40: 1,45: 1,50: 1,55: 1,60: 1,65: 1,70: 1,75: 1,80: 1,85: 1,90: 1},
15: {10: 4,15: 1,20: 1,25: 1,30: 1,35: 1,40: 1,45: 1,50: 1,55: 1,60: 1,65: 1,70: 1,75: 1,80: 1,85: 1,90: 1},
20: {10: 6,15: 3,20: 1,25: 1,30: 1,35: …Run Code Online (Sandbox Code Playgroud) 好吧,这似乎是一个非常基本的问题,但我在任何地方都找不到可行的答案,所以就在这里。
我有一些文字:
text = '''
Come and see the violence inherent in the system. Help! Help! I'm being
repressed! Listen, strange women lyin' in ponds distributin' swords is no
basis for a system of government. Supreme executive power derives from a
mandate from the masses, not from some farcical aquatic ceremony. The Lady
of the Lake, her arm clad in the purest shimmering samite held aloft
Excalibur from the bosom of the water, signifying by divine providence that
I, Arthur, …Run Code Online (Sandbox Code Playgroud) 我刚开始使用OOP进行python(如果这是一个愚蠢的问题,请原谅我).我正在使用一个模型,该模型使用一个函数来模拟大气中二氧化碳排放的衰减.对于每个时间步,应使用该函数减少c_size类的属性Emissiondecay
我已将代码简化为单次运行,但我不断收到错误:
Traceback (most recent call last):
File "<co2>", line 20, in <module>
x.decay(year=1)
TypeError: decay() got multiple values for argument 'year'
Run Code Online (Sandbox Code Playgroud)
我无法看到任何多个值可能来自哪里.我只是将一个int值传递给代码.
代码是:
import numpy as np
class Emission:
def __init__(self,e_year=0, e_size=0.0):
self.e_year=e_year #emission year
self.e_size=e_size #emission size
self.c_size=[e_size] #current size
def decay(year):
#returns a % decay based on the year since emission 0 = 100% 1 = 93%
# etc. from AR5 WG1 Chapter 8 supplementary material equation 8.SM.10
# using coefficients …Run Code Online (Sandbox Code Playgroud)