Contour polygon over satellite map - Plotly - python

I am trying to place a polygon filled with countour map on a satellite map. Since I want to make it interactive, i found Python and Plotly as a possible solution.
I can draw the polygon (boundary) on the map. Without a map I can also create the contour map.
I haven't figured out how to put the polygon (filled with contour) on the map (over the map). Is it even possible? If not, is there any suggestion how to achieve this?
Something similar to this picture

Related

Is is possible to get the background color of a folium map from geographical coordinates?

I'm trying to distinguish whether a geographical coordinate is located in water or on land using folium. My idea was to get the background color in folium from a coordinate but I'm not sure how to access it.
I have tried to look through the different plugins that folium has but could not find one that returns a color.

Plotting a coastline on cartesian grid in matplotlib

I am making maps of meteorological data (x,y-coordinates in m) using matplotlib.pyplot.contourf(). I want to plot a coastline, but all the examples I find on internet use lat-lon data (with cartopy or basemap).
Is there a way (without transforming the data to a lat-lon grid) to plot a coastline on my cartesian grid? I know size of the grid, and its center's lat-lon coordinates.
I haven't tried anything but look for similar examples, which I could not find.
The solution is to use cartopy's gnomonic projection: https://scitools.org.uk/cartopy/docs/v0.15/crs/projections.html#gnomonic , e.g.
proj =ccrs.Gnomonic(central_latitude=0, central_longitude= 0)
The origin of the data need to be specified (in lat-lon), and it expects the data coordinates to be distance in meters from that origin. Then, the normal cartopy features (like coastlines) work as usual.

Plotting points within a triangle

I'm using Python, and I have some data which can be projected on to points within an equilateral triangle whose side lengths sum to 1.
I'm not sure if there is an easy way to visualise a plot like this from Matplotlib or similar libraries, or if I'm just going to have to use a drawing package from scratch to make it happen. Any pointers gratefully recieved. Thanks!
If all you want to do is plot a few dots on a graph, you can infact use Matfplotlib's scatter plots for this:
https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html
Using plt.xlim(*min*, *max*) and plt.ylim(*min*, *max*), you can set the limits of the graph manually to fit your values (might not be neccessary though).
You can draw lines on the graph for the triangle shape (if you need that): How to draw a line with matplotlib?
If you don't need a scale, you can even remove that to have a blank canvas: Matplotlib plots: removing axis, legends and white spaces

Generating seamless matplotlib contour plot

I'm using matplotlib and Python to generate a contour plot that I would like to make seamless across the X axis (meaning the contour regions will wrap at the right edge and align with the values from the left edge to create continuous regions). What is the best way to approach something like this?

"continuous" plotting in Pygame

I do I plot a "continuous", moving plot in Pygame, like the plot in this "NetLogo" simulation? My main difficulty is not the plotting itself (lines between points) but the process of moving the framework of the plot when the curve getting close to the edge of the box.
Thank you.
Ok, so you can make a plot similar to the one in the application in the following way:
create a surface of the size of the graph. Then create a pixel array, so you will be able to modify the graph.
pxarray = pygame.PixelArray (surface)
you can then manipulate the array like any other array:
pxarray[x][y] = 0xFF00FF # this will set pixel at x,y to purple
you can normally then normally blit the surface to the screen.
more on pixel arrays : http://www.pygame.org/docs/ref/pixelarray.html
EDIT: Using pxarray, and transform you will have a shrinking graph if your numbers go out of range. Simply when the point is too big for the plot, you add enough rows, and use transform.scale to scale back to the original resolution.

Categories