小编And*_*rew的帖子

cartopy 设置范围,central_longitude=180

Cartopy 0.17.0:当我设置central_longitude时,我不知道如何准确设置提供的范围:

import matplotlib.pyplot as plt
import cartopy.crs as ccrs

projection = ccrs.PlateCarree(central_longitude=180)
ax = plt.axes(projection=projection)
ax.coastlines()
ax.set_extent((-120, 120, -45, 45), crs=ccrs.PlateCarree())
ax.gridlines(draw_labels=True, crs=ccrs.PlateCarree())
Run Code Online (Sandbox Code Playgroud)

这正确地划分了纬度子集: y_正确 这正确地划分了经度子集,但有额外的标签:

import matplotlib.pyplot as plt
import cartopy.crs as ccrs

projection = ccrs.PlateCarree(central_longitude=180)
ax = plt.axes(projection=projection)
ax.coastlines()
ax.set_extent((-120, 120, -45, 45))
ax.gridlines(draw_labels=True, crs=ccrs.PlateCarree())
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述 这可以正确设置纬度:

import matplotlib.pyplot as plt
import cartopy.crs as ccrs

projection = ccrs.PlateCarree(central_longitude=180)
ax = plt.axes(projection=projection)
ax.coastlines()
ax.set_extent((-120, 120, -45, 45), crs=projection)
ax.gridlines(draw_labels=True, crs=ccrs.PlateCarree())
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

python dictionary matplotlib cartopy extent

5
推荐指数
2
解决办法
9469
查看次数

如何手动设置全息图颜色栏的限制?

当我尝试输入自己的代码时...

在较早的单元格中...

ticker = FixedTicker(ticks=range(0, 10))
Run Code Online (Sandbox Code Playgroud)

在以下单元格中...

%%opts HeatMap [colorbar=True colorbar_opts={'ticker': ticker}]
Run Code Online (Sandbox Code Playgroud)

我知道了

TypeError [Call holoviews.ipython.show_traceback() for details]
MetaModel object got multiple values for keyword argument 'ticker'
Run Code Online (Sandbox Code Playgroud)

这是回溯...

  File "/Users/ahuang11/anaconda3/envs/tf/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py", line 757, in _init_glyphs
    renderer, glyph = self._init_glyph(plot, mapping, properties)

  File "/Users/ahuang11/anaconda3/envs/tf/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py", line 1201, in _init_glyph
    self._draw_colorbar(plot, self.handles['color_mapper'])

  File "/Users/ahuang11/anaconda3/envs/tf/lib/python3.6/site-packages/holoviews/plotting/bokeh/element.py", line 1100, in _draw_colorbar
    **dict(opts, **self.colorbar_opts))

TypeError: MetaModel object got multiple values for keyword argument 'ticker'
Run Code Online (Sandbox Code Playgroud)

python colorbar holoviews

3
推荐指数
1
解决办法
1258
查看次数

标签 统计

python ×2

cartopy ×1

colorbar ×1

dictionary ×1

extent ×1

holoviews ×1

matplotlib ×1