<｜begin▁of▁sentence｜>### Instruction:
As a technical writer, you might encounter a scenario where you need to document the process of repositioning nodes in a NetworkX graph. Imagine a situation where a team of engineers is working on a data visualization tool that utilizes NetworkX to represent a network graph. They have a requirement to modify the positions of a set of nodes in the graph so that they are all centered around a specific Y-coordinate while retaining their X-coordinates. Your documentation will need to guide users on how to achieve this task using NetworkX, ensuring that the technical information is communicated effectively for the intended audience. This could involve detailing the specific methods or functions within the NetworkX API that allow for the manipulation of node positions while preserving their X-coordinates. In this case, your documentation should cater to the needs of software developers or engineers who will be working with NetworkX to implement this functionality within their applications.
### Response:
import networkx as nx
import matplotlib.pyplot as plt

# Create a networkx graph
g = nx.Graph()

# Add nodes to the graph
for i in range(4):
    g.add_node(i)

# Manually place nodes using a 'pos' dictionary
pos = {0: (0.5, 1), 1: (0.5, 0.5), 2: (1, 0.5), 3: (1, 1)}

# Add 'y' centering functionality to the 'pos' dictionary
mid_y = 0.75 # Y coordinate to center nodes
for node, (x, y) in pos.items():
    pos[node] = (x, mid_y)
    
# Draw the graph
nx.draw(g, pos, with_labels=True)
plt.show()
<|EOT|>
