<｜begin▁of▁sentence｜>### Instruction:
Given a path graph with 4 nodes, how can you use NetworkX to draw the graph with a planar layout if the graph is planar?
### Response:
import matplotlib.pyplot as plt
import networkx as nx

# Create a graph
G = nx.path_graph(4)

# Check if the graph is planar
is_planar, embedding = nx.check_planarity(G)

# If the graph is planar, draw it with a planar layout
if is_planar:
    nx.draw_planar(G)
    plt.show()
else:
    raise nx.NetworkXException('G is not planar')
<|EOT|>
