简体   繁体   English

图中的粗“线”标记

[英]Fat "line" markers in a plot

I have a wind farm simulated by a LES model.我有一个由 LES 模型模拟的风电场。 Now, I have the positions of the turbines I than use:现在,我有我使用的涡轮机的位置:

plt.plot(xrow,y_position,'w|',markersize=8)

With xrow and y_position are the locations of the turbines. xrow 和 y_position 是涡轮机的位置。 Let's say for a 128,512 grid they are at:假设对于 128,512 个网格,它们位于:

xrow = [250,250,250,250]
y_poistion = [26,51,77,102]

I then use the code line I showed before but it Gives me only marker styles like this: |然后我使用我之前显示的代码行,但它只给我这样的标记样式: | . . And when I increase the marker size.当我增加标记大小时。

markersize = 12

It only Increases the length of the "bar" and not the thickness.它只会增加“条”的长度而不是厚度。 Now I would like to find out how to plot fat bars if you only have one data point available, xrow and y_position.现在,如果您只有一个数据点 xrow 和 y_position,我想了解如何绘制粗条。

Here's an example code:这是一个示例代码:

import matplotlib.pyplot as plt
import numpy as np
xy=np.zeros((128,512))
x = range(512)
y = range(128)
for i in y:
    for j in x:
        xy[i][j]=i*j
plt.imshow(xy, cmap = 'hot')
xrow = [250,250,250,250]
y_position = [26,51,77,102]
plt.plot(xrow,y_position,'w|',markersize=8, linewidth = 2)
plt.show()

This should give a plot with 4 white lines at a certain position.这应该会在某个位置给出一个带有 4 条白线的图。 My question is, how do I widen these lines?我的问题是,如何加宽这些线?

Please, help me with this.请在这件事上给予我帮助。

您可以使用markeredgewidth或缩写mew设置标记线宽度:

plt.plot(xrow, y_position, 'w|', markersize=8, mew=4)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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