How to plot geographical data with Plotly - python

I know my question might sound a bit too general but I actually just need some guidance to start learning geographical plotting with Plotly package iin python.
I'm following guides on the internet but I never really manage to replicate the method with data I find on the internet.
The simple case I'm trying to plot is the following:
I have a Geopandas dataframe gdf with coordinates of point samples and a value, all measured in a particular European state (Netherlands in my case).
I found on the internet a shape of the state in json (link to json)
What I am trying to do is:
Plotting a blank choropleth map of the Netherlands, so that it would set the correct position for points of the dataframe
On top of the previous layer, I want to plot the points of my gdf
I'm not asking for code so I won't be posting the gdf.
What I really want to understand is
Is this (px.choropleth overlayed with px.scatter_geo) the best way to plot points on a conventional geographical area?
What are the features that need to be present on my gdf in order to make this work? For now it has a 'geometry' column and a 'value' column.
Also feel free to post any additional resource that might prove helpful to start learning this topic (as long they explain every step and don't assume familiarity with geodata structure).

Related

Generate schematic (geographic) diagram from graph

I would like to know how best to generate a schematic diagram, something like this, from a graph (created using the Python NetworkX library) that contains the latitude and longitude of each node (city) and the lines connecting them in the Indian railway network.
The cities (nodes) should be located reasonably close to their actual position, but not necessarily exactly. I am OK with using the plate carrée projection that simply maps lat/long onto X/Y in the diagram.
The rail lines (edges) can be straight lines or even curves if it fits better.
On the diagram should be displayed the cities (preferably as dots) along with a short (max 4 characters) label for each, the lines connecting them, and a single label for each line (the given example has quite long labels for the lines).
Preferably the amount of manual tweaking of coordinates to get things to fit should be minimised.
Using Graphviz was my first idea. But I don't know how well neato/fdp (required for fixed positioning of nodes) will perform with large numbers of nodes/edges. Also, making Graphviz display labels separately outside the nodes (rather than inline) seems to need a lot of manual positioning of each label, which would be pretty boring. Is there any better way to get this kind of layout?
Doable (https://forum.graphviz.org/t/another-stupid-graphviz-trick-geographic-graphs/256), but does not seem to use many Graphviz features. In addition to tools mentioned in the link, maybe consider pikchr (https://pikchr.org/home/doc/trunk/homepage.md)

Add labels to real-time signal plotting with Vispy

I am not familiar enough with Vispy. I did adapt this example for my use case, but I don't know how to modify it further to include the missing features.
I am trying to plot in real-time N-channels of data at the same scale. Using pyqtgraph, the interface looks like this:
And with vispy:
My goal is to match both backends, step by step. The difference for now are:
The order in Vispy is reversed (plot at the top on Vispy is the plot at the bottom on pyqtgraph)
Lack channel names
Lack Y-axis label
Lack X-Axis and X-Axis label
Lack of headroom top/bottom
I do not know how to solve any of those, how to further improve this backend. Any tips, guidance towards the correct, best function to use for this would be very helpful.
I was looking into visual.text, but the positioning seemed difficult. I did not know how to match the label in front of one of the plot.

What is the best way to create a figure with distributions as insets in python?

I created a graph in MATLAB (see figure below) such that around every data point there is a data distribution plotted (grey area plots). The way I did it in MATLAB was to create a set of axes for every distribution curve and then plot the curves without showing those axes at every point of the data curve. I also used a command 'linkaxes' to set figure limits for all the curves at once.
I must say that this is far from an elegant solution and I had many troubles with saving this figure in the correct aspect ratio settings. All in all I couldn't find any other useful option in MATLAB.
Is there a more elegant solution for such types of graphs in Python? I am not that much interested in how to do the areas highlighted, but how to place a set of curves(distributions) exactly at the positions of the main data curve points.
Thank you!

Trying to create astro data over a specific region using Python

Suppose there is a geo region X. The celestial bodies move over that region over the year and, of course, the bodies do not remain the same or in the same position. I am trying to build a 2/3-D chart that maps the movement of the bodies over X (and given a certain time and place within X, show the bodies and their location at that time and place). I plan to do this using Python but at the same time lack knowledge of astronomy - Can I do it? Any pointers/modules/tutorials would help. Thanks.
As #postoronnim said, the astropy package provides you with everything you need for this task.
You can go here and you will have a working example.
Just a quick summary:
You can give a location for the observation (the main observatories in the planet are already available in the package but you can define your own with latitude, longitude and elevation).
Then you need coordinates of one object and the moment of the observation and you can plot a 2D (or 3D if you want to play with spherical coordinates) trajectory of you object in the sky. It is in genetal very usefull to plot Alt vs time to visualize when your object is visible.
Hope this helped
I would suggest you to have a glance at the opensource astronomy package stellarium with which you could simulate the sky for a given location for a given body. There should also be a documentation that accompanies that which could be helpful in getting yourself familiarised with the adopted algorithms.

Plotting 2-D time-series data on one y-axis with two properties

I'm trying to plot EEG (electroencephalography) data (an array of nElectrodes by nTimepoints) in python. I want to create a plot representing each electrode on the y-axis and each time point on the x-axis, but I also want the amplitude response to be represented on the y-axis. Here's an example of what I want the graph to look like (sorry for the rubbish xkcd powerpointedness of the graph):
http://i.stack.imgur.com/9LPqF.png
I'm having difficulty working out how to do this, particularly getting my head around giving each 'electrode' the ability to overlap with other electrodes (making artefacts much easier to spot).
I would really appreciate any help, so thanks in advance!
Darren
So upon looking back at the suggestion from #sebix, the following link has a small section of plotting script at the end which seems to work well for what I want. Here's the link below:
http://matplotlib.org/1.2.1/examples/pylab_examples/mri_with_eeg.html
I've never used offsets or anything before so this is new territory for me! Thanks for the comments.

Categories

Resources