简体   繁体   English

TypeError: __init__() 为参数 'center' 获得了多个值

[英]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.

相关问题 TypeError:__init __()为参数&#39;n_splits&#39;获取了多个值 - TypeError: __init__() got multiple values for argument 'n_splits' TypeError:__init __()为参数&#39;fieldnames&#39;获得了多个值 - TypeError: __init__() got multiple values for argument 'fieldnames' 类型错误:__init__() 为参数“strides”获得了多个值 - TypeError: __init__() got multiple values for argument 'strides' TypeError:__init__() 为参数“轴”获取了多个值 - TypeError: __init__() got multiple values for argument 'axes' Python TypeError:__ init __()为参数&#39;master&#39;获取了多个值 - Python TypeError: __init__() got multiple values for argument 'master' TypeError:__init __()为关键字参数“ choices”获得了多个值 - TypeError: __init__() got multiple values for keyword argument 'choices' TypeError:“ __ init __()为关键字参数&#39;name&#39;获得了多个值” - TypeError: “__init__() got multiple values for keyword argument 'name'” TypeError:__ init __()得到关键字参数&#39;customer&#39;的多个值 - TypeError: __init__() got multiple values for keyword argument 'customer' 类型错误:__init__() 为参数“index”获得了多个值 - TypeError: __init__() got multiple values for argument 'index' SQLAlchemy TypeError:__init __()为参数&#39;name&#39;获得了多个值 - SQLAlchemy TypeError: __init__() got multiple values for argument 'name'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM