Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Now finish it off with a flourish. Generate the plot with your favorite application. Here is one way to do it.

fig = plt.figure()
ax = fig.add_subplot(111)

for i in busMark:
    marker = ax.plot(i[1][0], i[1][1], 'ko')
    plt.text(i[1][0], i[1][1], i[2], fontsize=6) 

ax.set_xlim(0,285)
ax.set_ylim(0,180)
ax.axes.get_xaxis().set_visible(False)
ax.axes.get_yaxis().set_visible(False)
ax.set_title('load flow plot')
plt.show()

fig.set_size_inches(11.22,7.08)
extent = ax.get_window_extent().transformed(fig.dpi_scale_trans.inverted())
fig.savefig("loadflow.png", bbox_inches=extent)

I have limited myself to the bus markings but this should adequate to convey the general procedure. I am sure I am not the only guy working on this diagram problem. Let us know about your ideas.

click to hide/show revision 2
rewrote the i in busMarks to use tuple unpacking for readability

Now finish it off with a flourish. Generate the plot with your favorite application. Here is one way to do it.

fig = plt.figure()
ax = fig.add_subplot(111)

for i bus, (x, y), name in busMark:
    marker = ax.plot(i[1][0], i[1][1], ax.plot(x, y, 'ko')
    plt.text(i[1][0], i[1][1], i[2], plt.text(x, y, name, fontsize=6) 

ax.set_xlim(0,285)
ax.set_ylim(0,180)
ax.axes.get_xaxis().set_visible(False)
ax.axes.get_yaxis().set_visible(False)
ax.set_title('load flow plot')
plt.show()

fig.set_size_inches(11.22,7.08)
extent = ax.get_window_extent().transformed(fig.dpi_scale_trans.inverted())
fig.savefig("loadflow.png", bbox_inches=extent)

I have limited myself to the bus markings but this should adequate to convey the general procedure. I am sure I am not the only guy working on this diagram problem. Let us know about your ideas.