pythonlinemarkersfat

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.


Solution

  • You can set the marker line width with markeredgewidth or abbreviated mew:

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