Giter VIP home page Giter VIP logo

Comments (5)

jlandmann avatar jlandmann commented on August 22, 2024 3

Very cool! So just for the record, here's how it can work with rasterio:

  import rasterio
  from matplotlib import pyplot
  from matplotlib import colors, cm
  from rasterio.plot import show
  src = rasterio.open("some.tif")
  fig, ax = plt.subplots()
  cmap = pyplot.get_cmap('rainbow')
  data = src.read()
  show(data , transform=src.transform, ax=ax, cmap=cmap)
  fig.colorbar( cm.ScalarMappable(norm=colors.Normalize(vmin=np.nanmin(data), vmax=np.nanmax(data)), cmap=cmap), ax=ax)

grafik

from geoutils.

rhugonnet avatar rhugonnet commented on August 22, 2024 1

same code than Johannes but with cartopy (>0.17) will get imshow() to handle the georeferences:

import cartopy
import matplotlib.pyplot as plt
import rasterio as rio
src = rio.open('/home/atom/ongoing/work_worldwide/N65W019_final_err.tif')
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection=cartopy.crs.Robinson())
ax.gridlines(draw_labels=True, dms=True, x_inline=False, y_inline=False)
plt.imshow(src.read(1),cmap=plt.cm.Reds)
plt.colorbar()
plt.show()

Screenshot from 2021-03-03 20-40-45
Would that work?

from geoutils.

jlandmann avatar jlandmann commented on August 22, 2024

You can use imshow() in rasterio directly:

 import rasterio
from matplotlib import pyplot
src = rasterio.open("some.tif")
pyplot.imshow(src.read(1), cmap='pink')
pyplot.colorbar()
pyplot.show()

grafik

Is that what you thought of?

from geoutils.

adehecq avatar adehecq commented on August 22, 2024

You can use imshow() in rasterio directly:

Well but then you lose the georeferences... I can of course do it in matplotlib but I was wondering if there was a more direct way.

from geoutils.

adehecq avatar adehecq commented on August 22, 2024

Solved by #95

from geoutils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.