Remove colorbar from pcolormesh plot #6219
Answered
by
andersy005
haritha1022
asked this question in
Q&A
-
What happened?I was trying to plot panel plots raise AttributeError(f"{type(self).__name__!r} object " AttributeError: 'QuadMesh' object has no property 'cbar' What did you expect to happen?I am unable to remove the color bar Minimal Complete Verifiable Exampleimport xarray as xr
import cartopy.crs as ccrs
from cartopy import feature as cf
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
#Opening and reading data
data=xr.open_dataset("uvg.nc")
print(data)
def main():
x=data.longitude[::5];
y=data.latitude[::5]
u=data.u[5,::5,::5];
v=data.v[5,::5,::5]
z=data.z[5]
ax1 = plt.subplot(3,2,1,projection=ccrs.PlateCarree())
z.plot.pcolormesh(cmap="turbo",vmin=7500,vmax=8500, ax = ax1,cbar=False)
ax1.set_extent([60, 100, 38, 0])
ax1.coastlines()
ax1.quiver(x,y,u,v, angles='xy', scale_units='xy', scale=4)
plt.show() Relevant log outputraise AttributeError(f"{type(self).__name__!r} object " AttributeError: 'QuadMesh' object has no property 'cbar' Anything else we need to know?No response Environment |
Beta Was this translation helpful? Give feedback.
Answered by
andersy005
Jan 31, 2022
Replies: 1 comment 1 reply
-
@haritha1022, thank you for the report!
The issue lies in this line: z.plot.pcolormesh(cmap="turbo",vmin=7500,vmax=8500, ax = ax1,cbar=False) The right argument name is |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
andersy005
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@haritha1022, thank you for the report!
The issue lies in this line:
The right argument name is
add_colorbar
instead ofcbar
: