简体   繁体   中英

Fat "line" markers in a plot

I have a wind farm simulated by a LES model. 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. Let's say for a 128,512 grid they are at:

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.

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. 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)

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