subplot

Plotly: How to set up multiple subplots with grouped legends?

|▌冷眼眸甩不掉的悲伤 提交于 2020-12-13 05:40:24
问题 for each subplot I have 3 seperate line:2017 ,2018 and 2019 with 3 times "go.Scatter", each subplot represents one country (25 countries) with always these 3 years. I can use the subplot sample code but then all the 75 legends (25 X 3) will be all together with different colors and it's messy. I don't need different colors amont different subplot, I can just have 3 different colors and 3 legends for the 3 years on all subplots, would be ideal if I click on for example 2017 that all the 2017

Matplotlib sharex not working as expected

让人想犯罪 __ 提交于 2020-08-10 22:54:05
问题 I'm sure I am missing something obvious, but why is sharex=True, sharey=True not working? I expected the xlims and xticks to be the same for both subplots, and the ylims/yticks to be the same for both subplots. Using Python 3.8.3, matplotlib 3.2.1. x1, y1 = [(2,7,1), (6,2,2)] x2, y2 = [(8,3,0), (1,4,9)] fig, ax = plt.subplots(2,1, sharex=True, sharey=True, figsize=(15, 8)); ax1 = plt.subplot(2,1,1); ax1.scatter(x1, y1, c='red', label='Set1'); ax2 = plt.subplot(2,1,2); ax2.scatter(x2, y2, c=

Matplotlib sharex not working as expected

对着背影说爱祢 提交于 2020-08-10 22:52:13
问题 I'm sure I am missing something obvious, but why is sharex=True, sharey=True not working? I expected the xlims and xticks to be the same for both subplots, and the ylims/yticks to be the same for both subplots. Using Python 3.8.3, matplotlib 3.2.1. x1, y1 = [(2,7,1), (6,2,2)] x2, y2 = [(8,3,0), (1,4,9)] fig, ax = plt.subplots(2,1, sharex=True, sharey=True, figsize=(15, 8)); ax1 = plt.subplot(2,1,1); ax1.scatter(x1, y1, c='red', label='Set1'); ax2 = plt.subplot(2,1,2); ax2.scatter(x2, y2, c=