Matplotlib : single line chart with different markers
<p>I have a list for markers on my time series depicting a trade. First index in each each list of the bigger list is the index where i want my marker on the line chart. Now I want a different marker for buy and sell</p>

<pre><code>[[109, 'sell'],
 [122, 'buy'],
 [122, 'sell'],
 [127, 'buy'],
 [131, 'sell'],
 [142, 'buy'],
 [142, 'sell'],
 [150, 'buy']]
</code></pre>

<p>code:</p>

<pre><code>fig = plt.figure(figsize=(20,10))
ax = fig.add_subplot(1,1,1)
ax.set_ylim( min(timeSeriesList_1)-0.5, max(timeSeriesList_1)+0.5)
start, end = 0, len(timeSeriesList_index)
stepsize = 10
ax.xaxis.set_ticks(np.arange(start, end, stepsize))
ax.set_xticklabels(timeSeriesList_index2, rotation=50)

## change required here:
ax.plot(timeSeriesList_1, '-gD', markevery= [ x[0] for x in markers_on_list1])
</code></pre>

<p>This is how my chart looks:</p>

<p><a href="https://i.stack.imgur.com/MCvrv.png" rel="nofollow"><img src="https://i.stack.imgur.com/MCvrv.png" alt="enter image description here"></a></p>

<p>Please tell me, how I can have different markers for buy and sell.</p>

<p>Create two new arrays, one buy-array and one sell-array and plot them individually, with different markers.  To create the two arrays you can use list-comprehension</p>

<pre><code>buy = [x[0] for x in your_array if x[1]=='buy']
sell = [x[0] for x in your_array if x[1]=='sell']
</code></pre>

python matplotlib time-series