How can you scroll through numpy array images in PyQt5? - matplotlib

How can you scroll through Numpy array images in PyQt5? This is the shape of my input images array:
X = [512, 512, 100]
I tried using the onscroll method which uses mouse scroll event and we can mpl_connect it on the canvas (Matplotlib). This seems to work fine but when I put this canvas on PyQt5 canvas, the scrolling stops. Is there any way I can implement this in PyQt5?
I have tried to keep this question simple because I want a generic answer, but if someone is interested, I am ready to share the (non-working) code.

Related

Matplotlib Create Animation From Array of Frames

I am currently working in Jupyter Notebooks and I have an array of matplotlib scatter plots that I would like to animate and create a gif or video of.
Is this possible? Or would I need to save each of the 16+ plots as images and work from there?
Thank you!

Adobe Animate CC Canvas (CreateJS) vector graphics becomes blurry on scale up

So I am new to this next-gen Flash application they call "Adobe Animate CC" and I am trying to create an interactive map scene... very basic. If you click on the USA it should zoom in. Click again it should zoom out.
The issue I am having is that even though my map was imported from an SVG file -- and from what I can tell when residing in the "Adobe Animate CC" workspace it retains its vector data -- when I apply the scale tween using CreateJS the edges of the graphic become very pixelated.
Here's the code I am using:
var _this = this;
_this.stop();
_this.america.addEventListener("click", zoomMap);
function zoomMap(event) {
createjs.Tween.get(exportRoot.world1).to({scaleX: 10, scaleY: 10, x: 4000, y: 1000}, 1000);
}
And here are some images of the pixelated result:
Even more disconcerting is that that blue-green circle is a native circle object inside a symbol. Not an svg. I would expect that at least that would stay crisp under transformation.
Is this unavoidable? Is the application caching bitmap versions of my vector files on export? Can I stop this? Can I force a re-render of the vector file during and after my tween? Is there any way around this? Does this application even really support vector graphics?
Animate might be exporting as images, but it shouldn't unless you tell it to. What does your library JavaScript look like? Are any images exported? Maybe search the source for .cache to see if Adobe is doing anything funny under the hood.
If the map is an SVG source: Unfortunately, only the only SVG support in EaselJS (which underlays the Animate export) is for svg as a "bitmap source". This means it is being treated as an image of a specific dimensions, and scaling it past "100%" will interpolate the details.
It might be possible to load it as a larger bitmap, and scale it down to start, but that will:
make it much larger in memory
still only let you scale so much
Another option is to import the SVG asset into Adobe Animate, which should convert it to a vector graphic. If it is vector in EaselJS, you can scale it as much as you want, because it uses Canvas vector APIs to draw, instead of an image source.
You mentioned that the green circle is native (I assume a shape in Animate?). Are you sure its not being exported as an image, instead of a shape? Are you caching anything?
Hope that helps!

Unable to show layers in ArcGIS map after removing tiled map service layer

This is a Esri ArcGIS specific question.
I wish to create a function to change basemap.
To test the concept, I created a map and added a ArcGISTiledMapServiceLayer
var tiled = new ArcGISTiledMapServiceLayer('http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer');
Next, I will remove the layer and add a ArcGISImageServiceLayer to stimulate a change basemap action
var image = new ArcGISImageServiceLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Toronto/ImageServer", {
imageServiceParameters: params,
opacity: 0.75
});
What I realised is after these [adding tiled, removing tiled, adding image] actions, no layers will be rendered
I tested other scenarios and these are the results:
1) If I do not remove the tiled layer, both layers get rendered
2) If I add only image layer, image layer get rendered
3) If I add only tiled layer, tiled layer get rendered
Do you guys have any advice as to why I cannot perform a remove layer action?
To make this question understandable, I created a sample fiddle that can illustrate my case. Simply remove the removeLayer comment in the fiddle and run it. You will notice as mentioned, nothing will be rendered.
https://jsfiddle.net/82qjh0wg/
If you remove the basemap layer (which will be the first layer you add to the map if you don't specify the basemap layer in the constructor) then the entire map object will stop rendering.
If you want to hide the basemap layer then your best option is to either use css or create a blank basemap and change the basemap to that.
You could also set the transparency of the basemap to hide it.

Matplotlib 3D pan and zoom not working

When i try to use the pan and zoom tool, the plot rotates on left click and zooms from the center on right click. zooming the plot by making a rectangular selection is not working.
Has somebody a clue how this problem can be solved?
Looking through the source code on github, it doesn't appear that the features you are looking for are supported. Hence you are unable to zoom and/or pan using mplot3d.Axes3D
def can_zoom(self) :
"""
Return *True* if this axes supports the zoom box button functionality.
3D axes objects do not use the zoom box button.
"""
return False
def can_pan(self) :
"""
Return *True* if this axes supports the pan/zoom button functionality.
3D axes objects do not use the pan/zoom button.
"""
return False
Source code: https://github.com/matplotlib/matplotlib/blob/master/lib/mpl_toolkits/mplot3d/axes3d.py
At the time of writing these are on lines 1017 through to 1031

Knobs effect in QML

I’m trying to implement a custom widget in QML to obtain an effect such as http://anthonyterrien.com/knob/ [× Angle offset element in the page].
I tried with canvas object but if I apply a scale to the parent object of the canvas the quality of the canvas appear very ugly.
I tried with a glsl frag shader but the variable glFragCoord bind me to the screen coordinates and anyway if I apply a scale to the parent object the rendering appears ugly.
Someone can help me please???