Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plt.scatter needs norm argument in Station 2 #629

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
.DS_Store
.ipynb_checkpoints/
*.grd.gz
**/__pycache__/
11 changes: 8 additions & 3 deletions Gallery/Station/NCL_station_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@

nbins = len(colors) # One bin for each color

# Define colormap for plotting based on these colors
# Define colormap and norm for plotting based on these colors
cmap = mpl.colors.ListedColormap(colors)
norm = mpl.colors.BoundaryNorm([-1.2] + bin_bounds + [35], len(colors))

###################################################
# Utility Function: Make Shared Plot:
Expand Down Expand Up @@ -100,7 +101,12 @@ def make_shared_plot(title):
zorder=0)

# Scatter-plot the location data on the map
scatter = plt.scatter(lon, lat, c=dummy_data, cmap=cmap, zorder=1)
scatter = plt.scatter(lon,
lat,
c=dummy_data,
cmap=cmap,
norm=norm,
zorder=1)

plt.title(title, fontsize=16, y=1.04)

Expand Down Expand Up @@ -152,7 +158,6 @@ def make_shared_plot(title):

# Add a horizontal colorbar
cax = plt.axes((0.225, 0.05, 0.55, 0.025))
norm = mpl.colors.BoundaryNorm([-1.2] + bin_bounds + [35], len(colors))
mpl.colorbar.ColorbarBase(cax,
cmap=cmap,
orientation='horizontal',
Expand Down
Loading