Matplotlib: optimize vector image output, remove hidden vectors data - matplotlib

Assume I have a very big Matplotlib scatterplot with overlapping points.
Is there a way to ask Matplotlib to optimize ('compress') the plot (e.g. during savefig), so to not export vectors which are invisible (overlapped by others).
My current EPS/SVG/PDF-savefig is very big.
I can solve this by preprocessing the input data, however level of overlapping also depends on the plot properties (e.g. size of the marks etc).
If Matplotlib cannot do this, are there other tools which can optimize vector graphics (open source/free tools,so not the Adobe suite).
Tx.

Related

How to intersect two rasters in ArcMap?

I have two raster layers with different resolutions that I want to join see this image. One has higher resolution (transparent yellow) and the other raster has lower resolution but bigger extent (whole earth) and has information about different classes (drawn in different colors here). The resulting raster should have the higher resolution and extent of the raster drawn in yellow here but should be joined with the other raster, e.g. containing the information of what class it was laying within.
Really appreciate any help!
Cheers
You should to use mosaic rasters. Use Mosaic To New Raster tool.
But before rasters should have equal standart.
Use Resample tool for change resolution.
And your raster value system should be same scale. Arcmap will mosaic them anyway. But it can be wrong.
For example LST rasters. Suppose the raster is on a scale of 1 Fahrenheit and the raster is on a scale of 2 degrees Celsius.
In this case, even if the tools run and generate a new raster layer, the values will be incorrect.
I hope this answer was helpful.
Good luck with.

How to plot a vector field with error ellipse using cartopy

Cartopy seems like a great tool for Geoscience, but it appears to lack a method for plotting vector data on a map together with their error ellipses. Is there a straightforward way to add error ellipses centered on the tips of vector data?
Cartopy inherits all its vector plotting functionality from matplotlib. Cartopy provides a way to project the vectors, but they are drawn by matplotlib. I haven't heard of a feature you describe in matplotlib, so I'm afraid the answer is probably no.

Traces over image with gnuplot

It is possible to produce a graphic in gnuplot of the sort of the ones that they like in neuroscienes journals, where the traces (plots) of the electric measurements are drawn over an image (density) plot of other representation of the neural activity? To be clear, I have allready managed to do it in matplotlib (pyplot), but it is to slow for the data sets that I have, and I think gnuplot could be faster and nicer. The example graphic is below.

How to plot 2D vector field in single picture using Hue and Brightness method with Digital Micrograph script?

I would like to to plot 2D vector field in a single picture using the Hue & brightness method, i.e., Hue to direction (or say, phase), brightness to magnitude.
Such method is often used to visualize e.g., magnetic domains, vortex etc which are reconstructed from Lorenz microscopy.
As input, I have two images of size 1024*1024, pixels contain the magnitude of X and Y component of the vector field.
Since DM does not support native HSL color scheme, I think one should first uses a group of self defined functions to convert HSL to RGB...
You can only use RGB images in DigitalMicrograph, so you will have to do the conversion from HSB to RGB in your script code, and then create the according RGB image.
Luckily, there is a demonstration script on the Gatan script resources webpage which does exactly that! You can basically use the script as it is shown there.
Gatan Script Resources
Link to script-file:
Display as HSB
Note, the script uses complex images as input - just as a convenient container to combine two images into a single one. The test function demonstrates this though.

How can I output a matplotlib figure to a shapefile?

I want to create a contour plot with matlibplot and generate a shapefile from it so that I can use it in QGIS to display it.
Though it is possible to plot a map with matplotlib and then overlay with my contour plot, the choices of map sources are limited. It would be easier to export the contour plot in a shapefile and loaded in QGIS with a customized map.
Thanks!
There is a contour plugin available in QGIS, and it is based on the contouring functions of matplotlib. It's still a little bit buggy but hopefully that will be corrected in the future.