[英]TypeError: __init__() got multiple values for argument 'center'
I new to this and I tried to look through similar errors, but I am unsure why 'center' would be targeted as it centers the graph.我是新手,我试图查看类似的错误,但我不确定为什么“中心”会成为目标,因为它会使图形居中。
import yt
ds = yt.load("puredef_hdf5_chk_000000")
p = yt.ProjectionPlot(ds,'particle_postion_x', 'particle_postion_y',['particle_dens'], center='m', width=(20, 'Mpc'))
p.annotate_particles((20, 'Mpc'))
p.save()
With the output being: output 为:
runfile('C:/Users/rocke/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/richard/untitled7.py', wdir='C:/Users/rocke/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/richard')
yt : [WARNING ] 2020-07-02 15:22:54,470 Extending theta dimension to 2PI + left edge.
yt : [INFO ] 2020-07-02 15:22:54,484 Parameters: current_time = 0.0
yt : [INFO ] 2020-07-02 15:22:54,485 Parameters: domain_dimensions = [2 2 0]
yt : [INFO ] 2020-07-02 15:22:54,486 Parameters: domain_left_edge = [ 0.0000e+00 -6.5536e+09 0.0000e+00]
yt : [INFO ] 2020-07-02 15:22:54,487 Parameters: domain_right_edge = [6.55360000e+09 6.55360000e+09 6.28318531e+00]
yt : [INFO ] 2020-07-02 15:22:54,488 Parameters: cosmological_simulation = 0.0
Traceback (most recent call last):
File "C:\Users\rocke\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\richard\untitled7.py", line 12, in <module>
p = yt.ProjectionPlot(ds,'particle_postion_x', 'particle_postion_y',['particle_dens'], center='m', width=(20, 'Mpc'))
TypeError: __init__() got multiple values for argument 'center'
The function yt.ProjectionPlot
takes 3 parameters and the rest are optional parameters with a keyword. function yt.ProjectionPlot
采用 3 个参数,rest 是带有关键字的可选参数。 You are using 4 parameters, so 1 to many ( ['particle_dens']
).您正在使用 4 个参数,因此从 1 到多个( ['particle_dens']
)。 That probably also needs to be a keyword parameter.这可能还需要一个关键字参数。
Documentation for the function: https://yt-project.org/doc/reference/api/yt.visualization.plot_window.html#yt.visualization.plot_window.ProjectionPlot function 的文档: https://yt-project.org/doc/reference/api/yt.visualization.plot_window.html#yt.visualization.plot_window.ProjectionPlot
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.