1

I want to create a dashboard with 4 plots, with 2 hlines.

f, axs = plt.subplots(2,2,figsize=(16,14))
x=lplt['pts']
y=lplt['time']

axs[0,1].hlines(y, xmin = 0 , xmax = lplt['pts'], color='g')
axs[1,1].hlines(y, xmin = 0 , xmax = lplt['pts'], color='skyblue', linestyles= 'solid')
axs[1,0].barh(y, x, linewidth = 2)
axs[0,0].plot(y, x, marker = "o", linewidth = 2)

plt.show()

enter image description here


I would like to add the number in front of the plot with the green color, example:

enter image description here

And the last plot with something like this:

enter image description here

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158

1 Answers1

3
f, axs = plt.subplots(2,2,figsize=(16,14))
x = [20, 10, 5, 15]
y = ["A", "B", "C", "D"]

ax0 = axs[0, 0]
ax0.plot(y, x, marker = "o", linewidth = 2)

ax1 = axs[0, 1]
ax1.hlines(y, xmin=0 , xmax=x, color='green')
for xv, yv in zip(x, y):
    ax1.text(x=xv, y=yv, s=xv)

ax2 = axs[1, 0]
ax2.barh(y, x, linewidth=2)

ax3 = axs[1,1]
ax3.hlines(y, xmin=0 , xmax=x, color='skyblue', linestyles= 'solid')
ax3.scatter(x, y)

plt.show()

enter image description here

d.b
  • 32,245
  • 6
  • 36
  • 77