MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_plot_format

Function test_plot_format

lib/matplotlib/tests/test_axes.py:9574–9600  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9572
9573
9574def test_plot_format():
9575 fig, ax = plt.subplots()
9576 line = ax.plot([1, 2, 3], '1.0')
9577 assert line[0].get_color() == (1.0, 1.0, 1.0, 1.0)
9578 assert line[0].get_marker() == 'None'
9579 fig, ax = plt.subplots()
9580 line = ax.plot([1, 2, 3], '1')
9581 assert line[0].get_marker() == '1'
9582 fig, ax = plt.subplots()
9583 line = ax.plot([1, 2], [1, 2], '1.0', "1")
9584 fig.canvas.draw()
9585 assert line[0].get_color() == (1.0, 1.0, 1.0, 1.0)
9586 assert ax.get_yticklabels()[0].get_text() == '1'
9587 fig, ax = plt.subplots()
9588 line = ax.plot([1, 2], [1, 2], '1', "1.0")
9589 fig.canvas.draw()
9590 assert line[0].get_marker() == '1'
9591 assert ax.get_yticklabels()[0].get_text() == '1.0'
9592 fig, ax = plt.subplots()
9593 line = ax.plot([1, 2, 3], 'k3')
9594 assert line[0].get_marker() == '3'
9595 assert line[0].get_color() == 'k'
9596 fig, ax = plt.subplots()
9597 line = ax.plot([1, 2, 3], '.C12:')
9598 assert line[0].get_marker() == '.'
9599 assert line[0].get_color() == mcolors.to_rgba('C12')
9600 assert line[0].get_linestyle() == ':'
9601
9602
9603def test_automatic_legend():

Callers

nothing calls this directly

Calls 8

subplotsMethod · 0.45
plotMethod · 0.45
get_colorMethod · 0.45
get_markerMethod · 0.45
drawMethod · 0.45
get_textMethod · 0.45
to_rgbaMethod · 0.45
get_linestyleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…