d7696fe164e8b91946b75aa5c027b92ae3c1874d,examples/api/two_scales.py,,,#,21

Before Change


ax2 = ax1.twinx()  // create the second `Axes` instance

// Plot a different set of data on each axes
for ax, data, c in ((ax1, data1, "red"), (ax2, data2, "blue")):
    ax.plot(t, data, color=c)
    // Color the y-axis (both label and tick labels) accordingly to the data
    ax.yaxis.label.set_color(c)
    for tl in ax.get_yticklabels():
        tl.set_color(c)

// Label both axes
ax1.set_xlabel("time (s)")
ax1.set_ylabel("exp")
ax2.set_ylabel("sin")  // NB: we already took care of the x-label with ax1

After Change


ax1.set_xlabel("time (s)")
ax1.set_ylabel("exp", color=color)
ax1.plot(t, data1, color=color)
ax1.tick_params(axis="y", labelcolor=color)

ax2 = ax1.twinx()  // instantiate a second axes that shares the same x-axis

color = "tab:blue"
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: matplotlib/matplotlib
Commit Name: d7696fe164e8b91946b75aa5c027b92ae3c1874d
Time: 2018-01-25
Author: vincent.adrien@gmail.com
File Name: examples/api/two_scales.py
Class Name:
Method Name:


Project Name: matplotlib/matplotlib
Commit Name: eace7a6ed485bcfb6f06bd6f8e741ec9709d83ce
Time: 2016-11-14
Author: tcaswell@gmail.com
File Name: examples/api/two_scales.py
Class Name:
Method Name:


Project Name: arviz-devs/arviz
Commit Name: a06356d4fbbf2b3a5e951499c2e141709c766447
Time: 2019-07-12
Author: ColCarroll@users.noreply.github.com
File Name: arviz/plots/forestplot.py
Class Name:
Method Name: plot_forest