Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

matplotlib draw line between subplots

import matplotlib.pyplot as plt
from matplotlib.patches import ConnectionPatch
import numpy as np

fig = plt.figure(figsize=(10,5))
ax1 = fig.add_subplot(121)
ax2 = fig.add_subplot(122)

x,y = np.random.rand(100),np.random.rand(100)

ax1.plot(x,y,'ko')
ax2.plot(x,y,'ko')

i = 10
xy = (x[i],y[i])
con = ConnectionPatch(xyA=xy, xyB=xy, coordsA="data", coordsB="data",
                      axesA=ax2, axesB=ax1, color="red")
ax2.add_artist(con)

ax1.plot(x[i],y[i],'ro',markersize=10)
ax2.plot(x[i],y[i],'ro',markersize=10)


plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: import sys locate python = sys.exec_prefix print(locate python) 
Python :: alberi binari di ricerca python 
Python :: fastapi authentication 
Python :: string float to round to 2dp python 
Python :: How to make boxplot using seaborne 
Python :: How can I use Apache Spark with notebook in Anaconda 
Python :: mechanize python #9 
Python :: how to join models from another app 
Python :: pandas add missing rows from another dataframe 
Python :: the webpage at http://127.0.0.1:8000/ might be temporarily down or it may have moved permanently to a new web address. django 
Python :: unpack 
Python :: python calculate area diameter circumference circle 
Python :: metasploit in python 
Python :: apk calculate python 
Python :: # get documentation for module in terminal 
Python :: KeyError: 0 
Python :: how call a class in another class python 
Python :: xgb model prediction changes if i save and load the model 
Python :: split list in two based on condition python 
Python :: Find Factors of a Number using While Loop with validation 
Python :: Math Module fabs() Function in python 
Python :: unique character 01 
Python :: your momma in python 
Python :: python adding an item 
Python :: linux show output 
Python :: Python NumPy atleast_1d Function Example when inputs are in high dimension 
Python :: python request port 
Python :: Python NumPy vstack Function Example with 1d array 
Python :: emit data to specific client socketio python 
Python :: Python how to use __ne__ 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =